Merge
authoramurillo
Tue, 17 May 2016 05:38:15 -0700
changeset 38368 c8eb5d6812c5
parent 38367 21801e8e9344 (current diff)
parent 38328 40435a469d25 (diff)
child 38369 73280b96de24
Merge
jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/CharacterArrayCharacterIterator.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/CharacterIterator.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/RE.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/RECompiler.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/REDebugCompiler.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/REProgram.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/RESyntaxException.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/RETest.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/REUtil.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/ReaderCharacterIterator.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/StreamCharacterIterator.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/StringCharacterIterator.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/recompile.java
jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
jdk/src/java.httpclient/share/classes/java/net/http/HttpHeaders1.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginContextImpl.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PoolImpl.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/PluginContext.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Pool.java
jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java
jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java
jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java
jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java
jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java
jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java
jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java
jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java
jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java
jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java
jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java
jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java
jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java
jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template
jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template
jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AbstractTypeImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotatedTypeImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationDescImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationTypeElementDocImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationValueImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Comment.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ConstructorDocImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocLocale.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocletInvoker.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/FieldDocImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocClassFinder.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocEnter.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocTodo.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocTool.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/MemberDocImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Messager.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/MethodDocImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ModifierFilter.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/PackageDocImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ParamTagImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ParameterImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ParameterizedTypeImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/PrimitiveType.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ProgramElementDocImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/RootDocImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/SeeTagImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/SerialFieldTagImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/SerializedForm.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/SourcePositionImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Start.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/TagImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ThrowsTagImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ToolOption.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/TypeMaker.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/WildcardTypeImpl.java
--- a/.hgignore	Sat May 14 09:11:07 2016 -0700
+++ b/.hgignore	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,6 @@
 ^build/
 ^dist/
+^.idea/
 nbproject/private/
 ^webrev
 ^.hgtip
--- a/.hgtags	Sat May 14 09:11:07 2016 -0700
+++ b/.hgtags	Tue May 17 05:38:15 2016 -0700
@@ -360,3 +360,4 @@
 8d78fb40648dd221ce4ef19f9d5aa41ee1a3a884 jdk-9+115
 84aba7335005a3a47751dcf1f37935f97df9f99a jdk-9+116
 82b8d12a553f5617737c238cec060281d52e351c jdk-9+117
+7c04fcb12bd4a31570a238e663fa846dfa5ec3b8 jdk-9+118
--- a/.hgtags-top-repo	Sat May 14 09:11:07 2016 -0700
+++ b/.hgtags-top-repo	Tue May 17 05:38:15 2016 -0700
@@ -360,3 +360,4 @@
 09617ce980b99d49abfd54dacfed353c47e2a115 jdk-9+115
 6743a8e0cab7b5f6f4a0575f6664892f0ab740af jdk-9+116
 e882bcdbdac436523f3d5681611d3118a3804ea7 jdk-9+117
+047f95de8f918d8ff5e8cd2636a2abb5c3c8adb8 jdk-9+118
--- a/common/autoconf/flags.m4	Sat May 14 09:11:07 2016 -0700
+++ b/common/autoconf/flags.m4	Tue May 17 05:38:15 2016 -0700
@@ -768,7 +768,7 @@
         $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
         ;;
     esac
-    TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS)
+    TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS)
   elif test "x$TOOLCHAIN_TYPE" = xclang; then
     $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_GNU_SOURCE"
 
@@ -964,7 +964,7 @@
         -Wunused-value -Woverloaded-virtual"
 
     if test "x$TOOLCHAIN_TYPE" = xgcc; then
-      TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: [4.8],
+      TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: [4.8], PREFIX: $2,
           IF_AT_LEAST: [
             # These flags either do not work or give spurious warnings prior to gcc 4.8.
             $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-format-zero-length -Wtype-limits -Wuninitialized"
@@ -1411,9 +1411,15 @@
         DISABLE_WARNING_PREFIX=
       fi
       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
-      # Repeate the check for the BUILD_CC
+      # Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset
+      # CFLAGS since any target specific flags will likely not work with the
+      # build compiler
       CC_OLD="$CC"
+      CXX_OLD="$CXX"
       CC="$BUILD_CC"
+      CXX="$BUILD_CXX"
+      CFLAGS_OLD="$CFLAGS"
+      CFLAGS=""
       FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
           IF_TRUE: [BUILD_CC_CAN_DISABLE_WARNINGS=true],
           IF_FALSE: [BUILD_CC_CAN_DISABLE_WARNINGS=false]
@@ -1424,6 +1430,8 @@
         BUILD_CC_DISABLE_WARNING_PREFIX=
       fi
       CC="$CC_OLD"
+      CXX="$CXX_OLD"
+      CFLAGS="$CFLAGS_OLD"
       ;;
     clang)
       DISABLE_WARNING_PREFIX="-Wno-"
--- a/common/autoconf/generated-configure.sh	Sat May 14 09:11:07 2016 -0700
+++ b/common/autoconf/generated-configure.sh	Tue May 17 05:38:15 2016 -0700
@@ -4900,6 +4900,8 @@
 
 # Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
 # Must have CC_VERSION_NUMBER and CXX_VERSION_NUMBER.
+# $1 - optional variable prefix for compiler and version variables (BUILD_)
+# $2 - optional variable prefix for comparable variable (OPENJDK_BUILD_)
 
 
 # Check if the configured compiler (C and C++) is of a specific version or
@@ -4909,6 +4911,7 @@
 #   VERSION:   The version string to check against the found version
 #   IF_AT_LEAST:   block to run if the compiler is at least this version (>=)
 #   IF_OLDER_THAN:   block to run if the compiler is older than this version (<)
+#   PREFIX:   Optional variable prefix for compiler to compare version for (OPENJDK_BUILD_)
 
 
 
@@ -5073,7 +5076,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1462806878
+DATE_WHEN_GENERATED=1462970869
 
 ###############################################################################
 #
@@ -34795,19 +34798,19 @@
 
 
   if test "x$CC_VERSION_NUMBER" != "x$CXX_VERSION_NUMBER"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C and C++ compiler has different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER." >&5
-$as_echo "$as_me: WARNING: C and C++ compiler has different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER." >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C and C++ compiler have different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER." >&5
+$as_echo "$as_me: WARNING: C and C++ compiler have different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER." >&2;}
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This typically indicates a broken setup, and is not supported" >&5
 $as_echo "$as_me: WARNING: This typically indicates a broken setup, and is not supported" >&2;}
   fi
 
   # We only check CC_VERSION_NUMBER since we assume CXX_VERSION_NUMBER is equal.
-  if  [[ "$CC_VERSION_NUMBER" =~ (.*\.){3} ]] ; then
+  if  [[ "[$]CC_VERSION_NUMBER" =~ (.*\.){3} ]] ; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has more than three parts (X.Y.Z): $CC_VERSION_NUMBER. Comparisons might be wrong." >&5
 $as_echo "$as_me: WARNING: C compiler version number has more than three parts (X.Y.Z): $CC_VERSION_NUMBER. Comparisons might be wrong." >&2;}
   fi
 
-  if  [[  "$CC_VERSION_NUMBER" =~ [0-9]{6} ]] ; then
+  if  [[  "[$]CC_VERSION_NUMBER" =~ [0-9]{6} ]] ; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has a part larger than 99999: $CC_VERSION_NUMBER. Comparisons might be wrong." >&5
 $as_echo "$as_me: WARNING: C compiler version number has a part larger than 99999: $CC_VERSION_NUMBER. Comparisons might be wrong." >&2;}
   fi
@@ -34858,6 +34861,13 @@
 
 
 
+
+
+
+
+
+
+
     # Execute function body
 
   # Need to assign to a variable since m4 is blocked from modifying parts in [].
@@ -34897,6 +34907,8 @@
 
 
 
+
+
   fi
 
   #
@@ -46475,6 +46487,268 @@
     BUILD_LDCXX="$BUILD_CXX"
 
     PATH="$OLDPATH"
+
+
+  COMPILER=$BUILD_CC
+  COMPILER_NAME=BuildC
+
+  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
+    # cc -V output typically looks like
+    #     cc: Sun C 5.12 Linux_i386 2011/11/16
+    COMPILER_VERSION_OUTPUT=`$COMPILER -V 2>&1`
+    # Check that this is likely to be the Solaris Studio cc.
+    $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null
+    if test $? -ne 0; then
+      ALT_VERSION_OUTPUT=`$COMPILER --version 2>&1`
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&5
+$as_echo "$as_me: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running with -V was: \"$COMPILER_VERSION_OUTPUT\"" >&5
+$as_echo "$as_me: The result from running with -V was: \"$COMPILER_VERSION_OUTPUT\"" >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running with --version was: \"$ALT_VERSION_OUTPUT\"" >&5
+$as_echo "$as_me: The result from running with --version was: \"$ALT_VERSION_OUTPUT\"" >&6;}
+      as_fn_error $? "A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir." "$LINENO" 5
+    fi
+    # Remove usage instructions (if present), and
+    # collapse compiler output into a single line
+    COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e 's/ *[Uu]sage:.*//'`
+    COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e "s/^.*[ ,\t]$COMPILER_NAME[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/"`
+  elif test  "x$TOOLCHAIN_TYPE" = xxlc; then
+    # xlc -qversion output typically looks like
+    #     IBM XL C/C++ for AIX, V11.1 (5724-X13)
+    #     Version: 11.01.0000.0015
+    COMPILER_VERSION_OUTPUT=`$COMPILER -qversion 2>&1`
+    # Check that this is likely to be the IBM XL C compiler.
+    $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "IBM XL C" > /dev/null
+    if test $? -ne 0; then
+      ALT_VERSION_OUTPUT=`$COMPILER --version 2>&1`
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&5
+$as_echo "$as_me: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running with -qversion was: \"$COMPILER_VERSION_OUTPUT\"" >&5
+$as_echo "$as_me: The result from running with -qversion was: \"$COMPILER_VERSION_OUTPUT\"" >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running with --version was: \"$ALT_VERSION_OUTPUT\"" >&5
+$as_echo "$as_me: The result from running with --version was: \"$ALT_VERSION_OUTPUT\"" >&6;}
+      as_fn_error $? "A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir." "$LINENO" 5
+    fi
+    # Collapse compiler output into a single line
+    COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
+    COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e 's/^.*, V\([1-9][0-9.]*\).*$/\1/'`
+  elif test  "x$TOOLCHAIN_TYPE" = xmicrosoft; then
+    # There is no specific version flag, but all output starts with a version string.
+    # First line typically looks something like:
+    # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
+    COMPILER_VERSION_OUTPUT=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'`
+    # Check that this is likely to be Microsoft CL.EXE.
+    $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Microsoft.*Compiler" > /dev/null
+    if test $? -ne 0; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&5
+$as_echo "$as_me: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running it was: \"$COMPILER_VERSION_OUTPUT\"" >&5
+$as_echo "$as_me: The result from running it was: \"$COMPILER_VERSION_OUTPUT\"" >&6;}
+      as_fn_error $? "A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir." "$LINENO" 5
+    fi
+    # Collapse compiler output into a single line
+    COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
+    COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e 's/^.*ersion.\([1-9][0-9.]*\) .*$/\1/'`
+  elif test  "x$TOOLCHAIN_TYPE" = xgcc; then
+    # gcc --version output typically looks like
+    #     gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+    #     Copyright (C) 2013 Free Software Foundation, Inc.
+    #     This is free software; see the source for copying conditions.  There is NO
+    #     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+    COMPILER_VERSION_OUTPUT=`$COMPILER --version 2>&1`
+    # Check that this is likely to be GCC.
+    $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Free Software Foundation" > /dev/null
+    if test $? -ne 0; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&5
+$as_echo "$as_me: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running with --version was: \"$COMPILER_VERSION\"" >&5
+$as_echo "$as_me: The result from running with --version was: \"$COMPILER_VERSION\"" >&6;}
+      as_fn_error $? "A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir." "$LINENO" 5
+    fi
+    # Remove Copyright and legalese from version string, and
+    # collapse into a single line
+    COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e 's/ *Copyright .*//'`
+    COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e 's/^.* \([1-9]\.[0-9.]*\)[^0-9.].*$/\1/'`
+  elif test  "x$TOOLCHAIN_TYPE" = xclang; then
+    # clang --version output typically looks like
+    #    Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
+    #    clang version 3.3 (tags/RELEASE_33/final)
+    # or
+    #    Debian clang version 3.2-7ubuntu1 (tags/RELEASE_32/final) (based on LLVM 3.2)
+    #    Target: x86_64-pc-linux-gnu
+    #    Thread model: posix
+    COMPILER_VERSION_OUTPUT=`$COMPILER --version 2>&1`
+    # Check that this is likely to be clang
+    $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "clang" > /dev/null
+    if test $? -ne 0; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&5
+$as_echo "$as_me: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running with --version was: \"$COMPILER_VERSION_OUTPUT\"" >&5
+$as_echo "$as_me: The result from running with --version was: \"$COMPILER_VERSION_OUTPUT\"" >&6;}
+      as_fn_error $? "A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir." "$LINENO" 5
+    fi
+    # Collapse compiler output into a single line
+    COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
+    COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e 's/^.* version \([1-9][0-9.]*\).*$/\1/'`
+  else
+      as_fn_error $? "Unknown toolchain type $TOOLCHAIN_TYPE." "$LINENO" 5
+  fi
+  # This sets CC_VERSION_NUMBER or CXX_VERSION_NUMBER. (This comment is a grep marker)
+  BUILD_CC_VERSION_NUMBER="$COMPILER_VERSION_NUMBER"
+  # This sets CC_VERSION_STRING or CXX_VERSION_STRING. (This comment is a grep marker)
+  BUILD_CC_VERSION_STRING="$COMPILER_VERSION_STRING"
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: Using $TOOLCHAIN_TYPE $COMPILER_NAME compiler version $COMPILER_VERSION_NUMBER [$COMPILER_VERSION_STRING]" >&5
+$as_echo "$as_me: Using $TOOLCHAIN_TYPE $COMPILER_NAME compiler version $COMPILER_VERSION_NUMBER [$COMPILER_VERSION_STRING]" >&6;}
+
+
+  COMPILER=$BUILD_CXX
+  COMPILER_NAME=BuildC++
+
+  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
+    # cc -V output typically looks like
+    #     cc: Sun C 5.12 Linux_i386 2011/11/16
+    COMPILER_VERSION_OUTPUT=`$COMPILER -V 2>&1`
+    # Check that this is likely to be the Solaris Studio cc.
+    $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null
+    if test $? -ne 0; then
+      ALT_VERSION_OUTPUT=`$COMPILER --version 2>&1`
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&5
+$as_echo "$as_me: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running with -V was: \"$COMPILER_VERSION_OUTPUT\"" >&5
+$as_echo "$as_me: The result from running with -V was: \"$COMPILER_VERSION_OUTPUT\"" >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running with --version was: \"$ALT_VERSION_OUTPUT\"" >&5
+$as_echo "$as_me: The result from running with --version was: \"$ALT_VERSION_OUTPUT\"" >&6;}
+      as_fn_error $? "A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir." "$LINENO" 5
+    fi
+    # Remove usage instructions (if present), and
+    # collapse compiler output into a single line
+    COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e 's/ *[Uu]sage:.*//'`
+    COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e "s/^.*[ ,\t]$COMPILER_NAME[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/"`
+  elif test  "x$TOOLCHAIN_TYPE" = xxlc; then
+    # xlc -qversion output typically looks like
+    #     IBM XL C/C++ for AIX, V11.1 (5724-X13)
+    #     Version: 11.01.0000.0015
+    COMPILER_VERSION_OUTPUT=`$COMPILER -qversion 2>&1`
+    # Check that this is likely to be the IBM XL C compiler.
+    $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "IBM XL C" > /dev/null
+    if test $? -ne 0; then
+      ALT_VERSION_OUTPUT=`$COMPILER --version 2>&1`
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&5
+$as_echo "$as_me: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running with -qversion was: \"$COMPILER_VERSION_OUTPUT\"" >&5
+$as_echo "$as_me: The result from running with -qversion was: \"$COMPILER_VERSION_OUTPUT\"" >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running with --version was: \"$ALT_VERSION_OUTPUT\"" >&5
+$as_echo "$as_me: The result from running with --version was: \"$ALT_VERSION_OUTPUT\"" >&6;}
+      as_fn_error $? "A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir." "$LINENO" 5
+    fi
+    # Collapse compiler output into a single line
+    COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
+    COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e 's/^.*, V\([1-9][0-9.]*\).*$/\1/'`
+  elif test  "x$TOOLCHAIN_TYPE" = xmicrosoft; then
+    # There is no specific version flag, but all output starts with a version string.
+    # First line typically looks something like:
+    # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
+    COMPILER_VERSION_OUTPUT=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'`
+    # Check that this is likely to be Microsoft CL.EXE.
+    $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Microsoft.*Compiler" > /dev/null
+    if test $? -ne 0; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&5
+$as_echo "$as_me: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running it was: \"$COMPILER_VERSION_OUTPUT\"" >&5
+$as_echo "$as_me: The result from running it was: \"$COMPILER_VERSION_OUTPUT\"" >&6;}
+      as_fn_error $? "A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir." "$LINENO" 5
+    fi
+    # Collapse compiler output into a single line
+    COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
+    COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e 's/^.*ersion.\([1-9][0-9.]*\) .*$/\1/'`
+  elif test  "x$TOOLCHAIN_TYPE" = xgcc; then
+    # gcc --version output typically looks like
+    #     gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+    #     Copyright (C) 2013 Free Software Foundation, Inc.
+    #     This is free software; see the source for copying conditions.  There is NO
+    #     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+    COMPILER_VERSION_OUTPUT=`$COMPILER --version 2>&1`
+    # Check that this is likely to be GCC.
+    $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Free Software Foundation" > /dev/null
+    if test $? -ne 0; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&5
+$as_echo "$as_me: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running with --version was: \"$COMPILER_VERSION\"" >&5
+$as_echo "$as_me: The result from running with --version was: \"$COMPILER_VERSION\"" >&6;}
+      as_fn_error $? "A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir." "$LINENO" 5
+    fi
+    # Remove Copyright and legalese from version string, and
+    # collapse into a single line
+    COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e 's/ *Copyright .*//'`
+    COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e 's/^.* \([1-9]\.[0-9.]*\)[^0-9.].*$/\1/'`
+  elif test  "x$TOOLCHAIN_TYPE" = xclang; then
+    # clang --version output typically looks like
+    #    Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
+    #    clang version 3.3 (tags/RELEASE_33/final)
+    # or
+    #    Debian clang version 3.2-7ubuntu1 (tags/RELEASE_32/final) (based on LLVM 3.2)
+    #    Target: x86_64-pc-linux-gnu
+    #    Thread model: posix
+    COMPILER_VERSION_OUTPUT=`$COMPILER --version 2>&1`
+    # Check that this is likely to be clang
+    $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "clang" > /dev/null
+    if test $? -ne 0; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&5
+$as_echo "$as_me: The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The result from running with --version was: \"$COMPILER_VERSION_OUTPUT\"" >&5
+$as_echo "$as_me: The result from running with --version was: \"$COMPILER_VERSION_OUTPUT\"" >&6;}
+      as_fn_error $? "A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir." "$LINENO" 5
+    fi
+    # Collapse compiler output into a single line
+    COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
+    COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
+        $SED -e 's/^.* version \([1-9][0-9.]*\).*$/\1/'`
+  else
+      as_fn_error $? "Unknown toolchain type $TOOLCHAIN_TYPE." "$LINENO" 5
+  fi
+  # This sets CC_VERSION_NUMBER or CXX_VERSION_NUMBER. (This comment is a grep marker)
+  BUILD_CXX_VERSION_NUMBER="$COMPILER_VERSION_NUMBER"
+  # This sets CC_VERSION_STRING or CXX_VERSION_STRING. (This comment is a grep marker)
+  BUILD_CXX_VERSION_STRING="$COMPILER_VERSION_STRING"
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: Using $TOOLCHAIN_TYPE $COMPILER_NAME compiler version $COMPILER_VERSION_NUMBER [$COMPILER_VERSION_STRING]" >&5
+$as_echo "$as_me: Using $TOOLCHAIN_TYPE $COMPILER_NAME compiler version $COMPILER_VERSION_NUMBER [$COMPILER_VERSION_STRING]" >&6;}
+
+
+  if test "x$BUILD_CC_VERSION_NUMBER" != "x$BUILD_CXX_VERSION_NUMBER"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C and C++ compiler have different version numbers, $BUILD_CC_VERSION_NUMBER vs $BUILD_CXX_VERSION_NUMBER." >&5
+$as_echo "$as_me: WARNING: C and C++ compiler have different version numbers, $BUILD_CC_VERSION_NUMBER vs $BUILD_CXX_VERSION_NUMBER." >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This typically indicates a broken setup, and is not supported" >&5
+$as_echo "$as_me: WARNING: This typically indicates a broken setup, and is not supported" >&2;}
+  fi
+
+  # We only check CC_VERSION_NUMBER since we assume CXX_VERSION_NUMBER is equal.
+  if  [[ "[$]BUILD_CC_VERSION_NUMBER" =~ (.*\.){3} ]] ; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has more than three parts (X.Y.Z): $BUILD_CC_VERSION_NUMBER. Comparisons might be wrong." >&5
+$as_echo "$as_me: WARNING: C compiler version number has more than three parts (X.Y.Z): $BUILD_CC_VERSION_NUMBER. Comparisons might be wrong." >&2;}
+  fi
+
+  if  [[  "[$]BUILD_CC_VERSION_NUMBER" =~ [0-9]{6} ]] ; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has a part larger than 99999: $BUILD_CC_VERSION_NUMBER. Comparisons might be wrong." >&5
+$as_echo "$as_me: WARNING: C compiler version number has a part larger than 99999: $BUILD_CC_VERSION_NUMBER. Comparisons might be wrong." >&2;}
+  fi
+
+  OPENJDK_BUILD_COMPARABLE_ACTUAL_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", $1, $2, $3) }' <<< "$BUILD_CC_VERSION_NUMBER"`
+
   else
     # If we are not cross compiling, use the normal target compilers for
     # building the build platform executables.
@@ -49135,6 +49409,18 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
     # Execute function body
 
   # Need to assign to a variable since m4 is blocked from modifying parts in [].
@@ -49711,6 +49997,8 @@
 
 
 
+
+
   elif test "x$TOOLCHAIN_TYPE" = xclang; then
     JVM_CFLAGS="$JVM_CFLAGS -D_GNU_SOURCE"
 
@@ -49948,6 +50236,18 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
     # Execute function body
 
   # Need to assign to a variable since m4 is blocked from modifying parts in [].
@@ -49987,6 +50287,8 @@
 
 
 
+
+
     fi
     if !   [[ " $JVM_VARIANTS " =~ " zero " ]]   && !   [[ " $JVM_VARIANTS " =~ " zeroshark " ]]  ; then
       # Non-zero builds have stricter warnings
@@ -50453,6 +50755,18 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
     # Execute function body
 
   # Need to assign to a variable since m4 is blocked from modifying parts in [].
@@ -50469,7 +50783,7 @@
   # Version comparison method inspired by http://stackoverflow.com/a/24067243
   COMPARABLE_REFERENCE_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", $1, $2, $3) }' <<< "$REFERENCE_VERSION"`
 
-  if test $COMPARABLE_ACTUAL_VERSION -ge $COMPARABLE_REFERENCE_VERSION ; then
+  if test $OPENJDK_BUILD_COMPARABLE_ACTUAL_VERSION -ge $COMPARABLE_REFERENCE_VERSION ; then
     :
 
   else
@@ -50488,6 +50802,8 @@
 
 
 
+
+
   elif test "x$TOOLCHAIN_TYPE" = xclang; then
     OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D_GNU_SOURCE"
 
@@ -50725,6 +51041,18 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
     # Execute function body
 
   # Need to assign to a variable since m4 is blocked from modifying parts in [].
@@ -50741,7 +51069,7 @@
   # Version comparison method inspired by http://stackoverflow.com/a/24067243
   COMPARABLE_REFERENCE_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", $1, $2, $3) }' <<< "$REFERENCE_VERSION"`
 
-  if test $COMPARABLE_ACTUAL_VERSION -ge $COMPARABLE_REFERENCE_VERSION ; then
+  if test $OPENJDK_BUILD_COMPARABLE_ACTUAL_VERSION -ge $COMPARABLE_REFERENCE_VERSION ; then
     :
 
             # These flags either do not work or give spurious warnings prior to gcc 4.8.
@@ -50764,6 +51092,8 @@
 
 
 
+
+
     fi
     if !   [[ " $JVM_VARIANTS " =~ " zero " ]]   && !   [[ " $JVM_VARIANTS " =~ " zeroshark " ]]  ; then
       # Non-zero builds have stricter warnings
@@ -51918,9 +52248,15 @@
         DISABLE_WARNING_PREFIX=
       fi
       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
-      # Repeate the check for the BUILD_CC
+      # Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset
+      # CFLAGS since any target specific flags will likely not work with the
+      # build compiler
       CC_OLD="$CC"
+      CXX_OLD="$CXX"
       CC="$BUILD_CC"
+      CXX="$BUILD_CXX"
+      CFLAGS_OLD="$CFLAGS"
+      CFLAGS=""
 
 
 
@@ -52198,6 +52534,8 @@
         BUILD_CC_DISABLE_WARNING_PREFIX=
       fi
       CC="$CC_OLD"
+      CXX="$CXX_OLD"
+      CFLAGS="$CFLAGS_OLD"
       ;;
     clang)
       DISABLE_WARNING_PREFIX="-Wno-"
--- a/common/autoconf/toolchain.m4	Sat May 14 09:11:07 2016 -0700
+++ b/common/autoconf/toolchain.m4	Tue May 17 05:38:15 2016 -0700
@@ -59,23 +59,25 @@
 
 # Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
 # Must have CC_VERSION_NUMBER and CXX_VERSION_NUMBER.
+# $1 - optional variable prefix for compiler and version variables (BUILD_)
+# $2 - optional variable prefix for comparable variable (OPENJDK_BUILD_)
 AC_DEFUN([TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS],
 [
-  if test "x$CC_VERSION_NUMBER" != "x$CXX_VERSION_NUMBER"; then
-    AC_MSG_WARN([C and C++ compiler has different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER.])
+  if test "x[$]$1CC_VERSION_NUMBER" != "x[$]$1CXX_VERSION_NUMBER"; then
+    AC_MSG_WARN([C and C++ compiler have different version numbers, [$]$1CC_VERSION_NUMBER vs [$]$1CXX_VERSION_NUMBER.])
     AC_MSG_WARN([This typically indicates a broken setup, and is not supported])
   fi
 
   # We only check CC_VERSION_NUMBER since we assume CXX_VERSION_NUMBER is equal.
-  if [ [[ "$CC_VERSION_NUMBER" =~ (.*\.){3} ]] ]; then
-    AC_MSG_WARN([C compiler version number has more than three parts (X.Y.Z): $CC_VERSION_NUMBER. Comparisons might be wrong.])
+  if [ [[ "[$]$1CC_VERSION_NUMBER" =~ (.*\.){3} ]] ]; then
+    AC_MSG_WARN([C compiler version number has more than three parts (X.Y.Z): [$]$1CC_VERSION_NUMBER. Comparisons might be wrong.])
   fi
 
-  if [ [[  "$CC_VERSION_NUMBER" =~ [0-9]{6} ]] ]; then
-    AC_MSG_WARN([C compiler version number has a part larger than 99999: $CC_VERSION_NUMBER. Comparisons might be wrong.])
+  if [ [[  "[$]$1CC_VERSION_NUMBER" =~ [0-9]{6} ]] ]; then
+    AC_MSG_WARN([C compiler version number has a part larger than 99999: [$]$1CC_VERSION_NUMBER. Comparisons might be wrong.])
   fi
 
-  COMPARABLE_ACTUAL_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", [$]1, [$]2, [$]3) }' <<< "$CC_VERSION_NUMBER"`
+  $2COMPARABLE_ACTUAL_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", [$]1, [$]2, [$]3) }' <<< "[$]$1CC_VERSION_NUMBER"`
 ])
 
 # Check if the configured compiler (C and C++) is of a specific version or
@@ -85,8 +87,9 @@
 #   VERSION:   The version string to check against the found version
 #   IF_AT_LEAST:   block to run if the compiler is at least this version (>=)
 #   IF_OLDER_THAN:   block to run if the compiler is older than this version (<)
+#   PREFIX:   Optional variable prefix for compiler to compare version for (OPENJDK_BUILD_)
 BASIC_DEFUN_NAMED([TOOLCHAIN_CHECK_COMPILER_VERSION],
-    [*VERSION IF_AT_LEAST IF_OLDER_THAN], [$@],
+    [*VERSION PREFIX IF_AT_LEAST IF_OLDER_THAN], [$@],
 [
   # Need to assign to a variable since m4 is blocked from modifying parts in [].
   REFERENCE_VERSION=ARG_VERSION
@@ -102,7 +105,7 @@
   # Version comparison method inspired by http://stackoverflow.com/a/24067243
   COMPARABLE_REFERENCE_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", [$]1, [$]2, [$]3) }' <<< "$REFERENCE_VERSION"`
 
-  if test $COMPARABLE_ACTUAL_VERSION -ge $COMPARABLE_REFERENCE_VERSION ; then
+  if test [$]ARG_PREFIX[COMPARABLE_ACTUAL_VERSION] -ge $COMPARABLE_REFERENCE_VERSION ; then
     :
     ARG_IF_AT_LEAST
   else
@@ -808,6 +811,10 @@
     BUILD_LDCXX="$BUILD_CXX"
 
     PATH="$OLDPATH"
+
+    TOOLCHAIN_EXTRACT_COMPILER_VERSION(BUILD_CC, [BuildC])
+    TOOLCHAIN_EXTRACT_COMPILER_VERSION(BUILD_CXX, [BuildC++])
+    TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS([BUILD_], [OPENJDK_BUILD_])
   else
     # If we are not cross compiling, use the normal target compilers for
     # building the build platform executables.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/bin/idea.sh	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,199 @@
+#!/bin/sh
+#
+# 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
+# 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.
+#
+
+# Shell script for generating an IDEA project from a given list of modules
+
+usage() {
+      echo "usage: $0 [-h|--help] [-v|--verbose] [-o|--output <path>] [modules]+" 
+      exit 1
+}
+
+SCRIPT_DIR=`dirname $0`
+PWD=`pwd`
+cd $SCRIPT_DIR; SCRIPT_DIR=`pwd`
+cd ../../; TOP=`pwd`; cd $PWD
+
+IDEA_OUTPUT=$TOP/.idea
+VERBOSE="false"
+while [ $# -gt 0 ]
+do
+  case $1 in
+    -h | --help )
+      usage
+      ;;
+
+    -v | --vebose )
+      VERBOSE="true"
+      ;;
+
+    -o | --output )
+      IDEA_OUTPUT=$2
+      shift
+      ;;
+
+    -*)  # bad option
+      usage
+      ;;
+
+     * )  # non option
+      break
+      ;;
+  esac
+  shift
+done
+
+mkdir $IDEA_OUTPUT || exit 1
+cd $IDEA_OUTPUT; IDEA_OUTPUT=`pwd`
+
+IDEA_MAKE="$TOP/make/idea"
+IDEA_TEMPLATE="$IDEA_MAKE/template"
+IML_TEMPLATE="$IDEA_TEMPLATE/jdk.iml"
+ANT_TEMPLATE="$IDEA_TEMPLATE/ant.xml"
+IDEA_IML="$IDEA_OUTPUT/jdk.iml"
+IDEA_ANT="$IDEA_OUTPUT/ant.xml"
+
+if [ "$VERBOSE" = "true" ] ; then
+  echo "output dir: $IDEA_OUTPUT"
+  echo "idea template dir: $IDEA_TEMPLATE"
+fi
+
+if [ ! -f "$IML_TEMPLATE" ] ; then
+  echo "FATAL: cannot find $IML_TEMPLATE" >&2; exit 1
+fi
+
+if [ ! -f "$ANT_TEMPLATE" ] ; then
+  echo "FATAL: cannot find $ANT_TEMPLATE" >&2; exit 1
+fi
+
+cp -r "$IDEA_TEMPLATE"/* "$IDEA_OUTPUT"
+cd $TOP ; make -f "$IDEA_MAKE/idea.gmk" -I make/common idea MAKEOVERRIDES= OUT=$IDEA_OUTPUT/env.cfg MODULES="$*" || exit 1
+cd $SCRIPT_DIR
+
+. $IDEA_OUTPUT/env.cfg
+
+# Expect MODULE_ROOTS, MODULE_NAMES, BOOT_JDK & SPEC to be set
+if [ "x$MODULE_ROOTS" = "x" ] ; then
+  echo "FATAL: MODULE_ROOTS is empty" >&2; exit 1
+fi
+
+if [ "x$MODULE_NAMES" = "x" ] ; then
+  echo "FATAL: MODULE_NAMES is empty" >&2; exit 1
+fi
+
+if [ "x$BOOT_JDK" = "x" ] ; then
+  echo "FATAL: BOOT_JDK is empty" >&2; exit 1
+fi
+
+if [ "x$SPEC" = "x" ] ; then
+  echo "FATAL: SPEC is empty" >&2; exit 1
+fi
+
+SOURCE_FOLDER="      <sourceFolder url=\"file://\$MODULE_DIR\$/####\" isTestSource=\"false\" />"
+SOURCE_FOLDERS_DONE="false"
+
+addSourceFolder() {
+  root=$@
+  relativePath="`echo "$root" | sed -e s@"$TOP/\(.*$\)"@"\1"@`"
+  folder="`echo "$SOURCE_FOLDER" | sed -e s@"\(.*/\)####\(.*\)"@"\1$relativePath\2"@`"
+  printf "%s\n" "$folder" >> $IDEA_IML
+}
+
+### Generate project iml
+RELATIVE_BUILD_DIR="`dirname $SPEC | sed -e s@"$TOP/\(.*$\)"@"\1"@`"
+rm -f $IDEA_IML
+while IFS= read -r line
+do
+  if echo "$line" | egrep "^ .* <sourceFolder.*####" > /dev/null ; then
+    if [ "$SOURCE_FOLDERS_DONE" = "false" ] ; then 
+      SOURCE_FOLDERS_DONE="true"
+      for root in $MODULE_ROOTS; do
+         addSourceFolder $root
+      done
+    fi
+  elif echo "$line" | egrep "^ .* <excludeFolder.*####" > /dev/null ; then
+    ul="`echo "$line" | sed -e s@"\(.*/\)####\(.*\)"@"\1$RELATIVE_BUILD_DIR\2"@`"
+    printf "%s\n" "$ul" >> $IDEA_IML 
+  else
+    printf "%s\n" "$line" >> $IDEA_IML
+  fi
+done < "$IML_TEMPLATE"
+
+
+MODULE_NAME="        <property name=\"module.name\" value=\"####\" />"
+
+addModuleName() {
+  mn="`echo "$MODULE_NAME" | sed -e s@"\(.*\)####\(.*\)"@"\1$MODULE_NAMES\2"@`"
+  printf "%s\n" "$mn" >> $IDEA_ANT
+}
+
+BUILD_DIR="        <property name=\"build.target.dir\" value=\"####\" />"
+
+addBuildDir() {
+  DIR=`dirname $SPEC`
+  mn="`echo "$BUILD_DIR" | sed -e s@"\(.*\)####\(.*\)"@"\1$DIR\2"@`"
+  printf "%s\n" "$mn" >> $IDEA_ANT
+}
+
+### Generate ant.xml
+
+rm -f $IDEA_ANT
+while IFS= read -r line
+do
+  if echo "$line" | egrep "^ .* <property name=\"module.name\"" > /dev/null ; then
+    addModuleName
+  elif echo "$line" | egrep "^ .* <property name=\"build.target.dir\"" > /dev/null ; then
+    addBuildDir
+  else
+    printf "%s\n" "$line" >> $IDEA_ANT
+  fi
+done < "$ANT_TEMPLATE"
+
+### Compile the custom Logger
+
+CLASSES=$IDEA_OUTPUT/classes
+
+if [ "x$ANT_HOME" = "x" ] ; then
+   # try some common locations, before giving up
+   if [ -f "/usr/share/ant/lib/ant.jar" ] ; then
+     ANT_HOME="/usr/share/ant"
+   elif [ -f "/usr/local/Cellar/ant/1.9.4/libexec/lib/ant.jar" ] ; then
+     ANT_HOME="/usr/local/Cellar/ant/1.9.4/libexec"
+   else
+     echo "FATAL: cannot find ant. Try setting ANT_HOME." >&2; exit 1
+   fi
+fi
+CP=$ANT_HOME/lib/ant.jar
+rm -rf $CLASSES; mkdir $CLASSES
+
+if [ "x$CYGPATH" = "x" ] ; then ## CYGPATH may be set in env.cfg
+  JAVAC_SOURCE_FILE=$IDEA_OUTPUT/src/idea/JdkIdeaAntLogger.java
+  JAVAC_CLASSES=$CLASSES
+  JAVAC_CP=$CP
+else
+  JAVAC_SOURCE_FILE=`cygpath -am $IDEA_OUTPUT/src/idea/JdkIdeaAntLogger.java`
+  JAVAC_CLASSES=`cygpath -am $CLASSES`
+  JAVAC_CP=`cygpath -am $CP`
+fi
+
+$BOOT_JDK/bin/javac -d $JAVAC_CLASSES -cp $JAVAC_CP $JAVAC_SOURCE_FILE
--- a/common/bin/jib.sh	Sat May 14 09:11:07 2016 -0700
+++ b/common/bin/jib.sh	Tue May 17 05:38:15 2016 -0700
@@ -89,7 +89,7 @@
     fi
 
     if command -v curl > /dev/null; then
-        getcmd="curl -s"
+        getcmd="curl -s -L --retry 3 --retry-delay 5"
     elif command -v wget > /dev/null; then
         getcmd="wget --quiet -O -"
     else
--- a/corba/.hgtags	Sat May 14 09:11:07 2016 -0700
+++ b/corba/.hgtags	Tue May 17 05:38:15 2016 -0700
@@ -360,3 +360,4 @@
 7bab1b1b36824924b1c657a8419369ba93d198d3 jdk-9+115
 7dfa7377a5e601b8f740741a9a80e04c72dd04d6 jdk-9+116
 7a1b36bf2fe55a9a7732489ccdd326c910329a7e jdk-9+117
+8c2c2d17f7ce92a31c9ccb44a122ec62f5a85ace jdk-9+118
--- a/hotspot/.hgtags	Sat May 14 09:11:07 2016 -0700
+++ b/hotspot/.hgtags	Tue May 17 05:38:15 2016 -0700
@@ -520,3 +520,4 @@
 88dd08d7be0fe7fb9f1914b1628f0aae9bf56e25 jdk-9+115
 61a214186dae6811dd989e9165e42f7dbf02acde jdk-9+116
 88170d3642905b9e6cac03e8efcc976885a7e6da jdk-9+117
+9b1075cac08dc836ec32e7b368415cbe3aceaf8c jdk-9+118
--- a/hotspot/src/share/vm/prims/jvm.cpp	Sat May 14 09:11:07 2016 -0700
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Tue May 17 05:38:15 2016 -0700
@@ -3387,14 +3387,14 @@
   return (!access.is_private() && InstanceKlass::cast(current_class)->is_same_class_package(field_class));
 }
 
-// Return the first non-null class loader up the execution stack, or null
-// if only code from the null class loader is on the stack.
+// Return the first user-defined class loader up the execution stack, or null
+// if only code from the bootstrap or platform class loader is on the stack.
 
 JVM_ENTRY(jobject, JVM_LatestUserDefinedLoader(JNIEnv *env))
   for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
     vfst.skip_reflection_related_frames(); // Only needed for 1.4 reflection
     oop loader = vfst.method()->method_holder()->class_loader();
-    if (loader != NULL) {
+    if (loader != NULL && !SystemDictionary::is_platform_class_loader(loader)) {
       return JNIHandles::make_local(env, loader);
     }
   }
--- a/hotspot/test/Makefile	Sat May 14 09:11:07 2016 -0700
+++ b/hotspot/test/Makefile	Tue May 17 05:38:15 2016 -0700
@@ -120,24 +120,33 @@
 TEST_ROOT := $(shell pwd)
 
 # Root of all test results
-ifdef ALT_OUTPUTDIR
-  ABS_BUILD_ROOT = $(ALT_OUTPUTDIR)
+ifdef TEST_OUTPUT_DIR
+  $(shell $(MKDIR) -p $(TEST_OUTPUT_DIR)/jtreg)
+  ABS_TEST_OUTPUT_DIR := \
+    $(shell $(CD) $(TEST_OUTPUT_DIR)/jtreg && $(PWD))
 else
-  ABS_BUILD_ROOT = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)
+  ifdef ALT_OUTPUTDIR
+    ABS_OUTPUTDIR = $(shell $(CD) $(ALT_OUTPUTDIR) && $(PWD))
+  else
+    ABS_OUTPUTDIR = $(shell $(CD) $(TEST_ROOT)/.. && $(PWD))
+  endif
+
+  ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
+  ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
 endif
-ABS_TEST_OUTPUT_DIR = $(ABS_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
 
 # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
 ifndef PRODUCT_HOME
-  # Try to use j2sdk-image if it exists
-  ABS_JDK_IMAGE = $(ABS_BUILD_ROOT)/j2sdk-image
-  PRODUCT_HOME :=                       \
-    $(shell                             \
-      if [ -d $(ABS_JDK_IMAGE) ] ; then \
-         $(ECHO) "$(ABS_JDK_IMAGE)";    \
-       else                             \
-         $(ECHO) "$(ABS_BUILD_ROOT)" ;  \
+  # Try to use images/jdk if it exists
+  ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/images/jdk
+  PRODUCT_HOME :=                       		\
+    $(shell                             		\
+      if [ -d $(ABS_JDK_IMAGE) ] ; then 		\
+         $(ECHO) "$(ABS_JDK_IMAGE)";    		\
+       else                             		\
+         $(ECHO) "$(ABS_PLATFORM_BUILD_ROOT)";		\
        fi)
+  PRODUCT_HOME := $(PRODUCT_HOME)
 endif
 
 # Expect JPRT to set JAVA_ARGS (e.g. -server etc.)
--- a/jaxp/.hgtags	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/.hgtags	Tue May 17 05:38:15 2016 -0700
@@ -360,3 +360,4 @@
 1902a5bda18e794b31fc5f520f5e7d827714b50d jdk-9+115
 9d71d20e614777cd23c1a43b38b5c08a9094d27a jdk-9+116
 46b57560cd06ebcdd21489250628ff5f9d9d8916 jdk-9+117
+a8aa25fc6c5fda0ed7a93b8ffee62da326a752fc jdk-9+118
--- a/jaxp/THIRD_PARTY_README	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/THIRD_PARTY_README	Tue May 17 05:38:15 2016 -0700
@@ -3387,7 +3387,6 @@
   Apache Commons Math 2.2
   Apache Derby 10.10.1.2        [included with JDK 8]
   Apache Jakarta BCEL 5.2 
-  Apache Jakarta Regexp 1.4 
   Apache Santuario XML Security for Java 1.5.4
   Apache Xalan-Java 2.7.1 
   Apache Xerces Java 2.10.0 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/InstructionFinder.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/InstructionFinder.java	Tue May 17 05:38:15 2016 -0700
@@ -4,64 +4,29 @@
  */
 package com.sun.org.apache.bcel.internal.util;
 
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- * 4. The names "Apache" and "Apache Software Foundation" and
- *    "Apache BCEL" must not be used to endorse or promote products
- *    derived from this software without prior written permission. For
- *    written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    "Apache BCEL", nor may "Apache" appear in their name, without
- *    prior written permission of the Apache Software Foundation.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
  */
 
-import java.util.*;
 import com.sun.org.apache.bcel.internal.Constants;
 import com.sun.org.apache.bcel.internal.generic.*;
-import com.sun.org.apache.regexp.internal.*;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * InstructionFinder is a tool to search for given instructions patterns,
@@ -231,28 +196,22 @@
     if(start == -1)
       throw new ClassGenException("Instruction handle " + from +
                                   " not found in instruction list.");
-    try {
-      RE regex = new RE(search);
-      ArrayList matches = new ArrayList();
-
-      while(start < il_string.length() && regex.match(il_string, start)) {
-        int startExpr = regex.getParenStart(0);
-        int endExpr   = regex.getParenEnd(0);
-        int lenExpr   = regex.getParenLength(0);
 
-        InstructionHandle[] match = getMatch(startExpr, lenExpr);
+    Pattern regex = Pattern.compile(search);
+    List<InstructionHandle[]> matches = new ArrayList<>();
+    Matcher matcher = regex.matcher(il_string);
+    while(start < il_string.length() && matcher.find(start)) {
+      int startExpr = matcher.start();
+      int endExpr   = matcher.end();
+      int lenExpr   = endExpr - startExpr;
+      InstructionHandle[] match = getMatch(startExpr, lenExpr);
 
-        if((constraint == null) || constraint.checkCode(match))
-          matches.add(match);
-        start = endExpr;
-      }
-
-      return matches.iterator();
-    } catch(RESyntaxException e) {
-      System.err.println(e);
+      if((constraint == null) || constraint.checkCode(match))
+        matches.add(match);
+      start = endExpr;
     }
 
-    return null;
+    return matches.iterator();
   }
 
   /**
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/CharacterArrayCharacterIterator.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.regexp.internal;
-
-/**
- * Encapsulates char[] as CharacterIterator
- *
- * @author <a href="mailto:ales.novak@netbeans.com">Ales Novak</a>
- */
-public final class CharacterArrayCharacterIterator implements CharacterIterator
-{
-    /** encapsulated */
-    private final char[] src;
-    /** offset in the char array */
-    private final int off;
-    /** used portion of the array */
-    private final int len;
-
-    /** @param src - encapsulated String */
-    public CharacterArrayCharacterIterator(char[] src, int off, int len)
-    {
-        this.src = src;
-        this.off = off;
-        this.len = len;
-    }
-
-    /** @return a substring */
-    public String substring(int beginIndex, int endIndex)
-    {
-        if (endIndex > len) {
-            throw new IndexOutOfBoundsException("endIndex=" + endIndex
-                                                + "; sequence size=" + len);
-        }
-        if (beginIndex < 0 || beginIndex > endIndex) {
-            throw new IndexOutOfBoundsException("beginIndex=" + beginIndex
-                                                + "; endIndex=" + endIndex);
-        }
-        return new String(src, off + beginIndex, endIndex - beginIndex);
-    }
-
-    /** @return a substring */
-    public String substring(int beginIndex)
-    {
-        return substring(beginIndex, len);
-    }
-
-    /** @return a character at the specified position. */
-    public char charAt(int pos)
-    {
-        return src[off + pos];
-    }
-
-    /** @return <tt>true</tt> iff if the specified index is after the end of the character stream */
-    public boolean isEnd(int pos)
-    {
-        return (pos >= len);
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/CharacterIterator.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.regexp.internal;
-
-/**
- * Encapsulates different types of character sources - String, InputStream, ...
- * Defines a set of common methods
- *
- * @author <a href="mailto:ales.novak@netbeans.com">Ales Novak</a>
- */
-public interface CharacterIterator
-{
-    /** @return a substring */
-    String substring(int beginIndex, int endIndex);
-
-    /** @return a substring */
-    String substring(int beginIndex);
-
-    /** @return a character at the specified position. */
-    char charAt(int pos);
-
-    /** @return <tt>true</tt> iff if the specified index is after the end of the character stream */
-    boolean isEnd(int pos);
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/RE.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1760 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.regexp.internal;
-
-import java.io.Serializable;
-import java.util.Vector;
-
-/**
- * RE is an efficient, lightweight regular expression evaluator/matcher
- * class. Regular expressions are pattern descriptions which enable
- * sophisticated matching of strings.  In addition to being able to
- * match a string against a pattern, you can also extract parts of the
- * match.  This is especially useful in text parsing! Details on the
- * syntax of regular expression patterns are given below.
- *
- * <p>
- * To compile a regular expression (RE), you can simply construct an RE
- * matcher object from the string specification of the pattern, like this:
- *
- * <pre>
- *  RE r = new RE("a*b");
- * </pre>
- *
- * <p>
- * Once you have done this, you can call either of the RE.match methods to
- * perform matching on a String.  For example:
- *
- * <pre>
- *  boolean matched = r.match("aaaab");
- * </pre>
- *
- * will cause the boolean matched to be set to true because the
- * pattern "a*b" matches the string "aaaab".
- *
- * <p>
- * If you were interested in the <i>number</i> of a's which matched the
- * first part of our example expression, you could change the expression to
- * "(a*)b".  Then when you compiled the expression and matched it against
- * something like "xaaaab", you would get results like this:
- *
- * <pre>
- *  RE r = new RE("(a*)b");                  // Compile expression
- *  boolean matched = r.match("xaaaab");     // Match against "xaaaab"
- *
- *  String wholeExpr = r.getParen(0);        // wholeExpr will be 'aaaab'
- *  String insideParens = r.getParen(1);     // insideParens will be 'aaaa'
- *
- *  int startWholeExpr = r.getParenStart(0); // startWholeExpr will be index 1
- *  int endWholeExpr = r.getParenEnd(0);     // endWholeExpr will be index 6
- *  int lenWholeExpr = r.getParenLength(0);  // lenWholeExpr will be 5
- *
- *  int startInside = r.getParenStart(1);    // startInside will be index 1
- *  int endInside = r.getParenEnd(1);        // endInside will be index 5
- *  int lenInside = r.getParenLength(1);     // lenInside will be 4
- * </pre>
- *
- * You can also refer to the contents of a parenthesized expression
- * within a regular expression itself.  This is called a
- * 'backreference'.  The first backreference in a regular expression is
- * denoted by \1, the second by \2 and so on.  So the expression:
- *
- * <pre>
- *  ([0-9]+)=\1
- * </pre>
- *
- * will match any string of the form n=n (like 0=0 or 2=2).
- *
- * <p>
- * The full regular expression syntax accepted by RE is described here:
- *
- * <pre>
- *
- *  <b><font face=times roman>Characters</font></b>
- *
- *    <i>unicodeChar</i>   Matches any identical unicode character
- *    \                    Used to quote a meta-character (like '*')
- *    \\                   Matches a single '\' character
- *    \0nnn                Matches a given octal character
- *    \xhh                 Matches a given 8-bit hexadecimal character
- *    \\uhhhh              Matches a given 16-bit hexadecimal character
- *    \t                   Matches an ASCII tab character
- *    \n                   Matches an ASCII newline character
- *    \r                   Matches an ASCII return character
- *    \f                   Matches an ASCII form feed character
- *
- *
- *  <b><font face=times roman>Character Classes</font></b>
- *
- *    [abc]                Simple character class
- *    [a-zA-Z]             Character class with ranges
- *    [^abc]               Negated character class
- * </pre>
- *
- * <b>NOTE:</b> Incomplete ranges will be interpreted as &quot;starts
- * from zero&quot; or &quot;ends with last character&quot;.
- * <br>
- * I.e. [-a] is the same as [\\u0000-a], and [a-] is the same as [a-\\uFFFF],
- * [-] means &quot;all characters&quot;.
- *
- * <pre>
- *
- *  <b><font face=times roman>Standard POSIX Character Classes</font></b>
- *
- *    [:alnum:]            Alphanumeric characters.
- *    [:alpha:]            Alphabetic characters.
- *    [:blank:]            Space and tab characters.
- *    [:cntrl:]            Control characters.
- *    [:digit:]            Numeric characters.
- *    [:graph:]            Characters that are printable and are also visible.
- *                         (A space is printable, but not visible, while an
- *                         `a' is both.)
- *    [:lower:]            Lower-case alphabetic characters.
- *    [:print:]            Printable characters (characters that are not
- *                         control characters.)
- *    [:punct:]            Punctuation characters (characters that are not letter,
- *                         digits, control characters, or space characters).
- *    [:space:]            Space characters (such as space, tab, and formfeed,
- *                         to name a few).
- *    [:upper:]            Upper-case alphabetic characters.
- *    [:xdigit:]           Characters that are hexadecimal digits.
- *
- *
- *  <b><font face=times roman>Non-standard POSIX-style Character Classes</font></b>
- *
- *    [:javastart:]        Start of a Java identifier
- *    [:javapart:]         Part of a Java identifier
- *
- *
- *  <b><font face=times roman>Predefined Classes</font></b>
- *
- *    .         Matches any character other than newline
- *    \w        Matches a "word" character (alphanumeric plus "_")
- *    \W        Matches a non-word character
- *    \s        Matches a whitespace character
- *    \S        Matches a non-whitespace character
- *    \d        Matches a digit character
- *    \D        Matches a non-digit character
- *
- *
- *  <b><font face=times roman>Boundary Matchers</font></b>
- *
- *    ^         Matches only at the beginning of a line
- *    $         Matches only at the end of a line
- *    \b        Matches only at a word boundary
- *    \B        Matches only at a non-word boundary
- *
- *
- *  <b><font face=times roman>Greedy Closures</font></b>
- *
- *    A*        Matches A 0 or more times (greedy)
- *    A+        Matches A 1 or more times (greedy)
- *    A?        Matches A 1 or 0 times (greedy)
- *    A{n}      Matches A exactly n times (greedy)
- *    A{n,}     Matches A at least n times (greedy)
- *    A{n,m}    Matches A at least n but not more than m times (greedy)
- *
- *
- *  <b><font face=times roman>Reluctant Closures</font></b>
- *
- *    A*?       Matches A 0 or more times (reluctant)
- *    A+?       Matches A 1 or more times (reluctant)
- *    A??       Matches A 0 or 1 times (reluctant)
- *
- *
- *  <b><font face=times roman>Logical Operators</font></b>
- *
- *    AB        Matches A followed by B
- *    A|B       Matches either A or B
- *    (A)       Used for subexpression grouping
- *   (?:A)      Used for subexpression clustering (just like grouping but
- *              no backrefs)
- *
- *
- *  <b><font face=times roman>Backreferences</font></b>
- *
- *    \1    Backreference to 1st parenthesized subexpression
- *    \2    Backreference to 2nd parenthesized subexpression
- *    \3    Backreference to 3rd parenthesized subexpression
- *    \4    Backreference to 4th parenthesized subexpression
- *    \5    Backreference to 5th parenthesized subexpression
- *    \6    Backreference to 6th parenthesized subexpression
- *    \7    Backreference to 7th parenthesized subexpression
- *    \8    Backreference to 8th parenthesized subexpression
- *    \9    Backreference to 9th parenthesized subexpression
- * </pre>
- *
- * <p>
- * All closure operators (+, *, ?, {m,n}) are greedy by default, meaning
- * that they match as many elements of the string as possible without
- * causing the overall match to fail.  If you want a closure to be
- * reluctant (non-greedy), you can simply follow it with a '?'.  A
- * reluctant closure will match as few elements of the string as
- * possible when finding matches.  {m,n} closures don't currently
- * support reluctancy.
- *
- * <p>
- * <b><font face="times roman">Line terminators</font></b>
- * <br>
- * A line terminator is a one- or two-character sequence that marks
- * the end of a line of the input character sequence. The following
- * are recognized as line terminators:
- * <ul>
- * <li>A newline (line feed) character ('\n'),</li>
- * <li>A carriage-return character followed immediately by a newline character ("\r\n"),</li>
- * <li>A standalone carriage-return character ('\r'),</li>
- * <li>A next-line character ('\u0085'),</li>
- * <li>A line-separator character ('\u2028'), or</li>
- * <li>A paragraph-separator character ('\u2029).</li>
- * </ul>
- *
- * <p>
- * RE runs programs compiled by the RECompiler class.  But the RE
- * matcher class does not include the actual regular expression compiler
- * for reasons of efficiency.  In fact, if you want to pre-compile one
- * or more regular expressions, the 'recompile' class can be invoked
- * from the command line to produce compiled output like this:
- *
- * <pre>
- *    // Pre-compiled regular expression "a*b"
- *    char[] re1Instructions =
- *    {
- *        0x007c, 0x0000, 0x001a, 0x007c, 0x0000, 0x000d, 0x0041,
- *        0x0001, 0x0004, 0x0061, 0x007c, 0x0000, 0x0003, 0x0047,
- *        0x0000, 0xfff6, 0x007c, 0x0000, 0x0003, 0x004e, 0x0000,
- *        0x0003, 0x0041, 0x0001, 0x0004, 0x0062, 0x0045, 0x0000,
- *        0x0000,
- *    };
- *
- *
- *    REProgram re1 = new REProgram(re1Instructions);
- * </pre>
- *
- * You can then construct a regular expression matcher (RE) object from
- * the pre-compiled expression re1 and thus avoid the overhead of
- * compiling the expression at runtime. If you require more dynamic
- * regular expressions, you can construct a single RECompiler object and
- * re-use it to compile each expression. Similarly, you can change the
- * program run by a given matcher object at any time. However, RE and
- * RECompiler are not threadsafe (for efficiency reasons, and because
- * requiring thread safety in this class is deemed to be a rare
- * requirement), so you will need to construct a separate compiler or
- * matcher object for each thread (unless you do thread synchronization
- * yourself). Once expression compiled into the REProgram object, REProgram
- * can be safely shared across multiple threads and RE objects.
- *
- * <br><p><br>
- *
- * <font color="red">
- * <i>ISSUES:</i>
- *
- * <ul>
- *  <li>com.weusours.util.re is not currently compatible with all
- *      standard POSIX regcomp flags</li>
- *  <li>com.weusours.util.re does not support POSIX equivalence classes
- *      ([=foo=] syntax) (I18N/locale issue)</li>
- *  <li>com.weusours.util.re does not support nested POSIX character
- *      classes (definitely should, but not completely trivial)</li>
- *  <li>com.weusours.util.re Does not support POSIX character collation
- *      concepts ([.foo.] syntax) (I18N/locale issue)</li>
- *  <li>Should there be different matching styles (simple, POSIX, Perl etc?)</li>
- *  <li>Should RE support character iterators (for backwards RE matching!)?</li>
- *  <li>Should RE support reluctant {m,n} closures (does anyone care)?</li>
- *  <li>Not *all* possibilities are considered for greediness when backreferences
- *      are involved (as POSIX suggests should be the case).  The POSIX RE
- *      "(ac*)c*d[ac]*\1", when matched against "acdacaa" should yield a match
- *      of acdacaa where \1 is "a".  This is not the case in this RE package,
- *      and actually Perl doesn't go to this extent either!  Until someone
- *      actually complains about this, I'm not sure it's worth "fixing".
- *      If it ever is fixed, test #137 in RETest.txt should be updated.</li>
- * </ul>
- *
- * </font>
- *
- * @see recompile
- * @see RECompiler
- *
- * @author <a href="mailto:jonl@muppetlabs.com">Jonathan Locke</a>
- * @author <a href="mailto:ts@sch-fer.de">Tobias Sch&auml;fer</a>
- */
-public class RE implements Serializable
-{
-    /**
-     * Specifies normal, case-sensitive matching behaviour.
-     */
-    public static final int MATCH_NORMAL          = 0x0000;
-
-    /**
-     * Flag to indicate that matching should be case-independent (folded)
-     */
-    public static final int MATCH_CASEINDEPENDENT = 0x0001;
-
-    /**
-     * Newlines should match as BOL/EOL (^ and $)
-     */
-    public static final int MATCH_MULTILINE       = 0x0002;
-
-    /**
-     * Consider all input a single body of text - newlines are matched by .
-     */
-    public static final int MATCH_SINGLELINE      = 0x0004;
-
-    /************************************************
-     *                                              *
-     * The format of a node in a program is:        *
-     *                                              *
-     * [ OPCODE ] [ OPDATA ] [ OPNEXT ] [ OPERAND ] *
-     *                                              *
-     * char OPCODE - instruction                    *
-     * char OPDATA - modifying data                 *
-     * char OPNEXT - next node (relative offset)    *
-     *                                              *
-     ************************************************/
-
-                 //   Opcode              Char       Opdata/Operand  Meaning
-                 //   ----------          ---------- --------------- --------------------------------------------------
-    static final char OP_END              = 'E';  //                 end of program
-    static final char OP_BOL              = '^';  //                 match only if at beginning of line
-    static final char OP_EOL              = '$';  //                 match only if at end of line
-    static final char OP_ANY              = '.';  //                 match any single character except newline
-    static final char OP_ANYOF            = '[';  // count/ranges    match any char in the list of ranges
-    static final char OP_BRANCH           = '|';  // node            match this alternative or the next one
-    static final char OP_ATOM             = 'A';  // length/string   length of string followed by string itself
-    static final char OP_STAR             = '*';  // node            kleene closure
-    static final char OP_PLUS             = '+';  // node            positive closure
-    static final char OP_MAYBE            = '?';  // node            optional closure
-    static final char OP_ESCAPE           = '\\'; // escape          special escape code char class (escape is E_* code)
-    static final char OP_OPEN             = '(';  // number          nth opening paren
-    static final char OP_OPEN_CLUSTER     = '<';  //                 opening cluster
-    static final char OP_CLOSE            = ')';  // number          nth closing paren
-    static final char OP_CLOSE_CLUSTER    = '>';  //                 closing cluster
-    static final char OP_BACKREF          = '#';  // number          reference nth already matched parenthesized string
-    static final char OP_GOTO             = 'G';  //                 nothing but a (back-)pointer
-    static final char OP_NOTHING          = 'N';  //                 match null string such as in '(a|)'
-    static final char OP_RELUCTANTSTAR    = '8';  // none/expr       reluctant '*' (mnemonic for char is unshifted '*')
-    static final char OP_RELUCTANTPLUS    = '=';  // none/expr       reluctant '+' (mnemonic for char is unshifted '+')
-    static final char OP_RELUCTANTMAYBE   = '/';  // none/expr       reluctant '?' (mnemonic for char is unshifted '?')
-    static final char OP_POSIXCLASS       = 'P';  // classid         one of the posix character classes
-
-    // Escape codes
-    static final char E_ALNUM             = 'w';  // Alphanumeric
-    static final char E_NALNUM            = 'W';  // Non-alphanumeric
-    static final char E_BOUND             = 'b';  // Word boundary
-    static final char E_NBOUND            = 'B';  // Non-word boundary
-    static final char E_SPACE             = 's';  // Whitespace
-    static final char E_NSPACE            = 'S';  // Non-whitespace
-    static final char E_DIGIT             = 'd';  // Digit
-    static final char E_NDIGIT            = 'D';  // Non-digit
-
-    // Posix character classes
-    static final char POSIX_CLASS_ALNUM   = 'w';  // Alphanumerics
-    static final char POSIX_CLASS_ALPHA   = 'a';  // Alphabetics
-    static final char POSIX_CLASS_BLANK   = 'b';  // Blanks
-    static final char POSIX_CLASS_CNTRL   = 'c';  // Control characters
-    static final char POSIX_CLASS_DIGIT   = 'd';  // Digits
-    static final char POSIX_CLASS_GRAPH   = 'g';  // Graphic characters
-    static final char POSIX_CLASS_LOWER   = 'l';  // Lowercase characters
-    static final char POSIX_CLASS_PRINT   = 'p';  // Printable characters
-    static final char POSIX_CLASS_PUNCT   = '!';  // Punctuation
-    static final char POSIX_CLASS_SPACE   = 's';  // Spaces
-    static final char POSIX_CLASS_UPPER   = 'u';  // Uppercase characters
-    static final char POSIX_CLASS_XDIGIT  = 'x';  // Hexadecimal digits
-    static final char POSIX_CLASS_JSTART  = 'j';  // Java identifier start
-    static final char POSIX_CLASS_JPART   = 'k';  // Java identifier part
-
-    // Limits
-    static final int maxNode  = 65536;            // Maximum number of nodes in a program
-    static final int MAX_PAREN = 16;              // Number of paren pairs (only 9 can be backrefs)
-
-    // Node layout constants
-    static final int offsetOpcode = 0;            // Opcode offset (first character)
-    static final int offsetOpdata = 1;            // Opdata offset (second char)
-    static final int offsetNext   = 2;            // Next index offset (third char)
-    static final int nodeSize     = 3;            // Node size (in chars)
-
-    // State of current program
-    REProgram program;                            // Compiled regular expression 'program'
-    transient CharacterIterator search;           // The string being matched against
-    int matchFlags;                               // Match behaviour flags
-    int maxParen = MAX_PAREN;
-
-    // Parenthesized subexpressions
-    transient int parenCount;                     // Number of subexpressions matched (num open parens + 1)
-    transient int start0;                         // Cache of start[0]
-    transient int end0;                           // Cache of start[0]
-    transient int start1;                         // Cache of start[1]
-    transient int end1;                           // Cache of start[1]
-    transient int start2;                         // Cache of start[2]
-    transient int end2;                           // Cache of start[2]
-    transient int[] startn;                       // Lazy-alloced array of sub-expression starts
-    transient int[] endn;                         // Lazy-alloced array of sub-expression ends
-
-    // Backreferences
-    transient int[] startBackref;                 // Lazy-alloced array of backref starts
-    transient int[] endBackref;                   // Lazy-alloced array of backref ends
-
-    /**
-     * Constructs a regular expression matcher from a String by compiling it
-     * using a new instance of RECompiler.  If you will be compiling many
-     * expressions, you may prefer to use a single RECompiler object instead.
-     *
-     * @param pattern The regular expression pattern to compile.
-     * @exception RESyntaxException Thrown if the regular expression has invalid syntax.
-     * @see RECompiler
-     * @see recompile
-     */
-    public RE(String pattern) throws RESyntaxException
-    {
-        this(pattern, MATCH_NORMAL);
-    }
-
-    /**
-     * Constructs a regular expression matcher from a String by compiling it
-     * using a new instance of RECompiler.  If you will be compiling many
-     * expressions, you may prefer to use a single RECompiler object instead.
-     *
-     * @param pattern The regular expression pattern to compile.
-     * @param matchFlags The matching style
-     * @exception RESyntaxException Thrown if the regular expression has invalid syntax.
-     * @see RECompiler
-     * @see recompile
-     */
-    public RE(String pattern, int matchFlags) throws RESyntaxException
-    {
-        this(new RECompiler().compile(pattern));
-        setMatchFlags(matchFlags);
-    }
-
-    /**
-     * Construct a matcher for a pre-compiled regular expression from program
-     * (bytecode) data.  Permits special flags to be passed in to modify matching
-     * behaviour.
-     *
-     * @param program Compiled regular expression program (see RECompiler and/or recompile)
-     * @param matchFlags One or more of the RE match behaviour flags (RE.MATCH_*):
-     *
-     * <pre>
-     *   MATCH_NORMAL              // Normal (case-sensitive) matching
-     *   MATCH_CASEINDEPENDENT     // Case folded comparisons
-     *   MATCH_MULTILINE           // Newline matches as BOL/EOL
-     * </pre>
-     *
-     * @see RECompiler
-     * @see REProgram
-     * @see recompile
-     */
-    public RE(REProgram program, int matchFlags)
-    {
-        setProgram(program);
-        setMatchFlags(matchFlags);
-    }
-
-    /**
-     * Construct a matcher for a pre-compiled regular expression from program
-     * (bytecode) data.
-     *
-     * @param program Compiled regular expression program
-     * @see RECompiler
-     * @see recompile
-     */
-    public RE(REProgram program)
-    {
-        this(program, MATCH_NORMAL);
-    }
-
-    /**
-     * Constructs a regular expression matcher with no initial program.
-     * This is likely to be an uncommon practice, but is still supported.
-     */
-    public RE()
-    {
-        this((REProgram)null, MATCH_NORMAL);
-    }
-
-    /**
-     * Converts a 'simplified' regular expression to a full regular expression
-     *
-     * @param pattern The pattern to convert
-     * @return The full regular expression
-     */
-    public static String simplePatternToFullRegularExpression(String pattern)
-    {
-        StringBuffer buf = new StringBuffer();
-        for (int i = 0; i < pattern.length(); i++)
-        {
-            char c = pattern.charAt(i);
-            switch (c)
-            {
-                case '*':
-                    buf.append(".*");
-                    break;
-
-                case '.':
-                case '[':
-                case ']':
-                case '\\':
-                case '+':
-                case '?':
-                case '{':
-                case '}':
-                case '$':
-                case '^':
-                case '|':
-                case '(':
-                case ')':
-                    buf.append('\\');
-                default:
-                    buf.append(c);
-                    break;
-            }
-        }
-        return buf.toString();
-    }
-
-    /**
-     * Sets match behaviour flags which alter the way RE does matching.
-     * @param matchFlags One or more of the RE match behaviour flags (RE.MATCH_*):
-     *
-     * <pre>
-     *   MATCH_NORMAL              // Normal (case-sensitive) matching
-     *   MATCH_CASEINDEPENDENT     // Case folded comparisons
-     *   MATCH_MULTILINE           // Newline matches as BOL/EOL
-     * </pre>
-     */
-    public void setMatchFlags(int matchFlags)
-    {
-        this.matchFlags = matchFlags;
-    }
-
-    /**
-     * Returns the current match behaviour flags.
-     * @return Current match behaviour flags (RE.MATCH_*).
-     *
-     * <pre>
-     *   MATCH_NORMAL              // Normal (case-sensitive) matching
-     *   MATCH_CASEINDEPENDENT     // Case folded comparisons
-     *   MATCH_MULTILINE           // Newline matches as BOL/EOL
-     * </pre>
-     *
-     * @see #setMatchFlags
-     */
-    public int getMatchFlags()
-    {
-        return matchFlags;
-    }
-
-    /**
-     * Sets the current regular expression program used by this matcher object.
-     *
-     * @param program Regular expression program compiled by RECompiler.
-     * @see RECompiler
-     * @see REProgram
-     * @see recompile
-     */
-    public void setProgram(REProgram program)
-    {
-        this.program = program;
-        if (program != null && program.maxParens != -1) {
-            this.maxParen = program.maxParens;
-        } else {
-            this.maxParen = MAX_PAREN;
-        }
-    }
-
-    /**
-     * Returns the current regular expression program in use by this matcher object.
-     *
-     * @return Regular expression program
-     * @see #setProgram
-     */
-    public REProgram getProgram()
-    {
-        return program;
-    }
-
-    /**
-     * Returns the number of parenthesized subexpressions available after a successful match.
-     *
-     * @return Number of available parenthesized subexpressions
-     */
-    public int getParenCount()
-    {
-        return parenCount;
-    }
-
-    /**
-     * Gets the contents of a parenthesized subexpression after a successful match.
-     *
-     * @param which Nesting level of subexpression
-     * @return String
-     */
-    public String getParen(int which)
-    {
-        int start;
-        if (which < parenCount && (start = getParenStart(which)) >= 0)
-        {
-            return search.substring(start, getParenEnd(which));
-        }
-        return null;
-    }
-
-    /**
-     * Returns the start index of a given paren level.
-     *
-     * @param which Nesting level of subexpression
-     * @return String index
-     */
-    public final int getParenStart(int which)
-    {
-        if (which < parenCount)
-        {
-            switch (which)
-            {
-                case 0:
-                    return start0;
-
-                case 1:
-                    return start1;
-
-                case 2:
-                    return start2;
-
-                default:
-                    if (startn == null)
-                    {
-                        allocParens();
-                    }
-                    return startn[which];
-            }
-        }
-        return -1;
-    }
-
-    /**
-     * Returns the end index of a given paren level.
-     *
-     * @param which Nesting level of subexpression
-     * @return String index
-     */
-    public final int getParenEnd(int which)
-    {
-        if (which < parenCount)
-        {
-            switch (which)
-            {
-                case 0:
-                    return end0;
-
-                case 1:
-                    return end1;
-
-                case 2:
-                    return end2;
-
-                default:
-                    if (endn == null)
-                    {
-                        allocParens();
-                    }
-                    return endn[which];
-            }
-        }
-        return -1;
-    }
-
-    /**
-     * Returns the length of a given paren level.
-     *
-     * @param which Nesting level of subexpression
-     * @return Number of characters in the parenthesized subexpression
-     */
-    public final int getParenLength(int which)
-    {
-        if (which < parenCount)
-        {
-            return getParenEnd(which) - getParenStart(which);
-        }
-        return -1;
-    }
-
-    /**
-     * Sets the start of a paren level
-     *
-     * @param which Which paren level
-     * @param i Index in input array
-     */
-    protected final void setParenStart(int which, int i)
-    {
-        if (which < parenCount)
-        {
-            switch (which)
-            {
-                case 0:
-                    start0 = i;
-                    break;
-
-                case 1:
-                    start1 = i;
-                    break;
-
-                case 2:
-                    start2 = i;
-                    break;
-
-                default:
-                    if (startn == null)
-                    {
-                        allocParens();
-                    }
-                    startn[which] = i;
-                    break;
-            }
-        }
-    }
-
-    /**
-     * Sets the end of a paren level
-     *
-     * @param which Which paren level
-     * @param i Index in input array
-     */
-    protected final void setParenEnd(int which, int i)
-    {
-        if (which < parenCount)
-        {
-            switch (which)
-            {
-                case 0:
-                    end0 = i;
-                    break;
-
-                case 1:
-                    end1 = i;
-                    break;
-
-                case 2:
-                    end2 = i;
-                    break;
-
-                default:
-                    if (endn == null)
-                    {
-                        allocParens();
-                    }
-                    endn[which] = i;
-                    break;
-            }
-        }
-    }
-
-    /**
-     * Throws an Error representing an internal error condition probably resulting
-     * from a bug in the regular expression compiler (or possibly data corruption).
-     * In practice, this should be very rare.
-     *
-     * @param s Error description
-     */
-    protected void internalError(String s) throws Error
-    {
-        throw new Error("RE internal error: " + s);
-    }
-
-    /**
-     * Performs lazy allocation of subexpression arrays
-     */
-    private final void allocParens()
-    {
-        // Allocate arrays for subexpressions
-        startn = new int[maxParen];
-        endn = new int[maxParen];
-
-        // Set sub-expression pointers to invalid values
-        for (int i = 0; i < maxParen; i++)
-        {
-            startn[i] = -1;
-            endn[i] = -1;
-        }
-    }
-
-    /**
-     * Try to match a string against a subset of nodes in the program
-     *
-     * @param firstNode Node to start at in program
-     * @param lastNode  Last valid node (used for matching a subexpression without
-     *                  matching the rest of the program as well).
-     * @param idxStart  Starting position in character array
-     * @return Final input array index if match succeeded.  -1 if not.
-     */
-    protected int matchNodes(int firstNode, int lastNode, int idxStart)
-    {
-        // Our current place in the string
-        int idx = idxStart;
-
-        // Loop while node is valid
-        int next, opcode, opdata;
-        int idxNew;
-        char[] instruction = program.instruction;
-        for (int node = firstNode; node < lastNode; )
-        {
-            opcode = instruction[node + offsetOpcode];
-            next   = node + (short)instruction[node + offsetNext];
-            opdata = instruction[node + offsetOpdata];
-
-            switch (opcode)
-            {
-                case OP_RELUCTANTMAYBE:
-                    {
-                        int once = 0;
-                        do
-                        {
-                            // Try to match the rest without using the reluctant subexpr
-                            if ((idxNew = matchNodes(next, maxNode, idx)) != -1)
-                            {
-                                return idxNew;
-                            }
-                        }
-                        while ((once++ == 0) && (idx = matchNodes(node + nodeSize, next, idx)) != -1);
-                        return -1;
-                    }
-
-                case OP_RELUCTANTPLUS:
-                    while ((idx = matchNodes(node + nodeSize, next, idx)) != -1)
-                    {
-                        // Try to match the rest without using the reluctant subexpr
-                        if ((idxNew = matchNodes(next, maxNode, idx)) != -1)
-                        {
-                            return idxNew;
-                        }
-                    }
-                    return -1;
-
-                case OP_RELUCTANTSTAR:
-                    do
-                    {
-                        // Try to match the rest without using the reluctant subexpr
-                        if ((idxNew = matchNodes(next, maxNode, idx)) != -1)
-                        {
-                            return idxNew;
-                        }
-                    }
-                    while ((idx = matchNodes(node + nodeSize, next, idx)) != -1);
-                    return -1;
-
-                case OP_OPEN:
-
-                    // Match subexpression
-                    if ((program.flags & REProgram.OPT_HASBACKREFS) != 0)
-                    {
-                        startBackref[opdata] = idx;
-                    }
-                    if ((idxNew = matchNodes(next, maxNode, idx)) != -1)
-                    {
-                        // Increase valid paren count
-                        if ((opdata + 1) > parenCount)
-                        {
-                            parenCount = opdata + 1;
-                        }
-
-                        // Don't set paren if already set later on
-                        if (getParenStart(opdata) == -1)
-                        {
-                            setParenStart(opdata, idx);
-                        }
-                    }
-                    return idxNew;
-
-                case OP_CLOSE:
-
-                    // Done matching subexpression
-                    if ((program.flags & REProgram.OPT_HASBACKREFS) != 0)
-                    {
-                        endBackref[opdata] = idx;
-                    }
-                    if ((idxNew = matchNodes(next, maxNode, idx)) != -1)
-                    {
-                        // Increase valid paren count
-                        if ((opdata + 1) > parenCount)
-                        {
-                            parenCount = opdata + 1;
-                        }
-
-                        // Don't set paren if already set later on
-                        if (getParenEnd(opdata) == -1)
-                        {
-                            setParenEnd(opdata, idx);
-                        }
-                    }
-                    return idxNew;
-
-                case OP_OPEN_CLUSTER:
-                case OP_CLOSE_CLUSTER:
-                    // starting or ending the matching of a subexpression which has no backref.
-                    return matchNodes( next, maxNode, idx );
-
-                case OP_BACKREF:
-                    {
-                        // Get the start and end of the backref
-                        int s = startBackref[opdata];
-                        int e = endBackref[opdata];
-
-                        // We don't know the backref yet
-                        if (s == -1 || e == -1)
-                        {
-                            return -1;
-                        }
-
-                        // The backref is empty size
-                        if (s == e)
-                        {
-                            break;
-                        }
-
-                        // Get the length of the backref
-                        int l = e - s;
-
-                        // If there's not enough input left, give up.
-                        if (search.isEnd(idx + l - 1))
-                        {
-                            return -1;
-                        }
-
-                        // Case fold the backref?
-                        final boolean caseFold =
-                            ((matchFlags & MATCH_CASEINDEPENDENT) != 0);
-                        // Compare backref to input
-                        for (int i = 0; i < l; i++)
-                        {
-                            if (compareChars(search.charAt(idx++), search.charAt(s + i), caseFold) != 0)
-                            {
-                                return -1;
-                            }
-                        }
-                    }
-                    break;
-
-                case OP_BOL:
-
-                    // Fail if we're not at the start of the string
-                    if (idx != 0)
-                    {
-                        // If we're multiline matching, we could still be at the start of a line
-                        if ((matchFlags & MATCH_MULTILINE) == MATCH_MULTILINE)
-                        {
-                            // If not at start of line, give up
-                            if (idx <= 0 || !isNewline(idx - 1)) {
-                                return -1;
-                            } else {
-                                break;
-                            }
-                        }
-                        return -1;
-                    }
-                    break;
-
-                case OP_EOL:
-
-                    // If we're not at the end of string
-                    if (!search.isEnd(0) && !search.isEnd(idx))
-                    {
-                        // If we're multi-line matching
-                        if ((matchFlags & MATCH_MULTILINE) == MATCH_MULTILINE)
-                        {
-                            // Give up if we're not at the end of a line
-                            if (!isNewline(idx)) {
-                                return -1;
-                            } else {
-                                break;
-                            }
-                        }
-                        return -1;
-                    }
-                    break;
-
-                case OP_ESCAPE:
-
-                    // Which escape?
-                    switch (opdata)
-                    {
-                        // Word boundary match
-                        case E_NBOUND:
-                        case E_BOUND:
-                            {
-                                char cLast = ((idx == 0) ? '\n' : search.charAt(idx - 1));
-                                char cNext = ((search.isEnd(idx)) ? '\n' : search.charAt(idx));
-                                if ((Character.isLetterOrDigit(cLast) == Character.isLetterOrDigit(cNext)) == (opdata == E_BOUND))
-                                {
-                                    return -1;
-                                }
-                            }
-                            break;
-
-                        // Alpha-numeric, digit, space, javaLetter, javaLetterOrDigit
-                        case E_ALNUM:
-                        case E_NALNUM:
-                        case E_DIGIT:
-                        case E_NDIGIT:
-                        case E_SPACE:
-                        case E_NSPACE:
-
-                            // Give up if out of input
-                            if (search.isEnd(idx))
-                            {
-                                return -1;
-                            }
-
-                            char c = search.charAt(idx);
-
-                            // Switch on escape
-                            switch (opdata)
-                            {
-                                case E_ALNUM:
-                                case E_NALNUM:
-                                    if (!((Character.isLetterOrDigit(c) || c == '_') == (opdata == E_ALNUM)))
-                                    {
-                                        return -1;
-                                    }
-                                    break;
-
-                                case E_DIGIT:
-                                case E_NDIGIT:
-                                    if (!(Character.isDigit(c) == (opdata == E_DIGIT)))
-                                    {
-                                        return -1;
-                                    }
-                                    break;
-
-                                case E_SPACE:
-                                case E_NSPACE:
-                                    if (!(Character.isWhitespace(c) == (opdata == E_SPACE)))
-                                    {
-                                        return -1;
-                                    }
-                                    break;
-                            }
-                            idx++;
-                            break;
-
-                        default:
-                            internalError("Unrecognized escape '" + opdata + "'");
-                    }
-                    break;
-
-                case OP_ANY:
-
-                    if ((matchFlags & MATCH_SINGLELINE) == MATCH_SINGLELINE) {
-                        // Match anything
-                        if (search.isEnd(idx))
-                        {
-                            return -1;
-                        }
-                    }
-                    else
-                    {
-                        // Match anything but a newline
-                        if (search.isEnd(idx) || isNewline(idx))
-                        {
-                            return -1;
-                        }
-                    }
-                    idx++;
-                    break;
-
-                case OP_ATOM:
-                    {
-                        // Match an atom value
-                        if (search.isEnd(idx))
-                        {
-                            return -1;
-                        }
-
-                        // Get length of atom and starting index
-                        int lenAtom = opdata;
-                        int startAtom = node + nodeSize;
-
-                        // Give up if not enough input remains to have a match
-                        if (search.isEnd(lenAtom + idx - 1))
-                        {
-                            return -1;
-                        }
-
-                        // Match atom differently depending on casefolding flag
-                        final boolean caseFold =
-                            ((matchFlags & MATCH_CASEINDEPENDENT) != 0);
-
-                        for (int i = 0; i < lenAtom; i++)
-                        {
-                            if (compareChars(search.charAt(idx++), instruction[startAtom + i], caseFold) != 0)
-                            {
-                                return -1;
-                            }
-                        }
-                    }
-                    break;
-
-                case OP_POSIXCLASS:
-                    {
-                        // Out of input?
-                        if (search.isEnd(idx))
-                        {
-                            return -1;
-                        }
-
-                        switch (opdata)
-                        {
-                            case POSIX_CLASS_ALNUM:
-                                if (!Character.isLetterOrDigit(search.charAt(idx)))
-                                {
-                                    return -1;
-                                }
-                                break;
-
-                            case POSIX_CLASS_ALPHA:
-                                if (!Character.isLetter(search.charAt(idx)))
-                                {
-                                    return -1;
-                                }
-                                break;
-
-                            case POSIX_CLASS_DIGIT:
-                                if (!Character.isDigit(search.charAt(idx)))
-                                {
-                                    return -1;
-                                }
-                                break;
-
-                            case POSIX_CLASS_BLANK: // JWL - bugbug: is this right??
-                                if (!Character.isSpaceChar(search.charAt(idx)))
-                                {
-                                    return -1;
-                                }
-                                break;
-
-                            case POSIX_CLASS_SPACE:
-                                if (!Character.isWhitespace(search.charAt(idx)))
-                                {
-                                    return -1;
-                                }
-                                break;
-
-                            case POSIX_CLASS_CNTRL:
-                                if (Character.getType(search.charAt(idx)) != Character.CONTROL)
-                                {
-                                    return -1;
-                                }
-                                break;
-
-                            case POSIX_CLASS_GRAPH: // JWL - bugbug???
-                                switch (Character.getType(search.charAt(idx)))
-                                {
-                                    case Character.MATH_SYMBOL:
-                                    case Character.CURRENCY_SYMBOL:
-                                    case Character.MODIFIER_SYMBOL:
-                                    case Character.OTHER_SYMBOL:
-                                        break;
-
-                                    default:
-                                        return -1;
-                                }
-                                break;
-
-                            case POSIX_CLASS_LOWER:
-                                if (Character.getType(search.charAt(idx)) != Character.LOWERCASE_LETTER)
-                                {
-                                    return -1;
-                                }
-                                break;
-
-                            case POSIX_CLASS_UPPER:
-                                if (Character.getType(search.charAt(idx)) != Character.UPPERCASE_LETTER)
-                                {
-                                    return -1;
-                                }
-                                break;
-
-                            case POSIX_CLASS_PRINT:
-                                if (Character.getType(search.charAt(idx)) == Character.CONTROL)
-                                {
-                                    return -1;
-                                }
-                                break;
-
-                            case POSIX_CLASS_PUNCT:
-                            {
-                                int type = Character.getType(search.charAt(idx));
-                                switch(type)
-                                {
-                                    case Character.DASH_PUNCTUATION:
-                                    case Character.START_PUNCTUATION:
-                                    case Character.END_PUNCTUATION:
-                                    case Character.CONNECTOR_PUNCTUATION:
-                                    case Character.OTHER_PUNCTUATION:
-                                        break;
-
-                                    default:
-                                        return -1;
-                                }
-                            }
-                            break;
-
-                            case POSIX_CLASS_XDIGIT: // JWL - bugbug??
-                            {
-                                boolean isXDigit = ((search.charAt(idx) >= '0' && search.charAt(idx) <= '9') ||
-                                                    (search.charAt(idx) >= 'a' && search.charAt(idx) <= 'f') ||
-                                                    (search.charAt(idx) >= 'A' && search.charAt(idx) <= 'F'));
-                                if (!isXDigit)
-                                {
-                                    return -1;
-                                }
-                            }
-                            break;
-
-                            case POSIX_CLASS_JSTART:
-                                if (!Character.isJavaIdentifierStart(search.charAt(idx)))
-                                {
-                                    return -1;
-                                }
-                                break;
-
-                            case POSIX_CLASS_JPART:
-                                if (!Character.isJavaIdentifierPart(search.charAt(idx)))
-                                {
-                                    return -1;
-                                }
-                                break;
-
-                            default:
-                                internalError("Bad posix class");
-                                break;
-                        }
-
-                        // Matched.
-                        idx++;
-                    }
-                    break;
-
-                case OP_ANYOF:
-                    {
-                        // Out of input?
-                        if (search.isEnd(idx))
-                        {
-                            return -1;
-                        }
-
-                        // Get character to match against character class and maybe casefold
-                        char c = search.charAt(idx);
-                        boolean caseFold = (matchFlags & MATCH_CASEINDEPENDENT) != 0;
-                        // Loop through character class checking our match character
-                        int idxRange = node + nodeSize;
-                        int idxEnd = idxRange + (opdata * 2);
-                        boolean match = false;
-                        for (int i = idxRange; !match && i < idxEnd; )
-                        {
-                            // Get start, end and match characters
-                            char s = instruction[i++];
-                            char e = instruction[i++];
-
-                            match = ((compareChars(c, s, caseFold) >= 0)
-                                     && (compareChars(c, e, caseFold) <= 0));
-                        }
-
-                        // Fail if we didn't match the character class
-                        if (!match)
-                        {
-                            return -1;
-                        }
-                        idx++;
-                    }
-                    break;
-
-                case OP_BRANCH:
-                {
-                    // Check for choices
-                    if (instruction[next + offsetOpcode] != OP_BRANCH)
-                    {
-                        // If there aren't any other choices, just evaluate this branch.
-                        node += nodeSize;
-                        continue;
-                    }
-
-                    // Try all available branches
-                    short nextBranch;
-                    do
-                    {
-                        // Try matching the branch against the string
-                        if ((idxNew = matchNodes(node + nodeSize, maxNode, idx)) != -1)
-                        {
-                            return idxNew;
-                        }
-
-                        // Go to next branch (if any)
-                        nextBranch = (short)instruction[node + offsetNext];
-                        node += nextBranch;
-                    }
-                    while (nextBranch != 0 && (instruction[node + offsetOpcode] == OP_BRANCH));
-
-                    // Failed to match any branch!
-                    return -1;
-                }
-
-                case OP_NOTHING:
-                case OP_GOTO:
-
-                    // Just advance to the next node without doing anything
-                    break;
-
-                case OP_END:
-
-                    // Match has succeeded!
-                    setParenEnd(0, idx);
-                    return idx;
-
-                default:
-
-                    // Corrupt program
-                    internalError("Invalid opcode '" + opcode + "'");
-            }
-
-            // Advance to the next node in the program
-            node = next;
-        }
-
-        // We "should" never end up here
-        internalError("Corrupt program");
-        return -1;
-    }
-
-    /**
-     * Match the current regular expression program against the current
-     * input string, starting at index i of the input string.  This method
-     * is only meant for internal use.
-     *
-     * @param i The input string index to start matching at
-     * @return True if the input matched the expression
-     */
-    protected boolean matchAt(int i)
-    {
-        // Initialize start pointer, paren cache and paren count
-        start0 = -1;
-        end0   = -1;
-        start1 = -1;
-        end1   = -1;
-        start2 = -1;
-        end2   = -1;
-        startn = null;
-        endn   = null;
-        parenCount = 1;
-        setParenStart(0, i);
-
-        // Allocate backref arrays (unless optimizations indicate otherwise)
-        if ((program.flags & REProgram.OPT_HASBACKREFS) != 0)
-        {
-            startBackref = new int[maxParen];
-            endBackref = new int[maxParen];
-        }
-
-        // Match against string
-        int idx;
-        if ((idx = matchNodes(0, maxNode, i)) != -1)
-        {
-            setParenEnd(0, idx);
-            return true;
-        }
-
-        // Didn't match
-        parenCount = 0;
-        return false;
-    }
-
-    /**
-     * Matches the current regular expression program against a character array,
-     * starting at a given index.
-     *
-     * @param search String to match against
-     * @param i Index to start searching at
-     * @return True if string matched
-     */
-    public boolean match(String search, int i)
-    {
-        return match(new StringCharacterIterator(search), i);
-    }
-
-    /**
-     * Matches the current regular expression program against a character array,
-     * starting at a given index.
-     *
-     * @param search String to match against
-     * @param i Index to start searching at
-     * @return True if string matched
-     */
-    public boolean match(CharacterIterator search, int i)
-    {
-        // There is no compiled program to search with!
-        if (program == null)
-        {
-            // This should be uncommon enough to be an error case rather
-            // than an exception (which would have to be handled everywhere)
-            internalError("No RE program to run!");
-        }
-
-        // Save string to search
-        this.search = search;
-
-        // Can we optimize the search by looking for a prefix string?
-        if (program.prefix == null)
-        {
-            // Unprefixed matching must try for a match at each character
-            for ( ;! search.isEnd(i - 1); i++)
-            {
-                // Try a match at index i
-                if (matchAt(i))
-                {
-                    return true;
-                }
-            }
-            return false;
-        }
-        else
-        {
-            // Prefix-anchored matching is possible
-            boolean caseIndependent = (matchFlags & MATCH_CASEINDEPENDENT) != 0;
-            char[] prefix = program.prefix;
-            for ( ; !search.isEnd(i + prefix.length - 1); i++)
-            {
-                int j = i;
-                int k = 0;
-
-                boolean match;
-                do {
-                    // If there's a mismatch of any character in the prefix, give up
-                    match = (compareChars(search.charAt(j++), prefix[k++], caseIndependent) == 0);
-                } while (match && k < prefix.length);
-
-                // See if the whole prefix string matched
-                if (k == prefix.length)
-                {
-                    // We matched the full prefix at firstChar, so try it
-                    if (matchAt(i))
-                    {
-                        return true;
-                    }
-                }
-            }
-            return false;
-        }
-    }
-
-    /**
-     * Matches the current regular expression program against a String.
-     *
-     * @param search String to match against
-     * @return True if string matched
-     */
-    public boolean match(String search)
-    {
-        return match(search, 0);
-    }
-
-    /**
-     * Splits a string into an array of strings on regular expression boundaries.
-     * This function works the same way as the Perl function of the same name.
-     * Given a regular expression of "[ab]+" and a string to split of
-     * "xyzzyababbayyzabbbab123", the result would be the array of Strings
-     * "[xyzzy, yyz, 123]".
-     *
-     * <p>Please note that the first string in the resulting array may be an empty
-     * string. This happens when the very first character of input string is
-     * matched by the pattern.
-     *
-     * @param s String to split on this regular exression
-     * @return Array of strings
-     */
-    public String[] split(String s)
-    {
-        // Create new vector
-        Vector v = new Vector();
-
-        // Start at position 0 and search the whole string
-        int pos = 0;
-        int len = s.length();
-
-        // Try a match at each position
-        while (pos < len && match(s, pos))
-        {
-            // Get start of match
-            int start = getParenStart(0);
-
-            // Get end of match
-            int newpos = getParenEnd(0);
-
-            // Check if no progress was made
-            if (newpos == pos)
-            {
-                v.addElement(s.substring(pos, start + 1));
-                newpos++;
-            }
-            else
-            {
-                v.addElement(s.substring(pos, start));
-            }
-
-            // Move to new position
-            pos = newpos;
-        }
-
-        // Push remainder if it's not empty
-        String remainder = s.substring(pos);
-        if (remainder.length() != 0)
-        {
-            v.addElement(remainder);
-        }
-
-        // Return vector as an array of strings
-        String[] ret = new String[v.size()];
-        v.copyInto(ret);
-        return ret;
-    }
-
-    /**
-     * Flag bit that indicates that subst should replace all occurrences of this
-     * regular expression.
-     */
-    public static final int REPLACE_ALL            = 0x0000;
-
-    /**
-     * Flag bit that indicates that subst should only replace the first occurrence
-     * of this regular expression.
-     */
-    public static final int REPLACE_FIRSTONLY      = 0x0001;
-
-    /**
-     * Flag bit that indicates that subst should replace backreferences
-     */
-    public static final int REPLACE_BACKREFERENCES = 0x0002;
-
-    /**
-     * Substitutes a string for this regular expression in another string.
-     * This method works like the Perl function of the same name.
-     * Given a regular expression of "a*b", a String to substituteIn of
-     * "aaaabfooaaabgarplyaaabwackyb" and the substitution String "-", the
-     * resulting String returned by subst would be "-foo-garply-wacky-".
-     *
-     * @param substituteIn String to substitute within
-     * @param substitution String to substitute for all matches of this regular expression.
-     * @return The string substituteIn with zero or more occurrences of the current
-     * regular expression replaced with the substitution String (if this regular
-     * expression object doesn't match at any position, the original String is returned
-     * unchanged).
-     */
-    public String subst(String substituteIn, String substitution)
-    {
-        return subst(substituteIn, substitution, REPLACE_ALL);
-    }
-
-    /**
-     * Substitutes a string for this regular expression in another string.
-     * This method works like the Perl function of the same name.
-     * Given a regular expression of "a*b", a String to substituteIn of
-     * "aaaabfooaaabgarplyaaabwackyb" and the substitution String "-", the
-     * resulting String returned by subst would be "-foo-garply-wacky-".
-     * <p>
-     * It is also possible to reference the contents of a parenthesized expression
-     * with $0, $1, ... $9. A regular expression of "http://[\\.\\w\\-\\?/~_@&=%]+",
-     * a String to substituteIn of "visit us: http://www.apache.org!" and the
-     * substitution String "&lt;a href=\"$0\"&gt;$0&lt;/a&gt;", the resulting String
-     * returned by subst would be
-     * "visit us: &lt;a href=\"http://www.apache.org\"&gt;http://www.apache.org&lt;/a&gt;!".
-     * <p>
-     * <i>Note:</i> $0 represents the whole match.
-     *
-     * @param substituteIn String to substitute within
-     * @param substitution String to substitute for matches of this regular expression
-     * @param flags One or more bitwise flags from REPLACE_*.  If the REPLACE_FIRSTONLY
-     * flag bit is set, only the first occurrence of this regular expression is replaced.
-     * If the bit is not set (REPLACE_ALL), all occurrences of this pattern will be
-     * replaced. If the flag REPLACE_BACKREFERENCES is set, all backreferences will
-     * be processed.
-     * @return The string substituteIn with zero or more occurrences of the current
-     * regular expression replaced with the substitution String (if this regular
-     * expression object doesn't match at any position, the original String is returned
-     * unchanged).
-     */
-    public String subst(String substituteIn, String substitution, int flags)
-    {
-        // String to return
-        StringBuffer ret = new StringBuffer();
-
-        // Start at position 0 and search the whole string
-        int pos = 0;
-        int len = substituteIn.length();
-
-        // Try a match at each position
-        while (pos < len && match(substituteIn, pos))
-        {
-            // Append string before match
-            ret.append(substituteIn.substring(pos, getParenStart(0)));
-
-            if ((flags & REPLACE_BACKREFERENCES) != 0)
-            {
-                // Process backreferences
-                int lCurrentPosition = 0;
-                int lLastPosition = -2;
-                int lLength = substitution.length();
-                boolean bAddedPrefix = false;
-
-                while ((lCurrentPosition = substitution.indexOf("$", lCurrentPosition)) >= 0)
-                {
-                    if ((lCurrentPosition == 0 || substitution.charAt(lCurrentPosition - 1) != '\\')
-                        && lCurrentPosition+1 < lLength)
-                    {
-                        char c = substitution.charAt(lCurrentPosition + 1);
-                        if (c >= '0' && c <= '9')
-                        {
-                            if (bAddedPrefix == false)
-                            {
-                                // Append everything between the beginning of the
-                                // substitution string and the current $ sign
-                                ret.append(substitution.substring(0, lCurrentPosition));
-                                bAddedPrefix = true;
-                            }
-                            else
-                            {
-                                // Append everything between the last and the current $ sign
-                                ret.append(substitution.substring(lLastPosition + 2, lCurrentPosition));
-                            }
-
-                            // Append the parenthesized expression
-                            // Note: if a parenthesized expression of the requested
-                            // index is not available "null" is added to the string
-                            ret.append(getParen(c - '0'));
-                            lLastPosition = lCurrentPosition;
-                        }
-                    }
-
-                    // Move forward, skipping past match
-                    lCurrentPosition++;
-                }
-
-                // Append everything after the last $ sign
-                ret.append(substitution.substring(lLastPosition + 2, lLength));
-            }
-            else
-            {
-                // Append substitution without processing backreferences
-                ret.append(substitution);
-            }
-
-            // Move forward, skipping past match
-            int newpos = getParenEnd(0);
-
-            // We always want to make progress!
-            if (newpos == pos)
-            {
-                newpos++;
-            }
-
-            // Try new position
-            pos = newpos;
-
-            // Break out if we're only supposed to replace one occurrence
-            if ((flags & REPLACE_FIRSTONLY) != 0)
-            {
-                break;
-            }
-        }
-
-        // If there's remaining input, append it
-        if (pos < len)
-        {
-            ret.append(substituteIn.substring(pos));
-        }
-
-        // Return string buffer as string
-        return ret.toString();
-    }
-
-    /**
-     * Returns an array of Strings, whose toString representation matches a regular
-     * expression. This method works like the Perl function of the same name.  Given
-     * a regular expression of "a*b" and an array of String objects of [foo, aab, zzz,
-     * aaaab], the array of Strings returned by grep would be [aab, aaaab].
-     *
-     * @param search Array of Objects to search
-     * @return Array of Strings whose toString() value matches this regular expression.
-     */
-    public String[] grep(Object[] search)
-    {
-        // Create new vector to hold return items
-        Vector v = new Vector();
-
-        // Traverse array of objects
-        for (int i = 0; i < search.length; i++)
-        {
-            // Get next object as a string
-            String s = search[i].toString();
-
-            // If it matches this regexp, add it to the list
-            if (match(s))
-            {
-                v.addElement(s);
-            }
-        }
-
-        // Return vector as an array of strings
-        String[] ret = new String[v.size()];
-        v.copyInto(ret);
-        return ret;
-    }
-
-    /**
-     * @return true if character at i-th position in the <code>search</code> string is a newline
-     */
-    private boolean isNewline(int i)
-    {
-        char nextChar = search.charAt(i);
-
-        if (nextChar == '\n' || nextChar == '\r' || nextChar == '\u0085'
-            || nextChar == '\u2028' || nextChar == '\u2029')
-        {
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Compares two characters.
-     *
-     * @param c1 first character to compare.
-     * @param c2 second character to compare.
-     * @param caseIndependent whether comparision is case insensitive or not.
-     * @return negative, 0, or positive integer as the first character
-     *         less than, equal to, or greater then the second.
-     */
-    private int compareChars(char c1, char c2, boolean caseIndependent)
-    {
-        if (caseIndependent)
-        {
-            c1 = Character.toLowerCase(c1);
-            c2 = Character.toLowerCase(c2);
-        }
-        return ((int)c1 - (int)c2);
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/RECompiler.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1520 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.regexp.internal;
-
-import com.sun.org.apache.regexp.internal.RE;
-import java.util.Hashtable;
-
-/**
- * A regular expression compiler class.  This class compiles a pattern string into a
- * regular expression program interpretable by the RE evaluator class.  The 'recompile'
- * command line tool uses this compiler to pre-compile regular expressions for use
- * with RE.  For a description of the syntax accepted by RECompiler and what you can
- * do with regular expressions, see the documentation for the RE matcher class.
- *
- * @see RE
- * @see recompile
- *
- * @author <a href="mailto:jonl@muppetlabs.com">Jonathan Locke</a>
- * @author <a href="mailto:gholam@xtra.co.nz">Michael McCallum</a>
- */
-public class RECompiler
-{
-    // The compiled program
-    char[] instruction;                                 // The compiled RE 'program' instruction buffer
-    int lenInstruction;                                 // The amount of the program buffer currently in use
-
-    // Input state for compiling regular expression
-    String pattern;                                     // Input string
-    int len;                                            // Length of the pattern string
-    int idx;                                            // Current input index into ac
-    int parens;                                         // Total number of paren pairs
-
-    // Node flags
-    static final int NODE_NORMAL   = 0;                 // No flags (nothing special)
-    static final int NODE_NULLABLE = 1;                 // True if node is potentially null
-    static final int NODE_TOPLEVEL = 2;                 // True if top level expr
-
-    // Special types of 'escapes'
-    static final int ESC_MASK      = 0xffff0;           // Escape complexity mask
-    static final int ESC_BACKREF   = 0xfffff;           // Escape is really a backreference
-    static final int ESC_COMPLEX   = 0xffffe;           // Escape isn't really a true character
-    static final int ESC_CLASS     = 0xffffd;           // Escape represents a whole class of characters
-
-    // {m,n} stacks
-    int maxBrackets = 10;                               // Maximum number of bracket pairs
-    static final int bracketUnbounded = -1;             // Unbounded value
-    int brackets = 0;                                   // Number of bracket sets
-    int[] bracketStart = null;                          // Starting point
-    int[] bracketEnd = null;                            // Ending point
-    int[] bracketMin = null;                            // Minimum number of matches
-    int[] bracketOpt = null;                            // Additional optional matches
-
-    // Lookup table for POSIX character class names
-    static Hashtable hashPOSIX = new Hashtable();
-    static
-    {
-        hashPOSIX.put("alnum",     new Character(RE.POSIX_CLASS_ALNUM));
-        hashPOSIX.put("alpha",     new Character(RE.POSIX_CLASS_ALPHA));
-        hashPOSIX.put("blank",     new Character(RE.POSIX_CLASS_BLANK));
-        hashPOSIX.put("cntrl",     new Character(RE.POSIX_CLASS_CNTRL));
-        hashPOSIX.put("digit",     new Character(RE.POSIX_CLASS_DIGIT));
-        hashPOSIX.put("graph",     new Character(RE.POSIX_CLASS_GRAPH));
-        hashPOSIX.put("lower",     new Character(RE.POSIX_CLASS_LOWER));
-        hashPOSIX.put("print",     new Character(RE.POSIX_CLASS_PRINT));
-        hashPOSIX.put("punct",     new Character(RE.POSIX_CLASS_PUNCT));
-        hashPOSIX.put("space",     new Character(RE.POSIX_CLASS_SPACE));
-        hashPOSIX.put("upper",     new Character(RE.POSIX_CLASS_UPPER));
-        hashPOSIX.put("xdigit",    new Character(RE.POSIX_CLASS_XDIGIT));
-        hashPOSIX.put("javastart", new Character(RE.POSIX_CLASS_JSTART));
-        hashPOSIX.put("javapart",  new Character(RE.POSIX_CLASS_JPART));
-    }
-
-    /**
-     * Constructor.  Creates (initially empty) storage for a regular expression program.
-     */
-    public RECompiler()
-    {
-        // Start off with a generous, yet reasonable, initial size
-        instruction = new char[128];
-        lenInstruction = 0;
-    }
-
-    /**
-     * Ensures that n more characters can fit in the program buffer.
-     * If n more can't fit, then the size is doubled until it can.
-     * @param n Number of additional characters to ensure will fit.
-     */
-    void ensure(int n)
-    {
-        // Get current program length
-        int curlen = instruction.length;
-
-        // If the current length + n more is too much
-        if (lenInstruction + n >= curlen)
-        {
-            // Double the size of the program array until n more will fit
-            while (lenInstruction + n >= curlen)
-            {
-                curlen *= 2;
-            }
-
-            // Allocate new program array and move data into it
-            char[] newInstruction = new char[curlen];
-            System.arraycopy(instruction, 0, newInstruction, 0, lenInstruction);
-            instruction = newInstruction;
-        }
-    }
-
-    /**
-     * Emit a single character into the program stream.
-     * @param c Character to add
-     */
-    void emit(char c)
-    {
-        // Make room for character
-        ensure(1);
-
-        // Add character
-        instruction[lenInstruction++] = c;
-    }
-
-    /**
-     * Inserts a node with a given opcode and opdata at insertAt.  The node relative next
-     * pointer is initialized to 0.
-     * @param opcode Opcode for new node
-     * @param opdata Opdata for new node (only the low 16 bits are currently used)
-     * @param insertAt Index at which to insert the new node in the program
-     */
-    void nodeInsert(char opcode, int opdata, int insertAt)
-    {
-        // Make room for a new node
-        ensure(RE.nodeSize);
-
-        // Move everything from insertAt to the end down nodeSize elements
-        System.arraycopy(instruction, insertAt, instruction, insertAt + RE.nodeSize, lenInstruction - insertAt);
-        instruction[insertAt + RE.offsetOpcode] = opcode;
-        instruction[insertAt + RE.offsetOpdata] = (char)opdata;
-        instruction[insertAt + RE.offsetNext] = 0;
-        lenInstruction += RE.nodeSize;
-    }
-
-    /**
-     * Appends a node to the end of a node chain
-     * @param node Start of node chain to traverse
-     * @param pointTo Node to have the tail of the chain point to
-     */
-    void setNextOfEnd(int node, int pointTo)
-    {
-        // Traverse the chain until the next offset is 0
-        int next = instruction[node + RE.offsetNext];
-        // while the 'node' is not the last in the chain
-        // and the 'node' is not the last in the program.
-        while ( next != 0 && node < lenInstruction )
-        {
-            // if the node we are supposed to point to is in the chain then
-            // point to the end of the program instead.
-            // Michael McCallum <gholam@xtra.co.nz>
-            // FIXME: // This is a _hack_ to stop infinite programs.
-            // I believe that the implementation of the reluctant matches is wrong but
-            // have not worked out a better way yet.
-            if ( node == pointTo ) {
-              pointTo = lenInstruction;
-            }
-            node += next;
-            next = instruction[node + RE.offsetNext];
-        }
-        // if we have reached the end of the program then dont set the pointTo.
-        // im not sure if this will break any thing but passes all the tests.
-        if ( node < lenInstruction ) {
-            // Point the last node in the chain to pointTo.
-            instruction[node + RE.offsetNext] = (char)(short)(pointTo - node);
-        }
-    }
-
-    /**
-     * Adds a new node
-     * @param opcode Opcode for node
-     * @param opdata Opdata for node (only the low 16 bits are currently used)
-     * @return Index of new node in program
-     */
-    int node(char opcode, int opdata)
-    {
-        // Make room for a new node
-        ensure(RE.nodeSize);
-
-        // Add new node at end
-        instruction[lenInstruction + RE.offsetOpcode] = opcode;
-        instruction[lenInstruction + RE.offsetOpdata] = (char)opdata;
-        instruction[lenInstruction + RE.offsetNext] = 0;
-        lenInstruction += RE.nodeSize;
-
-        // Return index of new node
-        return lenInstruction - RE.nodeSize;
-    }
-
-
-    /**
-     * Throws a new internal error exception
-     * @exception Error Thrown in the event of an internal error.
-     */
-    void internalError() throws Error
-    {
-        throw new Error("Internal error!");
-    }
-
-    /**
-     * Throws a new syntax error exception
-     * @exception RESyntaxException Thrown if the regular expression has invalid syntax.
-     */
-    void syntaxError(String s) throws RESyntaxException
-    {
-        throw new RESyntaxException(s);
-    }
-
-    /**
-     * Allocate storage for brackets only as needed
-     */
-    void allocBrackets()
-    {
-        // Allocate bracket stacks if not already done
-        if (bracketStart == null)
-        {
-            // Allocate storage
-            bracketStart = new int[maxBrackets];
-            bracketEnd   = new int[maxBrackets];
-            bracketMin   = new int[maxBrackets];
-            bracketOpt   = new int[maxBrackets];
-
-            // Initialize to invalid values
-            for (int i = 0; i < maxBrackets; i++)
-            {
-                bracketStart[i] = bracketEnd[i] = bracketMin[i] = bracketOpt[i] = -1;
-            }
-        }
-    }
-
-    /** Enlarge storage for brackets only as needed. */
-    synchronized void reallocBrackets() {
-        // trick the tricky
-        if (bracketStart == null) {
-            allocBrackets();
-        }
-
-        int new_size = maxBrackets * 2;
-        int[] new_bS = new int[new_size];
-        int[] new_bE = new int[new_size];
-        int[] new_bM = new int[new_size];
-        int[] new_bO = new int[new_size];
-        // Initialize to invalid values
-        for (int i=brackets; i<new_size; i++) {
-            new_bS[i] = new_bE[i] = new_bM[i] = new_bO[i] = -1;
-        }
-        System.arraycopy(bracketStart,0, new_bS,0, brackets);
-        System.arraycopy(bracketEnd,0,   new_bE,0, brackets);
-        System.arraycopy(bracketMin,0,   new_bM,0, brackets);
-        System.arraycopy(bracketOpt,0,   new_bO,0, brackets);
-        bracketStart = new_bS;
-        bracketEnd   = new_bE;
-        bracketMin   = new_bM;
-        bracketOpt   = new_bO;
-        maxBrackets  = new_size;
-    }
-
-    /**
-     * Match bracket {m,n} expression put results in bracket member variables
-     * @exception RESyntaxException Thrown if the regular expression has invalid syntax.
-     */
-    void bracket() throws RESyntaxException
-    {
-        // Current character must be a '{'
-        if (idx >= len || pattern.charAt(idx++) != '{')
-        {
-            internalError();
-        }
-
-        // Next char must be a digit
-        if (idx >= len || !Character.isDigit(pattern.charAt(idx)))
-        {
-            syntaxError("Expected digit");
-        }
-
-        // Get min ('m' of {m,n}) number
-        StringBuffer number = new StringBuffer();
-        while (idx < len && Character.isDigit(pattern.charAt(idx)))
-        {
-            number.append(pattern.charAt(idx++));
-        }
-        try
-        {
-            bracketMin[brackets] = Integer.parseInt(number.toString());
-        }
-        catch (NumberFormatException e)
-        {
-            syntaxError("Expected valid number");
-        }
-
-        // If out of input, fail
-        if (idx >= len)
-        {
-            syntaxError("Expected comma or right bracket");
-        }
-
-        // If end of expr, optional limit is 0
-        if (pattern.charAt(idx) == '}')
-        {
-            idx++;
-            bracketOpt[brackets] = 0;
-            return;
-        }
-
-        // Must have at least {m,} and maybe {m,n}.
-        if (idx >= len || pattern.charAt(idx++) != ',')
-        {
-            syntaxError("Expected comma");
-        }
-
-        // If out of input, fail
-        if (idx >= len)
-        {
-            syntaxError("Expected comma or right bracket");
-        }
-
-        // If {m,} max is unlimited
-        if (pattern.charAt(idx) == '}')
-        {
-            idx++;
-            bracketOpt[brackets] = bracketUnbounded;
-            return;
-        }
-
-        // Next char must be a digit
-        if (idx >= len || !Character.isDigit(pattern.charAt(idx)))
-        {
-            syntaxError("Expected digit");
-        }
-
-        // Get max number
-        number.setLength(0);
-        while (idx < len && Character.isDigit(pattern.charAt(idx)))
-        {
-            number.append(pattern.charAt(idx++));
-        }
-        try
-        {
-            bracketOpt[brackets] = Integer.parseInt(number.toString()) - bracketMin[brackets];
-        }
-        catch (NumberFormatException e)
-        {
-            syntaxError("Expected valid number");
-        }
-
-        // Optional repetitions must be >= 0
-        if (bracketOpt[brackets] < 0)
-        {
-            syntaxError("Bad range");
-        }
-
-        // Must have close brace
-        if (idx >= len || pattern.charAt(idx++) != '}')
-        {
-            syntaxError("Missing close brace");
-        }
-    }
-
-    /**
-     * Match an escape sequence.  Handles quoted chars and octal escapes as well
-     * as normal escape characters.  Always advances the input stream by the
-     * right amount. This code "understands" the subtle difference between an
-     * octal escape and a backref.  You can access the type of ESC_CLASS or
-     * ESC_COMPLEX or ESC_BACKREF by looking at pattern[idx - 1].
-     * @return ESC_* code or character if simple escape
-     * @exception RESyntaxException Thrown if the regular expression has invalid syntax.
-     */
-    int escape() throws RESyntaxException
-    {
-        // "Shouldn't" happen
-        if (pattern.charAt(idx) != '\\')
-        {
-            internalError();
-        }
-
-        // Escape shouldn't occur as last character in string!
-        if (idx + 1 == len)
-        {
-            syntaxError("Escape terminates string");
-        }
-
-        // Switch on character after backslash
-        idx += 2;
-        char escapeChar = pattern.charAt(idx - 1);
-        switch (escapeChar)
-        {
-            case RE.E_BOUND:
-            case RE.E_NBOUND:
-                return ESC_COMPLEX;
-
-            case RE.E_ALNUM:
-            case RE.E_NALNUM:
-            case RE.E_SPACE:
-            case RE.E_NSPACE:
-            case RE.E_DIGIT:
-            case RE.E_NDIGIT:
-                return ESC_CLASS;
-
-            case 'u':
-            case 'x':
-                {
-                    // Exact required hex digits for escape type
-                    int hexDigits = (escapeChar == 'u' ? 4 : 2);
-
-                    // Parse up to hexDigits characters from input
-                    int val = 0;
-                    for ( ; idx < len && hexDigits-- > 0; idx++)
-                    {
-                        // Get char
-                        char c = pattern.charAt(idx);
-
-                        // If it's a hexadecimal digit (0-9)
-                        if (c >= '0' && c <= '9')
-                        {
-                            // Compute new value
-                            val = (val << 4) + c - '0';
-                        }
-                        else
-                        {
-                            // If it's a hexadecimal letter (a-f)
-                            c = Character.toLowerCase(c);
-                            if (c >= 'a' && c <= 'f')
-                            {
-                                // Compute new value
-                                val = (val << 4) + (c - 'a') + 10;
-                            }
-                            else
-                            {
-                                // If it's not a valid digit or hex letter, the escape must be invalid
-                                // because hexDigits of input have not been absorbed yet.
-                                syntaxError("Expected " + hexDigits + " hexadecimal digits after \\" + escapeChar);
-                            }
-                        }
-                    }
-                    return val;
-                }
-
-            case 't':
-                return '\t';
-
-            case 'n':
-                return '\n';
-
-            case 'r':
-                return '\r';
-
-            case 'f':
-                return '\f';
-
-            case '0':
-            case '1':
-            case '2':
-            case '3':
-            case '4':
-            case '5':
-            case '6':
-            case '7':
-            case '8':
-            case '9':
-
-                // An octal escape starts with a 0 or has two digits in a row
-                if ((idx < len && Character.isDigit(pattern.charAt(idx))) || escapeChar == '0')
-                {
-                    // Handle \nnn octal escapes
-                    int val = escapeChar - '0';
-                    if (idx < len && Character.isDigit(pattern.charAt(idx)))
-                    {
-                        val = ((val << 3) + (pattern.charAt(idx++) - '0'));
-                        if (idx < len && Character.isDigit(pattern.charAt(idx)))
-                        {
-                            val = ((val << 3) + (pattern.charAt(idx++) - '0'));
-                        }
-                    }
-                    return val;
-                }
-
-                // It's actually a backreference (\[1-9]), not an escape
-                return ESC_BACKREF;
-
-            default:
-
-                // Simple quoting of a character
-                return escapeChar;
-        }
-    }
-
-    /**
-     * Compile a character class
-     * @return Index of class node
-     * @exception RESyntaxException Thrown if the regular expression has invalid syntax.
-     */
-    int characterClass() throws RESyntaxException
-    {
-        // Check for bad calling or empty class
-        if (pattern.charAt(idx) != '[')
-        {
-            internalError();
-        }
-
-        // Check for unterminated or empty class
-        if ((idx + 1) >= len || pattern.charAt(++idx) == ']')
-        {
-            syntaxError("Empty or unterminated class");
-        }
-
-        // Check for POSIX character class
-        if (idx < len && pattern.charAt(idx) == ':')
-        {
-            // Skip colon
-            idx++;
-
-            // POSIX character classes are denoted with lowercase ASCII strings
-            int idxStart = idx;
-            while (idx < len && pattern.charAt(idx) >= 'a' && pattern.charAt(idx) <= 'z')
-            {
-                idx++;
-            }
-
-            // Should be a ":]" to terminate the POSIX character class
-            if ((idx + 1) < len && pattern.charAt(idx) == ':' && pattern.charAt(idx + 1) == ']')
-            {
-                // Get character class
-                String charClass = pattern.substring(idxStart, idx);
-
-                // Select the POSIX class id
-                Character i = (Character)hashPOSIX.get(charClass);
-                if (i != null)
-                {
-                    // Move past colon and right bracket
-                    idx += 2;
-
-                    // Return new POSIX character class node
-                    return node(RE.OP_POSIXCLASS, i.charValue());
-                }
-                syntaxError("Invalid POSIX character class '" + charClass + "'");
-            }
-            syntaxError("Invalid POSIX character class syntax");
-        }
-
-        // Try to build a class.  Create OP_ANYOF node
-        int ret = node(RE.OP_ANYOF, 0);
-
-        // Parse class declaration
-        char CHAR_INVALID = Character.MAX_VALUE;
-        char last = CHAR_INVALID;
-        char simpleChar = 0;
-        boolean include = true;
-        boolean definingRange = false;
-        int idxFirst = idx;
-        char rangeStart = Character.MIN_VALUE;
-        char rangeEnd;
-        RERange range = new RERange();
-        while (idx < len && pattern.charAt(idx) != ']')
-        {
-
-            switchOnCharacter:
-
-            // Switch on character
-            switch (pattern.charAt(idx))
-            {
-                case '^':
-                    include = !include;
-                    if (idx == idxFirst)
-                    {
-                        range.include(Character.MIN_VALUE, Character.MAX_VALUE, true);
-                    }
-                    idx++;
-                    continue;
-
-                case '\\':
-                {
-                    // Escape always advances the stream
-                    int c;
-                    switch (c = escape ())
-                    {
-                        case ESC_COMPLEX:
-                        case ESC_BACKREF:
-
-                            // Word boundaries and backrefs not allowed in a character class!
-                            syntaxError("Bad character class");
-
-                        case ESC_CLASS:
-
-                            // Classes can't be an endpoint of a range
-                            if (definingRange)
-                            {
-                                syntaxError("Bad character class");
-                            }
-
-                            // Handle specific type of class (some are ok)
-                            switch (pattern.charAt(idx - 1))
-                            {
-                                case RE.E_NSPACE:
-                                case RE.E_NDIGIT:
-                                case RE.E_NALNUM:
-                                    syntaxError("Bad character class");
-
-                                case RE.E_SPACE:
-                                    range.include('\t', include);
-                                    range.include('\r', include);
-                                    range.include('\f', include);
-                                    range.include('\n', include);
-                                    range.include('\b', include);
-                                    range.include(' ', include);
-                                    break;
-
-                                case RE.E_ALNUM:
-                                    range.include('a', 'z', include);
-                                    range.include('A', 'Z', include);
-                                    range.include('_', include);
-
-                                    // Fall through!
-
-                                case RE.E_DIGIT:
-                                    range.include('0', '9', include);
-                                    break;
-                            }
-
-                            // Make last char invalid (can't be a range start)
-                            last = CHAR_INVALID;
-                            break;
-
-                        default:
-
-                            // Escape is simple so treat as a simple char
-                            simpleChar = (char) c;
-                            break switchOnCharacter;
-                    }
-                }
-                continue;
-
-                case '-':
-
-                    // Start a range if one isn't already started
-                    if (definingRange)
-                    {
-                        syntaxError("Bad class range");
-                    }
-                    definingRange = true;
-
-                    // If no last character, start of range is 0
-                    rangeStart = (last == CHAR_INVALID ? 0 : last);
-
-                    // Premature end of range. define up to Character.MAX_VALUE
-                    if ((idx + 1) < len && pattern.charAt(++idx) == ']')
-                    {
-                        simpleChar = Character.MAX_VALUE;
-                        break;
-                    }
-                    continue;
-
-                default:
-                    simpleChar = pattern.charAt(idx++);
-                    break;
-            }
-
-            // Handle simple character simpleChar
-            if (definingRange)
-            {
-                // if we are defining a range make it now
-                rangeEnd = simpleChar;
-
-                // Actually create a range if the range is ok
-                if (rangeStart >= rangeEnd)
-                {
-                    syntaxError("Bad character class");
-                }
-                range.include(rangeStart, rangeEnd, include);
-
-                // We are done defining the range
-                last = CHAR_INVALID;
-                definingRange = false;
-            }
-            else
-            {
-                // If simple character and not start of range, include it
-                if (idx >= len || pattern.charAt(idx) != '-')
-                {
-                    range.include(simpleChar, include);
-                }
-                last = simpleChar;
-            }
-        }
-
-        // Shouldn't be out of input
-        if (idx == len)
-        {
-            syntaxError("Unterminated character class");
-        }
-
-        // Absorb the ']' end of class marker
-        idx++;
-
-        // Emit character class definition
-        instruction[ret + RE.offsetOpdata] = (char)range.num;
-        for (int i = 0; i < range.num; i++)
-        {
-            emit((char)range.minRange[i]);
-            emit((char)range.maxRange[i]);
-        }
-        return ret;
-    }
-
-    /**
-     * Absorb an atomic character string.  This method is a little tricky because
-     * it can un-include the last character of string if a closure operator follows.
-     * This is correct because *+? have higher precedence than concatentation (thus
-     * ABC* means AB(C*) and NOT (ABC)*).
-     * @return Index of new atom node
-     * @exception RESyntaxException Thrown if the regular expression has invalid syntax.
-     */
-    int atom() throws RESyntaxException
-    {
-        // Create a string node
-        int ret = node(RE.OP_ATOM, 0);
-
-        // Length of atom
-        int lenAtom = 0;
-
-        // Loop while we've got input
-
-        atomLoop:
-
-        while (idx < len)
-        {
-            // Is there a next char?
-            if ((idx + 1) < len)
-            {
-                char c = pattern.charAt(idx + 1);
-
-                // If the next 'char' is an escape, look past the whole escape
-                if (pattern.charAt(idx) == '\\')
-                {
-                    int idxEscape = idx;
-                    escape();
-                    if (idx < len)
-                    {
-                        c = pattern.charAt(idx);
-                    }
-                    idx = idxEscape;
-                }
-
-                // Switch on next char
-                switch (c)
-                {
-                    case '{':
-                    case '?':
-                    case '*':
-                    case '+':
-
-                        // If the next character is a closure operator and our atom is non-empty, the
-                        // current character should bind to the closure operator rather than the atom
-                        if (lenAtom != 0)
-                        {
-                            break atomLoop;
-                        }
-                }
-            }
-
-            // Switch on current char
-            switch (pattern.charAt(idx))
-            {
-                case ']':
-                case '^':
-                case '$':
-                case '.':
-                case '[':
-                case '(':
-                case ')':
-                case '|':
-                    break atomLoop;
-
-                case '{':
-                case '?':
-                case '*':
-                case '+':
-
-                    // We should have an atom by now
-                    if (lenAtom == 0)
-                    {
-                        // No atom before closure
-                        syntaxError("Missing operand to closure");
-                    }
-                    break atomLoop;
-
-                case '\\':
-
-                    {
-                        // Get the escaped character (advances input automatically)
-                        int idxBeforeEscape = idx;
-                        int c = escape();
-
-                        // Check if it's a simple escape (as opposed to, say, a backreference)
-                        if ((c & ESC_MASK) == ESC_MASK)
-                        {
-                            // Not a simple escape, so backup to where we were before the escape.
-                            idx = idxBeforeEscape;
-                            break atomLoop;
-                        }
-
-                        // Add escaped char to atom
-                        emit((char) c);
-                        lenAtom++;
-                    }
-                    break;
-
-                default:
-
-                    // Add normal character to atom
-                    emit(pattern.charAt(idx++));
-                    lenAtom++;
-                    break;
-            }
-        }
-
-        // This "shouldn't" happen
-        if (lenAtom == 0)
-        {
-            internalError();
-        }
-
-        // Emit the atom length into the program
-        instruction[ret + RE.offsetOpdata] = (char)lenAtom;
-        return ret;
-    }
-
-    /**
-     * Match a terminal node.
-     * @param flags Flags
-     * @return Index of terminal node (closeable)
-     * @exception RESyntaxException Thrown if the regular expression has invalid syntax.
-     */
-    int terminal(int[] flags) throws RESyntaxException
-    {
-        switch (pattern.charAt(idx))
-        {
-        case RE.OP_EOL:
-        case RE.OP_BOL:
-        case RE.OP_ANY:
-            return node(pattern.charAt(idx++), 0);
-
-        case '[':
-            return characterClass();
-
-        case '(':
-            return expr(flags);
-
-        case ')':
-            syntaxError("Unexpected close paren");
-
-        case '|':
-            internalError();
-
-        case ']':
-            syntaxError("Mismatched class");
-
-        case 0:
-            syntaxError("Unexpected end of input");
-
-        case '?':
-        case '+':
-        case '{':
-        case '*':
-            syntaxError("Missing operand to closure");
-
-        case '\\':
-            {
-                // Don't forget, escape() advances the input stream!
-                int idxBeforeEscape = idx;
-
-                // Switch on escaped character
-                switch (escape())
-                {
-                    case ESC_CLASS:
-                    case ESC_COMPLEX:
-                        flags[0] &= ~NODE_NULLABLE;
-                        return node(RE.OP_ESCAPE, pattern.charAt(idx - 1));
-
-                    case ESC_BACKREF:
-                        {
-                            char backreference = (char)(pattern.charAt(idx - 1) - '0');
-                            if (parens <= backreference)
-                            {
-                                syntaxError("Bad backreference");
-                            }
-                            flags[0] |= NODE_NULLABLE;
-                            return node(RE.OP_BACKREF, backreference);
-                        }
-
-                    default:
-
-                        // We had a simple escape and we want to have it end up in
-                        // an atom, so we back up and fall though to the default handling
-                        idx = idxBeforeEscape;
-                        flags[0] &= ~NODE_NULLABLE;
-                        break;
-                }
-            }
-        }
-
-        // Everything above either fails or returns.
-        // If it wasn't one of the above, it must be the start of an atom.
-        flags[0] &= ~NODE_NULLABLE;
-        return atom();
-    }
-
-    /**
-     * Compile a possibly closured terminal
-     * @param flags Flags passed by reference
-     * @return Index of closured node
-     * @exception RESyntaxException Thrown if the regular expression has invalid syntax.
-     */
-    int closure(int[] flags) throws RESyntaxException
-    {
-        // Before terminal
-        int idxBeforeTerminal = idx;
-
-        // Values to pass by reference to terminal()
-        int[] terminalFlags = { NODE_NORMAL };
-
-        // Get terminal symbol
-        int ret = terminal(terminalFlags);
-
-        // Or in flags from terminal symbol
-        flags[0] |= terminalFlags[0];
-
-        // Advance input, set NODE_NULLABLE flag and do sanity checks
-        if (idx >= len)
-        {
-            return ret;
-        }
-        boolean greedy = true;
-        char closureType = pattern.charAt(idx);
-        switch (closureType)
-        {
-            case '?':
-            case '*':
-
-                // The current node can be null
-                flags[0] |= NODE_NULLABLE;
-
-            case '+':
-
-                // Eat closure character
-                idx++;
-
-            case '{':
-
-                // Don't allow blantant stupidity
-                int opcode = instruction[ret + RE.offsetOpcode];
-                if (opcode == RE.OP_BOL || opcode == RE.OP_EOL)
-                {
-                    syntaxError("Bad closure operand");
-                }
-                if ((terminalFlags[0] & NODE_NULLABLE) != 0)
-                {
-                    syntaxError("Closure operand can't be nullable");
-                }
-                break;
-        }
-
-        // If the next character is a '?', make the closure non-greedy (reluctant)
-        if (idx < len && pattern.charAt(idx) == '?')
-        {
-            idx++;
-            greedy = false;
-        }
-
-        if (greedy)
-        {
-            // Actually do the closure now
-            switch (closureType)
-            {
-                case '{':
-                {
-                    // We look for our bracket in the list
-                    boolean found = false;
-                    int i;
-                    allocBrackets();
-                    for (i = 0; i < brackets; i++)
-                    {
-                        if (bracketStart[i] == idx)
-                        {
-                            found = true;
-                            break;
-                        }
-                    }
-
-                    // If its not in the list we parse the {m,n}
-                    if (!found)
-                    {
-                        if (brackets >= maxBrackets)
-                        {
-                            reallocBrackets();
-                        }
-                        bracketStart[brackets] = idx;
-                        bracket();
-                        bracketEnd[brackets] = idx;
-                        i = brackets++;
-                    }
-
-                    // Process min first
-                    if (bracketMin[i]-- > 0)
-                    {
-                        if (bracketMin[i] > 0 || bracketOpt[i] != 0) {
-                            // Rewind stream and run it through again - more matchers coming
-                            for (int j = 0; j < brackets; j++) {
-                                if (j != i && bracketStart[j] < idx
-                                    && bracketStart[j] >= idxBeforeTerminal)
-                                {
-                                    brackets--;
-                                    bracketStart[j] = bracketStart[brackets];
-                                    bracketEnd[j] = bracketEnd[brackets];
-                                    bracketMin[j] = bracketMin[brackets];
-                                    bracketOpt[j] = bracketOpt[brackets];
-                                }
-                            }
-
-                            idx = idxBeforeTerminal;
-                        } else {
-                            // Bug #1030: No optinal matches - no need to rewind
-                            idx = bracketEnd[i];
-                        }
-                        break;
-                    }
-
-                    // Do the right thing for maximum ({m,})
-                    if (bracketOpt[i] == bracketUnbounded)
-                    {
-                        // Drop through now and closure expression.
-                        // We are done with the {m,} expr, so skip rest
-                        closureType = '*';
-                        bracketOpt[i] = 0;
-                        idx = bracketEnd[i];
-                    }
-                    else
-                        if (bracketOpt[i]-- > 0)
-                        {
-                            if (bracketOpt[i] > 0)
-                            {
-                                // More optional matchers - 'play it again sam!'
-                                idx = idxBeforeTerminal;
-                            } else {
-                                // Bug #1030: We are done - this one is last and optional
-                                idx = bracketEnd[i];
-                            }
-                            // Drop through to optionally close
-                            closureType = '?';
-                        }
-                        else
-                        {
-                            // Rollback terminal - neither min nor opt matchers present
-                            lenInstruction = ret;
-                            node(RE.OP_NOTHING, 0);
-
-                            // We are done. skip the rest of {m,n} expr
-                            idx = bracketEnd[i];
-                            break;
-                        }
-                }
-
-                // Fall through!
-
-                case '?':
-                case '*':
-
-                    if (!greedy)
-                    {
-                        break;
-                    }
-
-                    if (closureType == '?')
-                    {
-                        // X? is compiled as (X|)
-                        nodeInsert(RE.OP_BRANCH, 0, ret);                 // branch before X
-                        setNextOfEnd(ret, node (RE.OP_BRANCH, 0));        // inserted branch to option
-                        int nothing = node (RE.OP_NOTHING, 0);            // which is OP_NOTHING
-                        setNextOfEnd(ret, nothing);                       // point (second) branch to OP_NOTHING
-                        setNextOfEnd(ret + RE.nodeSize, nothing);         // point the end of X to OP_NOTHING node
-                    }
-
-                    if (closureType == '*')
-                    {
-                        // X* is compiled as (X{gotoX}|)
-                        nodeInsert(RE.OP_BRANCH, 0, ret);                         // branch before X
-                        setNextOfEnd(ret + RE.nodeSize, node(RE.OP_BRANCH, 0));   // end of X points to an option
-                        setNextOfEnd(ret + RE.nodeSize, node(RE.OP_GOTO, 0));     // to goto
-                        setNextOfEnd(ret + RE.nodeSize, ret);                     // the start again
-                        setNextOfEnd(ret, node(RE.OP_BRANCH, 0));                 // the other option is
-                        setNextOfEnd(ret, node(RE.OP_NOTHING, 0));                // OP_NOTHING
-                    }
-                    break;
-
-                case '+':
-                {
-                    // X+ is compiled as X({gotoX}|)
-                    int branch;
-                    branch = node(RE.OP_BRANCH, 0);                   // a new branch
-                    setNextOfEnd(ret, branch);                        // is added to the end of X
-                    setNextOfEnd(node(RE.OP_GOTO, 0), ret);           // one option is to go back to the start
-                    setNextOfEnd(branch, node(RE.OP_BRANCH, 0));      // the other option
-                    setNextOfEnd(ret, node(RE.OP_NOTHING, 0));        // is OP_NOTHING
-                }
-                break;
-            }
-        }
-        else
-        {
-            // Add end after closured subexpr
-            setNextOfEnd(ret, node(RE.OP_END, 0));
-
-            // Actually do the closure now
-            switch (closureType)
-            {
-                case '?':
-                    nodeInsert(RE.OP_RELUCTANTMAYBE, 0, ret);
-                    break;
-
-                case '*':
-                    nodeInsert(RE.OP_RELUCTANTSTAR, 0, ret);
-                    break;
-
-                case '+':
-                    nodeInsert(RE.OP_RELUCTANTPLUS, 0, ret);
-                    break;
-            }
-
-            // Point to the expr after the closure
-            setNextOfEnd(ret, lenInstruction);
-        }
-        return ret;
-    }
-
-    /**
-     * Compile one branch of an or operator (implements concatenation)
-     * @param flags Flags passed by reference
-     * @return Pointer to branch node
-     * @exception RESyntaxException Thrown if the regular expression has invalid syntax.
-     */
-    int branch(int[] flags) throws RESyntaxException
-    {
-        // Get each possibly closured piece and concat
-        int node;
-        int ret = node(RE.OP_BRANCH, 0);
-        int chain = -1;
-        int[] closureFlags = new int[1];
-        boolean nullable = true;
-        while (idx < len && pattern.charAt(idx) != '|' && pattern.charAt(idx) != ')')
-        {
-            // Get new node
-            closureFlags[0] = NODE_NORMAL;
-            node = closure(closureFlags);
-            if (closureFlags[0] == NODE_NORMAL)
-            {
-                nullable = false;
-            }
-
-            // If there's a chain, append to the end
-            if (chain != -1)
-            {
-                setNextOfEnd(chain, node);
-            }
-
-            // Chain starts at current
-            chain = node;
-        }
-
-        // If we don't run loop, make a nothing node
-        if (chain == -1)
-        {
-            node(RE.OP_NOTHING, 0);
-        }
-
-        // Set nullable flag for this branch
-        if (nullable)
-        {
-            flags[0] |= NODE_NULLABLE;
-        }
-        return ret;
-    }
-
-    /**
-     * Compile an expression with possible parens around it.  Paren matching
-     * is done at this level so we can tie the branch tails together.
-     * @param flags Flag value passed by reference
-     * @return Node index of expression in instruction array
-     * @exception RESyntaxException Thrown if the regular expression has invalid syntax.
-     */
-    int expr(int[] flags) throws RESyntaxException
-    {
-        // Create open paren node unless we were called from the top level (which has no parens)
-        int paren = -1;
-        int ret = -1;
-        int closeParens = parens;
-        if ((flags[0] & NODE_TOPLEVEL) == 0 && pattern.charAt(idx) == '(')
-        {
-            // if its a cluster ( rather than a proper subexpression ie with backrefs )
-            if ( idx + 2 < len && pattern.charAt( idx + 1 ) == '?' && pattern.charAt( idx + 2 ) == ':' )
-            {
-                paren = 2;
-                idx += 3;
-                ret = node( RE.OP_OPEN_CLUSTER, 0 );
-            }
-            else
-            {
-                paren = 1;
-                idx++;
-                ret = node(RE.OP_OPEN, parens++);
-            }
-        }
-        flags[0] &= ~NODE_TOPLEVEL;
-
-        // Create a branch node
-        int branch = branch(flags);
-        if (ret == -1)
-        {
-            ret = branch;
-        }
-        else
-        {
-            setNextOfEnd(ret, branch);
-        }
-
-        // Loop through branches
-        while (idx < len && pattern.charAt(idx) == '|')
-        {
-            idx++;
-            branch = branch(flags);
-            setNextOfEnd(ret, branch);
-        }
-
-        // Create an ending node (either a close paren or an OP_END)
-        int end;
-        if ( paren > 0 )
-        {
-            if (idx < len && pattern.charAt(idx) == ')')
-            {
-                idx++;
-            }
-            else
-            {
-                syntaxError("Missing close paren");
-            }
-            if ( paren == 1 )
-            {
-                end = node(RE.OP_CLOSE, closeParens);
-            }
-            else
-            {
-                end = node( RE.OP_CLOSE_CLUSTER, 0 );
-            }
-        }
-        else
-        {
-            end = node(RE.OP_END, 0);
-        }
-
-        // Append the ending node to the ret nodelist
-        setNextOfEnd(ret, end);
-
-        // Hook the ends of each branch to the end node
-        int currentNode = ret;
-        int nextNodeOffset = instruction[ currentNode + RE.offsetNext ];
-        // while the next node o
-        while ( nextNodeOffset != 0 && currentNode < lenInstruction )
-        {
-            // If branch, make the end of the branch's operand chain point to the end node.
-            if ( instruction[ currentNode + RE.offsetOpcode ] == RE.OP_BRANCH )
-            {
-                setNextOfEnd( currentNode + RE.nodeSize, end );
-            }
-            nextNodeOffset = instruction[ currentNode + RE.offsetNext ];
-            currentNode += nextNodeOffset;
-        }
-
-        // Return the node list
-        return ret;
-    }
-
-    /**
-     * Compiles a regular expression pattern into a program runnable by the pattern
-     * matcher class 'RE'.
-     * @param pattern Regular expression pattern to compile (see RECompiler class
-     * for details).
-     * @return A compiled regular expression program.
-     * @exception RESyntaxException Thrown if the regular expression has invalid syntax.
-     * @see RECompiler
-     * @see RE
-     */
-    public REProgram compile(String pattern) throws RESyntaxException
-    {
-        // Initialize variables for compilation
-        this.pattern = pattern;                         // Save pattern in instance variable
-        len = pattern.length();                         // Precompute pattern length for speed
-        idx = 0;                                        // Set parsing index to the first character
-        lenInstruction = 0;                             // Set emitted instruction count to zero
-        parens = 1;                                     // Set paren level to 1 (the implicit outer parens)
-        brackets = 0;                                   // No bracketed closures yet
-
-        // Initialize pass by reference flags value
-        int[] flags = { NODE_TOPLEVEL };
-
-        // Parse expression
-        expr(flags);
-
-        // Should be at end of input
-        if (idx != len)
-        {
-            if (pattern.charAt(idx) == ')')
-            {
-                syntaxError("Unmatched close paren");
-            }
-            syntaxError("Unexpected input remains");
-        }
-
-        // Return the result
-        char[] ins = new char[lenInstruction];
-        System.arraycopy(instruction, 0, ins, 0, lenInstruction);
-        return new REProgram(parens, ins);
-    }
-
-    /**
-     * Local, nested class for maintaining character ranges for character classes.
-     */
-    class RERange
-    {
-        int size = 16;                      // Capacity of current range arrays
-        int[] minRange = new int[size];     // Range minima
-        int[] maxRange = new int[size];     // Range maxima
-        int num = 0;                        // Number of range array elements in use
-
-        /**
-         * Deletes the range at a given index from the range lists
-         * @param index Index of range to delete from minRange and maxRange arrays.
-         */
-        void delete(int index)
-        {
-            // Return if no elements left or index is out of range
-            if (num == 0 || index >= num)
-            {
-                return;
-            }
-
-            // Move elements down
-            while (++index < num)
-            {
-                if (index - 1 >= 0)
-                {
-                    minRange[index-1] = minRange[index];
-                    maxRange[index-1] = maxRange[index];
-                }
-            }
-
-            // One less element now
-            num--;
-        }
-
-        /**
-         * Merges a range into the range list, coalescing ranges if possible.
-         * @param min Minimum end of range
-         * @param max Maximum end of range
-         */
-        void merge(int min, int max)
-        {
-            // Loop through ranges
-            for (int i = 0; i < num; i++)
-            {
-                // Min-max is subsumed by minRange[i]-maxRange[i]
-                if (min >= minRange[i] && max <= maxRange[i])
-                {
-                    return;
-                }
-
-                // Min-max subsumes minRange[i]-maxRange[i]
-                else if (min <= minRange[i] && max >= maxRange[i])
-                {
-                    delete(i);
-                    merge(min, max);
-                    return;
-                }
-
-                // Min is in the range, but max is outside
-                else if (min >= minRange[i] && min <= maxRange[i])
-                {
-                    delete(i);
-                    min = minRange[i];
-                    merge(min, max);
-                    return;
-                }
-
-                // Max is in the range, but min is outside
-                else if (max >= minRange[i] && max <= maxRange[i])
-                {
-                    delete(i);
-                    max = maxRange[i];
-                    merge(min, max);
-                    return;
-                }
-            }
-
-            // Must not overlap any other ranges
-            if (num >= size)
-            {
-                size *= 2;
-                int[] newMin = new int[size];
-                int[] newMax = new int[size];
-                System.arraycopy(minRange, 0, newMin, 0, num);
-                System.arraycopy(maxRange, 0, newMax, 0, num);
-                minRange = newMin;
-                maxRange = newMax;
-            }
-            minRange[num] = min;
-            maxRange[num] = max;
-            num++;
-        }
-
-        /**
-         * Removes a range by deleting or shrinking all other ranges
-         * @param min Minimum end of range
-         * @param max Maximum end of range
-         */
-        void remove(int min, int max)
-        {
-            // Loop through ranges
-            for (int i = 0; i < num; i++)
-            {
-                // minRange[i]-maxRange[i] is subsumed by min-max
-                if (minRange[i] >= min && maxRange[i] <= max)
-                {
-                    delete(i);
-                    i--;
-                    return;
-                }
-
-                // min-max is subsumed by minRange[i]-maxRange[i]
-                else if (min >= minRange[i] && max <= maxRange[i])
-                {
-                    int minr = minRange[i];
-                    int maxr = maxRange[i];
-                    delete(i);
-                    if (minr < min)
-                    {
-                        merge(minr, min - 1);
-                    }
-                    if (max < maxr)
-                    {
-                        merge(max + 1, maxr);
-                    }
-                    return;
-                }
-
-                // minRange is in the range, but maxRange is outside
-                else if (minRange[i] >= min && minRange[i] <= max)
-                {
-                    minRange[i] = max + 1;
-                    return;
-                }
-
-                // maxRange is in the range, but minRange is outside
-                else if (maxRange[i] >= min && maxRange[i] <= max)
-                {
-                    maxRange[i] = min - 1;
-                    return;
-                }
-            }
-        }
-
-        /**
-         * Includes (or excludes) the range from min to max, inclusive.
-         * @param min Minimum end of range
-         * @param max Maximum end of range
-         * @param include True if range should be included.  False otherwise.
-         */
-        void include(int min, int max, boolean include)
-        {
-            if (include)
-            {
-                merge(min, max);
-            }
-            else
-            {
-                remove(min, max);
-            }
-        }
-
-        /**
-         * Includes a range with the same min and max
-         * @param minmax Minimum and maximum end of range (inclusive)
-         * @param include True if range should be included.  False otherwise.
-         */
-        void include(char minmax, boolean include)
-        {
-            include(minmax, minmax, include);
-        }
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/REDebugCompiler.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,225 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.regexp.internal;
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-/**
- * A subclass of RECompiler which can dump a regular expression program
- * for debugging purposes.
- *
- * @author <a href="mailto:jonl@muppetlabs.com">Jonathan Locke</a>
- */
-public class REDebugCompiler extends RECompiler
-{
-    /**
-     * Mapping from opcodes to descriptive strings
-     */
-    static Hashtable hashOpcode = new Hashtable();
-    static
-    {
-        hashOpcode.put(new Integer(RE.OP_RELUCTANTSTAR),    "OP_RELUCTANTSTAR");
-        hashOpcode.put(new Integer(RE.OP_RELUCTANTPLUS),    "OP_RELUCTANTPLUS");
-        hashOpcode.put(new Integer(RE.OP_RELUCTANTMAYBE),   "OP_RELUCTANTMAYBE");
-        hashOpcode.put(new Integer(RE.OP_END),              "OP_END");
-        hashOpcode.put(new Integer(RE.OP_BOL),              "OP_BOL");
-        hashOpcode.put(new Integer(RE.OP_EOL),              "OP_EOL");
-        hashOpcode.put(new Integer(RE.OP_ANY),              "OP_ANY");
-        hashOpcode.put(new Integer(RE.OP_ANYOF),            "OP_ANYOF");
-        hashOpcode.put(new Integer(RE.OP_BRANCH),           "OP_BRANCH");
-        hashOpcode.put(new Integer(RE.OP_ATOM),             "OP_ATOM");
-        hashOpcode.put(new Integer(RE.OP_STAR),             "OP_STAR");
-        hashOpcode.put(new Integer(RE.OP_PLUS),             "OP_PLUS");
-        hashOpcode.put(new Integer(RE.OP_MAYBE),            "OP_MAYBE");
-        hashOpcode.put(new Integer(RE.OP_NOTHING),          "OP_NOTHING");
-        hashOpcode.put(new Integer(RE.OP_GOTO),             "OP_GOTO");
-        hashOpcode.put(new Integer(RE.OP_ESCAPE),           "OP_ESCAPE");
-        hashOpcode.put(new Integer(RE.OP_OPEN),             "OP_OPEN");
-        hashOpcode.put(new Integer(RE.OP_CLOSE),            "OP_CLOSE");
-        hashOpcode.put(new Integer(RE.OP_BACKREF),          "OP_BACKREF");
-        hashOpcode.put(new Integer(RE.OP_POSIXCLASS),       "OP_POSIXCLASS");
-        hashOpcode.put(new Integer(RE.OP_OPEN_CLUSTER),      "OP_OPEN_CLUSTER");
-        hashOpcode.put(new Integer(RE.OP_CLOSE_CLUSTER),      "OP_CLOSE_CLUSTER");
-    }
-
-    /**
-     * Returns a descriptive string for an opcode.
-     * @param opcode Opcode to convert to a string
-     * @return Description of opcode
-     */
-    String opcodeToString(char opcode)
-    {
-        // Get string for opcode
-        String ret =(String)hashOpcode.get(new Integer(opcode));
-
-        // Just in case we have a corrupt program
-        if (ret == null)
-        {
-            ret = "OP_????";
-        }
-        return ret;
-    }
-
-    /**
-     * Return a string describing a (possibly unprintable) character.
-     * @param c Character to convert to a printable representation
-     * @return String representation of character
-     */
-    String charToString(char c)
-    {
-        // If it's unprintable, convert to '\###'
-        if (c < ' ' || c > 127)
-        {
-            return "\\" + (int)c;
-        }
-
-        // Return the character as a string
-        return String.valueOf(c);
-    }
-
-    /**
-     * Returns a descriptive string for a node in a regular expression program.
-     * @param node Node to describe
-     * @return Description of node
-     */
-    String nodeToString(int node)
-    {
-        // Get opcode and opdata for node
-        char opcode =      instruction[node + RE.offsetOpcode];
-        int opdata  = (int)instruction[node + RE.offsetOpdata];
-
-        // Return opcode as a string and opdata value
-        return opcodeToString(opcode) + ", opdata = " + opdata;
-    }
-
-    /**
-     * Inserts a node with a given opcode and opdata at insertAt.  The node relative next
-     * pointer is initialized to 0.
-     * @param opcode Opcode for new node
-     * @param opdata Opdata for new node (only the low 16 bits are currently used)
-     * @param insertAt Index at which to insert the new node in the program * /
-    void nodeInsert(char opcode, int opdata, int insertAt) {
-        System.out.println( "====> " + opcode + " " + opdata + " " + insertAt );
-        PrintWriter writer = new PrintWriter( System.out );
-        dumpProgram( writer );
-        super.nodeInsert( opcode, opdata, insertAt );
-        System.out.println( "====< " );
-        dumpProgram( writer );
-        writer.flush();
-    }/**/
-
-
-    /**
-    * Appends a node to the end of a node chain
-    * @param node Start of node chain to traverse
-    * @param pointTo Node to have the tail of the chain point to * /
-    void setNextOfEnd(int node, int pointTo) {
-        System.out.println( "====> " + node + " " + pointTo );
-        PrintWriter writer = new PrintWriter( System.out );
-        dumpProgram( writer );
-        super.setNextOfEnd( node, pointTo );
-        System.out.println( "====< " );
-        dumpProgram( writer );
-        writer.flush();
-    }/**/
-
-
-    /**
-     * Dumps the current program to a PrintWriter
-     * @param p PrintWriter for program dump output
-     */
-    public void dumpProgram(PrintWriter p)
-    {
-        // Loop through the whole program
-        for (int i = 0; i < lenInstruction; )
-        {
-            // Get opcode, opdata and next fields of current program node
-            char opcode =        instruction[i + RE.offsetOpcode];
-            char opdata =        instruction[i + RE.offsetOpdata];
-            short next  = (short)instruction[i + RE.offsetNext];
-
-            // Display the current program node
-            p.print(i + ". " + nodeToString(i) + ", next = ");
-
-            // If there's no next, say 'none', otherwise give absolute index of next node
-            if (next == 0)
-            {
-                p.print("none");
-            }
-            else
-            {
-                p.print(i + next);
-            }
-
-            // Move past node
-            i += RE.nodeSize;
-
-            // If character class
-            if (opcode == RE.OP_ANYOF)
-            {
-                // Opening bracket for start of char class
-                p.print(", [");
-
-                // Show each range in the char class
-                int rangeCount = opdata;
-                for (int r = 0; r < rangeCount; r++)
-                {
-                    // Get first and last chars in range
-                    char charFirst = instruction[i++];
-                    char charLast  = instruction[i++];
-
-                    // Print range as X-Y, unless range encompasses only one char
-                    if (charFirst == charLast)
-                    {
-                        p.print(charToString(charFirst));
-                    }
-                    else
-                    {
-                        p.print(charToString(charFirst) + "-" + charToString(charLast));
-                    }
-                }
-
-                // Annotate the end of the char class
-                p.print("]");
-            }
-
-            // If atom
-            if (opcode == RE.OP_ATOM)
-            {
-                // Open quote
-                p.print(", \"");
-
-                // Print each character in the atom
-                for (int len = opdata; len-- != 0; )
-                {
-                    p.print(charToString(instruction[i++]));
-                }
-
-                // Close quote
-                p.print("\"");
-            }
-
-            // Print a newline
-            p.println("");
-        }
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/REProgram.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.regexp.internal;
-
-import java.io.Serializable;
-
-/**
- * A class that holds compiled regular expressions.  This is exposed mainly
- * for use by the recompile utility (which helps you produce precompiled
- * REProgram objects). You should not otherwise need to work directly with
- * this class.
-*
- * @see RE
- * @see RECompiler
- *
- * @author <a href="mailto:jonl@muppetlabs.com">Jonathan Locke</a>
- */
-public class REProgram implements Serializable
-{
-    static final int OPT_HASBACKREFS = 1;
-
-    char[] instruction;         // The compiled regular expression 'program'
-    int lenInstruction;         // The amount of the instruction buffer in use
-    char[] prefix;              // Prefix string optimization
-    int flags;                  // Optimization flags (REProgram.OPT_*)
-    int maxParens = -1;
-
-    /**
-     * Constructs a program object from a character array
-     * @param instruction Character array with RE opcode instructions in it
-     */
-    public REProgram(char[] instruction)
-    {
-        this(instruction, instruction.length);
-    }
-
-    /**
-     * Constructs a program object from a character array
-     * @param parens Count of parens in the program
-     * @param instruction Character array with RE opcode instructions in it
-     */
-    public REProgram(int parens, char[] instruction)
-    {
-        this(instruction, instruction.length);
-        this.maxParens = parens;
-    }
-
-    /**
-     * Constructs a program object from a character array
-     * @param instruction Character array with RE opcode instructions in it
-     * @param lenInstruction Amount of instruction array in use
-     */
-    public REProgram(char[] instruction, int lenInstruction)
-    {
-        setInstructions(instruction, lenInstruction);
-    }
-
-    /**
-     * Returns a copy of the current regular expression program in a character
-     * array that is exactly the right length to hold the program.  If there is
-     * no program compiled yet, getInstructions() will return null.
-     * @return A copy of the current compiled RE program
-     */
-    public char[] getInstructions()
-    {
-        // Ensure program has been compiled!
-        if (lenInstruction != 0)
-        {
-            // Return copy of program
-            char[] ret = new char[lenInstruction];
-            System.arraycopy(instruction, 0, ret, 0, lenInstruction);
-            return ret;
-        }
-        return null;
-    }
-
-    /**
-     * Sets a new regular expression program to run.  It is this method which
-     * performs any special compile-time search optimizations.  Currently only
-     * two optimizations are in place - one which checks for backreferences
-     * (so that they can be lazily allocated) and another which attempts to
-     * find an prefix anchor string so that substantial amounts of input can
-     * potentially be skipped without running the actual program.
-     * @param instruction Program instruction buffer
-     * @param lenInstruction Length of instruction buffer in use
-     */
-    public void setInstructions(char[] instruction, int lenInstruction)
-    {
-        // Save reference to instruction array
-        this.instruction = instruction;
-        this.lenInstruction = lenInstruction;
-
-        // Initialize other program-related variables
-        flags = 0;
-        prefix = null;
-
-        // Try various compile-time optimizations if there's a program
-        if (instruction != null && lenInstruction != 0)
-        {
-            // If the first node is a branch
-            if (lenInstruction >= RE.nodeSize && instruction[0 + RE.offsetOpcode] == RE.OP_BRANCH)
-            {
-                // to the end node
-                int next = instruction[0 + RE.offsetNext];
-                if (instruction[next + RE.offsetOpcode] == RE.OP_END)
-                {
-                    // and the branch starts with an atom
-                    if (lenInstruction >= (RE.nodeSize * 2) && instruction[RE.nodeSize + RE.offsetOpcode] == RE.OP_ATOM)
-                    {
-                        // then get that atom as an prefix because there's no other choice
-                        int lenAtom = instruction[RE.nodeSize + RE.offsetOpdata];
-                        prefix = new char[lenAtom];
-                        System.arraycopy(instruction, RE.nodeSize * 2, prefix, 0, lenAtom);
-                    }
-                }
-            }
-
-            BackrefScanLoop:
-
-            // Check for backreferences
-            for (int i = 0; i < lenInstruction; i += RE.nodeSize)
-            {
-                switch (instruction[i + RE.offsetOpcode])
-                {
-                    case RE.OP_ANYOF:
-                        i += (instruction[i + RE.offsetOpdata] * 2);
-                        break;
-
-                    case RE.OP_ATOM:
-                        i += instruction[i + RE.offsetOpdata];
-                        break;
-
-                    case RE.OP_BACKREF:
-                        flags |= OPT_HASBACKREFS;
-                        break BackrefScanLoop;
-                }
-            }
-        }
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/RESyntaxException.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.regexp.internal;
-
-/**
- * Exception thrown to indicate a syntax error in a regular expression.
- * This is a non-checked exception because you should only have problems compiling
- * a regular expression during development.
- * If you are making regular expresion programs dynamically then you can catch it
- * if you wish. But should not be forced to.
- *
- * @author <a href="mailto:jonl@muppetlabs.com">Jonathan Locke</a>
- * @author <a href="mailto:gholam@xtra.co.nz>Michael McCallum</a>
- */
-public class RESyntaxException extends RuntimeException
-{
-    /**
-     * Constructor.
-     * @param s Further description of the syntax error
-     */
-    public RESyntaxException(String s)
-    {
-        super("Syntax error: " + s);
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/RETest.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,883 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.regexp.internal;
-
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.File;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ObjectInputStream;
-import java.io.StringBufferInputStream;
-import java.io.StringReader;
-import java.io.IOException;
-
-/**
- * Data driven (and optionally interactive) testing harness to exercise regular
- * expression compiler and matching engine.
- *
- * @author <a href="mailto:jonl@muppetlabs.com">Jonathan Locke</a>
- * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
- * @author <a href="mailto:gholam@xtra.co.nz">Michael McCallum</a>
- */
-public class RETest
-{
-    // True if we want to see output from success cases
-    static final boolean showSuccesses = false;
-
-    // A new line character.
-    static final String NEW_LINE = System.getProperty( "line.separator" );
-
-    // Construct a debug compiler
-    REDebugCompiler compiler = new REDebugCompiler();
-
-    /**
-     * Main program entrypoint.  If an argument is given, it will be compiled
-     * and interactive matching will ensue.  If no argument is given, the
-     * file RETest.txt will be used as automated testing input.
-     * @param args Command line arguments (optional regular expression)
-     */
-    public static void main(String[] args)
-    {
-        try
-        {
-            if (!test( args )) {
-                System.exit(1);
-            }
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-            System.exit(1);
-        }
-    }
-
-    /**
-     * Testing entrypoint.
-     * @param args Command line arguments
-     * @exception Exception thrown in case of error
-     */
-    public static boolean test( String[] args ) throws Exception
-    {
-        RETest test = new RETest();
-        // Run interactive tests against a single regexp
-        if (args.length == 2)
-        {
-            test.runInteractiveTests(args[1]);
-        }
-        else if (args.length == 1)
-        {
-            // Run automated tests
-            test.runAutomatedTests(args[0]);
-        }
-        else
-        {
-            System.out.println( "Usage: RETest ([-i] [regex]) ([/path/to/testfile.txt])" );
-            System.out.println( "By Default will run automated tests from file 'docs/RETest.txt' ..." );
-            System.out.println();
-            test.runAutomatedTests("docs/RETest.txt");
-        }
-        return test.failures == 0;
-    }
-
-    /**
-     * Constructor
-     */
-    public RETest()
-    {
-    }
-
-    /**
-     * Compile and test matching against a single expression
-     * @param expr Expression to compile and test
-     */
-    void runInteractiveTests(String expr)
-    {
-        RE r = new RE();
-        try
-        {
-            // Compile expression
-            r.setProgram(compiler.compile(expr));
-
-            // Show expression
-            say("" + NEW_LINE + "" + expr + "" + NEW_LINE + "");
-
-            // Show program for compiled expression
-            PrintWriter writer = new PrintWriter( System.out );
-            compiler.dumpProgram( writer );
-            writer.flush();
-
-            boolean running = true;
-            // Test matching against compiled expression
-            while ( running )
-            {
-                // Read from keyboard
-                BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
-                System.out.print("> ");
-                System.out.flush();
-                String match = br.readLine();
-
-                if ( match != null )
-                {
-                    // Try a match against the keyboard input
-                    if (r.match(match))
-                    {
-                        say("Match successful.");
-                    }
-                    else
-                    {
-                        say("Match failed.");
-                    }
-
-                    // Show subparen registers
-                    showParens(r);
-                }
-                else
-                {
-                    running = false;
-                    System.out.println();
-                }
-            }
-        }
-        catch (Exception e)
-        {
-            say("Error: " + e.toString());
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * Exit with a fatal error.
-     * @param s Last famous words before exiting
-     */
-    void die(String s)
-    {
-        say("FATAL ERROR: " + s);
-        System.exit(-1);
-    }
-
-    /**
-     * Fail with an error. Will print a big failure message to System.out.
-     *
-     * @param log Output before failure
-     * @param s Failure description
-     */
-    void fail(StringBuffer log, String s)
-    {
-        System.out.print(log.toString());
-        fail(s);
-    }
-
-    /**
-     * Fail with an error. Will print a big failure message to System.out.
-     *
-     * @param s Failure description
-     */
-    void fail(String s)
-    {
-        failures++;
-        say("" + NEW_LINE + "");
-        say("*******************************************************");
-        say("*********************  FAILURE!  **********************");
-        say("*******************************************************");
-        say("" + NEW_LINE + "");
-        say(s);
-        say("");
-        // make sure the writer gets flushed.
-        if (compiler != null) {
-            PrintWriter writer = new PrintWriter( System.out );
-            compiler.dumpProgram( writer );
-            writer.flush();
-            say("" + NEW_LINE + "");
-        }
-    }
-
-    /**
-     * Say something to standard out
-     * @param s What to say
-     */
-    void say(String s)
-    {
-        System.out.println(s);
-    }
-
-    /**
-     * Dump parenthesized subexpressions found by a regular expression matcher object
-     * @param r Matcher object with results to show
-     */
-    void showParens(RE r)
-    {
-        // Loop through each paren
-        for (int i = 0; i < r.getParenCount(); i++)
-        {
-            // Show paren register
-            say("$" + i + " = " + r.getParen(i));
-        }
-    }
-
-    /*
-     * number in automated test
-     */
-    int testCount = 0;
-
-    /*
-     * Count of failures in automated test
-     */
-    int failures = 0;
-
-    /**
-     * Run automated tests in RETest.txt file (from Perl 4.0 test battery)
-     * @exception Exception thrown in case of error
-     */
-    void runAutomatedTests(String testDocument) throws Exception
-    {
-        long ms = System.currentTimeMillis();
-
-        // Some unit tests
-        testPrecompiledRE();
-        testSplitAndGrep();
-        testSubst();
-        testOther();
-
-        // Test from script file
-        File testInput = new File(testDocument);
-        if (! testInput.exists()) {
-            throw new Exception ("Could not find: " + testDocument);
-        }
-
-        BufferedReader br = new BufferedReader(new FileReader(testInput));
-        try
-        {
-            // While input is available, parse lines
-            while (br.ready())
-            {
-                RETestCase testcase = getNextTestCase(br);
-                if (testcase != null) {
-                    testcase.runTest();
-                }
-            }
-        }
-        finally
-        {
-            br.close();
-        }
-
-        // Show match time
-        say(NEW_LINE + NEW_LINE + "Match time = " + (System.currentTimeMillis() - ms) + " ms.");
-
-        // Print final results
-        if (failures > 0) {
-            say("*************** THERE ARE FAILURES! *******************");
-        }
-        say("Tests complete.  " + testCount + " tests, " + failures + " failure(s).");
-    }
-
-    /**
-     * Run automated unit test
-     * @exception Exception thrown in case of error
-     */
-    void testOther() throws Exception
-    {
-        // Serialization test 1: Compile regexp and serialize/deserialize it
-        RE r = new RE("(a*)b");
-        say("Serialized/deserialized (a*)b");
-        ByteArrayOutputStream out = new ByteArrayOutputStream(128);
-        new ObjectOutputStream(out).writeObject(r);
-        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
-        r = (RE)new ObjectInputStream(in).readObject();
-        if (!r.match("aaab"))
-        {
-            fail("Did not match 'aaab' with deserialized RE.");
-        } else {
-            say("aaaab = true");
-            showParens(r);
-        }
-
-        // Serialization test 2: serialize/deserialize used regexp
-        out.reset();
-        say("Deserialized (a*)b");
-        new ObjectOutputStream(out).writeObject(r);
-        in = new ByteArrayInputStream(out.toByteArray());
-        r = (RE)new ObjectInputStream(in).readObject();
-        if (r.getParenCount() != 0)
-        {
-            fail("Has parens after deserialization.");
-        }
-        if (!r.match("aaab"))
-        {
-            fail("Did not match 'aaab' with deserialized RE.");
-        } else {
-            say("aaaab = true");
-            showParens(r);
-        }
-
-        // Test MATCH_CASEINDEPENDENT
-        r = new RE("abc(\\w*)");
-        say("MATCH_CASEINDEPENDENT abc(\\w*)");
-        r.setMatchFlags(RE.MATCH_CASEINDEPENDENT);
-        say("abc(d*)");
-        if (!r.match("abcddd"))
-        {
-            fail("Did not match 'abcddd'.");
-        } else {
-            say("abcddd = true");
-            showParens(r);
-        }
-
-        if (!r.match("aBcDDdd"))
-        {
-            fail("Did not match 'aBcDDdd'.");
-        } else {
-            say("aBcDDdd = true");
-            showParens(r);
-        }
-
-        if (!r.match("ABCDDDDD"))
-        {
-            fail("Did not match 'ABCDDDDD'.");
-        } else {
-            say("ABCDDDDD = true");
-            showParens(r);
-        }
-
-        r = new RE("(A*)b\\1");
-        r.setMatchFlags(RE.MATCH_CASEINDEPENDENT);
-        if (!r.match("AaAaaaBAAAAAA"))
-        {
-            fail("Did not match 'AaAaaaBAAAAAA'.");
-        } else {
-            say("AaAaaaBAAAAAA = true");
-            showParens(r);
-        }
-
-        r = new RE("[A-Z]*");
-        r.setMatchFlags(RE.MATCH_CASEINDEPENDENT);
-        if (!r.match("CaBgDe12"))
-        {
-            fail("Did not match 'CaBgDe12'.");
-        } else {
-            say("CaBgDe12 = true");
-            showParens(r);
-        }
-
-        // Test MATCH_MULTILINE. Test for eol/bol symbols.
-        r = new RE("^abc$", RE.MATCH_MULTILINE);
-        if (!r.match("\nabc")) {
-            fail("\"\\nabc\" doesn't match \"^abc$\"");
-        }
-        if (!r.match("\rabc")) {
-            fail("\"\\rabc\" doesn't match \"^abc$\"");
-        }
-        if (!r.match("\r\nabc")) {
-            fail("\"\\r\\nabc\" doesn't match \"^abc$\"");
-        }
-        if (!r.match("\u0085abc")) {
-            fail("\"\\u0085abc\" doesn't match \"^abc$\"");
-        }
-        if (!r.match("\u2028abc")) {
-            fail("\"\\u2028abc\" doesn't match \"^abc$\"");
-        }
-        if (!r.match("\u2029abc")) {
-            fail("\"\\u2029abc\" doesn't match \"^abc$\"");
-        }
-
-        // Test MATCH_MULTILINE. Test that '.' does not matches new line.
-        r = new RE("^a.*b$", RE.MATCH_MULTILINE);
-        if (r.match("a\nb")) {
-            fail("\"a\\nb\" matches \"^a.*b$\"");
-        }
-        if (r.match("a\rb")) {
-            fail("\"a\\rb\" matches \"^a.*b$\"");
-        }
-        if (r.match("a\r\nb")) {
-            fail("\"a\\r\\nb\" matches \"^a.*b$\"");
-        }
-        if (r.match("a\u0085b")) {
-            fail("\"a\\u0085b\" matches \"^a.*b$\"");
-        }
-        if (r.match("a\u2028b")) {
-            fail("\"a\\u2028b\" matches \"^a.*b$\"");
-        }
-        if (r.match("a\u2029b")) {
-            fail("\"a\\u2029b\" matches \"^a.*b$\"");
-        }
-    }
-
-    private void testPrecompiledRE()
-    {
-        // Pre-compiled regular expression "a*b"
-        char[] re1Instructions =
-        {
-            0x007c, 0x0000, 0x001a, 0x007c, 0x0000, 0x000d, 0x0041,
-            0x0001, 0x0004, 0x0061, 0x007c, 0x0000, 0x0003, 0x0047,
-            0x0000, 0xfff6, 0x007c, 0x0000, 0x0003, 0x004e, 0x0000,
-            0x0003, 0x0041, 0x0001, 0x0004, 0x0062, 0x0045, 0x0000,
-            0x0000,
-        };
-
-        REProgram re1 = new REProgram(re1Instructions);
-
-        // Simple test of pre-compiled regular expressions
-        RE r = new RE(re1);
-        say("a*b");
-        boolean result = r.match("aaab");
-        say("aaab = " + result);
-        showParens(r);
-        if (!result) {
-            fail("\"aaab\" doesn't match to precompiled \"a*b\"");
-        }
-
-        result = r.match("b");
-        say("b = " + result);
-        showParens(r);
-        if (!result) {
-            fail("\"b\" doesn't match to precompiled \"a*b\"");
-        }
-
-        result = r.match("c");
-        say("c = " + result);
-        showParens(r);
-        if (result) {
-            fail("\"c\" matches to precompiled \"a*b\"");
-        }
-
-        result = r.match("ccccaaaaab");
-        say("ccccaaaaab = " + result);
-        showParens(r);
-        if (!result) {
-            fail("\"ccccaaaaab\" doesn't match to precompiled \"a*b\"");
-        }
-    }
-
-    private void testSplitAndGrep()
-    {
-        String[] expected = {"xxxx", "xxxx", "yyyy", "zzz"};
-        RE r = new RE("a*b");
-        String[] s = r.split("xxxxaabxxxxbyyyyaaabzzz");
-        for (int i = 0; i < expected.length && i < s.length; i++) {
-            assertEquals("Wrong splitted part", expected[i], s[i]);
-        }
-        assertEquals("Wrong number of splitted parts", expected.length,
-                     s.length);
-
-        r = new RE("x+");
-        expected = new String[] {"xxxx", "xxxx"};
-        s = r.grep(s);
-        for (int i = 0; i < s.length; i++)
-        {
-            say("s[" + i + "] = " + s[i]);
-            assertEquals("Grep fails", expected[i], s[i]);
-        }
-        assertEquals("Wrong number of string found by grep", expected.length,
-                     s.length);
-    }
-
-    private void testSubst()
-    {
-        RE r = new RE("a*b");
-        String expected = "-foo-garply-wacky-";
-        String actual = r.subst("aaaabfooaaabgarplyaaabwackyb", "-");
-        assertEquals("Wrong result of substitution in \"a*b\"", expected, actual);
-
-        // Test subst() with backreferences
-        r = new RE("http://[\\.\\w\\-\\?/~_@&=%]+");
-        actual = r.subst("visit us: http://www.apache.org!",
-                         "1234<a href=\"$0\">$0</a>", RE.REPLACE_BACKREFERENCES);
-        assertEquals("Wrong subst() result", "visit us: 1234<a href=\"http://www.apache.org\">http://www.apache.org</a>!", actual);
-
-        // Test subst() with backreferences without leading characters
-        // before first backreference
-        r = new RE("(.*?)=(.*)");
-        actual = r.subst("variable=value",
-                         "$1_test_$212", RE.REPLACE_BACKREFERENCES);
-        assertEquals("Wrong subst() result", "variable_test_value12", actual);
-
-        // Test subst() with NO backreferences
-        r = new RE("^a$");
-        actual = r.subst("a",
-                         "b", RE.REPLACE_BACKREFERENCES);
-        assertEquals("Wrong subst() result", "b", actual);
-
-        // Test subst() with NO backreferences
-        r = new RE("^a$", RE.MATCH_MULTILINE);
-        actual = r.subst("\r\na\r\n",
-                         "b", RE.REPLACE_BACKREFERENCES);
-        assertEquals("Wrong subst() result", "\r\nb\r\n", actual);
-    }
-
-    public void assertEquals(String message, String expected, String actual)
-    {
-        if (expected != null && !expected.equals(actual)
-            || actual != null && !actual.equals(expected))
-        {
-            fail(message + " (expected \"" + expected
-                 + "\", actual \"" + actual + "\")");
-        }
-    }
-
-    public void assertEquals(String message, int expected, int actual)
-    {
-        if (expected != actual) {
-            fail(message + " (expected \"" + expected
-                 + "\", actual \"" + actual + "\")");
-        }
-    }
-
-    /**
-     * Converts yesno string to boolean.
-     * @param yesno string representation of expected result
-     * @return true if yesno is "YES", false if yesno is "NO"
-     *         stops program otherwise.
-     */
-    private boolean getExpectedResult(String yesno)
-    {
-        if ("NO".equals(yesno))
-        {
-            return false;
-        }
-        else if ("YES".equals(yesno))
-        {
-            return true;
-        }
-        else
-        {
-            // Bad test script
-            die("Test script error!");
-            return false; //to please javac
-        }
-    }
-
-    /**
-     * Finds next test description in a given script.
-     * @param br <code>BufferedReader</code> for a script file
-     * @return strign tag for next test description
-     * @exception IOException if some io problems occured
-     */
-    private String findNextTest(BufferedReader br) throws IOException
-    {
-        String number = "";
-
-        while (br.ready())
-        {
-            number = br.readLine();
-            if (number == null)
-            {
-                break;
-            }
-            number = number.trim();
-            if (number.startsWith("#"))
-            {
-                break;
-            }
-            if (!number.equals(""))
-            {
-                say("Script error.  Line = " + number);
-                System.exit(-1);
-            }
-        }
-        return number;
-    }
-
-    /**
-     * Creates testcase for the next test description in the script file.
-     * @param br <code>BufferedReader</code> for script file.
-     * @return a new tescase or null.
-     * @exception IOException if some io problems occured
-     */
-    private RETestCase getNextTestCase(BufferedReader br) throws IOException
-    {
-        // Find next re test case
-        final String tag = findNextTest(br);
-
-        // Are we done?
-        if (!br.ready())
-        {
-            return null;
-        }
-
-        // Get expression
-        final String expr = br.readLine();
-
-        // Get test information
-        final String matchAgainst = br.readLine();
-        final boolean badPattern = "ERR".equals(matchAgainst);
-        boolean shouldMatch = false;
-        int expectedParenCount = 0;
-        String[] expectedParens = null;
-
-        if (!badPattern) {
-            shouldMatch = getExpectedResult(br.readLine().trim());
-            if (shouldMatch) {
-                expectedParenCount = Integer.parseInt(br.readLine().trim());
-                expectedParens = new String[expectedParenCount];
-                for (int i = 0; i < expectedParenCount; i++) {
-                    expectedParens[i] = br.readLine();
-                }
-            }
-        }
-
-        return new RETestCase(this, tag, expr, matchAgainst, badPattern,
-                              shouldMatch, expectedParens);
-    }
-}
-
-final class RETestCase
-{
-    final private StringBuffer log = new StringBuffer();
-    final private int number;
-    final private String tag; // number from script file
-    final private String pattern;
-    final private String toMatch;
-    final private boolean badPattern;
-    final private boolean shouldMatch;
-    final private String[] parens;
-    final private RETest test;
-    private RE regexp;
-
-    public RETestCase(RETest test, String tag, String pattern,
-                      String toMatch, boolean badPattern,
-                      boolean shouldMatch, String[] parens)
-    {
-        this.number = ++test.testCount;
-        this.test = test;
-        this.tag = tag;
-        this.pattern = pattern;
-        this.toMatch = toMatch;
-        this.badPattern = badPattern;
-        this.shouldMatch = shouldMatch;
-        if (parens != null) {
-            this.parens = new String[parens.length];
-            for (int i = 0; i < parens.length; i++) {
-                this.parens[i] = parens[i];
-            }
-        } else {
-            this.parens = null;
-        }
-    }
-
-    public void runTest()
-    {
-        test.say(tag + "(" + number + "): " + pattern);
-        if (testCreation()) {
-            testMatch();
-        }
-    }
-
-    boolean testCreation()
-    {
-        try
-        {
-            // Compile it
-            regexp = new RE();
-            regexp.setProgram(test.compiler.compile(pattern));
-            // Expression didn't cause an expected error
-            if (badPattern)
-            {
-                test.fail(log, "Was expected to be an error, but wasn't.");
-                return false;
-            }
-
-            return true;
-        }
-        // Some expressions *should* cause exceptions to be thrown
-        catch (Exception e)
-        {
-            // If it was supposed to be an error, report success and continue
-            if (badPattern)
-            {
-                log.append("   Match: ERR\n");
-                success("Produces an error (" + e.toString() + "), as expected.");
-                return false;
-            }
-
-            // Wasn't supposed to be an error
-            String message = (e.getMessage() == null) ? e.toString() : e.getMessage();
-            test.fail(log, "Produces an unexpected exception \"" + message + "\"");
-            e.printStackTrace();
-        }
-        catch (Error e)
-        {
-            // Internal error happened
-            test.fail(log, "Compiler threw fatal error \"" + e.getMessage() + "\"");
-            e.printStackTrace();
-        }
-
-        return false;
-    }
-
-    private void testMatch()
-    {
-        log.append("   Match against: '" + toMatch + "'\n");
-        // Try regular matching
-        try
-        {
-            // Match against the string
-            boolean result = regexp.match(toMatch);
-            log.append("   Matched: " + (result ? "YES" : "NO") + "\n");
-
-            // Check result, parens, and iterators
-            if (checkResult(result) && (!shouldMatch || checkParens()))
-            {
-                // test match(CharacterIterator, int)
-                // for every CharacterIterator implementation.
-                log.append("   Match using StringCharacterIterator\n");
-                if (!tryMatchUsingCI(new StringCharacterIterator(toMatch)))
-                    return;
-
-                log.append("   Match using CharacterArrayCharacterIterator\n");
-                if (!tryMatchUsingCI(new CharacterArrayCharacterIterator(toMatch.toCharArray(), 0, toMatch.length())))
-                    return;
-
-                log.append("   Match using StreamCharacterIterator\n");
-                if (!tryMatchUsingCI(new StreamCharacterIterator(new StringBufferInputStream(toMatch))))
-                    return;
-
-                log.append("   Match using ReaderCharacterIterator\n");
-                if (!tryMatchUsingCI(new ReaderCharacterIterator(new StringReader(toMatch))))
-                    return;
-            }
-        }
-        // Matcher blew it
-        catch(Exception e)
-        {
-            test.fail(log, "Matcher threw exception: " + e.toString());
-            e.printStackTrace();
-        }
-        // Internal error
-        catch(Error e)
-        {
-            test.fail(log, "Matcher threw fatal error \"" + e.getMessage() + "\"");
-            e.printStackTrace();
-        }
-    }
-
-    private boolean checkResult(boolean result)
-    {
-        // Write status
-        if (result == shouldMatch) {
-            success((shouldMatch ? "Matched" : "Did not match")
-                    + " \"" + toMatch + "\", as expected:");
-            return true;
-        } else {
-            if (shouldMatch) {
-                test.fail(log, "Did not match \"" + toMatch + "\", when expected to.");
-            } else {
-                test.fail(log, "Matched \"" + toMatch + "\", when not expected to.");
-            }
-            return false;
-        }
-    }
-
-    private boolean checkParens()
-    {
-        // Show subexpression registers
-        if (RETest.showSuccesses)
-        {
-            test.showParens(regexp);
-        }
-
-        log.append("   Paren count: " + regexp.getParenCount() + "\n");
-        if (!assertEquals(log, "Wrong number of parens", parens.length, regexp.getParenCount()))
-        {
-            return false;
-        }
-
-        // Check registers against expected contents
-        for (int p = 0; p < regexp.getParenCount(); p++)
-        {
-            log.append("   Paren " + p + ": " + regexp.getParen(p) + "\n");
-
-            // Compare expected result with actual
-            if ("null".equals(parens[p]) && regexp.getParen(p) == null)
-            {
-                // Consider "null" in test file equal to null
-                continue;
-            }
-            if (!assertEquals(log, "Wrong register " + p, parens[p], regexp.getParen(p)))
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    boolean tryMatchUsingCI(CharacterIterator matchAgainst)
-    {
-        try {
-            boolean result = regexp.match(matchAgainst, 0);
-            log.append("   Match: " + (result ? "YES" : "NO") + "\n");
-            return checkResult(result) && (!shouldMatch || checkParens());
-        }
-        // Matcher blew it
-        catch(Exception e)
-        {
-            test.fail(log, "Matcher threw exception: " + e.toString());
-            e.printStackTrace();
-        }
-        // Internal error
-        catch(Error e)
-        {
-            test.fail(log, "Matcher threw fatal error \"" + e.getMessage() + "\"");
-            e.printStackTrace();
-        }
-        return false;
-    }
-
-    public boolean assertEquals(StringBuffer log, String message, String expected, String actual)
-    {
-        if (expected != null && !expected.equals(actual)
-            || actual != null && !actual.equals(expected))
-        {
-            test.fail(log, message + " (expected \"" + expected
-                      + "\", actual \"" + actual + "\")");
-            return false;
-        }
-        return true;
-    }
-
-    public boolean assertEquals(StringBuffer log, String message, int expected, int actual)
-    {
-        if (expected != actual) {
-            test.fail(log, message + " (expected \"" + expected
-                      + "\", actual \"" + actual + "\")");
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Show a success
-     * @param s Success story
-     */
-    void success(String s)
-    {
-        if (RETest.showSuccesses)
-        {
-            test.say("" + RETest.NEW_LINE + "-----------------------" + RETest.NEW_LINE + "");
-            test.say("Expression #" + (number) + " \"" + pattern + "\" ");
-            test.say("Success: " + s);
-        }
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/REUtil.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.regexp.internal;
-
-/**
- * This is a class that contains utility helper methods for this package.
- *
- * @author <a href="mailto:jonl@muppetlabs.com">Jonathan Locke</a>
- */
-public class REUtil
-{
-    /** complex: */
-    private static final String complexPrefix = "complex:";
-
-    /**
-     * Creates a regular expression, permitting simple or complex syntax
-     * @param expression The expression, beginning with a prefix if it's complex or
-     * having no prefix if it's simple
-     * @param matchFlags Matching style flags
-     * @return The regular expression object
-     * @exception RESyntaxException thrown in case of error
-     */
-    public static RE createRE(String expression, int matchFlags) throws RESyntaxException
-    {
-        if (expression.startsWith(complexPrefix))
-        {
-            return new RE(expression.substring(complexPrefix.length()), matchFlags);
-        }
-        return new RE(RE.simplePatternToFullRegularExpression(expression), matchFlags);
-    }
-
-    /**
-     * Creates a regular expression, permitting simple or complex syntax
-     * @param expression The expression, beginning with a prefix if it's complex or
-     * having no prefix if it's simple
-     * @return The regular expression object
-     * @exception RESyntaxException thrown in case of error
-     */
-    public static RE createRE(String expression) throws RESyntaxException
-    {
-        return createRE(expression, RE.MATCH_NORMAL);
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/ReaderCharacterIterator.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.regexp.internal;
-
-import java.io.Reader;
-import java.io.IOException;
-
-/**
- * Encapsulates java.io.Reader as CharacterIterator
- *
- * @author <a href="mailto:ales.novak@netbeans.com">Ales Novak</a>
- */
-public final class ReaderCharacterIterator implements CharacterIterator
-{
-    /** Underlying reader */
-    private final Reader reader;
-
-    /** Buffer of read chars */
-    private final StringBuffer buff;
-
-    /** read end? */
-    private boolean closed;
-
-    /** @param reader a Reader, which is parsed */
-    public ReaderCharacterIterator(Reader reader)
-    {
-        this.reader = reader;
-        this.buff = new StringBuffer(512);
-        this.closed = false;
-    }
-
-    /** @return a substring */
-    public String substring(int beginIndex, int endIndex)
-    {
-        try
-        {
-            ensure(endIndex);
-            return buff.toString().substring(beginIndex, endIndex);
-        }
-        catch (IOException e)
-        {
-            throw new StringIndexOutOfBoundsException(e.getMessage());
-        }
-    }
-
-    /** @return a substring */
-    public String substring(int beginIndex)
-    {
-        try
-        {
-            readAll();
-            return buff.toString().substring(beginIndex);
-        }
-        catch (IOException e)
-        {
-            throw new StringIndexOutOfBoundsException(e.getMessage());
-        }
-    }
-
-    /** @return a character at the specified position. */
-    public char charAt(int pos)
-    {
-        try
-        {
-            ensure(pos);
-            return buff.charAt(pos);
-        }
-        catch (IOException e)
-        {
-            throw new StringIndexOutOfBoundsException(e.getMessage());
-        }
-    }
-
-    /** @return <tt>true</tt> iff if the specified index is after the end of the character stream */
-    public boolean isEnd(int pos)
-    {
-        if (buff.length() > pos)
-        {
-            return false;
-        }
-        else
-        {
-            try
-            {
-                ensure(pos);
-                return (buff.length() <= pos);
-            }
-            catch (IOException e)
-            {
-                throw new StringIndexOutOfBoundsException(e.getMessage());
-            }
-        }
-    }
-
-    /** Reads n characters from the stream and appends them to the buffer */
-    private int read(int n) throws IOException
-    {
-        if (closed)
-        {
-            return 0;
-        }
-
-        char[] c = new char[n];
-        int count = 0;
-        int read = 0;
-
-        do
-        {
-            read = reader.read(c);
-            if (read < 0) // EOF
-            {
-                closed = true;
-                break;
-            }
-            count += read;
-            buff.append(c, 0, read);
-        }
-        while (count < n);
-
-        return count;
-    }
-
-    /** Reads rest of the stream. */
-    private void readAll() throws IOException
-    {
-        while(! closed)
-        {
-            read(1000);
-        }
-    }
-
-    /** Reads chars up to the idx */
-    private void ensure(int idx) throws IOException
-    {
-        if (closed)
-        {
-            return;
-        }
-
-        if (idx < buff.length())
-        {
-            return;
-        }
-        read(idx + 1 - buff.length());
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/StreamCharacterIterator.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.regexp.internal;
-
-import java.io.InputStream;
-import java.io.IOException;
-
-/**
- * Encapsulates java.io.InputStream as CharacterIterator.
- *
- * @author <a href="mailto:ales.novak@netbeans.com">Ales Novak</a>
- */
-public final class StreamCharacterIterator implements CharacterIterator
-{
-    /** Underlying is */
-    private final InputStream is;
-
-    /** Buffer of read chars */
-    private final StringBuffer buff;
-
-    /** read end? */
-    private boolean closed;
-
-    /** @param is an InputStream, which is parsed */
-    public StreamCharacterIterator(InputStream is)
-    {
-        this.is = is;
-        this.buff = new StringBuffer(512);
-        this.closed = false;
-    }
-
-    /** @return a substring */
-    public String substring(int beginIndex, int endIndex)
-    {
-        try
-        {
-            ensure(endIndex);
-            return buff.toString().substring(beginIndex, endIndex);
-        }
-        catch (IOException e)
-        {
-            throw new StringIndexOutOfBoundsException(e.getMessage());
-        }
-    }
-
-    /** @return a substring */
-    public String substring(int beginIndex)
-    {
-        try
-        {
-            readAll();
-            return buff.toString().substring(beginIndex);
-        }
-        catch (IOException e)
-        {
-            throw new StringIndexOutOfBoundsException(e.getMessage());
-        }
-    }
-
-
-    /** @return a character at the specified position. */
-    public char charAt(int pos)
-    {
-        try
-        {
-            ensure(pos);
-            return buff.charAt(pos);
-        }
-        catch (IOException e)
-        {
-            throw new StringIndexOutOfBoundsException(e.getMessage());
-        }
-    }
-
-    /** @return <tt>true</tt> iff if the specified index is after the end of the character stream */
-    public boolean isEnd(int pos)
-    {
-        if (buff.length() > pos)
-        {
-            return false;
-        }
-        else
-        {
-            try
-            {
-                ensure(pos);
-                return (buff.length() <= pos);
-            }
-            catch (IOException e)
-            {
-                throw new StringIndexOutOfBoundsException(e.getMessage());
-            }
-        }
-    }
-
-    /** Reads n characters from the stream and appends them to the buffer */
-    private int read(int n) throws IOException
-    {
-        if (closed)
-        {
-            return 0;
-        }
-
-        int c;
-        int i = n;
-        while (--i >= 0)
-        {
-            c = is.read();
-            if (c < 0) // EOF
-            {
-                closed = true;
-                break;
-            }
-            buff.append((char) c);
-        }
-        return n - i;
-    }
-
-    /** Reads rest of the stream. */
-    private void readAll() throws IOException
-    {
-        while(! closed)
-        {
-            read(1000);
-        }
-    }
-
-    /** Reads chars up to the idx */
-    private void ensure(int idx) throws IOException
-    {
-        if (closed)
-        {
-            return;
-        }
-
-        if (idx < buff.length())
-        {
-            return;
-        }
-
-        read(idx + 1 - buff.length());
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/StringCharacterIterator.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.regexp.internal;
-
-/**
- * Encapsulates String as CharacterIterator.
- *
- * @author <a href="mailto:ales.novak@netbeans.com">Ales Novak</a>
- */
-public final class StringCharacterIterator implements CharacterIterator
-{
-    /** encapsulated */
-    private final String src;
-
-    /** @param src - encapsulated String */
-    public StringCharacterIterator(String src)
-    {
-        this.src = src;
-    }
-
-    /** @return a substring */
-    public String substring(int beginIndex, int endIndex)
-    {
-        return src.substring(beginIndex, endIndex);
-    }
-
-    /** @return a substring */
-    public String substring(int beginIndex)
-    {
-        return src.substring(beginIndex);
-    }
-
-    /** @return a character at the specified position. */
-    public char charAt(int pos)
-    {
-        return src.charAt(pos);
-    }
-
-    /** @return <tt>true</tt> iff if the specified index is after the end of the character stream */
-    public boolean isEnd(int pos)
-    {
-        return (pos >= src.length());
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/regexp/internal/recompile.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.regexp.internal;
-
-import com.sun.org.apache.regexp.internal.RECompiler;
-import com.sun.org.apache.regexp.internal.RESyntaxException;
-
-/**
- * 'recompile' is a command line tool that pre-compiles one or more regular expressions
- * for use with the regular expression matcher class 'RE'.  For example, the command
- * "java recompile a*b" produces output like this:
- *
- * <pre>
- *
- *    // Pre-compiled regular expression "a*b"
- *    char[] re1Instructions =
- *    {
- *        0x007c, 0x0000, 0x001a, 0x007c, 0x0000, 0x000d, 0x0041,
- *        0x0001, 0x0004, 0x0061, 0x007c, 0x0000, 0x0003, 0x0047,
- *        0x0000, 0xfff6, 0x007c, 0x0000, 0x0003, 0x004e, 0x0000,
- *        0x0003, 0x0041, 0x0001, 0x0004, 0x0062, 0x0045, 0x0000,
- *        0x0000,
- *    };
- *
- *    REProgram re1 = new REProgram(re1Instructions);
- *
- * </pre>
- *
- * By pasting this output into your code, you can construct a regular expression matcher
- * (RE) object directly from the pre-compiled data (the character array re1), thus avoiding
- * the overhead of compiling the expression at runtime.  For example:
- *
- * <pre>
- *
- *    RE r = new RE(re1);
- *
- * </pre>
- *
- * @see RE
- * @see RECompiler
- *
- * @author <a href="mailto:jonl@muppetlabs.com">Jonathan Locke</a>
- */
-public class recompile
-{
-    /**
-     * Main application entrypoint.
-     * @param arg Command line arguments
-     */
-    static public void main(String[] arg)
-    {
-        // Create a compiler object
-        RECompiler r = new RECompiler();
-
-        // Print usage if arguments are incorrect
-        if (arg.length <= 0 || arg.length % 2 != 0)
-        {
-            System.out.println("Usage: recompile <patternname> <pattern>");
-            System.exit(0);
-        }
-
-        // Loop through arguments, compiling each
-        for (int i = 0; i < arg.length; i += 2)
-        {
-            try
-            {
-                // Compile regular expression
-                String name         = arg[i];
-                String pattern      = arg[i+1];
-                String instructions = name + "PatternInstructions";
-
-                // Output program as a nice, formatted character array
-                System.out.print("\n    // Pre-compiled regular expression '" + pattern + "'\n"
-                                 + "    private static char[] " + instructions + " = \n    {");
-
-                // Compile program for pattern
-                REProgram program = r.compile(pattern);
-
-                // Number of columns in output
-                int numColumns = 7;
-
-                // Loop through program
-                char[] p = program.getInstructions();
-                for (int j = 0; j < p.length; j++)
-                {
-                    // End of column?
-                    if ((j % numColumns) == 0)
-                    {
-                        System.out.print("\n        ");
-                    }
-
-                    // Print character as padded hex number
-                    String hex = Integer.toHexString(p[j]);
-                    while (hex.length() < 4)
-                    {
-                        hex = "0" + hex;
-                    }
-                    System.out.print("0x" + hex + ", ");
-                }
-
-                // End of program block
-                System.out.println("\n    };");
-                System.out.println("\n    private static RE " + name + "Pattern = new RE(new REProgram(" + instructions + "));");
-            }
-            catch (RESyntaxException e)
-            {
-                System.out.println("Syntax error in expression \"" + arg[i] + "\": " + e.toString());
-            }
-            catch (Exception e)
-            {
-                System.out.println("Unexpected exception: " + e.toString());
-            }
-            catch (Error e)
-            {
-                System.out.println("Internal error: " + e.toString());
-            }
-        }
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1346,6 +1346,15 @@
     }
 
     /**
+     * Writes character reference in hex format.
+     */
+    private void writeCharRef(int codePoint) throws IOException {
+        fWriter.write( "&#x" );
+        fWriter.write( Integer.toHexString(codePoint) );
+        fWriter.write( ';' );
+    }
+
+    /**
      * Writes XML content to underlying writer. Escapes characters unless
      * escaping character feature is turned off.
      */
@@ -1368,10 +1377,14 @@
             if (fEncoder != null && !fEncoder.canEncode(ch)){
                 fWriter.write(content, startWritePos, index - startWritePos );
 
-                // Escape this char as underlying encoder cannot handle it
-                fWriter.write( "&#x" );
-                fWriter.write(Integer.toHexString(ch));
-                fWriter.write( ';' );
+                // Check if current and next characters forms a surrogate pair
+                // and escape it to avoid generation of invalid xml content
+                if ( index != end - 1 && Character.isSurrogatePair(ch, content[index+1])) {
+                    writeCharRef(Character.toCodePoint(ch, content[index+1]));
+                    index++;
+                } else {
+                    writeCharRef(ch);
+                }
                 startWritePos = index + 1;
                 continue;
             }
@@ -1439,10 +1452,15 @@
             if (fEncoder != null && !fEncoder.canEncode(ch)){
                 fWriter.write(content, startWritePos, index - startWritePos );
 
-                // Escape this char as underlying encoder cannot handle it
-                fWriter.write( "&#x" );
-                fWriter.write(Integer.toHexString(ch));
-                fWriter.write( ';' );
+                // Check if current and next characters forms a surrogate pair
+                // and escape it to avoid generation of invalid xml content
+                if ( index != end - 1 && Character.isSurrogatePair(ch, content.charAt(index+1))) {
+                    writeCharRef(Character.toCodePoint(ch, content.charAt(index+1)));
+                    index++;
+                } else {
+                    writeCharRef(ch);
+                }
+
                 startWritePos = index + 1;
                 continue;
             }
--- a/jaxp/src/java.xml/share/classes/module-info.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/module-info.java	Tue May 17 05:38:15 2016 -0700
@@ -86,5 +86,6 @@
     uses javax.xml.transform.TransformerFactory;
     uses javax.xml.validation.SchemaFactory;
     uses javax.xml.xpath.XPathFactory;
+    uses org.xml.sax.XMLReader;
 }
 
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/AttributeList.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/AttributeList.java	Tue May 17 05:38:15 2016 -0700
@@ -93,6 +93,7 @@
  * @see org.xml.sax.DocumentHandler#startElement startElement
  * @see org.xml.sax.helpers.AttributeListImpl AttributeListImpl
  */
+@Deprecated(since="5")
 public interface AttributeList {
 
 
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/DocumentHandler.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/DocumentHandler.java	Tue May 17 05:38:15 2016 -0700
@@ -68,6 +68,7 @@
  * @see org.xml.sax.Locator
  * @see org.xml.sax.HandlerBase
  */
+@Deprecated(since="5")
 public interface DocumentHandler {
 
 
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/Parser.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/Parser.java	Tue May 17 05:38:15 2016 -0700
@@ -73,6 +73,7 @@
  * @see org.xml.sax.HandlerBase
  * @see org.xml.sax.InputSource
  */
+@Deprecated(since="5")
 public interface Parser
 {
 
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/helpers/NewInstance.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/helpers/NewInstance.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,7 @@
 
 package org.xml.sax.helpers;
 
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
+import java.util.Objects;
 
 /**
  * Create a new instance of a class by name.
@@ -57,31 +56,26 @@
  * @version 2.0.1 (sax2r2)
  */
 class NewInstance {
+
     private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal";
     /**
      * Creates a new instance of the specified class name
      *
      * Package private so this code is not exposed at the API level.
      */
-    static Object newInstance (ClassLoader classLoader, String className)
+    static <T> T newInstance (Class<T> type, ClassLoader loader, String clsName)
         throws ClassNotFoundException, IllegalAccessException,
             InstantiationException
     {
-        // make sure we have access to restricted packages
-        boolean internal = false;
-        if (System.getSecurityManager() != null) {
-            if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
-                internal = true;
-            }
+        ClassLoader classLoader = Objects.requireNonNull(loader);
+        String className = Objects.requireNonNull(clsName);
+
+        if (className.startsWith(DEFAULT_PACKAGE)) {
+            return type.cast(new com.sun.org.apache.xerces.internal.parsers.SAXParser());
         }
 
-        Class driverClass;
-        if (classLoader == null || internal) {
-            driverClass = Class.forName(className);
-        } else {
-            driverClass = classLoader.loadClass(className);
-        }
-        return driverClass.newInstance();
+        Class<?> driverClass = classLoader.loadClass(className);
+        return type.cast(driverClass.newInstance());
     }
 
 }
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/helpers/ParserFactory.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/helpers/ParserFactory.java	Tue May 17 05:38:15 2016 -0700
@@ -30,8 +30,6 @@
 
 package org.xml.sax.helpers;
 
-import org.xml.sax.Parser;
-
 
 /**
  * Java-specific class for dynamically loading SAX parsers.
@@ -65,6 +63,8 @@
  * @author David Megginson
  * @version 2.0.1 (sax2r2)
  */
+@SuppressWarnings( "deprecation" )
+@Deprecated(since="5")
 public class ParserFactory {
     private static SecuritySupport ss = new SecuritySupport();
 
@@ -97,7 +97,7 @@
      * @see #makeParser(java.lang.String)
      * @see org.xml.sax.Parser
      */
-    public static Parser makeParser ()
+    public static org.xml.sax.Parser makeParser ()
         throws ClassNotFoundException,
         IllegalAccessException,
         InstantiationException,
@@ -134,14 +134,13 @@
      * @see #makeParser()
      * @see org.xml.sax.Parser
      */
-    public static Parser makeParser (String className)
+    public static org.xml.sax.Parser makeParser (String className)
         throws ClassNotFoundException,
         IllegalAccessException,
         InstantiationException,
         ClassCastException
     {
-        return (Parser) NewInstance.newInstance (
-                ss.getContextClassLoader(), className);
+        return NewInstance.newInstance (org.xml.sax.Parser.class, ss.getClassLoader(), className);
     }
 
 }
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/helpers/SecuritySupport.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/helpers/SecuritySupport.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,72 +37,56 @@
  */
 class SecuritySupport  {
 
+    /**
+     * Returns the current thread's context class loader, or the system class loader
+     * if the context class loader is null.
+     * @return the current thread's context class loader, or the system class loader
+     * @throws SecurityException
+     */
+    ClassLoader getClassLoader() throws SecurityException{
+        return AccessController.doPrivileged((PrivilegedAction<ClassLoader>)() -> {
+            ClassLoader cl = Thread.currentThread().getContextClassLoader();
+            if (cl == null) {
+                cl = ClassLoader.getSystemClassLoader();
+            }
 
-    ClassLoader getContextClassLoader() throws SecurityException{
-        return (ClassLoader)
-                AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
-                //try {
-                cl = Thread.currentThread().getContextClassLoader();
-                //} catch (SecurityException ex) { }
-
-                if (cl == null)
-                    cl = ClassLoader.getSystemClassLoader();
-
-                return cl;
-            }
+            return cl;
         });
     }
 
     String getSystemProperty(final String propName) {
-        return (String)
-            AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
-                    return System.getProperty(propName);
-                }
-            });
+        return AccessController.doPrivileged((PrivilegedAction<String>)()
+                -> System.getProperty(propName));
     }
 
     FileInputStream getFileInputStream(final File file)
         throws FileNotFoundException
     {
         try {
-            return (FileInputStream)
-                AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                    public Object run() throws FileNotFoundException {
-                        return new FileInputStream(file);
-                    }
-                });
+            return AccessController.doPrivileged((PrivilegedExceptionAction<FileInputStream>)() ->
+                    new FileInputStream(file));
         } catch (PrivilegedActionException e) {
             throw (FileNotFoundException)e.getException();
         }
     }
 
-    InputStream getResourceAsStream(final ClassLoader cl,
-                                           final String name)
+
+    InputStream getResourceAsStream(final ClassLoader cl, final String name)
     {
-        return (InputStream)
-            AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
-                    InputStream ris;
-                    if (cl == null) {
-                        ris = SecuritySupport.class.getResourceAsStream(name);
-                    } else {
-                        ris = cl.getResourceAsStream(name);
-                    }
-                    return ris;
-                }
-            });
+        return AccessController.doPrivileged((PrivilegedAction<InputStream>) () -> {
+            InputStream ris;
+            if (cl == null) {
+                ris = SecuritySupport.class.getResourceAsStream(name);
+            } else {
+                ris = cl.getResourceAsStream(name);
+            }
+            return ris;
+        });
     }
 
     boolean doesFileExist(final File f) {
-    return ((Boolean)
-            AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
-                    return new Boolean(f.exists());
-                }
-            })).booleanValue();
+        return (AccessController.doPrivileged((PrivilegedAction<Boolean>)() ->
+                new Boolean(f.exists())));
     }
 
 }
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderFactory.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderFactory.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,10 +32,17 @@
 
 package org.xml.sax.helpers;
 import java.io.BufferedReader;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.ServiceConfigurationError;
+import java.util.ServiceLoader;
+import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
-import org.xml.sax.SAXException;
 
 
 /**
@@ -70,7 +77,11 @@
  * @since 1.4, SAX 2.0
  * @author David Megginson, David Brownell
  * @version 2.0.1 (sax2r2)
+ *
+ * @deprecated It is recommended to use {@link javax.xml.parsers.SAXParserFactory}
+ * instead.
  */
+@Deprecated(since="9")
 final public class XMLReaderFactory
 {
     /**
@@ -83,47 +94,43 @@
     }
 
     private static final String property = "org.xml.sax.driver";
-    private static SecuritySupport ss = new SecuritySupport();
+    private static final SecuritySupport ss = new SecuritySupport();
 
-    private static String _clsFromJar = null;
-    private static boolean _jarread = false;
     /**
-     * Attempt to create an XMLReader from system defaults.
-     * In environments which can support it, the name of the XMLReader
-     * class is determined by trying each these options in order, and
-     * using the first one which succeeds:
-     * <ul>
-     *
+     * Obtains a new instance of a {@link org.xml.sax.XMLReader}.
+     * This method uses the following ordered lookup procedure to find and load
+     * the {@link org.xml.sax.XMLReader} implementation class:
+     * <p>
+     * <ol>
      * <li>If the system property {@code org.xml.sax.driver}
      * has a value, that is used as an XMLReader class name. </li>
-     *
-     * <li>The JAR "Services API" is used to look for a class name
-     * in the <em>META-INF/services/org.xml.sax.driver</em> file in
-     * jarfiles available to the runtime.</li>
-     *
-     * <li> SAX parser distributions are strongly encouraged to provide
-     * a default XMLReader class name that will take effect only when
-     * previous options (on this list) are not successful.</li>
+     * <li>
+     * Use the service-provider loading facility, defined by the
+     * {@link java.util.ServiceLoader} class, to attempt to locate and load an
+     * implementation of the service {@link org.xml.sax.XMLReader} by using the
+     * {@linkplain java.lang.Thread#getContextClassLoader() current thread's context class loader}.
+     * If the context class loader is null, the
+     * {@linkplain ClassLoader#getSystemClassLoader() system class loader} will
+     * be used.
+     * </li>
+     * <li>
+     * Deprecated. Look for a class name in the {@code META-INF/services/org.xml.sax.driver}
+     * file in a jar file available to the runtime.</li>
+     * <li>
+     * <p>
+     * Otherwise, the system-default implementation is returned.
+     * </li>
+     * </ol>
      *
-     * <li>Finally, if {@link ParserFactory#makeParser()} can
-     * return a system default SAX1 parser, that parser is wrapped in
-     * a {@link ParserAdapter}.  (This is a migration aid for SAX1
-     * environments, where the {@code org.xml.sax.parser} system
-     * property will often be usable.) </li>
-     * </ul>
+     * @apiNote
+     * The process that looks for a class name in the
+     * {@code META-INF/services/org.xml.sax.driver} file in a jar file does not
+     * conform to the specification of the service-provider loading facility
+     * as defined in {@link java.util.ServiceLoader} and therefore does not
+     * support modularization. It is deprecated as of Java SE 9 and subject to
+     * removal in a future release.
      *
-     * <p> In environments such as small embedded systems, which can not
-     * support that flexibility, other mechanisms to determine the default
-     * may be used.
-     *
-     * <p>Note that many Java environments allow system properties to be
-     * initialized on a command line.  This means that <em>in most cases</em>
-     * setting a good value for that property ensures that calls to this
-     * method will succeed, except when security policies intervene.
-     * This will also maximize application portability to older SAX
-     * environments, with less robust implementations of this method.
-     *
-     * @return A new XMLReader.
+     * @return a new XMLReader.
      * @exception org.xml.sax.SAXException If no default XMLReader class
      *            can be identified and instantiated.
      * @see #createXMLReader(java.lang.String)
@@ -132,7 +139,7 @@
         throws SAXException
     {
         String          className = null;
-        ClassLoader     cl = ss.getContextClassLoader();
+        ClassLoader     cl = ss.getClassLoader();
 
         // 1. try the JVM-instance-wide system property
         try {
@@ -140,62 +147,26 @@
         }
         catch (RuntimeException e) { /* continue searching */ }
 
-        // 2. if that fails, try META-INF/services/
+        // 2. try the ServiceLoader
         if (className == null) {
-            if (!_jarread) {
-                _jarread = true;
-                String      service = "META-INF/services/" + property;
-                InputStream in;
-                BufferedReader      reader;
-
-                try {
-                    if (cl != null) {
-                        in = ss.getResourceAsStream(cl, service);
-
-                        // If no provider found then try the current ClassLoader
-                        if (in == null) {
-                            cl = null;
-                            in = ss.getResourceAsStream(cl, service);
-                        }
-                    } else {
-                        // No Context ClassLoader, try the current ClassLoader
-                        in = ss.getResourceAsStream(cl, service);
-                    }
-
-                    if (in != null) {
-                        reader = new BufferedReader (new InputStreamReader (in, "UTF8"));
-                        _clsFromJar = reader.readLine ();
-                        in.close ();
-                    }
-                } catch (Exception e) {
-                }
+            final XMLReader provider = findServiceProvider(XMLReader.class, cl);
+            if (provider != null) {
+                return provider;
             }
-            className = _clsFromJar;
         }
 
-        // 3. Distro-specific fallback
+        // 3. try META-INF/services/org.xml.sax.driver. This old process allows
+        // legacy providers to be found
         if (className == null) {
-// BEGIN DISTRIBUTION-SPECIFIC
-
-            // EXAMPLE:
-            // className = "com.example.sax.XmlReader";
-            // or a $JAVA_HOME/jre/lib/*properties setting...
-            className = "com.sun.org.apache.xerces.internal.parsers.SAXParser";
-
-// END DISTRIBUTION-SPECIFIC
+            className = jarLookup(cl);
         }
 
-        // do we know the XMLReader implementation class yet?
-        if (className != null)
-            return loadClass (cl, className);
+        // 4. Distro-specific fallback
+        if (className == null) {
+            return new com.sun.org.apache.xerces.internal.parsers.SAXParser();
+        }
 
-        // 4. panic -- adapt any SAX1 parser
-        try {
-            return new ParserAdapter (ParserFactory.makeParser ());
-        } catch (Exception e) {
-            throw new SAXException ("Can't create default XMLReader; "
-                    + "is system property org.xml.sax.driver set?");
-        }
+        return loadClass (cl, className);
     }
 
 
@@ -217,14 +188,14 @@
     public static XMLReader createXMLReader (String className)
         throws SAXException
     {
-        return loadClass (ss.getContextClassLoader(), className);
+        return loadClass (ss.getClassLoader(), className);
     }
 
     private static XMLReader loadClass (ClassLoader loader, String className)
     throws SAXException
     {
         try {
-            return (XMLReader) NewInstance.newInstance (loader, className);
+            return NewInstance.newInstance (XMLReader.class, loader, className);
         } catch (ClassNotFoundException e1) {
             throw new SAXException("SAX2 driver class " + className +
                                    " not found", e1);
@@ -240,4 +211,64 @@
                                    " does not implement XMLReader", e4);
         }
     }
+
+    /**
+     * Locates a provider by directly reading the jar service file.
+     * @param loader the ClassLoader to be used to read the service file
+     * @return the name of the provider, or null if nothing is found
+     */
+    private static String jarLookup(final ClassLoader loader) {
+        final ClassLoader cl = Objects.requireNonNull(loader);
+        String clsFromJar = null;
+        String service = "META-INF/services/" + property;
+        InputStream in;
+        BufferedReader      reader;
+
+        try {
+            in = ss.getResourceAsStream(cl, service);
+
+            // If no provider found then try the current ClassLoader
+            if (in == null) {
+                in = ss.getResourceAsStream(null, service);
+            }
+
+            if (in != null) {
+                reader = new BufferedReader (new InputStreamReader (in, "UTF8"));
+                clsFromJar = reader.readLine ();
+                in.close ();
+            }
+        } catch (IOException e) {
+        }
+        return clsFromJar;
+    }
+
+    /*
+     * Try to find provider using the ServiceLoader API
+     *
+     * @param type Base class / Service interface of the factory to find.
+     *
+     * @return instance of provider class if found or null
+     */
+    private static <T> T findServiceProvider(final Class<T> type, final ClassLoader loader)
+            throws SAXException {
+        ClassLoader cl = Objects.requireNonNull(loader);
+        try {
+            return AccessController.doPrivileged((PrivilegedAction<T>) () -> {
+                final ServiceLoader<T> serviceLoader;
+                serviceLoader = ServiceLoader.load(type, cl);
+                final Iterator<T> iterator = serviceLoader.iterator();
+                if (iterator.hasNext()) {
+                    return iterator.next();
+                } else {
+                    return null;
+                }
+            });
+        } catch(ServiceConfigurationError e) {
+            final RuntimeException x = new RuntimeException(
+                    "Provider for " + type + " cannot be created", e);
+            throw new SAXException("Provider for " + type + " cannot be created", x);
+
+          }
+      }
+
 }
--- a/jaxp/test/Makefile	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/test/Makefile	Tue May 17 05:38:15 2016 -0700
@@ -76,14 +76,20 @@
 TEST_ROOT := $(shell $(PWD))
 
 # Root of all test results
-ifdef ALT_OUTPUTDIR
-  ABS_OUTPUTDIR = $(shell $(CD) $(ALT_OUTPUTDIR) && $(PWD))
+ifdef TEST_OUTPUT_DIR
+  $(shell $(MKDIR) -p $(TEST_OUTPUT_DIR)/jtreg)
+  ABS_TEST_OUTPUT_DIR := \
+    $(shell $(CD) $(TEST_OUTPUT_DIR)/jtreg && $(PWD))
 else
-  ABS_OUTPUTDIR = $(shell $(CD) $(TEST_ROOT)/.. && $(PWD))
-endif
+  ifdef ALT_OUTPUTDIR
+    ABS_OUTPUTDIR = $(shell $(CD) $(ALT_OUTPUTDIR) && $(PWD))
+  else
+    ABS_OUTPUTDIR = $(shell $(CD) $(TEST_ROOT)/.. && $(PWD))
+  endif
 
-ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
-ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
+  ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
+  ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
+endif
 
 # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
 ifndef PRODUCT_HOME
--- a/jaxp/test/ProblemList.txt	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/test/ProblemList.txt	Tue May 17 05:38:15 2016 -0700
@@ -29,3 +29,5 @@
 # 8150145
 javax/xml/jaxp/unittest/common/TransformationWarningsTest.java	generic-all
 
+# 8156508
+javax/xml/jaxp/unittest/stream/FactoryFindTest.java             generic-all
--- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/BasicModularXMLParserTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/BasicModularXMLParserTest.java	Tue May 17 05:38:15 2016 -0700
@@ -38,7 +38,7 @@
  * @library /javax/xml/jaxp/libs
  * @build jdk.testlibrary.*
  * @run testng BasicModularXMLParserTest
- * @bug 8078820
+ * @bug 8078820 8156119
  * @summary Tests JAXP lib can instantiate the following interfaces
  *          with customized provider module on boot layer
  *
@@ -51,6 +51,7 @@
  *          javax.xml.transform.TransformerFactory
  *          javax.xml.validation.SchemaFactory
  *          javax.xml.xpath.XPathFactory
+ *          org.xml.sax.XMLReader
  */
 
 @Test
--- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/LayerModularXMLParserTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/LayerModularXMLParserTest.java	Tue May 17 05:38:15 2016 -0700
@@ -50,7 +50,7 @@
  * @library /javax/xml/jaxp/libs
  * @build jdk.testlibrary.*
  * @run testng LayerModularXMLParserTest
- * @bug 8078820
+ * @bug 8078820 8156119
  * @summary Tests JAXP lib works with layer and TCCL
  */
 
@@ -75,7 +75,7 @@
      * services provided by provider2
      */
     private static final String[] services2 = { "javax.xml.datatype.DatatypeFactory",
-            "javax.xml.stream.XMLEventFactory" };
+            "javax.xml.stream.XMLEventFactory", "org.xml.sax.XMLReader" };
 
     /*
      * Compiles all modules used by the test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/XMLReaderFactoryTest.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import jdk.testlibrary.CompilerUtils;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @build jdk.testlibrary.*
+ * @run testng XMLReaderFactoryTest
+ * @bug 8152912 8015099 8156119
+ * @summary Tests XMLReaderFactory can work as ServiceLoader compliant, as well as backward compatible
+ */
+
+@Test
+public class XMLReaderFactoryTest {
+    private static final String TEST_SRC = System.getProperty("test.src");
+
+    private static final Path SRC_DIR = Paths.get(TEST_SRC, "src").resolve("xmlprovider3");
+    private static final Path CLASSES_DIR = Paths.get("classes");
+    private static final Path LEGACY_DIR = CLASSES_DIR.resolve("legacy");
+    private static final Path SERVICE_DIR = CLASSES_DIR.resolve("service");
+
+    // resources to copy to the class path
+    private static final String LEGACY_SERVICE_FILE = "legacy/META-INF/services/org.xml.sax.driver";
+    private static final String SERVICE_FILE = "service/META-INF/services/org.xml.sax.XMLReader";
+
+    /*
+     * Compile class and copy service files
+     */
+    @BeforeTest
+    public void setup() throws Exception {
+        setup(LEGACY_DIR, LEGACY_SERVICE_FILE);
+        setup(SERVICE_DIR, SERVICE_FILE);
+    }
+
+    private void setup(Path dest, String serviceFile) throws Exception {
+        Files.createDirectories(dest);
+        assertTrue(CompilerUtils.compile(SRC_DIR, dest));
+
+        Path file = Paths.get(serviceFile.replace('/', File.separatorChar));
+        Path source = SRC_DIR.resolve(file);
+        Path target = CLASSES_DIR.resolve(file);
+        Files.createDirectories(target.getParent());
+        Files.copy(source, target);
+
+    }
+
+    public void testService() throws Exception {
+        ClassLoader clBackup = Thread.currentThread().getContextClassLoader();
+        try {
+            URL[] classUrls = { SERVICE_DIR.toUri().toURL() };
+            URLClassLoader loader = new URLClassLoader(classUrls, ClassLoader.getSystemClassLoader().getParent());
+
+            // set TCCL and try locating the provider
+            Thread.currentThread().setContextClassLoader(loader);
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            assertEquals(reader.getClass().getName(), "xp3.XMLReaderImpl");
+        } finally {
+            Thread.currentThread().setContextClassLoader(clBackup);
+        }
+    }
+
+    public void testLegacy() throws Exception {
+        ClassLoader clBackup = Thread.currentThread().getContextClassLoader();
+        try {
+            URL[] classUrls = { LEGACY_DIR.toUri().toURL() };
+            URLClassLoader loader = new URLClassLoader(classUrls, ClassLoader.getSystemClassLoader().getParent());
+
+            // set TCCL and try locating the provider
+            Thread.currentThread().setContextClassLoader(loader);
+            XMLReader reader1 = XMLReaderFactory.createXMLReader();
+            assertEquals(reader1.getClass().getName(), "xp3.XMLReaderImpl");
+
+            // now point to a random URL
+            Thread.currentThread().setContextClassLoader(
+                    new URLClassLoader(new URL[0], ClassLoader.getSystemClassLoader().getParent()));
+            // ClassNotFoundException if also trying to load class of reader1, which
+            // would be the case before 8152912
+            XMLReader reader2 = XMLReaderFactory.createXMLReader();
+            assertEquals(reader2.getClass().getName(), "com.sun.org.apache.xerces.internal.parsers.SAXParser");
+        } finally {
+            Thread.currentThread().setContextClassLoader(clBackup);
+        }
+    }
+}
--- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/test/test/XMLFactoryHelper.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/test/test/XMLFactoryHelper.java	Tue May 17 05:38:15 2016 -0700
@@ -31,6 +31,8 @@
 import java.util.Iterator;
 import java.util.ServiceLoader;
 
+import org.xml.sax.helpers.XMLReaderFactory;
+
 public class XMLFactoryHelper {
     /*
      * instantiate a xml factory by reflection e.g.
@@ -41,7 +43,9 @@
         try {
             // set thread context class loader to module class loader
             Thread.currentThread().setContextClassLoader(XMLFactoryHelper.class.getClassLoader());
-            if (serviceName.equals("javax.xml.validation.SchemaFactory"))
+            if (serviceName.equals("org.xml.sax.XMLReader"))
+                return XMLReaderFactory.createXMLReader();
+            else if (serviceName.equals("javax.xml.validation.SchemaFactory"))
                 return Class.forName(serviceName).getMethod("newInstance", String.class)
                         .invoke(null, W3C_XML_SCHEMA_NS_URI);
             else
--- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/unnamed/Main.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/unnamed/Main.java	Tue May 17 05:38:15 2016 -0700
@@ -30,6 +30,8 @@
 import java.util.Set;
 import java.util.stream.Stream;
 
+import org.xml.sax.helpers.XMLReaderFactory;
+
 public class Main {
     /*
      * @param args, the names of provider modules, which have been loaded
@@ -69,7 +71,9 @@
      */
     private static Object instantiateXMLService(String serviceName) {
         try {
-            if (serviceName.equals("javax.xml.validation.SchemaFactory"))
+            if (serviceName.equals("org.xml.sax.XMLReader"))
+                return XMLReaderFactory.createXMLReader();
+            else if (serviceName.equals("javax.xml.validation.SchemaFactory"))
                 return Class.forName(serviceName).getMethod("newInstance", String.class)
                         .invoke(null, W3C_XML_SCHEMA_NS_URI);
             else
@@ -102,6 +106,7 @@
             "javax.xml.parsers.DocumentBuilderFactory", "javax.xml.parsers.SAXParserFactory",
             "javax.xml.stream.XMLEventFactory", "javax.xml.stream.XMLInputFactory",
             "javax.xml.stream.XMLOutputFactory", "javax.xml.transform.TransformerFactory",
-            "javax.xml.validation.SchemaFactory", "javax.xml.xpath.XPathFactory" };
+            "javax.xml.validation.SchemaFactory", "javax.xml.xpath.XPathFactory",
+            "org.xml.sax.XMLReader"};
 
 }
--- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/xmlprovider2/module-info.java	Sat May 14 09:11:07 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/xmlprovider2/module-info.java	Tue May 17 05:38:15 2016 -0700
@@ -26,4 +26,5 @@
 
     provides javax.xml.datatype.DatatypeFactory with xp2.DatatypeFactoryImpl;
     provides javax.xml.stream.XMLEventFactory with xp2.XMLEventFactoryImpl;
+    provides org.xml.sax.XMLReader with xp2.XMLReaderImpl;
 }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/xmlprovider2/xp2/XMLReaderImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 xp2;
+
+import java.io.IOException;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+
+public class XMLReaderImpl implements XMLReader {
+
+    @Override
+    public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
+        return false;
+    }
+
+    @Override
+    public void setFeature(String name, boolean value) throws SAXNotRecognizedException,
+            SAXNotSupportedException {
+    }
+
+    @Override
+    public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
+        return null;
+    }
+
+    @Override
+    public void setProperty(String name, Object value) throws SAXNotRecognizedException,
+            SAXNotSupportedException {
+    }
+
+    @Override
+    public void setEntityResolver(EntityResolver resolver) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public EntityResolver getEntityResolver() {
+        return null;
+    }
+
+    @Override
+    public void setDTDHandler(DTDHandler handler) {
+    }
+
+    @Override
+    public DTDHandler getDTDHandler() {
+        return null;
+    }
+
+    @Override
+    public void setContentHandler(ContentHandler handler) {
+    }
+
+    @Override
+    public ContentHandler getContentHandler() {
+        return null;
+    }
+
+    @Override
+    public void setErrorHandler(ErrorHandler handler) {
+    }
+
+    @Override
+    public ErrorHandler getErrorHandler() {
+        return null;
+    }
+
+    @Override
+    public void parse(InputSource input) throws IOException, SAXException {
+    }
+
+    @Override
+    public void parse(String systemId) throws IOException, SAXException {
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/xmlprovider3/legacy/META-INF/services/org.xml.sax.driver	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,1 @@
+xp3.XMLReaderImpl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/xmlprovider3/service/META-INF/services/org.xml.sax.XMLReader	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,1 @@
+xp3.XMLReaderImpl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/xmlprovider3/xp3/XMLReaderImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 xp3;
+
+import java.io.IOException;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+
+public class XMLReaderImpl implements XMLReader {
+
+    @Override
+    public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
+        return false;
+    }
+
+    @Override
+    public void setFeature(String name, boolean value) throws SAXNotRecognizedException,
+            SAXNotSupportedException {
+    }
+
+    @Override
+    public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
+        return null;
+    }
+
+    @Override
+    public void setProperty(String name, Object value) throws SAXNotRecognizedException,
+            SAXNotSupportedException {
+    }
+
+    @Override
+    public void setEntityResolver(EntityResolver resolver) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public EntityResolver getEntityResolver() {
+        return null;
+    }
+
+    @Override
+    public void setDTDHandler(DTDHandler handler) {
+    }
+
+    @Override
+    public DTDHandler getDTDHandler() {
+        return null;
+    }
+
+    @Override
+    public void setContentHandler(ContentHandler handler) {
+    }
+
+    @Override
+    public ContentHandler getContentHandler() {
+        return null;
+    }
+
+    @Override
+    public void setErrorHandler(ErrorHandler handler) {
+    }
+
+    @Override
+    public ErrorHandler getErrorHandler() {
+        return null;
+    }
+
+    @Override
+    public void parse(InputSource input) throws IOException, SAXException {
+    }
+
+    @Override
+    public void parse(String systemId) throws IOException, SAXException {
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.testng.annotations.DataProvider;
+
+/*
+ * @test
+ * @bug 8145974
+ * @modules javax.xml
+ * @summary Check that XMLStreamWriter generates valid xml with surrogate pair
+ *  used within element text
+ */
+
+public class SurrogatesTest {
+
+    // Test that valid surrogate characters can be written/readen by xml stream
+    // reader/writer
+    @Test(dataProvider = "validData")
+    public void xmlWithValidSurrogatesTest(String content)
+            throws Exception {
+        generateAndReadXml(content);
+    }
+
+    // Test that unbalanced surrogate character will
+    @Test(dataProvider = "invalidData",
+            expectedExceptions = XMLStreamException.class)
+    public void xmlWithUnbalancedSurrogatesTest(String content)
+            throws Exception {
+        generateAndReadXml(content);
+    }
+
+    // Generates xml content with XMLStreamWriter and read it to check
+    // for correctness of xml and generated data
+    void generateAndReadXml(String content) throws Exception {
+        ByteArrayOutputStream stream = new ByteArrayOutputStream();
+        XMLOutputFactory factory = XMLOutputFactory.newInstance();
+        OutputStreamWriter streamWriter = new OutputStreamWriter(stream);
+        XMLStreamWriter writer = factory.createXMLStreamWriter(streamWriter);
+
+        // Generate xml with selected stream writer type
+        generateXML(writer, content);
+        String output = stream.toString();
+        System.out.println("Generated xml: " + output);
+        // Read generated xml with StAX parser
+        readXML(output.getBytes(), content);
+    }
+
+    // Generates XML with provided xml stream writer. Provided string
+    // is inserted into xml twice: with usage of writeCharacters( String )
+    // and writeCharacters( char [], int , int )
+    private void generateXML(XMLStreamWriter writer, String sequence)
+            throws XMLStreamException {
+        char[] seqArr = sequence.toCharArray();
+        writer.writeStartDocument();
+        writer.writeStartElement("root");
+
+        // Use writeCharacters( String ) to write characters
+        writer.writeStartElement("writeCharactersWithString");
+        writer.writeCharacters(sequence);
+        writer.writeEndElement();
+
+        // Use writeCharacters( char [], int , int ) to write characters
+        writer.writeStartElement("writeCharactersWithArray");
+        writer.writeCharacters(seqArr, 0, seqArr.length);
+        writer.writeEndElement();
+
+        // Close root element and document
+        writer.writeEndElement();
+        writer.writeEndDocument();
+        writer.flush();
+        writer.close();
+    }
+
+    // Reads generated XML data and check if it contains expected
+    // text in writeCharactersWithString and writeCharactersWithArray
+    // elements
+    private void readXML(byte[] xmlData, String expectedContent)
+            throws Exception {
+        InputStream stream = new ByteArrayInputStream(xmlData);
+        XMLInputFactory factory = XMLInputFactory.newInstance();
+        XMLStreamReader xmlReader
+                = factory.createXMLStreamReader(stream);
+        boolean inTestElement = false;
+        StringBuilder sb = new StringBuilder();
+        while (xmlReader.hasNext()) {
+            String ename;
+            switch (xmlReader.getEventType()) {
+                case XMLStreamConstants.START_ELEMENT:
+                    ename = xmlReader.getLocalName();
+                    if (ename.equals("writeCharactersWithString")
+                            || ename.equals("writeCharactersWithArray")) {
+                        inTestElement = true;
+                    }
+                    break;
+                case XMLStreamConstants.END_ELEMENT:
+                    ename = xmlReader.getLocalName();
+                    if (ename.equals("writeCharactersWithString")
+                            || ename.equals("writeCharactersWithArray")) {
+                        inTestElement = false;
+                        String content = sb.toString();
+                        System.out.println(ename + " text:'" + content + "' expected:'" + expectedContent+"'");
+                        Assert.assertEquals(content, expectedContent);
+                        sb.setLength(0);
+                    }
+                    break;
+                case XMLStreamConstants.CHARACTERS:
+                    if (inTestElement) {
+                        sb.append(xmlReader.getText());
+                    }
+                    break;
+            }
+            xmlReader.next();
+        }
+    }
+
+    @DataProvider(name = "validData")
+    Object[][] getValidData() {
+        return new Object[][] {
+            {"Don't Worry Be \uD83D\uDE0A"},
+            {"BMP characters \uE000\uFFFD"},
+            {"Simple text"},
+        };
+    }
+
+    @DataProvider(name = "invalidData")
+    Object[][] getInvalidData() {
+        return new Object[][] {
+            {"Unbalanced surrogate \uD83D"},
+            {"Unbalanced surrogate \uD83Dis here"},
+            {"Surrogate with followup BMP\uD83D\uFFF9"},
+        };
+    }
+}
--- a/jaxws/.hgtags	Sat May 14 09:11:07 2016 -0700
+++ b/jaxws/.hgtags	Tue May 17 05:38:15 2016 -0700
@@ -363,3 +363,4 @@
 4ff86e5489e4c0513dadfa69def8601c110ca5cd jdk-9+115
 529f0bf896e58525614d863e283ad155531941cb jdk-9+116
 58265b39fc74b932bda4d4f4649c530a89f55c4e jdk-9+117
+6ba73d04589ccc0705a5d8ae5111b63632b6ad20 jdk-9+118
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Tue May 17 05:38:15 2016 -0700
@@ -95,12 +95,12 @@
 
     /*non-public*/ MethodHandle varHandleMethodInvoker(VarHandle.AccessMode ak) {
         // TODO cache invoker
-        return makeVarHandleMethodInvoker(ak);
+        return makeVarHandleMethodInvoker(ak, false);
     }
 
     /*non-public*/ MethodHandle varHandleMethodExactInvoker(VarHandle.AccessMode ak) {
         // TODO cache invoker
-        return makeVarHandleMethodExactInvoker(ak);
+        return makeVarHandleMethodInvoker(ak, true);
     }
 
     private MethodHandle cachedInvoker(int idx) {
@@ -127,26 +127,11 @@
         return invoker;
     }
 
-    private MethodHandle makeVarHandleMethodInvoker(VarHandle.AccessMode ak) {
+    private MethodHandle makeVarHandleMethodInvoker(VarHandle.AccessMode ak, boolean isExact) {
         MethodType mtype = targetType;
         MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class);
 
-        LambdaForm lform = varHandleMethodGenericInvokerHandleForm(ak.methodName(), mtype);
-        VarHandle.AccessDescriptor ad = new VarHandle.AccessDescriptor(mtype, ak.at.ordinal(), ak.ordinal());
-        MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, ad);
-
-        invoker = invoker.withInternalMemberName(MemberName.makeVarHandleMethodInvoke(ak.methodName(), mtype), false);
-        assert(checkVarHandleInvoker(invoker));
-
-        maybeCompileToBytecode(invoker);
-        return invoker;
-    }
-
-    private MethodHandle makeVarHandleMethodExactInvoker(VarHandle.AccessMode ak) {
-        MethodType mtype = targetType;
-        MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class);
-
-        LambdaForm lform = varHandleMethodExactInvokerHandleForm(ak.methodName(), mtype);
+        LambdaForm lform = varHandleMethodInvokerHandleForm(ak.methodName(), mtype, isExact);
         VarHandle.AccessDescriptor ad = new VarHandle.AccessDescriptor(mtype, ak.at.ordinal(), ak.ordinal());
         MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, ad);
 
@@ -400,59 +385,7 @@
         return lform;
     }
 
-    private static LambdaForm varHandleMethodExactInvokerHandleForm(String name, MethodType mtype) {
-        // TODO Cache form?
-
-        final int THIS_MH      = 0;
-        final int CALL_VH      = THIS_MH + 1;
-        final int ARG_BASE     = CALL_VH + 1;
-        final int ARG_LIMIT = ARG_BASE + mtype.parameterCount();
-        int nameCursor = ARG_LIMIT;
-        final int VAD_ARG      = nameCursor++;
-        final int CHECK_TYPE   = nameCursor++;
-        final int GET_MEMBER   = nameCursor++;
-        final int LINKER_CALL  = nameCursor++;
-
-        MethodType invokerFormType = mtype.insertParameterTypes(0, VarHandle.class)
-                .basicType()
-                .appendParameterTypes(MemberName.class);
-
-        MemberName linker = new MemberName(MethodHandle.class, "linkToStatic", invokerFormType, REF_invokeStatic);
-        try {
-            linker = MemberName.getFactory().resolveOrFail(REF_invokeStatic, linker, null, NoSuchMethodException.class);
-        } catch (ReflectiveOperationException ex) {
-            throw newInternalError(ex);
-        }
-
-        Name[] names = new Name[LINKER_CALL + 1];
-        names[THIS_MH] = argument(THIS_MH, BasicType.basicType(Object.class));
-        names[CALL_VH] = argument(CALL_VH, BasicType.basicType(Object.class));
-        for (int i = 0; i < mtype.parameterCount(); i++) {
-            names[ARG_BASE + i] = argument(ARG_BASE + i, BasicType.basicType(mtype.parameterType(i)));
-        }
-
-        BoundMethodHandle.SpeciesData speciesData = BoundMethodHandle.speciesData_L();
-        names[THIS_MH] = names[THIS_MH].withConstraint(speciesData);
-
-        NamedFunction getter = speciesData.getterFunction(0);
-        names[VAD_ARG] = new Name(getter, names[THIS_MH]);
-
-        Object[] outArgs = Arrays.copyOfRange(names, CALL_VH, ARG_LIMIT + 1, Object[].class);
-
-        names[CHECK_TYPE] = new Name(NF_checkVarHandleExactType, names[CALL_VH], names[VAD_ARG]);
-
-        names[GET_MEMBER] = new Name(NF_getVarHandleMemberName, names[CALL_VH], names[VAD_ARG]);
-        outArgs[outArgs.length - 1] = names[GET_MEMBER];
-
-        names[LINKER_CALL] = new Name(linker, outArgs);
-        LambdaForm lform = new LambdaForm(name + ":VarHandle_exactInvoker" + shortenSignature(basicTypeSignature(mtype)),
-                                          ARG_LIMIT, names);
-
-        lform.compileToBytecode();
-        return lform;
-    }
-
-    private static LambdaForm varHandleMethodGenericInvokerHandleForm(String name, MethodType mtype) {
+    private static LambdaForm varHandleMethodInvokerHandleForm(String name, MethodType mtype, boolean isExact) {
         // TODO Cache form?
 
         final int THIS_MH      = 0;
@@ -477,8 +410,11 @@
         NamedFunction getter = speciesData.getterFunction(0);
         names[VAD_ARG] = new Name(getter, names[THIS_MH]);
 
-        names[CHECK_TYPE] = new Name(NF_checkVarHandleGenericType, names[CALL_VH], names[VAD_ARG]);
-
+        if (isExact) {
+            names[CHECK_TYPE] = new Name(NF_checkVarHandleExactType, names[CALL_VH], names[VAD_ARG]);
+        } else {
+            names[CHECK_TYPE] = new Name(NF_checkVarHandleGenericType, names[CALL_VH], names[VAD_ARG]);
+        }
         Object[] outArgs = new Object[ARG_LIMIT];
         outArgs[0] = names[CHECK_TYPE];
         for (int i = 1; i < ARG_LIMIT; i++) {
@@ -488,7 +424,8 @@
         MethodType outCallType = mtype.insertParameterTypes(0, VarHandle.class)
                 .basicType();
         names[LINKER_CALL] = new Name(outCallType, outArgs);
-        LambdaForm lform = new LambdaForm(name + ":VarHandle_invoker" + shortenSignature(basicTypeSignature(mtype)),
+        String debugName = isExact ? ":VarHandle_exactInvoker" : ":VarHandle_invoker";
+        LambdaForm lform = new LambdaForm(name + debugName + shortenSignature(basicTypeSignature(mtype)),
                                           ARG_LIMIT, names);
 
         lform.prepare();
@@ -511,21 +448,13 @@
 
     /*non-public*/ static
     @ForceInline
-    void checkVarHandleExactType(VarHandle handle, VarHandle.AccessDescriptor ad) {
-        MethodType erasedTarget = handle.vform.methodType_table[ad.type];
-        MethodType erasedSymbolic = ad.symbolicMethodTypeErased;
-        if (erasedTarget != erasedSymbolic)
-            throw newWrongMethodTypeException(erasedTarget, erasedSymbolic);
-    }
-
-    /*non-public*/ static
-    @ForceInline
-    MemberName getVarHandleMemberName(VarHandle handle, VarHandle.AccessDescriptor ad) {
-        MemberName mn = handle.vform.memberName_table[ad.mode];
-        if (mn == null) {
-            throw handle.unsupported();
+    MethodHandle checkVarHandleExactType(VarHandle handle, VarHandle.AccessDescriptor ad) {
+        MethodHandle mh = handle.getMethodHandle(ad.mode);
+        MethodType mt = mh.type();
+        if (mt != ad.symbolicMethodTypeInvoker) {
+            throw newWrongMethodTypeException(mt, ad.symbolicMethodTypeInvoker);
         }
-        return mn;
+        return mh;
     }
 
     /*non-public*/ static
@@ -649,8 +578,7 @@
         NF_getCallSiteTarget,
         NF_checkCustomized,
         NF_checkVarHandleGenericType,
-        NF_checkVarHandleExactType,
-        NF_getVarHandleMemberName;
+        NF_checkVarHandleExactType;
     static {
         try {
             NamedFunction nfs[] = {
@@ -666,8 +594,6 @@
                         .getDeclaredMethod("checkVarHandleGenericType", VarHandle.class, VarHandle.AccessDescriptor.class)),
                 NF_checkVarHandleExactType = new NamedFunction(Invokers.class
                         .getDeclaredMethod("checkVarHandleExactType", VarHandle.class, VarHandle.AccessDescriptor.class)),
-                NF_getVarHandleMemberName = new NamedFunction(Invokers.class
-                        .getDeclaredMethod("getVarHandleMemberName", VarHandle.class, VarHandle.AccessDescriptor.class))
             };
             // Each nf must be statically invocable or we get tied up in our bootstraps.
             assert(InvokerBytecodeGenerator.isStaticallyInvocable(nfs));
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Tue May 17 05:38:15 2016 -0700
@@ -1475,11 +1475,11 @@
         TypesAndInvokers tis = getTypesAndInvokers();
         MethodHandle mh = tis.methodHandle_table[mode];
         if (mh == null) {
-            mh = tis.methodHandle_table[mode] = getMethodHandleUncached(tis, mode);
+            mh = tis.methodHandle_table[mode] = getMethodHandleUncached(mode);
         }
         return mh;
     }
-    private final MethodHandle getMethodHandleUncached(TypesAndInvokers tis, int mode) {
+    private final MethodHandle getMethodHandleUncached(int mode) {
         MethodType mt = accessModeType(AccessMode.values()[mode]).
                 insertParameterTypes(0, VarHandle.class);
         MemberName mn = vform.getMemberName(mode);
--- a/jdk/src/java.base/share/classes/java/nio/Buffer.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/nio/Buffer.java	Tue May 17 05:38:15 2016 -0700
@@ -111,7 +111,7 @@
  * to zero.
  *
  *
- * <h2> Clearing, flipping, and rewinding </h2>
+ * <h2> Additional operations </h2>
  *
  * <p> In addition to methods for accessing the position, limit, and capacity
  * values and for marking and resetting, this class also defines the following
@@ -131,6 +131,12 @@
  *   it already contains: It leaves the limit unchanged and sets the position
  *   to zero.  </p></li>
  *
+ *   <li><p> {@link #slice} creates a subsequence of a buffer: It leaves the
+ *   limit and the position unchanged. </p></li>
+ *
+ *   <li><p> {@link #duplicate} creates a shallow copy of a buffer: It leaves
+ *   the limit and the position unchanged. </p></li>
+ *
  * </ul>
  *
  *
@@ -567,6 +573,46 @@
      */
     public abstract boolean isDirect();
 
+    /**
+     * Creates a new buffer whose content is a shared subsequence of
+     * this buffer's content.
+     *
+     * <p> The content of the new buffer will start at this buffer's current
+     * position.  Changes to this buffer's content will be visible in the new
+     * buffer, and vice versa; the two buffers' position, limit, and mark
+     * values will be independent.
+     *
+     * <p> The new buffer's position will be zero, its capacity and its limit
+     * will be the number of elements remaining in this buffer, its mark will be
+     * undefined. The new buffer will be direct if, and only if, this buffer is
+     * direct, and it will be read-only if, and only if, this buffer is
+     * read-only.  </p>
+     *
+     * @return  The new buffer
+     *
+     * @since 9
+     */
+    public abstract Buffer slice();
+
+    /**
+     * Creates a new buffer that shares this buffer's content.
+     *
+     * <p> The content of the new buffer will be that of this buffer.  Changes
+     * to this buffer's content will be visible in the new buffer, and vice
+     * versa; the two buffers' position, limit, and mark values will be
+     * independent.
+     *
+     * <p> The new buffer's capacity, limit, position and mark values will be
+     * identical to those of this buffer. The new buffer will be direct if, and
+     * only if, this buffer is direct, and it will be read-only if, and only if,
+     * this buffer is read-only.  </p>
+     *
+     * @return  The new buffer
+     *
+     * @since 9
+     */
+    public abstract Buffer duplicate();
+
 
     // -- Package-private methods for bounds checking, etc. --
 
--- a/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template	Tue May 17 05:38:15 2016 -0700
@@ -70,8 +70,7 @@
  *
 #end[byte]
  *
- *   <li><p> Methods for {@link #compact compacting}, {@link
- *   #duplicate duplicating}, and {@link #slice slicing}
+ *   <li><p> A method for {@link #compact compacting}
  *   $a$ $type$ buffer.  </p></li>
  *
  * </ul>
@@ -535,6 +534,7 @@
      * @see #alignedSlice(int)
 #end[byte]
      */
+    @Override
     public abstract $Type$Buffer slice();
 
     /**
@@ -557,6 +557,7 @@
      *
      * @return  The new $type$ buffer
      */
+    @Override
     public abstract $Type$Buffer duplicate();
 
     /**
--- a/jdk/src/java.base/share/classes/java/util/DualPivotQuicksort.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/DualPivotQuicksort.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -146,12 +146,26 @@
             }
         }
 
-        // Check special cases
-        // Implementation note: variable "right" is increased by 1.
-        if (run[count] == right++) { // The last run contains one element
+        // These invariants should hold true:
+        //    run[0] = 0
+        //    run[<last>] = right + 1; (terminator)
+
+        if (count == 0) {
+            // A single equal run
+            return;
+        } else if (count == 1 && run[count] > right) {
+            // Either a single ascending or a transformed descending run.
+            // Always check that a final run is a proper terminator, otherwise
+            // we have an unterminated trailing run, to handle downstream.
+            return;
+        }
+        right++;
+        if (run[count] < right) {
+            // Corner case: the final run is not a terminator. This may happen
+            // if a final run is an equals run, or there is a single-element run
+            // at the end. Fix up by adding a proper terminator at the end.
+            // Note that we terminate with (right + 1), incremented earlier.
             run[++count] = right;
-        } else if (count <= 1) { // The array is already sorted
-            return;
         }
 
         // Determine alternation base for merge
@@ -598,12 +612,26 @@
             }
         }
 
-        // Check special cases
-        // Implementation note: variable "right" is increased by 1.
-        if (run[count] == right++) { // The last run contains one element
+        // These invariants should hold true:
+        //    run[0] = 0
+        //    run[<last>] = right + 1; (terminator)
+
+        if (count == 0) {
+            // A single equal run
+            return;
+        } else if (count == 1 && run[count] > right) {
+            // Either a single ascending or a transformed descending run.
+            // Always check that a final run is a proper terminator, otherwise
+            // we have an unterminated trailing run, to handle downstream.
+            return;
+        }
+        right++;
+        if (run[count] < right) {
+            // Corner case: the final run is not a terminator. This may happen
+            // if a final run is an equals run, or there is a single-element run
+            // at the end. Fix up by adding a proper terminator at the end.
+            // Note that we terminate with (right + 1), incremented earlier.
             run[++count] = right;
-        } else if (count <= 1) { // The array is already sorted
-            return;
         }
 
         // Determine alternation base for merge
@@ -1086,12 +1114,26 @@
             }
         }
 
-        // Check special cases
-        // Implementation note: variable "right" is increased by 1.
-        if (run[count] == right++) { // The last run contains one element
+        // These invariants should hold true:
+        //    run[0] = 0
+        //    run[<last>] = right + 1; (terminator)
+
+        if (count == 0) {
+            // A single equal run
+            return;
+        } else if (count == 1 && run[count] > right) {
+            // Either a single ascending or a transformed descending run.
+            // Always check that a final run is a proper terminator, otherwise
+            // we have an unterminated trailing run, to handle downstream.
+            return;
+        }
+        right++;
+        if (run[count] < right) {
+            // Corner case: the final run is not a terminator. This may happen
+            // if a final run is an equals run, or there is a single-element run
+            // at the end. Fix up by adding a proper terminator at the end.
+            // Note that we terminate with (right + 1), incremented earlier.
             run[++count] = right;
-        } else if (count <= 1) { // The array is already sorted
-            return;
         }
 
         // Determine alternation base for merge
@@ -1574,12 +1616,26 @@
             }
         }
 
-        // Check special cases
-        // Implementation note: variable "right" is increased by 1.
-        if (run[count] == right++) { // The last run contains one element
+        // These invariants should hold true:
+        //    run[0] = 0
+        //    run[<last>] = right + 1; (terminator)
+
+        if (count == 0) {
+            // A single equal run
+            return;
+        } else if (count == 1 && run[count] > right) {
+            // Either a single ascending or a transformed descending run.
+            // Always check that a final run is a proper terminator, otherwise
+            // we have an unterminated trailing run, to handle downstream.
+            return;
+        }
+        right++;
+        if (run[count] < right) {
+            // Corner case: the final run is not a terminator. This may happen
+            // if a final run is an equals run, or there is a single-element run
+            // at the end. Fix up by adding a proper terminator at the end.
+            // Note that we terminate with (right + 1), incremented earlier.
             run[++count] = right;
-        } else if (count <= 1) { // The array is already sorted
-            return;
         }
 
         // Determine alternation base for merge
@@ -2158,12 +2214,26 @@
             }
         }
 
-        // Check special cases
-        // Implementation note: variable "right" is increased by 1.
-        if (run[count] == right++) { // The last run contains one element
+        // These invariants should hold true:
+        //    run[0] = 0
+        //    run[<last>] = right + 1; (terminator)
+
+        if (count == 0) {
+            // A single equal run
+            return;
+        } else if (count == 1 && run[count] > right) {
+            // Either a single ascending or a transformed descending run.
+            // Always check that a final run is a proper terminator, otherwise
+            // we have an unterminated trailing run, to handle downstream.
+            return;
+        }
+        right++;
+        if (run[count] < right) {
+            // Corner case: the final run is not a terminator. This may happen
+            // if a final run is an equals run, or there is a single-element run
+            // at the end. Fix up by adding a proper terminator at the end.
+            // Note that we terminate with (right + 1), incremented earlier.
             run[++count] = right;
-        } else if (count <= 1) { // The array is already sorted
-            return;
         }
 
         // Determine alternation base for merge
@@ -2701,12 +2771,26 @@
             }
         }
 
-        // Check special cases
-        // Implementation note: variable "right" is increased by 1.
-        if (run[count] == right++) { // The last run contains one element
+        // These invariants should hold true:
+        //    run[0] = 0
+        //    run[<last>] = right + 1; (terminator)
+
+        if (count == 0) {
+            // A single equal run
+            return;
+        } else if (count == 1 && run[count] > right) {
+            // Either a single ascending or a transformed descending run.
+            // Always check that a final run is a proper terminator, otherwise
+            // we have an unterminated trailing run, to handle downstream.
+            return;
+        }
+        right++;
+        if (run[count] < right) {
+            // Corner case: the final run is not a terminator. This may happen
+            // if a final run is an equals run, or there is a single-element run
+            // at the end. Fix up by adding a proper terminator at the end.
+            // Note that we terminate with (right + 1), incremented earlier.
             run[++count] = right;
-        } else if (count <= 1) { // The array is already sorted
-            return;
         }
 
         // Determine alternation base for merge
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java	Tue May 17 05:38:15 2016 -0700
@@ -68,13 +68,14 @@
         if (s != null && s.length() > 0)
             bcp = toURLClassPath(s);
 
-        // we have a class path if -cp is specified or -m is not specified
+        // we have a class path if -cp is specified or -m is not specified.
+        // If neither is specified then default to -cp <working directory>.
         URLClassPath ucp = null;
         String mainMid = System.getProperty("jdk.module.main");
         String cp = System.getProperty("java.class.path");
-        if (mainMid == null && (cp == null || cp.length() == 0))
-            cp = ".";
-        if (cp != null && cp.length() > 0)
+        if (mainMid == null && cp == null)
+            cp = "";
+        if (cp != null)
             ucp = toURLClassPath(cp);
 
 
@@ -197,7 +198,7 @@
          * @see java.lang.instrument.Instrumentation#appendToSystemClassLoaderSearch
          */
         void appendToClassPathForInstrumentation(String path) {
-            appendToUCP(path, ucp);
+            addClassPathToUCP(path, ucp);
         }
 
         /**
@@ -224,7 +225,7 @@
      */
     private static URLClassPath toURLClassPath(String cp) {
         URLClassPath ucp = new URLClassPath(new URL[0]);
-        appendToUCP(cp, ucp);
+        addClassPathToUCP(cp, ucp);
         return ucp;
     }
 
@@ -232,20 +233,28 @@
      * Converts the elements in the given class path to file URLs and adds
      * them to the given URLClassPath.
      */
-    private static void appendToUCP(String cp, URLClassPath ucp) {
-        String[] elements = cp.split(File.pathSeparator);
-        if (elements.length == 0) {
-            // contains path separator(s) only, default to current directory
-            // to be compatible with long standing behavior
-            elements = new String[] { "" };
+    private static void addClassPathToUCP(String cp, URLClassPath ucp) {
+        int off = 0;
+        int next;
+        while ((next = cp.indexOf(File.pathSeparator, off)) != -1) {
+            addURLToUCP(cp.substring(off, next), ucp);
+            off = next + 1;
         }
-        for (String s: elements) {
-            try {
-                URL url = Paths.get(s).toRealPath().toUri().toURL();
-                ucp.addURL(url);
-            } catch (InvalidPathException | IOException ignore) {
-                // malformed path string or class path element does not exist
-            }
+
+        // remaining
+        addURLToUCP(cp.substring(off), ucp);
+    }
+
+    /**
+     * Attempts to convert to the given string to a file URL and adds it
+     * to the given URLClassPath.
+     */
+    private static void addURLToUCP(String s, URLClassPath ucp) {
+        try {
+            URL url = Paths.get(s).toRealPath().toUri().toURL();
+            ucp.addURL(url);
+        } catch (InvalidPathException | IOException ignore) {
+            // malformed path string or class path element does not exist
         }
     }
 
--- a/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -259,14 +259,10 @@
 
     private static final Debug debug = Debug.getInstance("policy");
 
-    private static final String NONE = "NONE";
-    private static final String P11KEYSTORE = "PKCS11";
-
     private static final String SELF = "${{self}}";
     private static final String X500PRINCIPAL =
                         "javax.security.auth.x500.X500Principal";
     private static final String POLICY = "java.security.policy";
-    private static final String SECURITY_MANAGER = "java.security.manager";
     private static final String POLICY_URL = "policy.url.";
     private static final String AUTH_POLICY = "java.security.auth.policy";
     private static final String AUTH_POLICY_URL = "auth.policy.url.";
@@ -288,6 +284,17 @@
     private static final Class<?>[] PARAMS2 = { String.class, String.class };
 
     /**
+     * When a policy file has a syntax error, the exception code may generate
+     * another permission check and this can cause the policy file to be parsed
+     * repeatedly, leading to a StackOverflowError or ClassCircularityError.
+     * To avoid this, this set is populated with policy files that have been
+     * previously parsed and have syntax errors, so that they can be
+     * subsequently ignored.
+     */
+    private static AtomicReference<Set<URL>> badPolicyURLs =
+        new AtomicReference<>(new HashSet<>());
+
+    /**
      * Initializes the Policy object and reads the default policy
      * configuration file(s) into the Policy object.
      */
@@ -580,6 +587,16 @@
      * @param policyFile the policy Reader object.
      */
     private boolean init(URL policy, PolicyInfo newInfo) {
+
+        // skip parsing policy file if it has been previously parsed and
+        // has syntax errors
+        if (badPolicyURLs.get().contains(policy)) {
+            if (debug != null) {
+                debug.println("skipping bad policy file: " + policy);
+            }
+            return false;
+        }
+
         boolean success = false;
         PolicyParser pp = new PolicyParser(expandProperties);
         InputStreamReader isr = null;
@@ -622,13 +639,18 @@
                 addGrantEntry(ge, keyStore, newInfo);
             }
         } catch (PolicyParser.ParsingException pe) {
+            // record bad policy file to avoid later reparsing it
+            badPolicyURLs.updateAndGet(k -> {
+                k.add(policy);
+                return k;
+            });
             MessageFormat form = new MessageFormat(ResourcesMgr.getString
                 (POLICY + ".error.parsing.policy.message"));
             Object[] source = {policy, pe.getLocalizedMessage()};
             System.err.println(form.format(source));
-            if (debug != null)
+            if (debug != null) {
                 pe.printStackTrace();
-
+            }
         } catch (Exception e) {
             if (debug != null) {
                 debug.println("error parsing "+policy);
--- a/jdk/src/java.base/share/classes/sun/security/provider/PolicyParser.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/PolicyParser.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -213,7 +213,9 @@
                             new MessageFormat(ResourcesMgr.getString(
                                 "duplicate.keystore.domain.name"));
                         Object[] source = {domainName};
-                        throw new ParsingException(form.format(source));
+                        String msg = "duplicate keystore domain name: " +
+                                     domainName;
+                        throw new ParsingException(msg, form, source);
                     }
                 }
             } else {
@@ -743,7 +745,8 @@
                     ResourcesMgr.getString
                             ("expected.expect.read.end.of.file."));
             Object[] source = {expect};
-            throw new ParsingException(form.format(source));
+            String msg = "expected [" + expect + "], read [end of file]";
+            throw new ParsingException(msg, form, source);
         case StreamTokenizer.TT_WORD:
             if (expect.equalsIgnoreCase(st.sval)) {
                 lookahead = st.nextToken();
@@ -1244,7 +1247,8 @@
                 MessageFormat form = new MessageFormat(ResourcesMgr.getString(
                     "duplicate.keystore.name"));
                 Object[] source = {keystoreName};
-                throw new ParsingException(form.format(source));
+                String msg = "duplicate keystore name: " + keystoreName;
+                throw new ParsingException(msg, form, source);
             }
         }
 
@@ -1316,6 +1320,8 @@
         private static final long serialVersionUID = -4330692689482574072L;
 
         private String i18nMessage;
+        private MessageFormat form;
+        private Object[] source;
 
         /**
          * Constructs a ParsingException with the specified
@@ -1330,26 +1336,34 @@
             i18nMessage = msg;
         }
 
+        public ParsingException(String msg, MessageFormat form,
+                                Object[] source) {
+            super(msg);
+            this.form = form;
+            this.source = source;
+        }
+
         public ParsingException(int line, String msg) {
             super("line " + line + ": " + msg);
-            MessageFormat form = new MessageFormat
-                (ResourcesMgr.getString("line.number.msg"));
-            Object[] source = {line, msg};
-            i18nMessage = form.format(source);
+            // don't call form.format unless getLocalizedMessage is called
+            // to avoid unnecessary permission checks
+            form = new MessageFormat(ResourcesMgr.getString("line.number.msg"));
+            source = new Object[] {line, msg};
         }
 
         public ParsingException(int line, String expect, String actual) {
             super("line " + line + ": expected [" + expect +
                 "], found [" + actual + "]");
-            MessageFormat form = new MessageFormat(ResourcesMgr.getString
+            // don't call form.format unless getLocalizedMessage is called
+            // to avoid unnecessary permission checks
+            form = new MessageFormat(ResourcesMgr.getString
                 ("line.number.expected.expect.found.actual."));
-            Object[] source = {line, expect, actual};
-            i18nMessage = form.format(source);
+            source = new Object[] {line, expect, actual};
         }
 
         @Override
         public String getLocalizedMessage() {
-            return i18nMessage;
+            return i18nMessage != null ? i18nMessage : form.format(source);
         }
     }
 
--- a/jdk/src/java.httpclient/share/classes/java/net/http/HttpClientImpl.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/HttpClientImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -35,6 +35,7 @@
 import java.nio.channels.SelectableChannel;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
+import java.nio.channels.SocketChannel;
 import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -155,6 +156,15 @@
         selmgr.register(exchange);
     }
 
+    /**
+     * Only used from RawChannel to disconnect the channel from
+     * the selector
+     */
+    void cancelRegistration(SocketChannel s) {
+        selmgr.cancel(s);
+    }
+
+
     Http2ClientImpl client2() {
         return client2;
     }
@@ -220,6 +230,13 @@
             selector.wakeup();
         }
 
+        synchronized void cancel(SocketChannel e) {
+            SelectionKey key = e.keyFor(selector);
+            if (key != null)
+                key.cancel();
+            selector.wakeup();
+        }
+
         void wakeupSelector() {
             selector.wakeup();
         }
--- a/jdk/src/java.httpclient/share/classes/java/net/http/HttpHeaders1.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- */
-
-package java.net.http;
-
-public interface HttpHeaders1 extends HttpHeaders {
-    public void makeUnmodifiable();
-}
--- a/jdk/src/java.httpclient/share/classes/java/net/http/HttpResponseImpl.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/HttpResponseImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -176,7 +176,7 @@
      *
      * @return
      */
-    RawChannel rawChannel() {
+    RawChannel rawChannel() throws IOException {
         if (rawchan == null) {
             rawchan = new RawChannel(request.client(), connection);
         }
--- a/jdk/src/java.httpclient/share/classes/java/net/http/RawChannel.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/RawChannel.java	Tue May 17 05:38:15 2016 -0700
@@ -29,6 +29,7 @@
 import java.nio.channels.GatheringByteChannel;
 import java.nio.channels.SelectableChannel;
 import java.nio.channels.SelectionKey;
+import java.nio.channels.SocketChannel;
 
 //
 // Used to implement WebSocket. Each RawChannel corresponds to a TCP connection
@@ -56,9 +57,21 @@
     interface NonBlockingEvent extends RawEvent {
     }
 
-    RawChannel(HttpClientImpl client, HttpConnection connection) {
+    RawChannel(HttpClientImpl client, HttpConnection connection)
+                                                throws IOException {
         this.client = client;
         this.connection = connection;
+        SocketChannel chan = connection.channel();
+        client.cancelRegistration(chan);
+        chan.configureBlocking(false);
+    }
+
+    SocketChannel socketChannel() {
+        return connection.channel();
+    }
+
+    ByteBuffer getRemaining() {
+        return connection.getRemaining();
     }
 
     private class RawAsyncEvent extends AsyncEvent {
--- a/jdk/src/java.httpclient/share/classes/java/net/http/WSOpeningHandshake.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/WSOpeningHandshake.java	Tue May 17 05:38:15 2016 -0700
@@ -24,6 +24,8 @@
  */
 package java.net.http;
 
+import java.io.UncheckedIOException;
+import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.charset.StandardCharsets;
@@ -126,6 +128,8 @@
                         return CompletableFuture.completedFuture(result);
                     } catch (WebSocketHandshakeException e) {
                         return CompletableFuture.failedFuture(e);
+                    } catch (UncheckedIOException ee) {
+                        return CompletableFuture.failedFuture(ee.getCause());
                     }
                 });
     }
@@ -149,7 +153,12 @@
         checkAccept(response, h);
         checkExtensions(response, h);
         String subprotocol = checkAndReturnSubprotocol(response, h);
-        RawChannel channel = ((HttpResponseImpl) response).rawChannel();
+        RawChannel channel = null;
+        try {
+            channel = ((HttpResponseImpl) response).rawChannel();
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
         return new Result(subprotocol, channel);
     }
 
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/Jlink.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/Jlink.java	Tue May 17 05:38:15 2016 -0700
@@ -34,11 +34,9 @@
 import java.util.Set;
 import jdk.tools.jlink.internal.JlinkTask;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.PluginContext;
 import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.ExecutableImage;
 import jdk.tools.jlink.builder.ImageBuilder;
-import jdk.tools.jlink.internal.PluginContextImpl;
 import jdk.tools.jlink.internal.PluginRepository;
 
 /**
@@ -71,7 +69,6 @@
         private final List<Plugin> plugins;
         private final ImageBuilder imageBuilder;
         private final String lastSorterPluginName;
-        private final PluginContext pluginContext;
 
         /**
          * Empty plugins configuration.
@@ -86,7 +83,7 @@
          * @param plugins List of plugins.
          */
         public PluginsConfiguration(List<Plugin> plugins) {
-            this(plugins, null, null, null);
+            this(plugins, null, null);
         }
 
         /**
@@ -101,28 +98,10 @@
          */
         public PluginsConfiguration(List<Plugin> plugins,
                 ImageBuilder imageBuilder, String lastSorterPluginName) {
-            this(plugins, imageBuilder, lastSorterPluginName, null);
-        }
-
-        /**
-         * Plugins configuration with a last sorter and an ImageBuilder. No
-         * sorting can occur after the last sorter plugin. The ImageBuilder is
-         * in charge to layout the image content on disk.
-         *
-         * @param plugins List of transformer plugins.
-         * @param imageBuilder Image builder.
-         * @param lastSorterPluginName Name of last sorter plugin, no sorting
-         * @param ctx the plugin context
-         * can occur after it.
-         */
-        public PluginsConfiguration(List<Plugin> plugins,
-                ImageBuilder imageBuilder, String lastSorterPluginName,
-                PluginContext ctx) {
             this.plugins = plugins == null ? Collections.emptyList()
                     : plugins;
             this.imageBuilder = imageBuilder;
             this.lastSorterPluginName = lastSorterPluginName;
-            this.pluginContext = ctx != null? ctx : new PluginContextImpl();
         }
 
         /**
@@ -146,13 +125,6 @@
             return lastSorterPluginName;
         }
 
-        /**
-         * @return the pluginContext
-         */
-        public PluginContext getPluginContext() {
-            return pluginContext;
-        }
-
         @Override
         public String toString() {
             StringBuilder builder = new StringBuilder();
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Tue May 17 05:38:15 2016 -0700
@@ -1,3 +1,4 @@
+
 /*
  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,8 +25,6 @@
  */
 package jdk.tools.jlink.builder;
 
-import jdk.tools.jlink.plugin.ExecutableImage;
-import jdk.tools.jlink.plugin.PluginException;
 import java.io.BufferedOutputStream;
 import java.io.BufferedWriter;
 import java.io.ByteArrayInputStream;
@@ -47,8 +46,10 @@
 import java.nio.file.attribute.PosixFileAttributeView;
 import java.nio.file.attribute.PosixFilePermission;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Properties;
@@ -56,23 +57,40 @@
 import jdk.tools.jlink.internal.BasicImageWriter;
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin.SymImageFile;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.Module;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ExecutableImage;
+import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.PluginException;
 
 /**
  *
  * Default Image Builder. This builder creates the default runtime image layout.
  */
-public class DefaultImageBuilder implements ImageBuilder {
+public final class DefaultImageBuilder implements ImageBuilder {
 
     /**
      * The default java executable Image.
      */
-    static class DefaultExecutableImage extends ExecutableImage {
+    static final class DefaultExecutableImage implements ExecutableImage {
+
+        private final Path home;
+        private final List<String> args;
+        private final Set<String> modules;
 
         public DefaultExecutableImage(Path home, Set<String> modules) {
-            super(home, modules, createArgs(home));
+            this(home, modules, createArgs(home));
+        }
+
+        private DefaultExecutableImage(Path home, Set<String> modules,
+                List<String> args) {
+            Objects.requireNonNull(home);
+            Objects.requireNonNull(args);
+            if (!Files.exists(home)) {
+                throw new IllegalArgumentException("Invalid image home");
+            }
+            this.home = home;
+            this.modules = Collections.unmodifiableSet(modules);
+            this.args = Collections.unmodifiableList(args);
         }
 
         private static List<String> createArgs(Path home) {
@@ -84,6 +102,21 @@
         }
 
         @Override
+        public Path getHome() {
+            return home;
+        }
+
+        @Override
+        public Set<String> getModules() {
+            return modules;
+        }
+
+        @Override
+        public List<String> getExecutionArgs() {
+            return args;
+        }
+
+        @Override
         public void storeLaunchArgs(List<String> args) {
             try {
                 patchScripts(this, args);
@@ -111,17 +144,19 @@
         Files.createDirectories(mdir);
     }
 
-    private void storeFiles(Set<String> modules, Properties release) throws IOException {
+    private void storeFiles(Set<String> modules, Map<String, String> release) throws IOException {
         if (release != null) {
-            addModules(release, modules);
+            Properties props = new Properties();
+            props.putAll(release);
+            addModules(props, modules);
             File r = new File(root.toFile(), "release");
             try (FileOutputStream fo = new FileOutputStream(r)) {
-                release.store(fo, null);
+                props.store(fo, null);
             }
         }
     }
 
-    private void addModules(Properties release, Set<String> modules) throws IOException {
+    private void addModules(Properties props, Set<String> modules) throws IOException {
         StringBuilder builder = new StringBuilder();
         int i = 0;
         for (String m : modules) {
@@ -131,28 +166,32 @@
             }
             i++;
         }
-        release.setProperty("MODULES", builder.toString());
+        props.setProperty("MODULES", builder.toString());
     }
 
     @Override
-    public void storeFiles(Pool files, Properties release) {
+    public void storeFiles(ModulePool files) {
         try {
-            for (ModuleData f : files.getContent()) {
-               if (!f.getType().equals(Pool.ModuleDataType.CLASS_OR_RESOURCE)) {
-                    accept(f);
+            files.entries().forEach(f -> {
+                if (!f.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)) {
+                    try {
+                        accept(f);
+                    } catch (IOException ioExp) {
+                        throw new UncheckedIOException(ioExp);
+                    }
                 }
-            }
-            for (Module m : files.getModules()) {
+            });
+            files.modules().forEach(m -> {
                 // Only add modules that contain packages
                 if (!m.getAllPackages().isEmpty()) {
                     // Skip the fake module used by FileCopierPlugin when copying files.
                     if (m.getName().equals(FileCopierPlugin.FAKE_MODULE)) {
-                       continue;
+                        return;
                     }
                     modules.add(m.getName());
                 }
-            }
-            storeFiles(modules, release);
+            });
+            storeFiles(modules, files.getReleaseProperties());
 
             if (Files.getFileStore(root).supportsFileAttributeView(PosixFileAttributeView.class)) {
                 // launchers in the bin directory need execute permission
@@ -168,8 +207,8 @@
                 Path lib = root.resolve("lib");
                 if (Files.isDirectory(lib)) {
                     Files.find(lib, 2, (path, attrs) -> {
-                        return path.getFileName().toString().equals("jspawnhelper") ||
-                               path.getFileName().toString().equals("jexec");
+                        return path.getFileName().toString().equals("jspawnhelper")
+                                || path.getFileName().toString().equals("jexec");
                     }).forEach(this::setExecutable);
                 }
             }
@@ -180,27 +219,23 @@
         }
     }
 
-    @Override
-    public void storeFiles(Pool files) {
-        storeFiles(files, new Properties());
-    }
-
     /**
      * Generates launcher scripts.
+     *
      * @param imageContent The image content.
      * @param modules The set of modules that the runtime image contains.
      * @throws IOException
      */
-    protected void prepareApplicationFiles(Pool imageContent, Set<String> modules) throws IOException {
+    protected void prepareApplicationFiles(ModulePool imageContent, Set<String> modules) throws IOException {
         // generate launch scripts for the modules with a main class
         for (String module : modules) {
             String path = "/" + module + "/module-info.class";
-            ModuleData res = imageContent.get(path);
-            if (res == null) {
+            Optional<ModuleEntry> res = imageContent.findEntry(path);
+            if (!res.isPresent()) {
                 throw new IOException("module-info.class not found for " + module + " module");
             }
             Optional<String> mainClass;
-            ByteArrayInputStream stream = new ByteArrayInputStream(res.getBytes());
+            ByteArrayInputStream stream = new ByteArrayInputStream(res.get().getBytes());
             mainClass = ModuleDescriptor.read(stream).mainClass();
             if (mainClass.isPresent()) {
                 Path cmd = root.resolve("bin").resolve(module);
@@ -263,9 +298,9 @@
         }
     }
 
-    private void accept(ModuleData file) throws IOException {
+    private void accept(ModuleEntry file) throws IOException {
         String fullPath = file.getPath();
-        String module = "/" + file.getModule()+ "/";
+        String module = "/" + file.getModule() + "/";
         String filename = fullPath.substring(module.length());
         // Remove radical native|config|...
         filename = filename.substring(filename.indexOf('/') + 1);
@@ -404,8 +439,7 @@
 
     public static ExecutableImage getExecutableImage(Path root) {
         if (Files.exists(root.resolve("bin").resolve(getJavaProcessName()))) {
-            return new DefaultImageBuilder.DefaultExecutableImage(root,
-                    retrieveModules(root));
+            return new DefaultExecutableImage(root, retrieveModules(root));
         }
         return null;
     }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/ImageBuilder.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/ImageBuilder.java	Tue May 17 05:38:15 2016 -0700
@@ -29,7 +29,7 @@
 
 import jdk.tools.jlink.plugin.ExecutableImage;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModulePool;
 
 /**
  * Implement this interface to develop your own image layout. First the jimage
@@ -45,7 +45,7 @@
      * @param release the release properties
      * @throws PluginException
      */
-    public default void storeFiles(Pool content, Properties release) {
+    public default void storeFiles(ModulePool content, Properties release) {
         storeFiles(content);
     }
 
@@ -55,7 +55,7 @@
      * @param content Pool of module content.
      * @throws PluginException
      */
-    public default void storeFiles(Pool content) {
+    public default void storeFiles(ModulePool content) {
         throw new UnsupportedOperationException("storeFiles");
     }
 
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java	Tue May 17 05:38:15 2016 -0700
@@ -44,12 +44,11 @@
 import java.util.stream.Stream;
 import jdk.tools.jlink.internal.Archive.Entry;
 import jdk.tools.jlink.internal.Archive.Entry.EntryType;
-import jdk.tools.jlink.internal.PoolImpl.CompressedModuleData;
+import jdk.tools.jlink.internal.ModulePoolImpl.CompressedModuleData;
 import jdk.tools.jlink.plugin.ExecutableImage;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
-import jdk.tools.jlink.plugin.Pool.ModuleDataType;
+import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ModuleEntry;
 
 /**
  * An image (native endian.)
@@ -145,7 +144,7 @@
                                     }));
             ByteOrder order = ByteOrder.nativeOrder();
             BasicImageWriter writer = new BasicImageWriter(order);
-            PoolImpl pool = createPools(archives, entriesForModule, order, writer);
+            ModulePoolImpl pool = createPools(archives, entriesForModule, order, writer);
             try (OutputStream fos = Files.newOutputStream(jimageFile);
                     BufferedOutputStream bos = new BufferedOutputStream(fos);
                     DataOutputStream out = new DataOutputStream(bos)) {
@@ -163,9 +162,9 @@
             ByteOrder byteOrder)
             throws IOException {
         BasicImageWriter writer = new BasicImageWriter(byteOrder);
-        PoolImpl allContent = createPools(archives,
+        ModulePoolImpl allContent = createPools(archives,
                 entriesForModule, byteOrder, writer);
-        PoolImpl result = generateJImage(allContent,
+        ModulePoolImpl result = generateJImage(allContent,
              writer, plugins, plugins.getJImageFileOutputStream());
 
         //Handle files.
@@ -176,12 +175,12 @@
         }
     }
 
-    private static PoolImpl generateJImage(PoolImpl allContent,
+    private static ModulePoolImpl generateJImage(ModulePoolImpl allContent,
             BasicImageWriter writer,
             ImagePluginStack pluginSupport,
             DataOutputStream out
     ) throws IOException {
-        PoolImpl resultResources;
+        ModulePoolImpl resultResources;
         try {
             resultResources = pluginSupport.visitResources(allContent);
         } catch (PluginException pe) {
@@ -190,14 +189,14 @@
             throw new IOException(ex);
         }
         Set<String> duplicates = new HashSet<>();
-        long offset = 0;
+        long[] offset = new long[1];
 
-        List<ModuleData> content = new ArrayList<>();
+        List<ModuleEntry> content = new ArrayList<>();
         List<String> paths = new ArrayList<>();
                  // the order of traversing the resources and the order of
         // the module content being written must be the same
-        for (ModuleData res : resultResources.getContent()) {
-            if (res.getType().equals(ModuleDataType.CLASS_OR_RESOURCE)) {
+        resultResources.entries().forEach(res -> {
+            if (res.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)) {
                 String path = res.getPath();
                 content.add(res);
                 long uncompressedSize = res.getLength();
@@ -216,24 +215,24 @@
                     // TODO Need to hang bytes on resource and write
                     // from resource not zip.
                     // Skipping resource throws off writing from zip.
-                    offset += onFileSize;
-                    continue;
+                    offset[0] += onFileSize;
+                    return;
                 }
                 duplicates.add(path);
-                writer.addLocation(path, offset, compressedSize, uncompressedSize);
+                writer.addLocation(path, offset[0], compressedSize, uncompressedSize);
                 paths.add(path);
-                offset += onFileSize;
+                offset[0] += onFileSize;
             }
-        }
+        });
 
-        ImageResourcesTree tree = new ImageResourcesTree(offset, writer, paths);
+        ImageResourcesTree tree = new ImageResourcesTree(offset[0], writer, paths);
 
         // write header and indices
         byte[] bytes = writer.getBytes();
         out.write(bytes, 0, bytes.length);
 
         // write module content
-        for (ModuleData res : content) {
+        for (ModuleEntry res : content) {
             byte[] buf = res.getBytes();
             out.write(buf, 0, buf.length);
         }
@@ -245,26 +244,26 @@
         return resultResources;
     }
 
-    private static Pool.ModuleDataType mapImageFileType(EntryType type) {
+    private static ModuleEntry.Type mapImageFileType(EntryType type) {
         switch(type) {
             case CONFIG: {
-                return Pool.ModuleDataType.CONFIG;
+                return ModuleEntry.Type.CONFIG;
             }
             case NATIVE_CMD: {
-                return Pool.ModuleDataType.NATIVE_CMD;
+                return ModuleEntry.Type.NATIVE_CMD;
             }
             case NATIVE_LIB: {
-                return Pool.ModuleDataType.NATIVE_LIB;
+                return ModuleEntry.Type.NATIVE_LIB;
             }
         }
         return null;
     }
 
-    private static PoolImpl createPools(Set<Archive> archives,
+    private static ModulePoolImpl createPools(Set<Archive> archives,
             Map<String, List<Entry>> entriesForModule,
             ByteOrder byteOrder,
             BasicImageWriter writer) throws IOException {
-        PoolImpl resources = new PoolImpl(byteOrder, new StringTable() {
+        ModulePoolImpl resources = new ModulePoolImpl(byteOrder, new StringTable() {
 
             @Override
             public int addString(String str) {
@@ -291,7 +290,7 @@
                             path = "/" + mn + "/" + path;
                         }
                         try {
-                            resources.add(Pool.newResource(path, bytes));
+                            resources.add(ModuleEntry.create(path, bytes));
                         } catch (Exception ex) {
                             throw new IOException(ex);
                         }
@@ -300,7 +299,7 @@
                     try {
                         // Entry.path() contains the kind of file native, conf, bin, ...
                         // Keep it to avoid naming conflict (eg: native/jvm.cfg and config/jvm.cfg
-                        resources.add(Pool.newImageFile(mn,
+                        resources.add(ModuleEntry.create(mn,
                                 "/" + mn + "/" + entry.path(), mapImageFileType(entry.type()),
                                 entry.stream(), entry.size()));
                     } catch (Exception ex) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java	Tue May 17 05:38:15 2016 -0700
@@ -28,22 +28,17 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.Properties;
 import jdk.tools.jlink.plugin.ExecutableImage;
 import jdk.tools.jlink.builder.ImageBuilder;
 import jdk.tools.jlink.Jlink;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.PluginContext;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Plugin.CATEGORY;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.Plugin.Category;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.PostProcessorPlugin;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
@@ -52,17 +47,18 @@
  */
 public final class ImagePluginConfiguration {
 
-    private static final List<Plugin.CATEGORY> CATEGORIES_ORDER = new ArrayList<>();
+    private static final List<Plugin.Category> CATEGORIES_ORDER = new ArrayList<>();
 
     static {
-        CATEGORIES_ORDER.add(Plugin.CATEGORY.FILTER);
-        CATEGORIES_ORDER.add(Plugin.CATEGORY.TRANSFORMER);
-        CATEGORIES_ORDER.add(Plugin.CATEGORY.MODULEINFO_TRANSFORMER);
-        CATEGORIES_ORDER.add(Plugin.CATEGORY.SORTER);
-        CATEGORIES_ORDER.add(Plugin.CATEGORY.COMPRESSOR);
-        CATEGORIES_ORDER.add(Plugin.CATEGORY.VERIFIER);
-        CATEGORIES_ORDER.add(Plugin.CATEGORY.PROCESSOR);
-        CATEGORIES_ORDER.add(Plugin.CATEGORY.PACKAGER);
+        CATEGORIES_ORDER.add(Plugin.Category.FILTER);
+        CATEGORIES_ORDER.add(Plugin.Category.TRANSFORMER);
+        CATEGORIES_ORDER.add(Plugin.Category.MODULEINFO_TRANSFORMER);
+        CATEGORIES_ORDER.add(Plugin.Category.SORTER);
+        CATEGORIES_ORDER.add(Plugin.Category.COMPRESSOR);
+        CATEGORIES_ORDER.add(Plugin.Category.METAINFO_ADDER);
+        CATEGORIES_ORDER.add(Plugin.Category.VERIFIER);
+        CATEGORIES_ORDER.add(Plugin.Category.PROCESSOR);
+        CATEGORIES_ORDER.add(Plugin.Category.PACKAGER);
     }
 
     private ImagePluginConfiguration() {
@@ -76,8 +72,8 @@
         if (pluginsConfiguration == null) {
             return new ImagePluginStack();
         }
-        Map<Plugin.CATEGORY, List<Plugin>> plugins = new LinkedHashMap<>();
-        for (Plugin.CATEGORY cat : CATEGORIES_ORDER) {
+        Map<Plugin.Category, List<Plugin>> plugins = new LinkedHashMap<>();
+        for (Plugin.Category cat : CATEGORIES_ORDER) {
             plugins.put(cat, new ArrayList<>());
         }
 
@@ -89,7 +85,7 @@
                         + " added more than once to stack ");
             }
             seen.add(plug.getName());
-            CATEGORY category = Utils.getCategory(plug);
+            Category category = Utils.getCategory(plug);
             if (category == null) {
                 throw new PluginException("Invalid category for "
                         + plug.getName());
@@ -100,10 +96,10 @@
 
         List<TransformerPlugin> transformerPlugins = new ArrayList<>();
         List<PostProcessorPlugin> postProcessingPlugins = new ArrayList<>();
-        for (Entry<Plugin.CATEGORY, List<Plugin>> entry : plugins.entrySet()) {
+        for (Entry<Plugin.Category, List<Plugin>> entry : plugins.entrySet()) {
             // Sort according to plugin constraints
             List<Plugin> orderedPlugins = PluginOrderingGraph.sort(entry.getValue());
-            CATEGORY category = entry.getKey();
+            Category category = entry.getKey();
             for (Plugin p : orderedPlugins) {
                 if (Utils.isPostProcessor(category)) {
                     @SuppressWarnings("unchecked")
@@ -143,14 +139,13 @@
                 }
 
                 @Override
-                public void storeFiles(Pool files) {
+                public void storeFiles(ModulePool files) {
                     throw new PluginException("No directory setup to store files");
                 }
             };
         }
 
-        PluginContext ctxt = pluginsConfiguration.getPluginContext();
         return new ImagePluginStack(builder, transformerPlugins,
-                lastSorter, postProcessingPlugins, ctxt);
+                lastSorter, postProcessingPlugins);
     }
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java	Tue May 17 05:38:15 2016 -0700
@@ -37,20 +37,21 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
-import java.util.Properties;
+import java.util.Optional;
 import java.util.Set;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 import jdk.internal.jimage.decompressor.Decompressor;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.PluginContext;
 import jdk.tools.jlink.plugin.ExecutableImage;
 import jdk.tools.jlink.builder.ImageBuilder;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.LinkModule;
+import jdk.tools.jlink.plugin.ModuleEntry;
 import jdk.tools.jlink.plugin.PostProcessorPlugin;
 
 /**
@@ -64,9 +65,9 @@
         ExecutableImage retrieve(ImagePluginStack stack) throws IOException;
     }
 
-    public static final class OrderedResourcePool extends PoolImpl {
+    public static final class OrderedResourcePool extends ModulePoolImpl {
 
-        private final List<ModuleData> orderedList = new ArrayList<>();
+        private final List<ModuleEntry> orderedList = new ArrayList<>();
 
         public OrderedResourcePool(ByteOrder order, StringTable table) {
             super(order, table);
@@ -78,22 +79,22 @@
          * @param resource The Resource to add.
          */
         @Override
-        public void add(ModuleData resource) {
+        public void add(ModuleEntry resource) {
             super.add(resource);
             orderedList.add(resource);
         }
 
-        List<ModuleData> getOrderedList() {
+        List<ModuleEntry> getOrderedList() {
             return Collections.unmodifiableList(orderedList);
         }
     }
 
-    private final static class CheckOrderResourcePool extends PoolImpl {
+    private final static class CheckOrderResourcePool extends ModulePoolImpl {
 
-        private final List<ModuleData> orderedList;
+        private final List<ModuleEntry> orderedList;
         private int currentIndex;
 
-        public CheckOrderResourcePool(ByteOrder order, List<ModuleData> orderedList, StringTable table) {
+        public CheckOrderResourcePool(ByteOrder order, List<ModuleEntry> orderedList, StringTable table) {
             super(order, table);
             this.orderedList = orderedList;
         }
@@ -104,8 +105,8 @@
          * @param resource The Resource to add.
          */
         @Override
-        public void add(ModuleData resource) {
-            ModuleData ordered = orderedList.get(currentIndex);
+        public void add(ModuleEntry resource) {
+            ModuleEntry ordered = orderedList.get(currentIndex);
             if (!resource.equals(ordered)) {
                 throw new PluginException("Resource " + resource.getPath() + " not in the right order");
             }
@@ -166,26 +167,16 @@
     private final List<ResourcePrevisitor> resourcePrevisitors = new ArrayList<>();
 
     private final ImageBuilder imageBuilder;
-    private final Properties release;
 
     public ImagePluginStack() {
         this(null, Collections.emptyList(), null,
-                Collections.emptyList(), null);
+                Collections.emptyList());
     }
 
     public ImagePluginStack(ImageBuilder imageBuilder,
             List<TransformerPlugin> contentPlugins,
             Plugin lastSorter,
             List<PostProcessorPlugin> postprocessingPlugins) {
-        this(imageBuilder, contentPlugins, lastSorter,
-            postprocessingPlugins, null);
-    }
-
-    public ImagePluginStack(ImageBuilder imageBuilder,
-            List<TransformerPlugin> contentPlugins,
-            Plugin lastSorter,
-            List<PostProcessorPlugin> postprocessingPlugins,
-            PluginContext ctxt) {
         Objects.requireNonNull(contentPlugins);
         this.lastSorter = lastSorter;
         for (TransformerPlugin p : contentPlugins) {
@@ -200,7 +191,6 @@
             this.postProcessingPlugins.add(p);
         }
         this.imageBuilder = imageBuilder;
-        this.release = ctxt != null? ctxt.getReleaseProperties() : new Properties();
     }
 
     public void operate(ImageProvider provider) throws Exception {
@@ -231,12 +221,12 @@
      * @return The result of the visit.
      * @throws IOException
      */
-    public PoolImpl visitResources(PoolImpl resources)
+    public ModulePoolImpl visitResources(ModulePoolImpl resources)
             throws Exception {
         Objects.requireNonNull(resources);
         resources.setReadOnly();
         if (resources.isEmpty()) {
-            return new PoolImpl(resources.getByteOrder(),
+            return new ModulePoolImpl(resources.getByteOrder(),
                     resources.getStringTable());
         }
         PreVisitStrings previsit = new PreVisitStrings();
@@ -250,11 +240,11 @@
             resources.getStringTable().addString(s);
         }
 
-        PoolImpl current = resources;
-        List<Pool.ModuleData> frozenOrder = null;
+        ModulePoolImpl current = resources;
+        List<ModuleEntry> frozenOrder = null;
         for (TransformerPlugin p : contentPlugins) {
             current.setReadOnly();
-            PoolImpl output = null;
+            ModulePoolImpl output = null;
             if (p == lastSorter) {
                 if (frozenOrder != null) {
                     throw new Exception("Order of resources is already frozen. Plugin "
@@ -268,7 +258,7 @@
                     output = new CheckOrderResourcePool(current.getByteOrder(),
                             frozenOrder, resources.getStringTable());
                 } else {
-                    output = new PoolImpl(current.getByteOrder(),
+                    output = new ModulePoolImpl(current.getByteOrder(),
                             resources.getStringTable());
                 }
             }
@@ -287,15 +277,15 @@
     }
 
     /**
-     * This pool wrap the original pool and automatically uncompress moduledata
+     * This pool wrap the original pool and automatically uncompress ModuleEntry
      * if needed.
      */
-    private class LastPool extends Pool {
-        private class LastModule implements Module {
+    private class LastPool implements ModulePool {
+        private class LastModule implements LinkModule {
 
-            private final Module module;
+            final LinkModule module;
 
-            LastModule(Module module) {
+            LastModule(LinkModule module) {
                 this.module = module;
             }
 
@@ -305,9 +295,9 @@
             }
 
             @Override
-            public ModuleData get(String path) {
-                ModuleData d = module.get(path);
-                return getUncompressed(d);
+            public Optional<ModuleEntry> findEntry(String path) {
+                Optional<ModuleEntry> d = module.findEntry(path);
+                return d.isPresent()? Optional.of(getUncompressed(d.get())) : Optional.empty();
             }
 
             @Override
@@ -316,7 +306,7 @@
             }
 
             @Override
-            public void add(ModuleData data) {
+            public void add(ModuleEntry data) {
                 throw new PluginException("pool is readonly");
             }
 
@@ -331,19 +321,24 @@
             }
 
             @Override
-            public Collection<ModuleData> getContent() {
-                List<ModuleData> lst = new ArrayList<>();
-                for(ModuleData md : module.getContent()) {
+            public Stream<ModuleEntry> entries() {
+                List<ModuleEntry> lst = new ArrayList<>();
+                module.entries().forEach(md -> {
                     lst.add(getUncompressed(md));
-                }
-                return lst;
+                });
+                return lst.stream();
+            }
+
+            @Override
+            public int getEntryCount() {
+                return module.getEntryCount();
             }
         }
-        private final PoolImpl pool;
+        private final ModulePoolImpl pool;
         Decompressor decompressor = new Decompressor();
-        Collection<ModuleData> content;
+        Collection<ModuleEntry> content;
 
-        LastPool(PoolImpl pool) {
+        LastPool(ModulePoolImpl pool) {
             this.pool = pool;
         }
 
@@ -353,23 +348,14 @@
         }
 
         @Override
-        public void add(ModuleData resource) {
+        public void add(ModuleEntry resource) {
             throw new PluginException("pool is readonly");
         }
 
-        /**
-         * Retrieves the module of the provided name.
-         *
-         * @param name The module name
-         * @return the module or null if the module doesn't exist.
-         */
         @Override
-        public Module getModule(String name) {
-            Module module = pool.getModule(name);
-            if (module != null) {
-                module = new LastModule(module);
-            }
-            return module;
+        public Optional<LinkModule> findModule(String name) {
+            Optional<LinkModule> module = pool.findModule(name);
+            return module.isPresent()? Optional.of(new LastModule(module.get())) : Optional.empty();
         }
 
         /**
@@ -378,45 +364,55 @@
          * @return The collection of modules.
          */
         @Override
-        public Collection<Module> getModules() {
-            List<Module> modules = new ArrayList<>();
-            for (Module m : pool.getModules()) {
+        public Stream<? extends LinkModule> modules() {
+            List<LinkModule> modules = new ArrayList<>();
+            pool.modules().forEach(m -> {
                 modules.add(new LastModule(m));
-            }
-            return modules;
+            });
+            return modules.stream();
+        }
+
+        @Override
+        public int getModuleCount() {
+            return pool.getModuleCount();
         }
 
         /**
          * Get all resources contained in this pool instance.
          *
-         * @return The collection of resources;
+         * @return The stream of resources;
          */
         @Override
-        public Collection<ModuleData> getContent() {
+        public Stream<? extends ModuleEntry> entries() {
             if (content == null) {
                 content = new ArrayList<>();
-                for (ModuleData md : pool.getContent()) {
+                pool.entries().forEach(md -> {
                     content.add(getUncompressed(md));
-                }
+                });
             }
-            return content;
+            return content.stream();
+        }
+
+        @Override
+        public int getEntryCount() {
+            return pool.getEntryCount();
         }
 
         /**
          * Get the resource for the passed path.
          *
          * @param path A resource path
-         * @return A Resource instance or null if the resource is not found
+         * @return A Resource instance if the resource is found
          */
         @Override
-        public ModuleData get(String path) {
+        public Optional<ModuleEntry> findEntry(String path) {
             Objects.requireNonNull(path);
-            Pool.ModuleData res = pool.get(path);
-            return getUncompressed(res);
+            Optional<ModuleEntry> res = pool.findEntry(path);
+            return res.isPresent()? Optional.of(getUncompressed(res.get())) : Optional.empty();
         }
 
         @Override
-        public boolean contains(ModuleData res) {
+        public boolean contains(ModuleEntry res) {
             return pool.contains(res);
         }
 
@@ -426,8 +422,8 @@
         }
 
         @Override
-        public void visit(Visitor visitor, Pool output) {
-            pool.visit(visitor, output);
+        public void transformAndCopy(Function<ModuleEntry, ModuleEntry> visitor, ModulePool output) {
+            pool.transformAndCopy(visitor, output);
         }
 
         @Override
@@ -435,14 +431,19 @@
             return pool.getByteOrder();
         }
 
-        private ModuleData getUncompressed(ModuleData res) {
+        @Override
+        public Map<String, String> getReleaseProperties() {
+            return Collections.unmodifiableMap(pool.getReleaseProperties());
+        }
+
+        private ModuleEntry getUncompressed(ModuleEntry res) {
             if (res != null) {
-                if (res instanceof PoolImpl.CompressedModuleData) {
+                if (res instanceof ModulePoolImpl.CompressedModuleData) {
                     try {
                         byte[] bytes = decompressor.decompressResource(getByteOrder(),
                                 (int offset) -> pool.getStringTable().getString(offset),
                                 res.getBytes());
-                        res = Pool.newResource(res.getPath(),
+                        res = ModuleEntry.create(res.getPath(),
                                 new ByteArrayInputStream(bytes),
                                 bytes.length);
                     } catch (IOException ex) {
@@ -462,20 +463,24 @@
      * @param writer
      * @throws java.lang.Exception
      */
-    public void storeFiles(PoolImpl original, PoolImpl transformed,
+    public void storeFiles(ModulePoolImpl original, ModulePoolImpl transformed,
             BasicImageWriter writer)
             throws Exception {
         Objects.requireNonNull(original);
-        try {
-            // fill release information available from transformed "java.base" module!
-            ModuleDescriptor desc = transformed.getModule("java.base").getDescriptor();
-            desc.osName().ifPresent(s -> release.put("OS_NAME", s));
-            desc.osVersion().ifPresent(s -> release.put("OS_VERSION", s));
-            desc.osArch().ifPresent(s -> release.put("OS_ARCH", s));
-        } catch (Exception ignored) {
-        }
+        Objects.requireNonNull(transformed);
+        Optional<LinkModule> javaBase = transformed.findModule("java.base");
+        javaBase.ifPresent(mod -> {
+            try {
+                Map<String, String> release = transformed.getReleaseProperties();
+                // fill release information available from transformed "java.base" module!
+                ModuleDescriptor desc = mod.getDescriptor();
+                desc.osName().ifPresent(s -> release.put("OS_NAME", s));
+                desc.osVersion().ifPresent(s -> release.put("OS_VERSION", s));
+                desc.osArch().ifPresent(s -> release.put("OS_ARCH", s));
+            } catch (Exception ignored) {}
+        });
 
-        imageBuilder.storeFiles(new LastPool(transformed), release);
+        imageBuilder.storeFiles(new LastPool(transformed));
     }
 
     public ExecutableImage getExecutableImage() throws IOException {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModuleEntryImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.tools.jlink.internal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UncheckedIOException;
+import java.util.Objects;
+import jdk.tools.jlink.plugin.ModuleEntry;
+
+/**
+ * A LinkModuleEntry is the elementary unit of data inside an image. It is
+ * generally a file. e.g.: a java class file, a resource file, a shared library,
+ * ...
+ * <br>
+ * A LinkModuleEntry is identified by a path of the form:
+ * <ul>
+ * <li>For jimage content: /{module name}/{package1}/.../{packageN}/{file
+ * name}</li>
+ * <li>For other files (shared lib, launchers, config, ...):/{module name}/
+ * {@literal bin|conf|native}/{dir1}>/.../{dirN}/{file name}</li>
+ * </ul>
+ */
+public class ModuleEntryImpl implements ModuleEntry {
+
+    private final Type type;
+    private final String path;
+    private final String module;
+    private final long length;
+    private final InputStream stream;
+    private byte[] buffer;
+
+    /**
+     * Create a new LinkModuleEntry.
+     *
+     * @param module The module name.
+     * @param path The data path identifier.
+     * @param type The data type.
+     * @param stream The data content stream.
+     * @param length The stream length.
+     */
+    public ModuleEntryImpl(String module, String path, Type type, InputStream stream, long length) {
+        Objects.requireNonNull(module);
+        Objects.requireNonNull(path);
+        Objects.requireNonNull(type);
+        Objects.requireNonNull(stream);
+        this.path = path;
+        this.type = type;
+        this.module = module;
+        this.stream = stream;
+        this.length = length;
+    }
+
+    /**
+     * The LinkModuleEntry module name.
+     *
+     * @return The module name.
+     */
+    @Override
+    public final String getModule() {
+        return module;
+    }
+
+    /**
+     * The LinkModuleEntry path.
+     *
+     * @return The module path.
+     */
+    @Override
+    public final String getPath() {
+        return path;
+    }
+
+    /**
+     * The LinkModuleEntry's type.
+     *
+     * @return The data type.
+     */
+    @Override
+    public final Type getType() {
+        return type;
+    }
+
+    /**
+     * The LinkModuleEntry content as an array of byte.
+     *
+     * @return An Array of bytes.
+     */
+    @Override
+    public byte[] getBytes() {
+        if (buffer == null) {
+            try (InputStream is = stream) {
+                buffer = is.readAllBytes();
+            } catch (IOException ex) {
+                throw new UncheckedIOException(ex);
+            }
+        }
+        return buffer;
+    }
+
+    /**
+     * The LinkModuleEntry content length.
+     *
+     * @return The length.
+     */
+    @Override
+    public long getLength() {
+        return length;
+    }
+
+    /**
+     * The LinkModuleEntry stream.
+     *
+     * @return The module data stream.
+     */
+    @Override
+    public InputStream stream() {
+        return stream;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 7;
+        hash = 89 * hash + Objects.hashCode(this.path);
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (!(other instanceof ModuleEntryImpl)) {
+            return false;
+        }
+        ModuleEntryImpl f = (ModuleEntryImpl) other;
+        return f.path.equals(path);
+    }
+
+    @Override
+    public String toString() {
+        return getPath();
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModulePoolImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,421 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.tools.jlink.internal;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.lang.module.ModuleDescriptor;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Stream;
+import jdk.internal.jimage.decompressor.CompressedResourceHeader;
+import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.LinkModule;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.PluginException;
+import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
+
+/**
+ * Pool of module data.
+ */
+public class ModulePoolImpl implements ModulePool {
+
+    private class ModuleImpl implements LinkModule {
+
+        final Map<String, ModuleEntry> moduleContent = new LinkedHashMap<>();
+        private ModuleDescriptor descriptor;
+        final String name;
+
+        private ModuleImpl(String name) {
+            this.name = name;
+        }
+
+        @Override
+        public String getName() {
+            return name;
+        }
+
+        @Override
+        public Optional<ModuleEntry> findEntry(String path) {
+            if (!path.startsWith("/")) {
+                path = "/" + path;
+            }
+            if (!path.startsWith("/" + name)) {
+                path = "/" + name + path;
+            }
+            return Optional.ofNullable(moduleContent.get(path));
+        }
+
+        @Override
+        public ModuleDescriptor getDescriptor() {
+            if (descriptor == null) {
+                String p = "/" + name + "/module-info.class";
+                Optional<ModuleEntry> content = findEntry(p);
+                if (!content.isPresent()) {
+                    throw new PluginException("No module-info for " + name
+                            + " module");
+                }
+                ByteBuffer bb = ByteBuffer.wrap(content.get().getBytes());
+                descriptor = ModuleDescriptor.read(bb);
+            }
+            return descriptor;
+        }
+
+        @Override
+        public void add(ModuleEntry data) {
+            if (isReadOnly()) {
+                throw new PluginException("LinkConfiguration is readonly");
+            }
+            Objects.requireNonNull(data);
+            if (!data.getModule().equals(name)) {
+                throw new PluginException("Can't add resource " + data.getPath()
+                        + " to module " + name);
+            }
+            ModulePoolImpl.this.add(data);
+        }
+
+        @Override
+        public Set<String> getAllPackages() {
+            Set<String> pkgs = new HashSet<>();
+            moduleContent.values().stream().filter(m -> m.getType().
+                    equals(ModuleEntry.Type.CLASS_OR_RESOURCE)).forEach(res -> {
+                // Module metadata only contains packages with .class files
+                if (ImageFileCreator.isClassPackage(res.getPath())) {
+                    String[] split = ImageFileCreator.splitPath(res.getPath());
+                    String pkg = split[1];
+                    if (pkg != null && !pkg.isEmpty()) {
+                        pkgs.add(pkg);
+                    }
+                }
+            });
+            return pkgs;
+        }
+
+        @Override
+        public String toString() {
+            return getName();
+        }
+
+        @Override
+        public Stream<? extends ModuleEntry> entries() {
+            return moduleContent.values().stream();
+        }
+
+        @Override
+        public int getEntryCount() {
+            return moduleContent.values().size();
+        }
+    }
+
+    private final Map<String, ModuleEntry> resources = new LinkedHashMap<>();
+    private final Map<String, ModuleImpl> modules = new LinkedHashMap<>();
+    private final ModuleImpl fileCopierModule = new ModuleImpl(FileCopierPlugin.FAKE_MODULE);
+    private Map<String, String> releaseProps = new HashMap<>();
+
+    private final ByteOrder order;
+
+    private boolean isReadOnly;
+    private final StringTable table;
+
+    public ModulePoolImpl() {
+        this(ByteOrder.nativeOrder());
+    }
+
+    public ModulePoolImpl(ByteOrder order) {
+        this(order, new StringTable() {
+
+            @Override
+            public int addString(String str) {
+                return -1;
+            }
+
+            @Override
+            public String getString(int id) {
+                return null;
+            }
+        });
+    }
+
+    public ModulePoolImpl(ByteOrder order, StringTable table) {
+        this.order = order;
+        this.table = table;
+    }
+
+    /**
+     * Add a ModuleEntry.
+     *
+     * @param data The ModuleEntry to add.
+     */
+    @Override
+    public void add(ModuleEntry data) {
+        if (isReadOnly()) {
+            throw new PluginException("LinkConfiguration is readonly");
+        }
+        Objects.requireNonNull(data);
+        if (resources.get(data.getPath()) != null) {
+            throw new PluginException("Resource " + data.getPath()
+                    + " already present");
+        }
+        String modulename = data.getModule();
+        ModuleImpl m = modules.get(modulename);
+        // ## TODO: FileCopierPlugin should not add content to a module
+        // FAKE_MODULE is not really a module to be added in the image
+        if (FileCopierPlugin.FAKE_MODULE.equals(modulename)) {
+            m = fileCopierModule;
+        }
+        if (m == null) {
+            m = new ModuleImpl(modulename);
+            modules.put(modulename, m);
+        }
+        resources.put(data.getPath(), data);
+        m.moduleContent.put(data.getPath(), data);
+    }
+
+    /**
+     * Retrieves the module for the provided name.
+     *
+     * @param name The module name
+     * @return the module of matching name, if found
+     */
+    @Override
+    public Optional<LinkModule> findModule(String name) {
+        Objects.requireNonNull(name);
+        return Optional.ofNullable(modules.get(name));
+    }
+
+    /**
+     * The stream of modules contained in this LinkConfiguration.
+     *
+     * @return The stream of modules.
+     */
+    @Override
+    public Stream<? extends LinkModule> modules() {
+        return modules.values().stream();
+    }
+
+    /**
+     * Return the number of LinkModule count in this LinkConfiguration.
+     *
+     * @return the module count.
+     */
+    @Override
+    public int getModuleCount() {
+        return modules.size();
+    }
+
+    /**
+     * Get all ModuleEntry contained in this LinkConfiguration instance.
+     *
+     * @return The stream of LinkModuleEntries.
+     */
+    @Override
+    public Stream<? extends ModuleEntry> entries() {
+        return resources.values().stream();
+    }
+
+    /**
+     * Return the number of ModuleEntry count in this LinkConfiguration.
+     *
+     * @return the entry count.
+     */
+    @Override
+    public int getEntryCount() {
+        return resources.values().size();
+    }
+
+    /**
+     * Get the ModuleEntry for the passed path.
+     *
+     * @param path A data path
+     * @return A ModuleEntry instance or null if the data is not found
+     */
+    @Override
+    public Optional<ModuleEntry> findEntry(String path) {
+        Objects.requireNonNull(path);
+        return Optional.ofNullable(resources.get(path));
+    }
+
+    /**
+     * Check if the LinkConfiguration contains the given ModuleEntry.
+     *
+     * @param data The module data to check existence for.
+     * @return The module data or null if not found.
+     */
+    @Override
+    public boolean contains(ModuleEntry data) {
+        Objects.requireNonNull(data);
+        return findEntry(data.getPath()).isPresent();
+    }
+
+    /**
+     * Check if the LinkConfiguration contains some content at all.
+     *
+     * @return True, no content, false otherwise.
+     */
+    @Override
+    public boolean isEmpty() {
+        return resources.isEmpty();
+    }
+
+    /**
+     * Visit each ModuleEntry in this LinkConfiguration to transform it and
+     * copy the transformed ModuleEntry to the output LinkConfiguration.
+     *
+     * @param transform The function called for each ModuleEntry found in
+     * the LinkConfiguration. The transform function should return a
+     * ModuleEntry instance which will be added to the output or it should
+     * return null if the passed ModuleEntry is to be ignored for the
+     * output.
+     *
+     * @param output The LinkConfiguration to be filled with Visitor returned
+     * ModuleEntry.
+     */
+    @Override
+    public void transformAndCopy(Function<ModuleEntry, ModuleEntry> transform,
+            ModulePool output) {
+        entries().forEach(resource -> {
+            ModuleEntry res = transform.apply(resource);
+            if (res != null) {
+                output.add(res);
+            }
+        });
+    }
+
+    /**
+     * The ByteOrder currently in use when generating the jimage file.
+     *
+     * @return The ByteOrder.
+     */
+    @Override
+    public ByteOrder getByteOrder() {
+        return order;
+    }
+
+    @Override
+    public Map<String, String> getReleaseProperties() {
+        return isReadOnly()? Collections.unmodifiableMap(releaseProps) : releaseProps;
+    }
+
+    public StringTable getStringTable() {
+        return table;
+    }
+
+    /**
+     * Make this Resources instance read-only. No resource can be added.
+     */
+    public void setReadOnly() {
+        isReadOnly = true;
+    }
+
+    /**
+     * Read only state.
+     *
+     * @return true if readonly false otherwise.
+     */
+    @Override
+    public boolean isReadOnly() {
+        return isReadOnly;
+    }
+
+    /**
+     * A resource that has been compressed.
+     */
+    public static final class CompressedModuleData extends ModuleEntryImpl {
+
+        final long uncompressed_size;
+
+        private CompressedModuleData(String module, String path,
+                InputStream stream, long size,
+                long uncompressed_size) {
+            super(module, path, ModuleEntry.Type.CLASS_OR_RESOURCE, stream, size);
+            this.uncompressed_size = uncompressed_size;
+        }
+
+        public long getUncompressedSize() {
+            return uncompressed_size;
+        }
+
+        @Override
+        public boolean equals(Object other) {
+            if (!(other instanceof CompressedModuleData)) {
+                return false;
+            }
+            CompressedModuleData f = (CompressedModuleData) other;
+            return f.getPath().equals(getPath());
+        }
+
+        @Override
+        public int hashCode() {
+            return super.hashCode();
+        }
+    }
+
+    public static CompressedModuleData newCompressedResource(ModuleEntry original,
+            ByteBuffer compressed,
+            String plugin, String pluginConfig, StringTable strings,
+            ByteOrder order) {
+        Objects.requireNonNull(original);
+        Objects.requireNonNull(compressed);
+        Objects.requireNonNull(plugin);
+
+        boolean isTerminal = !(original instanceof CompressedModuleData);
+        long uncompressed_size = original.getLength();
+        if (original instanceof CompressedModuleData) {
+            CompressedModuleData comp = (CompressedModuleData) original;
+            uncompressed_size = comp.getUncompressedSize();
+        }
+        int nameOffset = strings.addString(plugin);
+        int configOffset = -1;
+        if (pluginConfig != null) {
+            configOffset = strings.addString(plugin);
+        }
+        CompressedResourceHeader rh
+                = new CompressedResourceHeader(compressed.limit(), original.getLength(),
+                        nameOffset, configOffset, isTerminal);
+        // Merge header with content;
+        byte[] h = rh.getBytes(order);
+        ByteBuffer bb = ByteBuffer.allocate(compressed.limit() + h.length);
+        bb.order(order);
+        bb.put(h);
+        bb.put(compressed);
+        byte[] contentWithHeader = bb.array();
+
+        CompressedModuleData compressedResource
+                = new CompressedModuleData(original.getModule(), original.getPath(),
+                        new ByteArrayInputStream(contentWithHeader),
+                        contentWithHeader.length, uncompressed_size);
+        return compressedResource;
+    }
+
+}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginContextImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.tools.jlink.internal;
-
-import java.util.Properties;
-
-import jdk.tools.jlink.plugin.PluginContext;
-
-public final class PluginContextImpl implements PluginContext {
-    private final Properties releaseProps = new Properties();
-
-    public Properties getReleaseProperties() {
-        return releaseProps;
-    }
-}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PoolImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.tools.jlink.internal;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.Objects;
-import jdk.internal.jimage.decompressor.CompressedResourceHeader;
-import jdk.tools.jlink.plugin.Pool;
-
-/**
- * Pool of module data.
- */
-public class PoolImpl extends Pool {
-
-    /**
-     * A resource that has been compressed.
-     */
-    public static final class CompressedModuleData extends ModuleData {
-
-        private final long uncompressed_size;
-
-        private CompressedModuleData(String module, String path,
-                InputStream stream, long size,
-                long uncompressed_size) {
-            super(module, path, ModuleDataType.CLASS_OR_RESOURCE, stream, size);
-            this.uncompressed_size = uncompressed_size;
-        }
-
-        public long getUncompressedSize() {
-            return uncompressed_size;
-        }
-
-        @Override
-        public boolean equals(Object other) {
-            if (!(other instanceof CompressedModuleData)) {
-                return false;
-            }
-            CompressedModuleData f = (CompressedModuleData) other;
-            return f.getPath().equals(getPath());
-        }
-
-        @Override
-        public int hashCode() {
-            return super.hashCode();
-        }
-    }
-
-    private boolean isReadOnly;
-    private final StringTable table;
-
-    public PoolImpl() {
-        this(ByteOrder.nativeOrder(), new StringTable() {
-
-            @Override
-            public int addString(String str) {
-                return -1;
-            }
-            @Override
-            public String getString(int id) {
-                return null;
-            }
-        });
-    }
-
-    public PoolImpl(ByteOrder order) {
-        this(order, new StringTable() {
-
-            @Override
-            public int addString(String str) {
-                return -1;
-            }
-            @Override
-            public String getString(int id) {
-                return null;
-            }
-        });
-    }
-
-    public PoolImpl(ByteOrder order, StringTable table) {
-        super(order);
-        this.table = table;
-    }
-
-    public StringTable getStringTable() {
-        return table;
-    }
-
-    /**
-     * Make this Resources instance read-only. No resource can be added.
-     */
-    public void setReadOnly() {
-        isReadOnly = true;
-    }
-
-    /**
-     * Read only state.
-     *
-     * @return true if readonly false otherwise.
-     */
-    @Override
-    public boolean isReadOnly() {
-        return isReadOnly;
-    }
-
-    public static CompressedModuleData newCompressedResource(ModuleData original,
-            ByteBuffer compressed,
-            String plugin, String pluginConfig, StringTable strings,
-            ByteOrder order) {
-        Objects.requireNonNull(original);
-        Objects.requireNonNull(compressed);
-        Objects.requireNonNull(plugin);
-
-        boolean isTerminal = !(original instanceof CompressedModuleData);
-        long uncompressed_size = original.getLength();
-        if (original instanceof CompressedModuleData) {
-            CompressedModuleData comp = (CompressedModuleData) original;
-            uncompressed_size = comp.getUncompressedSize();
-        }
-        int nameOffset = strings.addString(plugin);
-        int configOffset = -1;
-        if (pluginConfig != null) {
-            configOffset = strings.addString(plugin);
-        }
-        CompressedResourceHeader rh
-                = new CompressedResourceHeader(compressed.limit(), original.getLength(),
-                        nameOffset, configOffset, isTerminal);
-        // Merge header with content;
-        byte[] h = rh.getBytes(order);
-        ByteBuffer bb = ByteBuffer.allocate(compressed.limit() + h.length);
-        bb.order(order);
-        bb.put(h);
-        bb.put(compressed);
-        byte[] contentWithHeader = bb.array();
-
-        CompressedModuleData compressedResource
-                = new CompressedModuleData(original.getModule(), original.getPath(),
-                        new ByteArrayInputStream(contentWithHeader),
-                        contentWithHeader.length, uncompressed_size);
-        return compressedResource;
-    }
-
-}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePrevisitor.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePrevisitor.java	Tue May 17 05:38:15 2016 -0700
@@ -24,7 +24,7 @@
  */
 package jdk.tools.jlink.internal;
 
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModulePool;
 
 /**
  * Plugin wishing to pre-visit the resources must implement this interface.
@@ -44,5 +44,5 @@
      * usage.
      * @throws PluginException
      */
-    public void previsit(Pool resources, StringTable strings);
+    public void previsit(ModulePool resources, StringTable strings);
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java	Tue May 17 05:38:15 2016 -0700
@@ -52,7 +52,7 @@
 import jdk.tools.jlink.Jlink;
 import jdk.tools.jlink.Jlink.PluginsConfiguration;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.Plugin.CATEGORY;
+import jdk.tools.jlink.plugin.Plugin.Category;
 import jdk.tools.jlink.builder.DefaultImageBuilder;
 import jdk.tools.jlink.builder.ImageBuilder;
 import jdk.tools.jlink.plugin.PluginException;
@@ -346,7 +346,6 @@
                 }
             }
 
-            PluginContextImpl pluginContext = new PluginContextImpl();
             List<Plugin> pluginsList = new ArrayList<>();
             for (Entry<Plugin, List<Map<String, String>>> entry : pluginToMaps.entrySet()) {
                 Plugin plugin = entry.getKey();
@@ -356,7 +355,7 @@
                 // we call configure once for each occurrence. It is upto the plugin
                 // to 'merge' and/or 'override' arguments.
                 for (Map<String, String> map : argsMaps) {
-                    plugin.configure(Collections.unmodifiableMap(map), pluginContext);
+                    plugin.configure(Collections.unmodifiableMap(map));
                 }
 
                 if (!Utils.isDisabled(plugin)) {
@@ -371,7 +370,7 @@
 
             }
             return new Jlink.PluginsConfiguration(pluginsList,
-                    builder, lastSorter, pluginContext);
+                    builder, lastSorter);
         }
     }
 
@@ -594,7 +593,7 @@
                          + ": " + plugin.getClass().getName());
                     log.println(bundleHelper.getMessage("main.plugin.module")
                          + ": " + plugin.getClass().getModule().getName());
-                    CATEGORY category = Utils.getCategory(plugin);
+                    Category category = Utils.getCategory(plugin);
                     log.println(bundleHelper.getMessage("main.plugin.category")
                          + ": " + category.getName());
                     log.println(bundleHelper.getMessage("main.plugin.state")
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java	Tue May 17 05:38:15 2016 -0700
@@ -30,7 +30,6 @@
 import java.util.List;
 import java.util.function.Function;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.Plugin.PluginType;
 
 public class Utils {
 
@@ -50,25 +49,26 @@
         return arguments;
     };
 
-    public static boolean isPostProcessor(Plugin.CATEGORY category) {
-        return category.equals(Plugin.CATEGORY.VERIFIER)
-                || category.equals(Plugin.CATEGORY.PROCESSOR)
-                || category.equals(Plugin.CATEGORY.PACKAGER);
+    public static boolean isPostProcessor(Plugin.Category category) {
+        return category.equals(Plugin.Category.VERIFIER)
+                || category.equals(Plugin.Category.PROCESSOR)
+                || category.equals(Plugin.Category.PACKAGER);
     }
 
-    public static boolean isPreProcessor(Plugin.CATEGORY category) {
-        return category.equals(Plugin.CATEGORY.COMPRESSOR)
-                || category.equals(Plugin.CATEGORY.FILTER)
-                || category.equals(Plugin.CATEGORY.MODULEINFO_TRANSFORMER)
-                || category.equals(Plugin.CATEGORY.SORTER)
-                || category.equals(Plugin.CATEGORY.TRANSFORMER);
+    public static boolean isPreProcessor(Plugin.Category category) {
+        return category.equals(Plugin.Category.COMPRESSOR)
+                || category.equals(Plugin.Category.FILTER)
+                || category.equals(Plugin.Category.MODULEINFO_TRANSFORMER)
+                || category.equals(Plugin.Category.SORTER)
+                || category.equals(Plugin.Category.TRANSFORMER)
+                || category.equals(Plugin.Category.METAINFO_ADDER);
     }
 
     public static boolean isPostProcessor(Plugin prov) {
         if (prov.getType() != null) {
-            for (PluginType pt : prov.getType()) {
-                if (pt instanceof Plugin.CATEGORY) {
-                    return isPostProcessor((Plugin.CATEGORY) pt);
+            for (Plugin.Category pt : prov.getType()) {
+                if (pt instanceof Plugin.Category) {
+                    return isPostProcessor(pt);
                 }
             }
         }
@@ -77,20 +77,20 @@
 
     public static boolean isPreProcessor(Plugin prov) {
         if (prov.getType() != null) {
-            for (PluginType pt : prov.getType()) {
-                if (pt instanceof Plugin.CATEGORY) {
-                    return isPreProcessor((Plugin.CATEGORY) pt);
+            for (Plugin.Category pt : prov.getType()) {
+                if (pt instanceof Plugin.Category) {
+                    return isPreProcessor(pt);
                 }
             }
         }
         return false;
     }
 
-    public static Plugin.CATEGORY getCategory(Plugin provider) {
+    public static Plugin.Category getCategory(Plugin provider) {
         if (provider.getType() != null) {
-            for (Plugin.PluginType t : provider.getType()) {
-                if (t instanceof Plugin.CATEGORY) {
-                    return (Plugin.CATEGORY) t;
+            for (Plugin.Category t : provider.getType()) {
+                if (t instanceof Plugin.Category) {
+                    return t;
                 }
             }
         }
@@ -140,15 +140,15 @@
     }
 
     public static boolean isFunctional(Plugin prov) {
-        return prov.getState().contains(Plugin.STATE.FUNCTIONAL);
+        return prov.getState().contains(Plugin.State.FUNCTIONAL);
     }
 
     public static boolean isAutoEnabled(Plugin prov) {
-        return prov.getState().contains(Plugin.STATE.AUTO_ENABLED);
+        return prov.getState().contains(Plugin.State.AUTO_ENABLED);
     }
 
     public static boolean isDisabled(Plugin prov) {
-        return prov.getState().contains(Plugin.STATE.DISABLED);
+        return prov.getState().contains(Plugin.State.DISABLED);
     }
 
     // is this a builtin (jdk.jlink) plugin?
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/packager/AppRuntimeImageBuilder.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/packager/AppRuntimeImageBuilder.java	Tue May 17 05:38:15 2016 -0700
@@ -30,7 +30,7 @@
 import jdk.tools.jlink.builder.ImageBuilder;
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.builder.*;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModulePool;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -26,16 +26,13 @@
 
 import java.io.IOException;
 import java.io.UncheckedIOException;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.internal.PoolImpl;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 import jdk.tools.jlink.internal.ImagePluginStack;
 import jdk.tools.jlink.internal.ResourcePrevisitor;
@@ -62,10 +59,10 @@
     }
 
     @Override
-    public void visit(Pool in, Pool out) {
+    public void visit(ModulePool in, ModulePool out) {
         if (ss != null && zip != null) {
-            Pool output = new ImagePluginStack.OrderedResourcePool(in.getByteOrder(),
-                    ((PoolImpl) in).getStringTable());
+            ModulePool output = new ImagePluginStack.OrderedResourcePool(in.getByteOrder(),
+                    ((ModulePoolImpl) in).getStringTable());
             ss.visit(in, output);
             zip.visit(output, out);
         } else if (ss != null) {
@@ -76,16 +73,16 @@
     }
 
     @Override
-    public void previsit(Pool resources, StringTable strings) {
+    public void previsit(ModulePool resources, StringTable strings) {
         if (ss != null) {
             ss.previsit(resources, strings);
         }
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.COMPRESSOR);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.COMPRESSOR);
         return Collections.unmodifiableSet(set);
     }
 
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -32,8 +32,8 @@
 import java.util.Set;
 import java.util.function.Predicate;
 import jdk.tools.jlink.plugin.TransformerPlugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleDataType;
+import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ModuleEntry;
 import jdk.tools.jlink.internal.Utils;
 
 /**
@@ -51,9 +51,9 @@
     }
 
     @Override
-    public void visit(Pool in, Pool out) {
-        in.visit((file) -> {
-            if (!file.getType().equals(ModuleDataType.CLASS_OR_RESOURCE)) {
+    public void visit(ModulePool in, ModulePool out) {
+        in.transformAndCopy((file) -> {
+            if (!file.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)) {
                 file = predicate.test(file.getPath()) ? file : null;
             }
             return file;
@@ -61,9 +61,9 @@
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.FILTER);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.FILTER);
         return Collections.unmodifiableSet(set);
     }
 
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -32,7 +32,8 @@
 import java.util.function.Predicate;
 import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.TransformerPlugin;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.internal.Utils;
 
 /**
@@ -50,9 +51,9 @@
     }
 
     @Override
-    public void visit(Pool in, Pool out) {
-        in.visit((resource) -> {
-            if (resource.getType().equals(Pool.ModuleDataType.CLASS_OR_RESOURCE)) {
+    public void visit(ModulePool in, ModulePool out) {
+        in.transformAndCopy((resource) -> {
+            if (resource.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)) {
                 resource = predicate.test(resource.getPath()) ? resource : null;
             }
             return resource;
@@ -75,9 +76,9 @@
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.FILTER);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.FILTER);
         return Collections.unmodifiableSet(set);
     }
 
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -40,9 +40,10 @@
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 import jdk.tools.jlink.plugin.TransformerPlugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleDataType;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.internal.Utils;
+import jdk.tools.jlink.plugin.ModuleEntry;
 import jdk.tools.jlink.plugin.PluginException;
 
 /**
@@ -102,24 +103,24 @@
      * e.g.: /java.base/native/amd64/server/libjvm.so
      * /java.base/native/server/libjvm.dylib
      */
-    private List<Pool.ModuleData> getVMs(Pool in) {
+    private List<ModuleEntry> getVMs(ModulePool in) {
         String jvmlib = jvmlib();
-        List<Pool.ModuleData> ret = in.getModule("java.base").getContent().stream().filter((t) -> {
+        List<ModuleEntry> ret = in.findModule("java.base").get().entries().filter((t) -> {
             return t.getPath().endsWith("/" + jvmlib);
         }).collect(Collectors.toList());
         return ret;
     }
 
     @Override
-    public void visit(Pool in, Pool out) {
+    public void visit(ModulePool in, ModulePool out) {
         String jvmlib = jvmlib();
         TreeSet<Jvm> existing = new TreeSet<>(new JvmComparator());
         TreeSet<Jvm> removed = new TreeSet<>(new JvmComparator());
         if (!keepAll) {
             // First retrieve all available VM names and removed VM
-            List<Pool.ModuleData> jvms = getVMs(in);
+            List<ModuleEntry> jvms = getVMs(in);
             for (Jvm jvm : Jvm.values()) {
-                for (Pool.ModuleData md : jvms) {
+                for (ModuleEntry md : jvms) {
                     if (md.getPath().endsWith("/" + jvm.getName() + "/" + jvmlib)) {
                         existing.add(jvm);
                         if (isRemoved(md)) {
@@ -137,9 +138,9 @@
         }
 
         // Rewrite the jvm.cfg file.
-        in.visit((file) -> {
+        in.transformAndCopy((file) -> {
             if (!keepAll) {
-                if (file.getType().equals(ModuleDataType.NATIVE_LIB)) {
+                if (file.getType().equals(ModuleEntry.Type.NATIVE_LIB)) {
                     if (file.getPath().endsWith(JVM_CFG)) {
                         try {
                             file = handleJvmCfgFile(file, existing, removed);
@@ -155,14 +156,14 @@
 
     }
 
-    private boolean isRemoved(Pool.ModuleData file) {
+    private boolean isRemoved(ModuleEntry file) {
         return !predicate.test(file.getPath());
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.FILTER);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.FILTER);
         return Collections.unmodifiableSet(set);
     }
 
@@ -217,7 +218,7 @@
         }
     }
 
-    private Pool.ModuleData handleJvmCfgFile(Pool.ModuleData orig,
+    private ModuleEntry handleJvmCfgFile(ModuleEntry orig,
             TreeSet<Jvm> existing,
             TreeSet<Jvm> removed) throws IOException {
         if (keepAll) {
@@ -253,7 +254,7 @@
 
         byte[] content = builder.toString().getBytes(StandardCharsets.UTF_8);
 
-        return Pool.newImageFile(orig.getModule(),
+        return ModuleEntry.create(orig.getModule(),
                 orig.getPath(),
                 orig.getType(),
                 new ByteArrayInputStream(content), content.length);
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -41,10 +41,10 @@
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
+import jdk.tools.jlink.internal.ModuleEntryImpl;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
-import jdk.tools.jlink.plugin.Pool.ModuleDataType;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 import jdk.tools.jlink.internal.Utils;
 
@@ -68,12 +68,12 @@
     /**
      * Symbolic link to another path.
      */
-    public static abstract class SymImageFile extends Pool.ModuleData {
+    public static abstract class SymImageFile extends ModuleEntryImpl {
 
         private final String targetPath;
 
         public SymImageFile(String targetPath, String module, String path,
-                Pool.ModuleDataType type, InputStream stream, long size) {
+                ModuleEntry.Type type, InputStream stream, long size) {
             super(module, path, type, stream, size);
             this.targetPath = targetPath;
         }
@@ -86,7 +86,7 @@
     private static final class SymImageFileImpl extends SymImageFile {
 
         public SymImageFileImpl(String targetPath, Path file, String module,
-                String path, ModuleDataType type) {
+                String path, ModuleEntry.Type type) {
             super(targetPath, module, path, type, newStream(file), length(file));
         }
     }
@@ -110,11 +110,11 @@
     private static final class DirectoryCopy implements FileVisitor<Path> {
 
         private final Path source;
-        private final Pool pool;
+        private final ModulePool pool;
         private final String targetDir;
         private final List<SymImageFile> symlinks = new ArrayList<>();
 
-        DirectoryCopy(Path source, Pool pool, String targetDir) {
+        DirectoryCopy(Path source, ModulePool pool, String targetDir) {
             this.source = source;
             this.pool = pool;
             this.targetDir = targetDir;
@@ -148,7 +148,7 @@
                 }
                 SymImageFileImpl impl = new SymImageFileImpl(symTarget.toString(),
                         file, path, Objects.requireNonNull(file.getFileName()).toString(),
-                        Pool.ModuleDataType.OTHER);
+                        ModuleEntry.Type.OTHER);
                 symlinks.add(impl);
             } else {
                 addFile(pool, file, path);
@@ -172,14 +172,14 @@
         }
     }
 
-    private static void addFile(Pool pool, Path file, String path)
+    private static void addFile(ModulePool pool, Path file, String path)
             throws IOException {
         Objects.requireNonNull(pool);
         Objects.requireNonNull(file);
         Objects.requireNonNull(path);
-        ModuleData impl = Pool.newImageFile(FAKE_MODULE,
+        ModuleEntry impl = ModuleEntry.create(FAKE_MODULE,
                 "/" + FAKE_MODULE + "/other/" + path,
-                Pool.ModuleDataType.OTHER, newStream(file), length(file));
+                ModuleEntry.Type.OTHER, newStream(file), length(file));
         try {
             pool.add(impl);
         } catch (Exception ex) {
@@ -188,9 +188,9 @@
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.TRANSFORMER);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.TRANSFORMER);
         return Collections.unmodifiableSet(set);
     }
 
@@ -239,8 +239,8 @@
     }
 
     @Override
-    public void visit(Pool in, Pool out) {
-        in.visit((file) -> {
+    public void visit(ModulePool in, ModulePool out) {
+        in.transformAndCopy((file) -> {
             return file;
         }, out);
 
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -33,8 +33,9 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
+import jdk.tools.jlink.plugin.ModuleEntry;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 /**
@@ -60,8 +61,8 @@
     }
 
     @Override
-    public Set<PluginType> getType() {
-        return Collections.singleton(CATEGORY.TRANSFORMER);
+    public Set<Category> getType() {
+        return Collections.singleton(Category.TRANSFORMER);
     }
 
     @Override
@@ -75,8 +76,8 @@
     }
 
     @Override
-    public Set<STATE> getState() {
-        return EnumSet.of(STATE.AUTO_ENABLED, STATE.FUNCTIONAL);
+    public Set<State> getState() {
+        return EnumSet.of(State.AUTO_ENABLED, State.FUNCTIONAL);
     }
 
     @Override
@@ -151,8 +152,8 @@
     }
 
     @Override
-    public void visit(Pool in, Pool out) {
-        for (Pool.ModuleData data : in.getContent()) {
+    public void visit(ModulePool in, ModulePool out) {
+        in.entries().forEach(data -> {
             if (("/java.base/" + BMH + ".class").equals(data.getPath())) {
                 // Add BoundMethodHandle unchanged
                 out.add(data);
@@ -162,11 +163,11 @@
                     out.add(data);
                 }
             }
-        }
+        });
     }
 
     @SuppressWarnings("unchecked")
-    private void generateConcreteClass(String types, Pool.ModuleData data, Pool out) {
+    private void generateConcreteClass(String types, ModuleEntry data, ModulePool out) {
         try {
             // Generate class
             Map.Entry<String, byte[]> result = (Map.Entry<String, byte[]>)
@@ -175,9 +176,9 @@
             byte[] bytes = result.getValue();
 
             // Add class to pool
-            Pool.ModuleData ndata = new Pool.ModuleData(data.getModule(),
+            ModuleEntry ndata = ModuleEntry.create(data.getModule(),
                     "/java.base/" + className + ".class",
-                    Pool.ModuleDataType.CLASS_OR_RESOURCE,
+                    ModuleEntry.Type.CLASS_OR_RESOURCE,
                     new ByteArrayInputStream(bytes), bytes.length);
             if (!out.contains(ndata)) {
                 out.add(ndata);
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -34,6 +34,7 @@
 import java.util.Locale;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.function.Predicate;
 import java.util.regex.Pattern;
@@ -44,9 +45,10 @@
 import jdk.tools.jlink.internal.ResourcePrevisitor;
 import jdk.tools.jlink.internal.StringTable;
 import jdk.tools.jlink.internal.Utils;
+import jdk.tools.jlink.plugin.LinkModule;
+import jdk.tools.jlink.plugin.ModuleEntry;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleDataType;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 /**
@@ -112,19 +114,19 @@
     }
 
     @Override
-    public void visit(Pool in, Pool out) {
-        in.visit((resource) -> {
+    public void visit(ModulePool in, ModulePool out) {
+        in.transformAndCopy((resource) -> {
             if (resource.getModule().equals(MODULENAME)) {
                 String path = resource.getPath();
                 resource = predicate.test(path) ? resource: null;
                 if (resource != null &&
-                    resource.getType().equals(ModuleDataType.CLASS_OR_RESOURCE)) {
+                    resource.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)) {
                     byte[] bytes = resource.getBytes();
                     ClassReader cr = new ClassReader(bytes);
                     if (Arrays.stream(cr.getInterfaces())
                         .anyMatch(i -> i.contains(METAINFONAME)) &&
                         stripUnsupportedLocales(bytes, cr)) {
-                        resource = new Pool.ModuleData(MODULENAME, path,
+                        resource = ModuleEntry.create(MODULENAME, path,
                             resource.getType(),
                             new ByteArrayInputStream(bytes), bytes.length);
                     }
@@ -135,9 +137,9 @@
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.FILTER);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.FILTER);
         return Collections.unmodifiableSet(set);
     }
 
@@ -172,12 +174,13 @@
     }
 
     @Override
-    public void previsit(Pool resources, StringTable strings) {
+    public void previsit(ModulePool resources, StringTable strings) {
         final Pattern p = Pattern.compile(".*((Data_)|(Names_))(?<tag>.*)\\.class");
-        Pool.Module module = resources.getModule(MODULENAME);
+        Optional<LinkModule> optMod = resources.findModule(MODULENAME);
 
         // jdk.localedata module validation
-        if (module != null) {
+        if (optMod.isPresent()) {
+            LinkModule module = optMod.get();
             Set<String> packages = module.getAllPackages();
             if (!packages.containsAll(LOCALEDATA_PACKAGES)) {
                 throw new PluginException(PluginsResourceBundle.getMessage(NAME + ".missingpackages") +
@@ -186,7 +189,7 @@
                         .collect(Collectors.joining(",\n\t")));
             }
 
-            available = Stream.concat(module.getContent().stream()
+            available = Stream.concat(module.entries()
                                         .map(md -> p.matcher(md.getPath()))
                                         .filter(m -> m.matches())
                                         .map(m -> m.group("tag").replaceAll("_", "-")),
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OptimizationPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OptimizationPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -24,7 +24,6 @@
  */
 package jdk.tools.jlink.internal.plugins;
 
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -287,9 +286,9 @@
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.TRANSFORMER);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.TRANSFORMER);
         return Collections.unmodifiableSet(set);
     }
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -36,9 +36,8 @@
 import java.util.Set;
 import java.util.function.ToIntFunction;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
-import jdk.tools.jlink.plugin.Pool.ModuleDataType;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 import jdk.tools.jlink.internal.Utils;
 
@@ -62,15 +61,15 @@
     }
 
     static class SortWrapper {
-        private final ModuleData resource;
+        private final ModuleEntry resource;
         private final int ordinal;
 
-        SortWrapper(ModuleData resource, int ordinal) {
+        SortWrapper(ModuleEntry resource, int ordinal) {
             this.resource = resource;
             this.ordinal = ordinal;
         }
 
-        ModuleData getResource() {
+        ModuleEntry getResource() {
             return resource;
         }
 
@@ -95,7 +94,7 @@
         return path;
     }
 
-    private int getOrdinal(ModuleData resource) {
+    private int getOrdinal(ModuleEntry resource) {
         String path = resource.getPath();
 
         Integer value = orderedPaths.get(stripModule(path));
@@ -126,23 +125,23 @@
     }
 
     @Override
-    public void visit(Pool in, Pool out) {
-        in.getContent().stream()
+    public void visit(ModulePool in, ModulePool out) {
+        in.entries()
                 .filter(resource -> resource.getType()
-                        .equals(ModuleDataType.CLASS_OR_RESOURCE))
+                        .equals(ModuleEntry.Type.CLASS_OR_RESOURCE))
                 .map((resource) -> new SortWrapper(resource, getOrdinal(resource)))
                 .sorted(OrderResourcesPlugin::compare)
                 .forEach((wrapper) -> out.add(wrapper.getResource()));
-        in.getContent().stream()
+        in.entries()
                 .filter(other -> !other.getType()
-                        .equals(ModuleDataType.CLASS_OR_RESOURCE))
+                        .equals(ModuleEntry.Type.CLASS_OR_RESOURCE))
                 .forEach((other) -> out.add(other));
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.SORTER);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.SORTER);
 
         return Collections.unmodifiableSet(set);
     }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -24,34 +24,33 @@
  */
 package jdk.tools.jlink.internal.plugins;
 
-import java.lang.module.ModuleDescriptor;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.EnumSet;
-import java.util.List;
+import java.util.HashMap;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
-import java.util.Properties;
-
+import java.util.function.Function;
 import jdk.tools.jlink.internal.Utils;
-import jdk.tools.jlink.plugin.ExecutableImage;
-import jdk.tools.jlink.plugin.PluginContext;
-import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.PostProcessorPlugin;
+import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.Plugin.Category;
+import jdk.tools.jlink.plugin.Plugin.State;
+import jdk.tools.jlink.plugin.TransformerPlugin;
 
 /**
  * This plugin adds/deletes information for 'release' file.
  */
-public final class ReleaseInfoPlugin implements PostProcessorPlugin {
+public final class ReleaseInfoPlugin implements TransformerPlugin {
     // option name
     public static final String NAME = "release-info";
     public static final String KEYS = "keys";
+    private final Map<String, String> release = new HashMap<>();
 
     @Override
-    public Set<PluginType> getType() {
-        return Collections.singleton(CATEGORY.PROCESSOR);
+    public Set<Category> getType() {
+        return Collections.singleton(Category.METAINFO_ADDER);
     }
 
     @Override
@@ -65,8 +64,8 @@
     }
 
     @Override
-    public Set<STATE> getState() {
-        return EnumSet.of(STATE.FUNCTIONAL);
+    public Set<State> getState() {
+        return EnumSet.of(State.FUNCTIONAL);
     }
 
     @Override
@@ -80,49 +79,49 @@
     }
 
     @Override
-    public void configure(Map<String, String> config, PluginContext ctx) {
-        Properties release = ctx != null? ctx.getReleaseProperties() : null;
-        if (release != null) {
-            String operation = config.get(NAME);
-            switch (operation) {
-                case "add": {
-                    // leave it to open-ended! source, java_version, java_full_version
-                    // can be passed via this option like:
-                    //
-                    //     --release-info add:build_type=fastdebug,source=openjdk,java_version=9
-                    // and put whatever value that was passed in command line.
+    public void configure(Map<String, String> config) {
+        String operation = config.get(NAME);
+        switch (operation) {
+            case "add": {
+                // leave it to open-ended! source, java_version, java_full_version
+                // can be passed via this option like:
+                //
+                //     --release-info add:build_type=fastdebug,source=openjdk,java_version=9
+                // and put whatever value that was passed in command line.
 
-                    config.keySet().stream().
-                        filter(s -> !NAME.equals(s)).
-                        forEach(s -> release.put(s, config.get(s)));
-                }
-                break;
+                config.keySet().stream().
+                    filter(s -> !NAME.equals(s)).
+                    forEach(s -> release.put(s, config.get(s)));
+            }
+            break;
 
-                case "del": {
-                    // --release-info del:keys=openjdk,java_version
-                    String[] keys = Utils.listParser.apply(config.get(KEYS));
-                    for (String k : keys) {
-                        release.remove(k);
-                    }
+            case "del": {
+                // --release-info del:keys=openjdk,java_version
+                String[] keys = Utils.listParser.apply(config.get(KEYS));
+                for (String k : keys) {
+                    release.remove(k);
                 }
-                break;
+            }
+            break;
 
-                default: {
-                    // --release-info <file>
-                    try (FileInputStream fis = new FileInputStream(operation)) {
-                        release.load(fis);
-                    } catch (IOException exp) {
-                        throw new RuntimeException(exp);
-                    }
+            default: {
+                // --release-info <file>
+                Properties props = new Properties();
+                try (FileInputStream fis = new FileInputStream(operation)) {
+                    props.load(fis);
+                } catch (IOException exp) {
+                    throw new RuntimeException(exp);
                 }
-                break;
+                props.forEach((k, v) -> release.put(k.toString(), v.toString()));
             }
+            break;
         }
     }
 
     @Override
-    public List<String> process(ExecutableImage image) {
-        // Nothing to do! Release info copied already during configure!
-        return Collections.emptyList();
+    public void visit(ModulePool in, ModulePool out) {
+        in.transformAndCopy(Function.identity(), out);
+        out.getReleaseProperties().putAll(in.getReleaseProperties());
+        out.getReleaseProperties().putAll(release);
     }
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -56,11 +56,11 @@
 import jdk.internal.jimage.decompressor.CompressIndexes;
 import jdk.internal.jimage.decompressor.SignatureParser;
 import jdk.internal.jimage.decompressor.StringSharingDecompressor;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.internal.ResourcePrevisitor;
 import jdk.tools.jlink.internal.StringTable;
 import jdk.tools.jlink.internal.Utils;
@@ -228,7 +228,7 @@
             }
         }
 
-        public byte[] transform(ModuleData resource, Pool out,
+        public byte[] transform(ModuleEntry resource, ModulePool out,
                 StringTable strings) throws IOException, Exception {
             byte[] content = resource.getBytes();
             ClassFile cf;
@@ -243,7 +243,7 @@
         }
 
         @SuppressWarnings("fallthrough")
-        private byte[] optimize(ModuleData resource, Pool resources,
+        private byte[] optimize(ModuleEntry resource, ModulePool resources,
                 StringTable strings,
                 Set<Integer> descriptorIndexes, byte[] content) throws Exception {
             DataInputStream stream = new DataInputStream(new ByteArrayInputStream(content));
@@ -348,27 +348,27 @@
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.COMPRESSOR);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.COMPRESSOR);
         return Collections.unmodifiableSet(set);
     }
 
     @Override
-    public void visit(Pool in, Pool result) {
+    public void visit(ModulePool in, ModulePool result) {
         CompactCPHelper visit = new CompactCPHelper();
-        in.visit((resource) -> {
-            ModuleData res = resource;
+        in.transformAndCopy((resource) -> {
+            ModuleEntry res = resource;
             if (predicate.test(resource.getPath()) && resource.getPath().endsWith(".class")) {
                 byte[] compressed = null;
                 try {
-                    compressed = visit.transform(resource, result, ((PoolImpl) in).getStringTable());
+                    compressed = visit.transform(resource, result, ((ModulePoolImpl) in).getStringTable());
                 } catch (Exception ex) {
                     throw new PluginException(ex);
                 }
-                res = PoolImpl.newCompressedResource(resource,
+                res = ModulePoolImpl.newCompressedResource(resource,
                         ByteBuffer.wrap(compressed), getName(), null,
-                        ((PoolImpl) in).getStringTable(), in.getByteOrder());
+                        ((ModulePoolImpl) in).getStringTable(), in.getByteOrder());
             }
             return res;
         }, result);
@@ -405,10 +405,10 @@
     }
 
     @Override
-    public void previsit(Pool resources, StringTable strings) {
+    public void previsit(ModulePool resources, StringTable strings) {
         CompactCPHelper preVisit = new CompactCPHelper();
-        for (ModuleData resource : resources.getContent()) {
-            if (resource.getType().equals(Pool.ModuleDataType.CLASS_OR_RESOURCE)
+        resources.entries().forEach(resource -> {
+            if (resource.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)
                     && resource.getPath().endsWith(".class") && predicate.test(resource.getPath())) {
                 try {
                     preVisit.transform(resource, null, strings);
@@ -416,6 +416,6 @@
                     throw new PluginException(ex);
                 }
             }
-        }
+        });
     }
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -29,14 +29,12 @@
 import java.io.UncheckedIOException;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Set;
 import java.util.function.Predicate;
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
-import jdk.tools.jlink.plugin.Pool.ModuleDataType;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 /**
@@ -61,9 +59,9 @@
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.TRANSFORMER);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.TRANSFORMER);
         return Collections.unmodifiableSet(set);
     }
 
@@ -73,11 +71,11 @@
     }
 
     @Override
-    public void visit(Pool in, Pool out) {
+    public void visit(ModulePool in, ModulePool out) {
         //remove *.diz files as well as debug attributes.
-        in.visit((resource) -> {
-            ModuleData res = resource;
-            if (resource.getType().equals(ModuleDataType.CLASS_OR_RESOURCE)) {
+        in.transformAndCopy((resource) -> {
+            ModuleEntry res = resource;
+            if (resource.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)) {
                 String path = resource.getPath();
                 if (path.endsWith(".class")) {
                     if (path.endsWith("module-info.class")) {
@@ -87,7 +85,7 @@
                         ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
                         reader.accept(writer, ClassReader.SKIP_DEBUG);
                         byte[] content = writer.toByteArray();
-                        res = Pool.newResource(path, new ByteArrayInputStream(content), content.length);
+                        res = ModuleEntry.create(path, new ByteArrayInputStream(content), content.length);
                     }
                 }
             } else if (predicate.test(res.getPath())) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -26,9 +26,9 @@
 
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Set;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 /**
@@ -45,16 +45,16 @@
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.FILTER);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.FILTER);
         return Collections.unmodifiableSet(set);
     }
 
     @Override
-    public void visit(Pool in, Pool out) {
-        in.visit((file) -> {
-            return file.getType() == Pool.ModuleDataType.NATIVE_CMD ? null : file;
+    public void visit(ModulePool in, ModulePool out) {
+        in.transformAndCopy((file) -> {
+            return file.getType() == ModuleEntry.Type.NATIVE_CMD ? null : file;
         }, out);
     }
 
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -36,6 +36,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
 
@@ -50,9 +51,10 @@
 
 import static jdk.internal.org.objectweb.asm.Opcodes.*;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 import jdk.tools.jlink.internal.plugins.SystemModuleDescriptorPlugin.Builder.*;
+import jdk.tools.jlink.plugin.ModuleEntry;
 
 /**
  * Jlink plugin to reconstitute module descriptors for installed modules.
@@ -81,8 +83,8 @@
     }
 
     @Override
-    public Set<PluginType> getType() {
-        return Collections.singleton(CATEGORY.TRANSFORMER);
+    public Set<Category> getType() {
+        return Collections.singleton(Category.TRANSFORMER);
     }
 
     @Override
@@ -96,9 +98,9 @@
     }
 
     @Override
-    public Set<STATE> getState() {
-        return enabled ? EnumSet.of(STATE.AUTO_ENABLED, STATE.FUNCTIONAL)
-                       : EnumSet.of(STATE.DISABLED);
+    public Set<State> getState() {
+        return enabled ? EnumSet.of(State.AUTO_ENABLED, State.FUNCTIONAL)
+                       : EnumSet.of(State.DISABLED);
     }
 
     @Override
@@ -110,7 +112,7 @@
 
 
     @Override
-    public void visit(Pool in, Pool out) {
+    public void visit(ModulePool in, ModulePool out) {
         if (!enabled) {
             throw new PluginException(NAME + " was set");
         }
@@ -119,13 +121,14 @@
 
         // generate the byte code to create ModuleDescriptors
         // skip parsing module-info.class and skip name check
-        for (Pool.Module module : in.getModules()) {
-            Pool.ModuleData data = module.get("module-info.class");
-            if (data == null) {
+        in.modules().forEach(module -> {
+            Optional<ModuleEntry> optData = module.findEntry("module-info.class");
+            if (! optData.isPresent()) {
                 // automatic module not supported yet
                 throw new PluginException("module-info.class not found for " +
                                           module.getName() + " module");
             }
+            ModuleEntry data = optData.get();
             assert module.getName().equals(data.getModule());
             try {
                 ByteArrayInputStream bain = new ByteArrayInputStream(data.getBytes());
@@ -141,7 +144,7 @@
                     ModuleInfoRewriter minfoWriter =
                         new ModuleInfoRewriter(bain, mbuilder.conceals());
                     // replace with the overridden version
-                    data = new Pool.ModuleData(data.getModule(),
+                    data = ModuleEntry.create(data.getModule(),
                                                data.getPath(),
                                                data.getType(),
                                                minfoWriter.stream(),
@@ -151,19 +154,17 @@
             } catch (IOException e) {
                 throw new PluginException(e);
             }
-
-        }
+        });
 
         // Generate the new class
         ClassWriter cwriter = builder.build();
-        for (Pool.ModuleData data : in.getContent()) {
+        in.entries().forEach(data -> {
             if (data.getPath().endsWith("module-info.class"))
-                continue;
-
+                return;
             if (builder.isOverriddenClass(data.getPath())) {
                 byte[] bytes = cwriter.toByteArray();
-                Pool.ModuleData ndata =
-                    new Pool.ModuleData(data.getModule(),
+                ModuleEntry ndata =
+                    ModuleEntry.create(data.getModule(),
                                         data.getPath(),
                                         data.getType(),
                                         new ByteArrayInputStream(bytes),
@@ -172,7 +173,7 @@
             } else {
                 out.add(data);
             }
-        }
+        });
     }
 
     /*
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -34,10 +34,9 @@
 import java.util.function.Predicate;
 import java.util.zip.Deflater;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.internal.PoolImpl;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
-import jdk.tools.jlink.plugin.Pool.ModuleDataType;
+import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 import jdk.tools.jlink.internal.Utils;
 
@@ -68,9 +67,9 @@
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.COMPRESSOR);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.COMPRESSOR);
         return Collections.unmodifiableSet(set);
     }
 
@@ -124,16 +123,16 @@
     }
 
     @Override
-    public void visit(Pool in, Pool out) {
-        in.visit((resource) -> {
-            ModuleData res = resource;
-            if (resource.getType().equals(ModuleDataType.CLASS_OR_RESOURCE)
+    public void visit(ModulePool in, ModulePool out) {
+        in.transformAndCopy((resource) -> {
+            ModuleEntry res = resource;
+            if (resource.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)
                     && predicate.test(resource.getPath())) {
                 byte[] compressed;
                 compressed = compress(resource.getBytes());
-                res = PoolImpl.newCompressedResource(resource,
+                res = ModulePoolImpl.newCompressedResource(resource,
                         ByteBuffer.wrap(compressed), getName(), null,
-                        ((PoolImpl) in).getStringTable(), in.getByteOrder());
+                        ((ModulePoolImpl) in).getStringTable(), in.getByteOrder());
             }
             return res;
         }, out);
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -26,9 +26,9 @@
 
 import java.util.Objects;
 import jdk.tools.jlink.plugin.TransformerPlugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 
 /**
  * Extend this class to develop your own plugin in order to transform jimage
@@ -41,17 +41,17 @@
     }
 
     @Override
-    public void visit(Pool allContent, Pool outResources) {
+    public void visit(ModulePool allContent, ModulePool outResources) {
         Objects.requireNonNull(allContent);
         Objects.requireNonNull(outResources);
-        PoolImpl resources = new PoolImpl(allContent.getByteOrder());
-        for(ModuleData md : allContent.getContent()) {
-            if(md.getType().equals(Pool.ModuleDataType.CLASS_OR_RESOURCE)) {
+        ModulePoolImpl resources = new ModulePoolImpl(allContent.getByteOrder());
+        allContent.entries().forEach(md -> {
+            if(md.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)) {
                 resources.add(md);
             } else {
                 outResources.add(md);
             }
-        }
+        });
         AsmPools pools = new AsmPools(resources);
         visit(pools);
         pools.fillOutputResources(outResources);
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPool.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPool.java	Tue May 17 05:38:15 2016 -0700
@@ -24,13 +24,12 @@
  */
 package jdk.tools.jlink.internal.plugins.asm;
 
-import java.io.InputStream;
-import java.nio.ByteBuffer;
 import java.util.Collection;
 import java.util.List;
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 
 /**
  * A pool of ClassReader and other resource files.
@@ -138,14 +137,14 @@
          * @return The ClassReader or null if the class is not found.
          * @throws jdk.tools.jlink.plugin.PluginException
          */
-        public ClassReader getClassReader(Pool.ModuleData res);
+        public ClassReader getClassReader(ModuleEntry res);
 
         /**
          * Returns all the classes contained in the writable pool.
          *
          * @return The collection of classes.
          */
-        public Collection<Pool.ModuleData> getClasses();
+        public Collection<ModuleEntry> getClasses();
     }
 
     /**
@@ -185,14 +184,14 @@
          * @param res The java resource
          * @return The Resource or null if the resource is not found.
          */
-        public ResourceFile getResourceFile(Pool.ModuleData res);
+        public ResourceFile getResourceFile(ModuleEntry res);
 
         /**
          * Returns all the resources contained in the writable pool.
          *
          * @return The array of resources.
          */
-        public Collection<Pool.ModuleData> getResourceFiles();
+        public Collection<ModuleEntry> getResourceFiles();
     }
 
     /**
@@ -206,7 +205,7 @@
          * @return The resource paths ordered in the way to use for storage in the jimage.
          * @throws jdk.tools.jlink.plugin.PluginException
          */
-        public List<String> sort(Pool resources);
+        public List<String> sort(ModulePool resources);
     }
 
     /**
@@ -237,7 +236,7 @@
      *
      * @return The classes.
      */
-    public Collection<Pool.ModuleData> getClasses();
+    public Collection<ModuleEntry> getClasses();
 
     /**
      * Returns the resources contained in the pool. Resources are all the file
@@ -245,7 +244,7 @@
      *
      * @return The array of resource files.
      */
-    public Collection<Pool.ModuleData> getResourceFiles();
+    public Collection<ModuleEntry> getResourceFiles();
 
     /**
      * Retrieves a resource based on the binary name. This name doesn't contain
@@ -266,7 +265,7 @@
      * @param res The resource
      * @return The resource file or null if it doesn't exist.
      */
-    public ResourceFile getResourceFile(Pool.ModuleData res);
+    public ResourceFile getResourceFile(ModuleEntry res);
 
     /**
      * Retrieve a ClassReader from the pool.
@@ -284,7 +283,7 @@
      * @return A reader or null if the class is unknown
      * @throws jdk.tools.jlink.plugin.PluginException
      */
-    public ClassReader getClassReader(Pool.ModuleData res);
+    public ClassReader getClassReader(ModuleEntry res);
 
     /**
      * To visit the set of ClassReaders.
@@ -310,6 +309,6 @@
      * @param output The pool used to fill the jimage.
      * @throws jdk.tools.jlink.plugin.PluginException
      */
-    public void fillOutputResources(Pool output);
+    public void fillOutputResources(ModulePool output);
 
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPoolImpl.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPoolImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -41,15 +41,14 @@
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Objects;
-import java.util.Optional;
 import java.util.Set;
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.tools.jlink.internal.ImageFileCreator;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.plugin.ModuleEntry;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModulePool;
 
 /**
  * A pool of ClassReader and other resource files. This class allows to
@@ -94,7 +93,7 @@
             }
 
             byte[] content = writer.toByteArray();
-            ModuleData res = Pool.newResource(path,
+            ModuleEntry res = ModuleEntry.create(path,
                     new ByteArrayInputStream(content), content.length);
             transformedClasses.put(className, res);
         }
@@ -108,7 +107,7 @@
         public void forgetClass(String className) {
             Objects.requireNonNull(className);
             // do we have a resource?
-            ModuleData res = transformedClasses.get(className);
+            ModuleEntry res = transformedClasses.get(className);
             if (res == null) {
                 res = inputClasses.get(className);
                 if (res == null) {
@@ -130,7 +129,7 @@
         @Override
         public ClassReader getClassReader(String binaryName) {
             Objects.requireNonNull(binaryName);
-            ModuleData res = transformedClasses.get(binaryName);
+            ModuleEntry res = transformedClasses.get(binaryName);
             ClassReader reader = null;
             if (res != null) {
                 reader = getClassReader(res);
@@ -144,16 +143,16 @@
          * @return The array of transformed classes.
          */
         @Override
-        public Collection<ModuleData> getClasses() {
-            List<ModuleData> classes = new ArrayList<>();
-            for (Entry<String, ModuleData> entry : transformedClasses.entrySet()) {
+        public Collection<ModuleEntry> getClasses() {
+            List<ModuleEntry> classes = new ArrayList<>();
+            for (Entry<String, ModuleEntry> entry : transformedClasses.entrySet()) {
                 classes.add(entry.getValue());
             }
             return classes;
         }
 
         @Override
-        public ClassReader getClassReader(ModuleData res) {
+        public ClassReader getClassReader(ModuleEntry res) {
             return newClassReader(res.getBytes());
         }
     }
@@ -176,7 +175,7 @@
         public void addResourceFile(ResourceFile resFile) {
             Objects.requireNonNull(resFile);
             String path = toResourceNamePath(resFile.getPath());
-            ModuleData res = Pool.newResource(path, resFile.getContent());
+            ModuleEntry res = ModuleEntry.create(path, resFile.getContent());
             transformedResources.put(resFile.getPath(), res);
         }
 
@@ -191,7 +190,7 @@
             Objects.requireNonNull(resourceName);
             String path = toResourceNamePath(resourceName);
             // do we have a resource?
-            ModuleData res = transformedResources.get(resourceName);
+            ModuleEntry res = transformedResources.get(resourceName);
             if (res == null) {
                 res = inputResources.get(resourceName);
                 if (res == null) {
@@ -212,7 +211,7 @@
         @Override
         public ResourceFile getResourceFile(String name) {
             Objects.requireNonNull(name);
-            ModuleData res = transformedResources.get(name);
+            ModuleEntry res = transformedResources.get(name);
             ResourceFile resFile = null;
             if (res != null) {
                 resFile = getResourceFile(res);
@@ -226,24 +225,24 @@
          * @return The array of transformed classes.
          */
         @Override
-        public Collection<ModuleData> getResourceFiles() {
-            List<ModuleData> resources = new ArrayList<>();
-            for (Entry<String, ModuleData> entry : transformedResources.entrySet()) {
+        public Collection<ModuleEntry> getResourceFiles() {
+            List<ModuleEntry> resources = new ArrayList<>();
+            for (Entry<String, ModuleEntry> entry : transformedResources.entrySet()) {
                 resources.add(entry.getValue());
             }
             return resources;
         }
 
         @Override
-        public ResourceFile getResourceFile(ModuleData res) {
+        public ResourceFile getResourceFile(ModuleEntry res) {
             return new ResourceFile(toJavaBinaryResourceName(res.getPath()),
                     res.getBytes());
         }
     }
 
-    private final Pool jimageResources;
-    private final Map<String, ModuleData> inputClasses;
-    private final Map<String, ModuleData> inputResources;
+    private final ModulePool jimageResources;
+    private final Map<String, ModuleEntry> inputClasses;
+    private final Map<String, ModuleEntry> inputResources;
     private final Map<String, String> inputClassPackageMapping;
     private final Map<String, String> inputOtherPackageMapping;
 
@@ -254,9 +253,9 @@
 
     private Sorter sorter;
 
-    private final Map<String, ModuleData> transformedClasses
+    private final Map<String, ModuleEntry> transformedClasses
             =            new LinkedHashMap<>();
-    private final Map<String, ModuleData> transformedResources
+    private final Map<String, ModuleEntry> transformedResources
             =            new LinkedHashMap<>();
     private final List<String> forgetResources = new ArrayList<>();
     private final Map<String, String> newPackageMapping = new HashMap<>();
@@ -274,7 +273,7 @@
      * @param pools The resource pools.
      * @param descriptor The module descriptor.
      */
-    AsmPoolImpl(Pool inputResources, String moduleName,
+    AsmPoolImpl(ModulePool inputResources, String moduleName,
             AsmPools pools,
             ModuleDescriptor descriptor) {
         Objects.requireNonNull(inputResources);
@@ -285,11 +284,11 @@
         this.moduleName = moduleName;
         this.pools = pools;
         this.descriptor = descriptor;
-        Map<String, ModuleData> classes = new LinkedHashMap<>();
-        Map<String, ModuleData> resources = new LinkedHashMap<>();
+        Map<String, ModuleEntry> classes = new LinkedHashMap<>();
+        Map<String, ModuleEntry> resources = new LinkedHashMap<>();
         Map<String, String> packageClassToModule = new HashMap<>();
         Map<String, String> packageOtherToModule = new HashMap<>();
-        for (ModuleData res : inputResources.getContent()) {
+        inputResources.entries().forEach(res -> {
             if (res.getPath().endsWith(".class")) {
                 classes.put(toJavaBinaryClassName(res.getPath()), res);
             } else {
@@ -305,7 +304,7 @@
                     packageOtherToModule.put(split[1], res.getModule());
                 }
             }
-        }
+        });
         this.inputClasses = Collections.unmodifiableMap(classes);
         this.inputResources = Collections.unmodifiableMap(resources);
 
@@ -356,7 +355,7 @@
      * @return The array of classes.
      */
     @Override
-    public Collection<ModuleData> getClasses() {
+    public Collection<ModuleEntry> getClasses() {
         return inputClasses.values();
     }
 
@@ -367,7 +366,7 @@
      * @return The array of classes.
      */
     @Override
-    public Collection<ModuleData> getResourceFiles() {
+    public Collection<ModuleEntry> getResourceFiles() {
         return inputResources.values();
     }
 
@@ -385,7 +384,7 @@
     @Override
     public ResourceFile getResourceFile(String binaryName) {
         Objects.requireNonNull(binaryName);
-        ModuleData res = inputResources.get(binaryName);
+        ModuleEntry res = inputResources.get(binaryName);
         ResourceFile resFile = null;
         if (res != null) {
             resFile = getResourceFile(res);
@@ -402,7 +401,7 @@
     @Override
     public ClassReader getClassReader(String binaryName) {
         Objects.requireNonNull(binaryName);
-        ModuleData res = inputClasses.get(binaryName);
+        ModuleEntry res = inputClasses.get(binaryName);
         ClassReader reader = null;
         if (res != null) {
             reader = getClassReader(res);
@@ -411,13 +410,13 @@
     }
 
     @Override
-    public ResourceFile getResourceFile(ModuleData res) {
+    public ResourceFile getResourceFile(ModuleEntry res) {
         return new ResourceFile(toJavaBinaryResourceName(res.getPath()),
                 res.getBytes());
     }
 
     @Override
-    public ClassReader getClassReader(ModuleData res) {
+    public ClassReader getClassReader(ModuleEntry res) {
         return newClassReader(res.getBytes());
     }
 
@@ -505,7 +504,7 @@
     @Override
     public void visitClassReaders(ClassReaderVisitor visitor) {
         Objects.requireNonNull(visitor);
-        for (ModuleData res : getClasses()) {
+        for (ModuleEntry res : getClasses()) {
             ClassReader reader = newClassReader(res.getBytes());
             ClassWriter writer = visitor.visit(reader);
             if (writer != null) {
@@ -523,7 +522,7 @@
     @Override
     public void visitResourceFiles(ResourceFileVisitor visitor) {
         Objects.requireNonNull(visitor);
-        for (ModuleData resource : getResourceFiles()) {
+        for (ModuleEntry resource : getResourceFiles()) {
             ResourceFile resFile
                     = new ResourceFile(toJavaBinaryResourceName(resource.getPath()),
                             resource.getBytes());
@@ -540,18 +539,18 @@
      * been set, it is used to sort the returned resources.     *
      */
     @Override
-    public void fillOutputResources(Pool outputResources) {
+    public void fillOutputResources(ModulePool outputResources) {
         List<String> added = new ArrayList<>();
         // If the sorter is null, use the input order.
         // New resources are added at the end
         // First input classes that have not been removed
-        Pool output = new PoolImpl(outputResources.getByteOrder(),
-                ((PoolImpl)outputResources).getStringTable());
-        for (ModuleData inResource : jimageResources.getContent()) {
+        ModulePool output = new ModulePoolImpl(outputResources.getByteOrder(),
+                ((ModulePoolImpl)outputResources).getStringTable());
+        jimageResources.entries().forEach(inResource -> {
             if (!forgetResources.contains(inResource.getPath())) {
-                ModuleData resource = inResource;
+                ModuleEntry resource = inResource;
                 // Do we have a transformed class with the same name?
-                ModuleData res = transformedResources.
+                ModuleEntry res = transformedResources.
                         get(toJavaBinaryResourceName(inResource.getPath()));
                 if (res != null) {
                     resource = res;
@@ -565,10 +564,10 @@
                 output.add(resource);
                 added.add(resource.getPath());
             }
-        }
+        });
         // Then new resources
-        for (Map.Entry<String, ModuleData> entry : transformedResources.entrySet()) {
-            ModuleData resource = entry.getValue();
+        for (Map.Entry<String, ModuleEntry> entry : transformedResources.entrySet()) {
+            ModuleEntry resource = entry.getValue();
             if (!forgetResources.contains(resource.getPath())) {
                 if (!added.contains(resource.getPath())) {
                     output.add(resource);
@@ -576,8 +575,8 @@
             }
         }
         // And new classes
-        for (Map.Entry<String, ModuleData> entry : transformedClasses.entrySet()) {
-            ModuleData resource = entry.getValue();
+        for (Map.Entry<String, ModuleEntry> entry : transformedClasses.entrySet()) {
+            ModuleEntry resource = entry.getValue();
             if (!forgetResources.contains(resource.getPath())) {
                 if (!added.contains(resource.getPath())) {
                     output.add(resource);
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPools.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPools.java	Tue May 17 05:38:15 2016 -0700
@@ -41,11 +41,11 @@
 import java.util.Set;
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.internal.plugins.asm.AsmPool.Sorter;
+import jdk.tools.jlink.plugin.ModuleEntry;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModulePool;
 
 /**
  * A container for pools of ClassReader and other resource files. A pool of all
@@ -97,10 +97,10 @@
             }
 
             @Override
-            public Collection<Pool.ModuleData> getClasses() {
-                List<Pool.ModuleData> all = new ArrayList<>();
+            public Collection<ModuleEntry> getClasses() {
+                List<ModuleEntry> all = new ArrayList<>();
                 visitAllPools((AsmModulePool pool) -> {
-                    for (Pool.ModuleData rf : pool.getTransformedClasses().getClasses()) {
+                    for (ModuleEntry rf : pool.getTransformedClasses().getClasses()) {
                         all.add(rf);
                     }
                 });
@@ -108,7 +108,7 @@
             }
 
             @Override
-            public ClassReader getClassReader(Pool.ModuleData res) {
+            public ClassReader getClassReader(ModuleEntry res) {
                 return visitPools((AsmModulePool pool) -> {
                     return pool.getTransformedClasses().getClassReader(res);
                 });
@@ -140,10 +140,10 @@
             }
 
             @Override
-            public Collection<Pool.ModuleData> getResourceFiles() {
-                List<Pool.ModuleData> all = new ArrayList<>();
+            public Collection<ModuleEntry> getResourceFiles() {
+                List<ModuleEntry> all = new ArrayList<>();
                 visitAllPools((AsmModulePool pool) -> {
-                    for (Pool.ModuleData rf : pool.getTransformedResourceFiles().getResourceFiles()) {
+                    for (ModuleEntry rf : pool.getTransformedResourceFiles().getResourceFiles()) {
                         all.add(rf);
                     }
                 });
@@ -151,7 +151,7 @@
             }
 
             @Override
-            public ResourceFile getResourceFile(Pool.ModuleData res) {
+            public ResourceFile getResourceFile(ModuleEntry res) {
                 return visitPools((AsmModulePool pool) -> {
                     return pool.getTransformedResourceFiles().getResourceFile(res);
                 });
@@ -175,10 +175,10 @@
         }
 
         @Override
-        public Collection<Pool.ModuleData> getClasses() {
-            List<Pool.ModuleData> all = new ArrayList<>();
+        public Collection<ModuleEntry> getClasses() {
+            List<ModuleEntry> all = new ArrayList<>();
             visitAllPools((AsmModulePool pool) -> {
-                for (Pool.ModuleData rf : pool.getClasses()) {
+                for (ModuleEntry rf : pool.getClasses()) {
                     all.add(rf);
                 }
             });
@@ -186,10 +186,10 @@
         }
 
         @Override
-        public Collection<Pool.ModuleData> getResourceFiles() {
-            List<Pool.ModuleData> all = new ArrayList<>();
+        public Collection<ModuleEntry> getResourceFiles() {
+            List<ModuleEntry> all = new ArrayList<>();
             visitAllPools((AsmModulePool pool) -> {
-                for (Pool.ModuleData rf : pool.getResourceFiles()) {
+                for (ModuleEntry rf : pool.getResourceFiles()) {
                     all.add(rf);
                 }
             });
@@ -211,14 +211,14 @@
         }
 
         @Override
-        public ResourceFile getResourceFile(Pool.ModuleData res) {
+        public ResourceFile getResourceFile(ModuleEntry res) {
             return visitPools((AsmModulePool pool) -> {
                 return pool.getResourceFile(res);
             });
         }
 
         @Override
-        public ClassReader getClassReader(Pool.ModuleData res) {
+        public ClassReader getClassReader(ModuleEntry res) {
             return visitPoolsEx((AsmModulePool pool) -> {
                 return pool.getClassReader(res);
             });
@@ -239,7 +239,7 @@
         }
 
         @Override
-        public void fillOutputResources(Pool outputResources) {
+        public void fillOutputResources(ModulePool outputResources) {
             AsmPools.this.fillOutputResources(outputResources);
         }
 
@@ -324,15 +324,15 @@
      *
      * @param inputResources The raw resources to build the pool from.
      */
-    public AsmPools(Pool inputResources) {
+    public AsmPools(ModulePool inputResources) {
         Objects.requireNonNull(inputResources);
-        Map<String, Pool> resPools = new LinkedHashMap<>();
+        Map<String, ModulePool> resPools = new LinkedHashMap<>();
         Map<String, ModuleDescriptor> descriptors = new HashMap<>();
-        for (Pool.ModuleData res : inputResources.getContent()) {
-            Pool p = resPools.get(res.getModule());
+        inputResources.entries().forEach(res -> {
+            ModulePool p = resPools.get(res.getModule());
             if (p == null) {
-                p = new PoolImpl(inputResources.getByteOrder(),
-                        ((PoolImpl)inputResources).getStringTable());
+                p = new ModulePoolImpl(inputResources.getByteOrder(),
+                        ((ModulePoolImpl)inputResources).getStringTable());
                 resPools.put(res.getModule(), p);
             }
             if (res.getPath().endsWith("module-info.class")) {
@@ -341,11 +341,11 @@
                 descriptors.put(res.getModule(), descriptor);
             }
             p.add(res);
-        }
+        });
         poolsArray = new AsmModulePool[resPools.size()];
         int i = 0;
 
-        for (Entry<String, Pool> entry : resPools.entrySet()) {
+        for (Entry<String, ModulePool> entry : resPools.entrySet()) {
             ModuleDescriptor descriptor = descriptors.get(entry.getKey());
             if (descriptor == null) {
                 throw new PluginException("module-info.class not found for " + entry.getKey() + " module");
@@ -405,7 +405,7 @@
      *
      * @param outputResources The pool used to fill the jimage.
      */
-    public void fillOutputResources(Pool outputResources) {
+    public void fillOutputResources(ModulePool outputResources) {
         // First sort modules
         List<String> modules = new ArrayList<>();
         for (String k : pools.keySet()) {
@@ -414,8 +414,8 @@
         if (moduleSorter != null) {
             modules = moduleSorter.sort(modules);
         }
-        Pool output = new PoolImpl(outputResources.getByteOrder(),
-                ((PoolImpl)outputResources).getStringTable());
+        ModulePool output = new ModulePoolImpl(outputResources.getByteOrder(),
+                ((ModulePoolImpl)outputResources).getStringTable());
         for (String mn : modules) {
             AsmPool pool = pools.get(mn);
             pool.fillOutputResources(output);
@@ -423,17 +423,17 @@
         sort(outputResources, output, global.sorter);
     }
 
-    static void sort(Pool outputResources,
-            Pool transientOutput, Sorter sorter) {
+    static void sort(ModulePool outputResources,
+            ModulePool transientOutput, Sorter sorter) {
         if (sorter != null) {
             List<String> order = sorter.sort(transientOutput);
             for (String s : order) {
-                outputResources.add(transientOutput.get(s));
+                outputResources.add(transientOutput.findEntry(s).get());
             }
         } else {
-            for (ModuleData res : transientOutput.getContent()) {
+            transientOutput.entries().forEach(res-> {
                 outputResources.add(res);
-            }
+            });
         }
     }
 
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ExecutableImage.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ExecutableImage.java	Tue May 17 05:38:15 2016 -0700
@@ -24,66 +24,41 @@
  */
 package jdk.tools.jlink.plugin;
 
-import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.Collections;
 import java.util.List;
-import java.util.Objects;
 import java.util.Set;
 
 /**
- * An executable runtime image. Instance of this class contains the information
- * needed to create image processes.
+ * An executable runtime image. Contains the information about the executable
+ * image created.
  */
-public abstract class ExecutableImage {
-
-    private final Path home;
-    private final List<String> args;
-    private final Set<String> modules;
-
-    protected ExecutableImage(Path home, Set<String> modules,
-            List<String> args) {
-        Objects.requireNonNull(home);
-        Objects.requireNonNull(args);
-        if (!Files.exists(home)) {
-            throw new IllegalArgumentException("Invalid image home");
-        }
-        this.home = home;
-        this.modules = Collections.unmodifiableSet(modules);
-        this.args = Collections.unmodifiableList(args);
-    }
+public interface ExecutableImage {
 
     /**
      * Image home directory,
      *
      * @return The home directory.
      */
-    public Path getHome() {
-        return home;
-    }
+    public Path getHome();
 
     /**
      * The names of the modules located in the image.
      *
      * @return The set of modules.
      */
-    public Set<String> getModules() {
-        return modules;
-    }
+    public Set<String> getModules();
 
     /**
      * The list of arguments required to execute the image.
      *
      * @return The list of arguments.
      */
-    public List<String> getExecutionArgs() {
-        return args;
-    }
+    public List<String> getExecutionArgs();
 
     /**
      * Store new arguments required to execute the image.
      *
      * @param args Additional arguments
      */
-    public abstract void storeLaunchArgs(List<String> args);
+    public void storeLaunchArgs(List<String> args);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/LinkModule.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.tools.jlink.plugin;
+
+import java.lang.module.ModuleDescriptor;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Stream;
+
+/**
+  * Link-time representation of a Java module.
+  */
+public interface LinkModule {
+
+    /**
+     * The module name.
+     *
+     * @return The name.
+     */
+    public String getName();
+
+    /**
+     * Retrieves a LinkModuleEntry from the given path (e.g:
+     * /mymodule/com.foo.bar/MyClass.class)
+     *
+     * @param path The piece of data path.
+     * @return A LinkModuleEntry of the given path, if found.
+     */
+    public Optional<ModuleEntry> findEntry(String path);
+
+    /**
+     * The module descriptor of this module.
+     *
+     * @return The module descriptor.
+     */
+    public ModuleDescriptor getDescriptor();
+
+    /**
+     * Add a LinkModuleEntry to this module.
+     *
+     * @param data The LinkModuleEntry to add.
+     */
+    public void add(ModuleEntry data);
+
+    /**
+     * Retrieves all the packages located in this module.
+     *
+     * @return The set of packages.
+     */
+    public Set<String> getAllPackages();
+
+    /**
+     * Retrieves the stream of LinkModuleEntry.
+     *
+     * @return The LinkModuleEntry stream.
+     */
+    public Stream<? extends ModuleEntry> entries();
+
+    /**
+     * Return the number of LinkModuleEntry count in this LinkModule.
+     *
+     * @return the entry count.
+     */
+    public int getEntryCount();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ModuleEntry.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.tools.jlink.plugin;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.Objects;
+import jdk.tools.jlink.internal.ImageFileCreator;
+import jdk.tools.jlink.internal.ModuleEntryImpl;
+
+/**
+ * A LinkModuleEntry is the elementary unit of data inside an image. It is
+ * generally a file. e.g.: a java class file, a resource file, a shared library,
+ * ...
+ * <br>
+ * A LinkModuleEntry is identified by a path of the form:
+ * <ul>
+ * <li>For jimage content: /{module name}/{package1}/.../{packageN}/{file
+ * name}</li>
+ * <li>For other files (shared lib, launchers, config, ...):/{module name}/
+ * {@literal bin|conf|native}/{dir1}>/.../{dirN}/{file name}</li>
+ * </ul>
+ */
+public interface ModuleEntry {
+
+    /**
+     * Type of module data.
+     * <li>
+     * <ul>CLASS_OR_RESOURCE: A java class or resource file.</ul>
+     * <ul>CONFIG: A configuration file.</ul>
+     * <ul>NATIVE_CMD: A native process launcher.</ul>
+     * <ul>NATIVE_LIB: A native library.</ul>
+     * <ul>OTHER: Other kind of file.</ul>
+     * </li>
+     */
+    public enum Type {
+        CLASS_OR_RESOURCE,
+        CONFIG,
+        NATIVE_CMD,
+        NATIVE_LIB,
+        OTHER
+    }
+    /**
+     * The LinkModuleEntry module name.
+     *
+     * @return The module name.
+     */
+    public String getModule();
+
+    /**
+     * The LinkModuleEntry path.
+     *
+     * @return The module path.
+     */
+    public String getPath();
+
+    /**
+     * The LinkModuleEntry's type.
+     *
+     * @return The data type.
+     */
+    public Type getType();
+
+    /**
+     * The LinkModuleEntry content as an array of byte.
+     *
+     * @return An Array of bytes.
+     */
+    public byte[] getBytes();
+
+    /**
+     * The LinkModuleEntry content length.
+     *
+     * @return The length.
+     */
+    public long getLength();
+
+    /**
+     * The LinkModuleEntry stream.
+     *
+     * @return The module data stream.
+     */
+    public InputStream stream();
+
+
+    /**
+     * Create a LinkModuleEntry located inside a jimage file. Such
+     * LinkModuleEntry has a Type being equals to CLASS_OR_RESOURCE.
+     *
+     * @param path The complete resource path (contains the module radical).
+     * @param content The resource content.
+     * @param size The content size.
+     * @return A new LinkModuleEntry.
+     */
+    public static ModuleEntry create(String path, InputStream content, long size) {
+        Objects.requireNonNull(path);
+        Objects.requireNonNull(content);
+        String[] split = ImageFileCreator.splitPath(path);
+        String module = split[0];
+        return new ModuleEntryImpl(module, path, Type.CLASS_OR_RESOURCE, content, size);
+    }
+
+    /**
+     * Create a LinkModuleEntry for a file that will be located inside a jimage
+     * file.
+     *
+     * @param path The resource path.
+     * @param content The resource content.
+     * @return A new LinkModuleEntry.
+     */
+    public static ModuleEntry create(String path, byte[] content) {
+        return create(path, new ByteArrayInputStream(content),
+                content.length);
+    }
+
+    /**
+     * Create a LinkModuleEntry for a file that will be located outside a jimage
+     * file.
+     *
+     * @param module The module in which this files is located.
+     * @param path The file path locator (doesn't contain the module name).
+     * @param type The LinkModuleEntry type.
+     * @param content The file content.
+     * @param size The content size.
+     * @return A new LinkModuleEntry.
+     */
+    public static ModuleEntry create(String module, String path, ModuleEntry.Type type,
+            InputStream content, long size) {
+        Objects.requireNonNull(path);
+        Objects.requireNonNull(content);
+        return new ModuleEntryImpl(module, path, type, content, size);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ModulePool.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.tools.jlink.plugin;
+
+import java.nio.ByteOrder;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Function;
+import java.util.stream.Stream;
+
+/**
+ * Pool of module data.
+ */
+public interface ModulePool {
+/**
+     * Is this a read-only ModulePool?
+     *
+     * @return true if this is a read-only configuration.
+     */
+    public boolean isReadOnly();
+
+    /**
+     * Add a ModuleEntry.
+     *
+     * @param data The ModuleEntry to add.
+     */
+    public void add(ModuleEntry data);
+    /**
+     * Retrieves the module for the provided name.
+     *
+     * @param name The module name
+     * @return the module of matching name, if found
+     */
+    public Optional<LinkModule> findModule(String name);
+
+    /**
+     * The stream of modules contained in this ModulePool.
+     *
+     * @return The stream of modules.
+     */
+    public Stream<? extends LinkModule> modules();
+
+    /**
+     * Return the number of LinkModule count in this ModulePool.
+     *
+     * @return the module count.
+     */
+    public int getModuleCount();
+
+    /**
+     * Get all ModuleEntry contained in this ModulePool instance.
+     *
+     * @return The stream of LinkModuleEntries.
+     */
+    public Stream<? extends ModuleEntry> entries();
+
+    /**
+     * Return the number of ModuleEntry count in this ModulePool.
+     *
+     * @return the entry count.
+     */
+    public int getEntryCount();
+
+    /**
+     * Get the ModuleEntry for the passed path.
+     *
+     * @param path A data path
+     * @return A ModuleEntry instance or null if the data is not found
+     */
+   public Optional<ModuleEntry> findEntry(String path);
+
+    /**
+     * Check if the ModulePool contains the given ModuleEntry.
+     *
+     * @param data The module data to check existence for.
+     * @return The module data or null if not found.
+     */
+    public boolean contains(ModuleEntry data);
+
+    /**
+     * Check if the ModulePool contains some content at all.
+     *
+     * @return True, no content, false otherwise.
+     */
+    public boolean isEmpty();
+
+    /**
+     * Visit each ModuleEntry in this ModulePool to transform it and copy
+     * the transformed ModuleEntry to the output ModulePool.
+     *
+     * @param transform The function called for each ModuleEntry found in the
+     * ModulePool. The transform function should return a ModuleEntry
+     * instance which will be added to the output or it should return null if
+     * the passed ModuleEntry is to be ignored for the output.
+     *
+     * @param output The ModulePool to be filled with Visitor returned
+     * ModuleEntry.
+     */
+    public void transformAndCopy(Function<ModuleEntry, ModuleEntry> transform, ModulePool output);
+
+    /**
+     * The ByteOrder currently in use when generating the jimage file.
+     *
+     * @return The ByteOrder.
+     */
+    public ByteOrder getByteOrder();
+
+    /**
+     * Release properties such as OS, CPU name, version etc.
+     *
+     * @return the release properties
+     */
+    public Map<String, String> getReleaseProperties();
+}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java	Tue May 17 05:38:15 2016 -0700
@@ -26,7 +26,6 @@
 
 import java.util.Collections;
 import java.util.EnumSet;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import jdk.tools.jlink.internal.plugins.PluginsResourceBundle;
@@ -37,14 +36,6 @@
 public interface Plugin {
 
     /**
-     * Type of plugin.
-     */
-    public interface PluginType {
-
-        public String getName();
-    }
-
-    /**
      * Order of categories:
      * <ol>
      * <li>FILTER: Filter in/out resources or files.</li>
@@ -53,28 +44,29 @@
      * <li>MODULEINFO_TRANSFORMER: Transform only module-info.class</li>
      * <li>SORTER: Sort resources within the resource container.</li>
      * <li>COMPRESSOR: Compress resource within the resouce containers.</li>
+     * <li>METAINFO_ADDER: Added meta info (like release, copyright etc.)</li>
      * <li>VERIFIER: Does some image verification.</li>
      * <li>PROCESSOR: Does some post processing on image.</li>
      * <li>PACKAGER: Final processing</li>
      * </ol>
      */
-    public enum CATEGORY implements PluginType {
+    public enum Category {
         FILTER("FILTER"),
         TRANSFORMER("TRANSFORMER"),
         MODULEINFO_TRANSFORMER("MODULEINFO_TRANSFORMER"),
         SORTER("SORTER"),
         COMPRESSOR("COMPRESSOR"),
+        METAINFO_ADDER("METAINFO_ADDER"),
         VERIFIER("VERIFIER"),
         PROCESSOR("PROCESSOR"),
         PACKAGER("PACKAGER");
 
         private final String name;
 
-        CATEGORY(String name) {
+        Category(String name) {
             this.name = name;
         }
 
-        @Override
         public String getName() {
             return name;
         }
@@ -91,7 +83,7 @@
      * {@link #getStateDescription() getStateDescription} method</li>
      * </ul>
      */
-    public enum STATE {
+    public enum State {
         DISABLED,
         AUTO_ENABLED,
         FUNCTIONAL
@@ -101,7 +93,7 @@
      * The Plugin set of types.
      * @return The set of types.
      */
-    public default Set<PluginType> getType() {
+    public default Set<Category> getType() {
         return Collections.emptySet();
     }
 
@@ -109,8 +101,8 @@
      * The Plugin set of states.
      * @return The set of states.
      */
-    public default Set<STATE> getState() {
-        return EnumSet.of(STATE.FUNCTIONAL);
+    public default Set<State> getState() {
+        return EnumSet.of(State.FUNCTIONAL);
     }
 
     /**
@@ -191,7 +183,7 @@
      * @return A status description.
      */
     public default String getStateDescription() {
-        return getState().contains(STATE.FUNCTIONAL)
+        return getState().contains(State.FUNCTIONAL)
                 ? PluginsResourceBundle.getMessage("main.status.ok")
                 : PluginsResourceBundle.getMessage("main.status.not.ok");
     }
@@ -206,18 +198,4 @@
      */
     public default void configure(Map<String, String> config) {
     }
-
-    /**
-     * Configure the plugin based on the passed configuration.
-     * This method is called prior to invoke the plugin.
-     *
-     * @param config The plugin configuration.
-     * @param ctx The plugin context
-     * @throws IllegalArgumentException if a mandatory argument is missing or
-     * if an argument has invalid value.
-     *
-     */
-    public default void configure(Map<String, String> config, PluginContext ctx) {
-        configure(config);
-    }
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/PluginContext.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.tools.jlink.plugin;
-
-import java.util.Properties;
-
-/**
- * Interface to plugin (container) context.
- */
-public interface PluginContext {
-    /**
-     * Returns 'release' properties
-     */
-    public Properties getReleaseProperties();
-}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Pool.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,528 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.tools.jlink.plugin;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UncheckedIOException;
-import java.lang.module.ModuleDescriptor;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import jdk.tools.jlink.internal.ImageFileCreator;
-import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
-
-/**
- * Pool of module data.
- *
- */
-public abstract class Pool {
-
-    /**
-     * Interface to visit the content of a Pool.
-     */
-    public interface Visitor {
-
-        /**
-         * Called for each visited ModuleData.
-         *
-         * @param content A ModuleData
-         * @return A ModuleData instance or null if the passed ModuleData is to
-         * be removed from the image.
-         * @throws PluginException
-         */
-        public ModuleData visit(ModuleData content);
-    }
-
-    /**
-     * Type of module data.
-     * <li>
-     * <ul>CLASS_OR_RESOURCE: A java class or resource file.</ul>
-     * <ul>CONFIG: A configuration file.</ul>
-     * <ul>NATIVE_CMD: A native process launcher.</ul>
-     * <ul>NATIVE_LIB: A native library.</ul>
-     * <ul>OTHER: Other kind of file.</ul>
-     * </li>
-     */
-    public static enum ModuleDataType {
-
-        CLASS_OR_RESOURCE,
-        CONFIG,
-        NATIVE_CMD,
-        NATIVE_LIB,
-        OTHER;
-    }
-
-    /**
-     * A module in the pool.
-     */
-    public interface Module {
-
-        /**
-         * The module name.
-         *
-         * @return The name.
-         */
-        public String getName();
-
-        /**
-         * Retrieves a ModuleData from a path (e.g:
-         * /mymodule/com.foo.bar/MyClass.class)
-         *
-         * @param path The piece of data path.
-         * @return A ModuleData or null if the path doesn't identify a
-         * ModuleData.
-         */
-        public ModuleData get(String path);
-
-        /**
-         * The module descriptor of this module.
-         *
-         * @return The module descriptor.
-         */
-        public ModuleDescriptor getDescriptor();
-
-        /**
-         * Add a ModuleData to this module.
-         *
-         * @param data The ModuleData to add.
-         */
-        public void add(ModuleData data);
-
-        /**
-         * Retrieves all the packages located in this module.
-         *
-         * @return The set of packages.
-         */
-        public Set<String> getAllPackages();
-
-        /**
-         * Retrieves the collection of ModuleData.
-         *
-         * @return The ModuleData collection.
-         */
-        public Collection<ModuleData> getContent();
-
-    }
-
-    private class ModuleImpl implements Module {
-
-        private final Map<String, ModuleData> moduleContent = new LinkedHashMap<>();
-        private ModuleDescriptor descriptor;
-        private final String name;
-
-        private ModuleImpl(String name) {
-            this.name = name;
-        }
-
-        @Override
-        public String getName() {
-            return name;
-        }
-
-        @Override
-        public ModuleData get(String path) {
-            if (!path.startsWith("/")) {
-                path = "/" + path;
-            }
-            if (!path.startsWith("/" + name)) {
-                path = "/" + name + path;
-            }
-            return moduleContent.get(path);
-        }
-
-        @Override
-        public ModuleDescriptor getDescriptor() {
-            if (descriptor == null) {
-                String p = "/" + name + "/module-info.class";
-                ModuleData content = moduleContent.get(p);
-                if (content == null) {
-                    throw new PluginException("No module-info for " + name
-                            + " module");
-                }
-                ByteBuffer bb = ByteBuffer.wrap(content.getBytes());
-                descriptor = ModuleDescriptor.read(bb);
-            }
-            return descriptor;
-        }
-
-        @Override
-        public void add(ModuleData data) {
-            if (isReadOnly()) {
-                throw new PluginException("pool is readonly");
-            }
-            Objects.requireNonNull(data);
-            if (!data.getModule().equals(name)) {
-                throw new PluginException("Can't add resource " + data.getPath()
-                        + " to module " + name);
-            }
-            Pool.this.add(data);
-        }
-
-        @Override
-        public Set<String> getAllPackages() {
-            Set<String> pkgs = new HashSet<>();
-            moduleContent.values().stream().filter(m -> m.getType().
-                    equals(ModuleDataType.CLASS_OR_RESOURCE)).forEach((res) -> {
-                // Module metadata only contains packages with .class files
-                if (ImageFileCreator.isClassPackage(res.getPath())) {
-                    String[] split = ImageFileCreator.splitPath(res.getPath());
-                    String pkg = split[1];
-                    if (pkg != null && !pkg.isEmpty()) {
-                        pkgs.add(pkg);
-                    }
-                }
-            });
-            return pkgs;
-        }
-
-        @Override
-        public String toString() {
-            return getName();
-        }
-
-        @Override
-        public Collection<ModuleData> getContent() {
-            return Collections.unmodifiableCollection(moduleContent.values());
-        }
-    }
-
-    /**
-     * A ModuleData is the elementary unit of data inside an image. It is
-     * generally a file. e.g.: a java class file, a resource file, a shared
-     * library, ...
-     * <br>
-     * A ModuleData is identified by a path of the form:
-     * <ul>
-     * <li>For jimage content: /{module name}/{package1}/.../{packageN}/{file
-     * name}</li>
-     * <li>For other files (shared lib, launchers, config, ...):/{module name}/
-     * {@literal bin|conf|native}/{dir1}/.../{dirN}/{file name}</li>
-     * </ul>
-     */
-    public static class ModuleData {
-
-        private final ModuleDataType type;
-        private final String path;
-        private final String module;
-        private final long length;
-        private final InputStream stream;
-        private byte[] buffer;
-
-        /**
-         * Create a new ModuleData.
-         *
-         * @param module The module name.
-         * @param path The data path identifier.
-         * @param type The data type.
-         * @param stream The data content stream.
-         * @param length The stream length.
-         */
-        public ModuleData(String module, String path, ModuleDataType type,
-                InputStream stream, long length) {
-            Objects.requireNonNull(module);
-            Objects.requireNonNull(path);
-            Objects.requireNonNull(type);
-            Objects.requireNonNull(stream);
-            this.path = path;
-            this.type = type;
-            this.module = module;
-            this.stream = stream;
-            this.length = length;
-        }
-
-        /**
-         * The ModuleData module name.
-         *
-         * @return The module name.
-         */
-        public final String getModule() {
-            return module;
-        }
-
-        /**
-         * The ModuleData path.
-         *
-         * @return The module path.
-         */
-        public final String getPath() {
-            return path;
-        }
-
-        /**
-         * The ModuleData type.
-         *
-         * @return The data type.
-         */
-        public final ModuleDataType getType() {
-            return type;
-        }
-
-        /**
-         * The ModuleData content as an array of byte.
-         *
-         * @return An Array of bytes.
-         */
-        public byte[] getBytes() {
-            if (buffer == null) {
-                try {
-                    buffer = stream.readAllBytes();
-                } catch (IOException ex) {
-                    throw new UncheckedIOException(ex);
-                }
-            }
-            return buffer;
-        }
-
-        /**
-         * The ModuleData content length.
-         *
-         * @return The length.
-         */
-        public long getLength() {
-            return length;
-        }
-
-        /**
-         * The ModuleData stream.
-         *
-         * @return The module data stream.
-         */
-        public InputStream stream() {
-            return stream;
-        }
-
-        @Override
-        public int hashCode() {
-            int hash = 7;
-            hash = 89 * hash + Objects.hashCode(this.path);
-            return hash;
-        }
-
-        @Override
-        public boolean equals(Object other) {
-            if (!(other instanceof ModuleData)) {
-                return false;
-            }
-            ModuleData f = (ModuleData) other;
-            return f.path.equals(path);
-        }
-
-        @Override
-        public String toString() {
-            return getPath();
-        }
-    }
-
-    private final Map<String, ModuleData> resources = new LinkedHashMap<>();
-    private final Map<String, ModuleImpl> modules = new LinkedHashMap<>();
-    private final ModuleImpl fileCopierModule = new ModuleImpl(FileCopierPlugin.FAKE_MODULE);
-
-    private final ByteOrder order;
-
-    protected Pool() {
-        this(ByteOrder.nativeOrder());
-    }
-
-    protected Pool(ByteOrder order) {
-        Objects.requireNonNull(order);
-        this.order = order;
-    }
-
-    /**
-     * Read only state. No data can be added to a ReadOnly Pool.
-     *
-     * @return true if readonly false otherwise.
-     */
-    public abstract boolean isReadOnly();
-
-    /**
-     * Add a ModuleData.
-     *
-     * @param data The ModuleData to add.
-     */
-    public void add(ModuleData data) {
-        if (isReadOnly()) {
-            throw new PluginException("pool is readonly");
-        }
-        Objects.requireNonNull(data);
-        if (resources.get(data.getPath()) != null) {
-            throw new PluginException("Resource " + data.getPath()
-                    + " already present");
-        }
-        String modulename = data.getModule();
-        ModuleImpl m = modules.get(modulename);
-        // ## TODO: FileCopierPlugin should not add content to a module
-        // FAKE_MODULE is not really a module to be added in the image
-        if (FileCopierPlugin.FAKE_MODULE.equals(modulename)) {
-            m = fileCopierModule;
-        }
-        if (m == null) {
-            m = new ModuleImpl(modulename);
-            modules.put(modulename, m);
-        }
-        resources.put(data.getPath(), data);
-        m.moduleContent.put(data.getPath(), data);
-    }
-
-    /**
-     * Retrieves the module for the provided name.
-     *
-     * @param name The module name
-     * @return the module or null if the module doesn't exist.
-     */
-    public Module getModule(String name) {
-        Objects.requireNonNull(name);
-        return modules.get(name);
-    }
-
-    /**
-     * The collection of modules contained in this pool.
-     *
-     * @return The collection of modules.
-     */
-    public Collection<Module> getModules() {
-        return Collections.unmodifiableCollection(modules.values());
-    }
-
-    /**
-     * Get all ModuleData contained in this pool instance.
-     *
-     * @return The collection of resources;
-     */
-    public Collection<ModuleData> getContent() {
-        return Collections.unmodifiableCollection(resources.values());
-    }
-
-    /**
-     * Get the ModuleData for the passed path.
-     *
-     * @param path A data path
-     * @return A ModuleData instance or null if the data is not found
-     */
-    public ModuleData get(String path) {
-        Objects.requireNonNull(path);
-        return resources.get(path);
-    }
-
-    /**
-     * Check if the pool contains this data.
-     *
-     * @param data The module data to check existence for.
-     * @return The module data or null if not found.
-     */
-    public boolean contains(ModuleData data) {
-        Objects.requireNonNull(data);
-        return get(data.getPath()) != null;
-    }
-
-    /**
-     * Check if the Pool contains some content.
-     *
-     * @return True, no content, false otherwise.
-     */
-    public boolean isEmpty() {
-        return resources.isEmpty();
-    }
-
-    /**
-     * Visit the pool.
-     *
-     * @param visitor The Visitor called for each ModuleData found in the pool.
-     * @param output The pool to be filled with Visitor returned ModuleData.
-     */
-    public void visit(Visitor visitor, Pool output) {
-        for (ModuleData resource : getContent()) {
-            ModuleData res = visitor.visit(resource);
-            if (res != null) {
-                output.add(res);
-            }
-        }
-    }
-
-    /**
-     * The ByteOrder currently in use when generating the jimage file.
-     *
-     * @return The ByteOrder.
-     */
-    public ByteOrder getByteOrder() {
-        return order;
-    }
-
-    /**
-     * Create a ModuleData located inside a jimage file. Such ModuleData has a
-     * ModuleDataType being equals to CLASS_OR_RESOURCE.
-     *
-     * @param path The complete resource path (contains the module radical).
-     * @param content The resource content.
-     * @param size The content size.
-     * @return A new ModuleData.
-     */
-    public static ModuleData newResource(String path, InputStream content, long size) {
-        Objects.requireNonNull(path);
-        Objects.requireNonNull(content);
-        String[] split = ImageFileCreator.splitPath(path);
-        String module = split[0];
-        return new ModuleData(module, path, ModuleDataType.CLASS_OR_RESOURCE, content, size);
-    }
-
-    /**
-     * Create a ModuleData for a file that will be located inside a jimage file.
-     *
-     * @param path The resource path.
-     * @param content The resource content.
-     * @return A new ModuleData.
-     */
-    public static ModuleData newResource(String path, byte[] content) {
-        return newResource(path, new ByteArrayInputStream(content),
-                content.length);
-    }
-
-    /**
-     * Create a ModuleData for a file that will be located outside a jimage
-     * file.
-     *
-     * @param module The module in which this files is located.
-     * @param path The file path locator (doesn't contain the module name).
-     * @param type The ModuleData type.
-     * @param content The file content.
-     * @param size The content size.
-     * @return A new ModuleData.
-     */
-    public static ModuleData newImageFile(String module, String path, ModuleDataType type,
-            InputStream content, long size) {
-        Objects.requireNonNull(path);
-        Objects.requireNonNull(content);
-        return new ModuleData(module, path, type, content, size);
-    }
-
-}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/TransformerPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/TransformerPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -40,5 +40,5 @@
      *
      * @throws PluginException
      */
-    public void visit(Pool in, Pool out);
+    public void visit(ModulePool in, ModulePool out);
 }
--- a/jdk/src/jdk.jlink/share/classes/module-info.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/module-info.java	Tue May 17 05:38:15 2016 -0700
@@ -24,9 +24,7 @@
  */
 
 module jdk.jlink {
-    exports jdk.tools.jlink;
     exports jdk.tools.jlink.plugin;
-    exports jdk.tools.jlink.builder;
 
     requires jdk.internal.opt;
     requires jdk.jdeps;
@@ -46,5 +44,5 @@
     provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.ExcludeVMPlugin;
     provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.IncludeLocalesPlugin;
     provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.GenerateJLIClassesPlugin;
-    provides jdk.tools.jlink.plugin.PostProcessorPlugin with jdk.tools.jlink.internal.plugins.ReleaseInfoPlugin;
+    provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.ReleaseInfoPlugin;
 }
--- a/jdk/test/ProblemList.txt	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/ProblemList.txt	Tue May 17 05:38:15 2016 -0700
@@ -228,6 +228,8 @@
 sun/security/pkcs11/KeyAgreement/TestDH.java                    8077138,8023434 windows-all
 sun/security/pkcs11/KeyAgreement/TestInterop.java               8077138,8023434 windows-all
 sun/security/pkcs11/KeyAgreement/TestShort.java                 8077138,8023434 windows-all
+sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java           8154910 windows-all
+sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java         8154910 windows-all
 sun/security/pkcs11/KeyGenerator/DESParity.java                 8077138,8023434 windows-all
 sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java          8077138,8023434 windows-all
 sun/security/pkcs11/KeyPairGenerator/TestDH2048.java            8077138,8023434 windows-all
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java	Tue May 17 05:38:15 2016 -0700
@@ -212,7 +212,6 @@
     }
 
     static MethodHandle findVirtual(VarHandle vh, TestAccessMode tam, MethodType mt) {
-        mt = vh.accessModeType(tam.toAccessMode());
         MethodHandle mh;
         try {
             mh = MethodHandles.publicLookup().
@@ -222,36 +221,26 @@
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
-        return bind(vh, tam, mh, mt);
+        return bind(vh, mh, mt);
     }
 
-    static MethodHandle varHandleInvokerWithAccessModeType(VarHandle vh, TestAccessMode tam, MethodType mt) {
-        mt = vh.accessModeType(tam.toAccessMode());
+    static MethodHandle varHandleInvoker(VarHandle vh, TestAccessMode tam, MethodType mt) {
         MethodHandle mh = MethodHandles.varHandleInvoker(
                 tam.toAccessMode(),
                 mt);
 
-        return bind(vh, tam, mh, mt);
+        return bind(vh, mh, mt);
     }
 
-    static MethodHandle varHandleInvokerWithSymbolicTypeDescriptor(VarHandle vh, TestAccessMode tam, MethodType mt) {
-        MethodHandle mh = MethodHandles.varHandleInvoker(
-                tam.toAccessMode(),
-                mt);
-
-        return bind(vh, tam, mh, mt);
-    }
-
-    static MethodHandle varHandleExactInvokerWithAccessModeType(VarHandle vh, TestAccessMode tam, MethodType mt) {
-        mt = vh.accessModeType(tam.toAccessMode());
+    static MethodHandle varHandleExactInvoker(VarHandle vh, TestAccessMode tam, MethodType mt) {
         MethodHandle mh = MethodHandles.varHandleExactInvoker(
                 tam.toAccessMode(),
                 mt);
 
-        return bind(vh, tam, mh, mt);
+        return bind(vh, mh, mt);
     }
 
-    private static MethodHandle bind(VarHandle vh, TestAccessMode testAccessMode, MethodHandle mh, MethodType emt) {
+    private static MethodHandle bind(VarHandle vh, MethodHandle mh, MethodType emt) {
         assertEquals(mh.type(), emt.insertParameterTypes(0, VarHandle.class),
                      "MethodHandle type differs from access mode type");
 
@@ -269,33 +258,30 @@
     enum VarHandleToMethodHandle {
         VAR_HANDLE_TO_METHOD_HANDLE(
                 "VarHandle.toMethodHandle",
+                true,
                 VarHandleBaseTest::toMethodHandle),
         METHOD_HANDLES_LOOKUP_FIND_VIRTUAL(
                 "Lookup.findVirtual",
+                false,
                 VarHandleBaseTest::findVirtual),
-        METHOD_HANDLES_VAR_HANDLE_INVOKER_WITH_ACCESS_MODE_TYPE(
-                "MethodHandles.varHandleInvoker(accessModeType)",
-                VarHandleBaseTest::varHandleInvokerWithAccessModeType),
-        METHOD_HANDLES_VAR_HANDLE_INVOKER_WITH_SYMBOLIC_TYPE_DESCRIPTOR(
-                "MethodHandles.varHandleInvoker(symbolicTypeDescriptor)",
-                VarHandleBaseTest::varHandleInvokerWithSymbolicTypeDescriptor),
-        METHOD_HANDLES_VAR_HANDLE_EXACT_INVOKER_WITH_ACCESS_MODE_TYPE(
-                "MethodHandles.varHandleExactInvoker(accessModeType)",
-                VarHandleBaseTest::varHandleExactInvokerWithAccessModeType);
+        METHOD_HANDLES_VAR_HANDLE_INVOKER(
+                "MethodHandles.varHandleInvoker",
+                false,
+                VarHandleBaseTest::varHandleInvoker),
+        METHOD_HANDLES_VAR_HANDLE_EXACT_INVOKER(
+                "MethodHandles.varHandleExactInvoker",
+                true,
+                VarHandleBaseTest::varHandleExactInvoker);
 
         final String desc;
+        final boolean isExact;
         final TriFunction<VarHandle, TestAccessMode, MethodType, MethodHandle> f;
-        final boolean exact;
 
-        VarHandleToMethodHandle(String desc, TriFunction<VarHandle, TestAccessMode, MethodType, MethodHandle> f) {
-            this(desc, f, false);
-        }
-
-        VarHandleToMethodHandle(String desc, TriFunction<VarHandle, TestAccessMode, MethodType, MethodHandle> f,
-                                boolean exact) {
+        VarHandleToMethodHandle(String desc, boolean isExact,
+                                TriFunction<VarHandle, TestAccessMode, MethodType, MethodHandle> f) {
             this.desc = desc;
             this.f = f;
-            this.exact = exact;
+            this.isExact = isExact;
         }
 
         MethodHandle apply(VarHandle vh, TestAccessMode am, MethodType mt) {
@@ -364,6 +350,15 @@
             return amToHandle.computeIfAbsent(
                     amt, k -> f.apply(vh, am, mt));
         }
+
+        Class<? extends Throwable> getWMTEOOrOther(Class<? extends Throwable> c) {
+            return f.isExact ? WrongMethodTypeException.class : c;
+        }
+
+        void checkWMTEOrCCE(ThrowingRunnable r) {
+            checkWithThrowable(getWMTEOOrOther(ClassCastException.class), null, r);
+        }
+
     }
 
     interface AccessTestAction<T> {
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessBoolean
  * @run testng/othervm -Diters=20000                         VarHandleTestAccessBoolean
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestAccessBoolean
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessBoolean
  */
 
 import org.testng.annotations.BeforeClass;
@@ -293,6 +294,10 @@
         });
 
         checkUOE(() -> {
+            boolean r = (boolean) vh.getAndSet(recv, true);
+        });
+
+        checkUOE(() -> {
             boolean o = (boolean) vh.getAndAdd(recv, true);
         });
 
@@ -379,6 +384,10 @@
         });
 
         checkUOE(() -> {
+            boolean r = (boolean) vh.getAndSet(true);
+        });
+
+        checkUOE(() -> {
             boolean o = (boolean) vh.getAndAdd(true);
         });
 
@@ -455,6 +464,10 @@
         });
 
         checkUOE(() -> {
+            boolean r = (boolean) vh.getAndSet(recv, true);
+        });
+
+        checkUOE(() -> {
             boolean o = (boolean) vh.getAndAdd(recv, true);
         });
 
@@ -531,6 +544,10 @@
         });
 
         checkUOE(() -> {
+            boolean r = (boolean) vh.getAndSet(true);
+        });
+
+        checkUOE(() -> {
             boolean o = (boolean) vh.getAndAdd(true);
         });
 
@@ -614,6 +631,10 @@
         });
 
         checkUOE(() -> {
+            boolean r = (boolean) vh.getAndSet(array, i, true);
+        });
+
+        checkUOE(() -> {
             boolean o = (boolean) vh.getAndAdd(array, i, true);
         });
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessByte
  * @run testng/othervm -Diters=20000                         VarHandleTestAccessByte
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestAccessByte
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessByte
  */
 
 import org.testng.annotations.BeforeClass;
@@ -293,6 +294,10 @@
         });
 
         checkUOE(() -> {
+            byte r = (byte) vh.getAndSet(recv, (byte)1);
+        });
+
+        checkUOE(() -> {
             byte o = (byte) vh.getAndAdd(recv, (byte)1);
         });
 
@@ -379,6 +384,10 @@
         });
 
         checkUOE(() -> {
+            byte r = (byte) vh.getAndSet((byte)1);
+        });
+
+        checkUOE(() -> {
             byte o = (byte) vh.getAndAdd((byte)1);
         });
 
@@ -455,6 +464,10 @@
         });
 
         checkUOE(() -> {
+            byte r = (byte) vh.getAndSet(recv, (byte)1);
+        });
+
+        checkUOE(() -> {
             byte o = (byte) vh.getAndAdd(recv, (byte)1);
         });
 
@@ -531,6 +544,10 @@
         });
 
         checkUOE(() -> {
+            byte r = (byte) vh.getAndSet((byte)1);
+        });
+
+        checkUOE(() -> {
             byte o = (byte) vh.getAndAdd((byte)1);
         });
 
@@ -614,6 +631,10 @@
         });
 
         checkUOE(() -> {
+            byte r = (byte) vh.getAndSet(array, i, (byte)1);
+        });
+
+        checkUOE(() -> {
             byte o = (byte) vh.getAndAdd(array, i, (byte)1);
         });
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessChar
  * @run testng/othervm -Diters=20000                         VarHandleTestAccessChar
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestAccessChar
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessChar
  */
 
 import org.testng.annotations.BeforeClass;
@@ -293,6 +294,10 @@
         });
 
         checkUOE(() -> {
+            char r = (char) vh.getAndSet(recv, 'a');
+        });
+
+        checkUOE(() -> {
             char o = (char) vh.getAndAdd(recv, 'a');
         });
 
@@ -379,6 +384,10 @@
         });
 
         checkUOE(() -> {
+            char r = (char) vh.getAndSet('a');
+        });
+
+        checkUOE(() -> {
             char o = (char) vh.getAndAdd('a');
         });
 
@@ -455,6 +464,10 @@
         });
 
         checkUOE(() -> {
+            char r = (char) vh.getAndSet(recv, 'a');
+        });
+
+        checkUOE(() -> {
             char o = (char) vh.getAndAdd(recv, 'a');
         });
 
@@ -531,6 +544,10 @@
         });
 
         checkUOE(() -> {
+            char r = (char) vh.getAndSet('a');
+        });
+
+        checkUOE(() -> {
             char o = (char) vh.getAndAdd('a');
         });
 
@@ -614,6 +631,10 @@
         });
 
         checkUOE(() -> {
+            char r = (char) vh.getAndSet(array, i, 'a');
+        });
+
+        checkUOE(() -> {
             char o = (char) vh.getAndAdd(array, i, 'a');
         });
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessDouble
  * @run testng/othervm -Diters=20000                         VarHandleTestAccessDouble
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestAccessDouble
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessDouble
  */
 
 import org.testng.annotations.BeforeClass;
@@ -293,6 +294,10 @@
         });
 
         checkUOE(() -> {
+            double r = (double) vh.getAndSet(recv, 1.0d);
+        });
+
+        checkUOE(() -> {
             double o = (double) vh.getAndAdd(recv, 1.0d);
         });
 
@@ -379,6 +384,10 @@
         });
 
         checkUOE(() -> {
+            double r = (double) vh.getAndSet(1.0d);
+        });
+
+        checkUOE(() -> {
             double o = (double) vh.getAndAdd(1.0d);
         });
 
@@ -455,6 +464,10 @@
         });
 
         checkUOE(() -> {
+            double r = (double) vh.getAndSet(recv, 1.0d);
+        });
+
+        checkUOE(() -> {
             double o = (double) vh.getAndAdd(recv, 1.0d);
         });
 
@@ -531,6 +544,10 @@
         });
 
         checkUOE(() -> {
+            double r = (double) vh.getAndSet(1.0d);
+        });
+
+        checkUOE(() -> {
             double o = (double) vh.getAndAdd(1.0d);
         });
 
@@ -614,6 +631,10 @@
         });
 
         checkUOE(() -> {
+            double r = (double) vh.getAndSet(array, i, 1.0d);
+        });
+
+        checkUOE(() -> {
             double o = (double) vh.getAndAdd(array, i, 1.0d);
         });
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessFloat
  * @run testng/othervm -Diters=20000                         VarHandleTestAccessFloat
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestAccessFloat
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessFloat
  */
 
 import org.testng.annotations.BeforeClass;
@@ -293,6 +294,10 @@
         });
 
         checkUOE(() -> {
+            float r = (float) vh.getAndSet(recv, 1.0f);
+        });
+
+        checkUOE(() -> {
             float o = (float) vh.getAndAdd(recv, 1.0f);
         });
 
@@ -379,6 +384,10 @@
         });
 
         checkUOE(() -> {
+            float r = (float) vh.getAndSet(1.0f);
+        });
+
+        checkUOE(() -> {
             float o = (float) vh.getAndAdd(1.0f);
         });
 
@@ -455,6 +464,10 @@
         });
 
         checkUOE(() -> {
+            float r = (float) vh.getAndSet(recv, 1.0f);
+        });
+
+        checkUOE(() -> {
             float o = (float) vh.getAndAdd(recv, 1.0f);
         });
 
@@ -531,6 +544,10 @@
         });
 
         checkUOE(() -> {
+            float r = (float) vh.getAndSet(1.0f);
+        });
+
+        checkUOE(() -> {
             float o = (float) vh.getAndAdd(1.0f);
         });
 
@@ -614,6 +631,10 @@
         });
 
         checkUOE(() -> {
+            float r = (float) vh.getAndSet(array, i, 1.0f);
+        });
+
+        checkUOE(() -> {
             float o = (float) vh.getAndAdd(array, i, 1.0f);
         });
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessInt
  * @run testng/othervm -Diters=20000                         VarHandleTestAccessInt
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestAccessInt
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessInt
  */
 
 import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessLong
  * @run testng/othervm -Diters=20000                         VarHandleTestAccessLong
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestAccessLong
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessLong
  */
 
 import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessShort
  * @run testng/othervm -Diters=20000                         VarHandleTestAccessShort
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestAccessShort
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessShort
  */
 
 import org.testng.annotations.BeforeClass;
@@ -293,6 +294,10 @@
         });
 
         checkUOE(() -> {
+            short r = (short) vh.getAndSet(recv, (short)1);
+        });
+
+        checkUOE(() -> {
             short o = (short) vh.getAndAdd(recv, (short)1);
         });
 
@@ -379,6 +384,10 @@
         });
 
         checkUOE(() -> {
+            short r = (short) vh.getAndSet((short)1);
+        });
+
+        checkUOE(() -> {
             short o = (short) vh.getAndAdd((short)1);
         });
 
@@ -455,6 +464,10 @@
         });
 
         checkUOE(() -> {
+            short r = (short) vh.getAndSet(recv, (short)1);
+        });
+
+        checkUOE(() -> {
             short o = (short) vh.getAndAdd(recv, (short)1);
         });
 
@@ -531,6 +544,10 @@
         });
 
         checkUOE(() -> {
+            short r = (short) vh.getAndSet((short)1);
+        });
+
+        checkUOE(() -> {
             short o = (short) vh.getAndAdd((short)1);
         });
 
@@ -614,6 +631,10 @@
         });
 
         checkUOE(() -> {
+            short r = (short) vh.getAndSet(array, i, (short)1);
+        });
+
+        checkUOE(() -> {
             short o = (short) vh.getAndAdd(array, i, (short)1);
         });
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessString
  * @run testng/othervm -Diters=20000                         VarHandleTestAccessString
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestAccessString
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessString
  */
 
 import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsChar
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAsChar
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAsChar
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAsChar
  */
 
 import org.testng.annotations.DataProvider;
@@ -254,6 +255,10 @@
                 vh.setOpaque(array, ci, VALUE_1);
             });
             checkUOE(() -> {
+                boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+            });
+
+            checkUOE(() -> {
                 char r = (char) vh.compareAndExchangeVolatile(array, ci, VALUE_2, VALUE_1);
             });
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsDouble
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAsDouble
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAsDouble
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAsDouble
  */
 
 import org.testng.annotations.DataProvider;
@@ -254,9 +255,7 @@
             checkROBE(() -> {
                 double o = (double) vh.getAndSet(array, ci, VALUE_1);
             });
-            checkUOE(() -> {
-                boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
-            });
+
 
             checkUOE(() -> {
                 double o = (double) vh.getAndAdd(array, ci, VALUE_1);
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsFloat
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAsFloat
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAsFloat
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAsFloat
  */
 
 import org.testng.annotations.DataProvider;
@@ -254,9 +255,7 @@
             checkROBE(() -> {
                 float o = (float) vh.getAndSet(array, ci, VALUE_1);
             });
-            checkUOE(() -> {
-                boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
-            });
+
 
             checkUOE(() -> {
                 float o = (float) vh.getAndAdd(array, ci, VALUE_1);
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsInt
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAsInt
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAsInt
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAsInt
  */
 
 import org.testng.annotations.DataProvider;
@@ -247,9 +248,7 @@
             checkROBE(() -> {
                 int o = (int) vh.getAndSet(array, ci, VALUE_1);
             });
-            checkUOE(() -> {
-                boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
-            });
+
 
             checkROBE(() -> {
                 int o = (int) vh.getAndAdd(array, ci, VALUE_1);
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsLong
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAsLong
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAsLong
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAsLong
  */
 
 import org.testng.annotations.DataProvider;
@@ -247,9 +248,7 @@
             checkROBE(() -> {
                 long o = (long) vh.getAndSet(array, ci, VALUE_1);
             });
-            checkUOE(() -> {
-                boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
-            });
+
 
             checkROBE(() -> {
                 long o = (long) vh.getAndAdd(array, ci, VALUE_1);
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsShort
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAsShort
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAsShort
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAsShort
  */
 
 import org.testng.annotations.DataProvider;
@@ -254,6 +255,10 @@
                 vh.setOpaque(array, ci, VALUE_1);
             });
             checkUOE(() -> {
+                boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+            });
+
+            checkUOE(() -> {
                 short r = (short) vh.compareAndExchangeVolatile(array, ci, VALUE_2, VALUE_1);
             });
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java	Tue May 17 05:38:15 2016 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessBoolean
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessBoolean
  */
 
 import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java	Tue May 17 05:38:15 2016 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessByte
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessByte
  */
 
 import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java	Tue May 17 05:38:15 2016 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessChar
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessChar
  */
 
 import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java	Tue May 17 05:38:15 2016 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessDouble
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessDouble
  */
 
 import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java	Tue May 17 05:38:15 2016 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessFloat
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessFloat
  */
 
 import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java	Tue May 17 05:38:15 2016 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessInt
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessInt
  */
 
 import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java	Tue May 17 05:38:15 2016 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessLong
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessLong
  */
 
 import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java	Tue May 17 05:38:15 2016 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessShort
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessShort
  */
 
 import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java	Tue May 17 05:38:15 2016 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessString
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessString
  */
 
 import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java	Tue May 17 05:38:15 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8156486
  * @run testng/othervm VarHandleTestMethodTypeBoolean
  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeBoolean
  */
@@ -81,27 +82,28 @@
     public Object[][] accessTestCaseProvider() throws Exception {
         List<AccessTestCase<?>> cases = new ArrayList<>();
 
-        cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Instance field",
                                               vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Static field",
                                               vhStaticField, VarHandleTestMethodTypeBoolean::testStaticFieldWrongMethodType,
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Array wrong method type",
+        cases.add(new VarHandleAccessTestCase("Array",
                                               vhArray, VarHandleTestMethodTypeBoolean::testArrayWrongMethodType,
                                               false));
+
         for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
-            cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Instance field",
                                                      vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Static field",
                                                      vhStaticField, f, VarHandleTestMethodTypeBoolean::testStaticFieldWrongMethodType,
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Array",
                                                      vhArray, f, VarHandleTestMethodTypeBoolean::testArrayWrongMethodType,
                                                      false));
         }
@@ -329,63 +331,63 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                boolean x = (boolean) hs.get(am, methodType(boolean.class, Void.class)).
-                    invoke(null);
+                boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class)).
+                    invokeExact((VarHandleTestMethodTypeBoolean) null);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class)).
-                    invoke(0);
+                    invokeExact(0);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
-                Void x = (Void) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class)).
-                    invoke(recv);
+                Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeBoolean.class)).
+                    invokeExact(recv);
             });
             checkWMTE(() -> { // primitive class
                 int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeBoolean.class)).
-                    invoke(recv);
+                    invokeExact(recv);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean x = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                hs.get(am, methodType(void.class, Void.class, boolean.class)).
-                    invoke(null, true);
+                hs.get(am, methodType(void.class, VarHandleTestMethodTypeBoolean.class, boolean.class)).
+                    invokeExact((VarHandleTestMethodTypeBoolean) null, true);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 hs.get(am, methodType(void.class, Class.class, boolean.class)).
-                    invoke(Void.class, true);
+                    invokeExact(Void.class, true);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeBoolean.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, boolean.class)).
-                    invoke(0, true);
+                    invokeExact(0, true);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeBoolean.class, boolean.class, Class.class)).
-                    invoke(recv, true, Void.class);
+                    invokeExact(recv, true, Void.class);
             });
         }
 
@@ -513,32 +515,32 @@
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // primitive class
                 int x = (int) hs.get(am, methodType(int.class)).
-                    invoke();
+                    invokeExact();
             });
             // Incorrect arity
             checkWMTE(() -> { // >
                 boolean x = (boolean) hs.get(am, methodType(Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, boolean.class, Class.class)).
-                    invoke(true, Void.class);
+                    invokeExact(true, Void.class);
             });
         }
 
@@ -783,71 +785,71 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                boolean x = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class)).
-                    invoke(null, 0);
+                boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class)).
+                    invokeExact((boolean[]) null, 0);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class)).
-                    invoke(Void.class, 0);
+                    invokeExact(Void.class, 0);
             });
             checkWMTE(() -> { // array primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class)).
-                    invoke(0, 0);
+                    invokeExact(0, 0);
             });
             checkWMTE(() -> { // index reference class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, Class.class)).
-                    invoke(array, Void.class);
+                    invokeExact(array, Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class, boolean[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             checkWMTE(() -> { // primitive class
                 int x = (int) hs.get(am, methodType(int.class, boolean[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean x = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                hs.get(am, methodType(void.class, Void.class, int.class, boolean.class)).
-                    invoke(null, 0, true);
+                hs.get(am, methodType(void.class, boolean[].class, int.class, boolean.class)).
+                    invokeExact((boolean[]) null, 0, true);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 hs.get(am, methodType(void.class, Class.class, int.class, boolean.class)).
-                    invoke(Void.class, 0, true);
+                    invokeExact(Void.class, 0, true);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, boolean[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, int.class, boolean.class)).
-                    invoke(0, 0, true);
+                    invokeExact(0, 0, true);
             });
             checkWMTE(() -> { // index reference class
                 hs.get(am, methodType(void.class, boolean[].class, Class.class, boolean.class)).
-                    invoke(array, Void.class, true);
+                    invokeExact(array, Void.class, true);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, boolean[].class, int.class, Class.class)).
-                    invoke(array, 0, true, Void.class);
+                    invokeExact(array, 0, true, Void.class);
             });
         }
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java	Tue May 17 05:38:15 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8156486
  * @run testng/othervm VarHandleTestMethodTypeByte
  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeByte
  */
@@ -81,27 +82,28 @@
     public Object[][] accessTestCaseProvider() throws Exception {
         List<AccessTestCase<?>> cases = new ArrayList<>();
 
-        cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Instance field",
                                               vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Static field",
                                               vhStaticField, VarHandleTestMethodTypeByte::testStaticFieldWrongMethodType,
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Array wrong method type",
+        cases.add(new VarHandleAccessTestCase("Array",
                                               vhArray, VarHandleTestMethodTypeByte::testArrayWrongMethodType,
                                               false));
+
         for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
-            cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Instance field",
                                                      vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Static field",
                                                      vhStaticField, f, VarHandleTestMethodTypeByte::testStaticFieldWrongMethodType,
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Array",
                                                      vhArray, f, VarHandleTestMethodTypeByte::testArrayWrongMethodType,
                                                      false));
         }
@@ -329,63 +331,63 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                byte x = (byte) hs.get(am, methodType(byte.class, Void.class)).
-                    invoke(null);
+                byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class)).
+                    invokeExact((VarHandleTestMethodTypeByte) null);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 byte x = (byte) hs.get(am, methodType(byte.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 byte x = (byte) hs.get(am, methodType(byte.class, int.class)).
-                    invoke(0);
+                    invokeExact(0);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
-                Void x = (Void) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class)).
-                    invoke(recv);
+                Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class)).
+                    invokeExact(recv);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class)).
-                    invoke(recv);
+                    invokeExact(recv);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 byte x = (byte) hs.get(am, methodType(byte.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                hs.get(am, methodType(void.class, Void.class, byte.class)).
-                    invoke(null, (byte)1);
+                hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, byte.class)).
+                    invokeExact((VarHandleTestMethodTypeByte) null, (byte)1);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 hs.get(am, methodType(void.class, Class.class, byte.class)).
-                    invoke(Void.class, (byte)1);
+                    invokeExact(Void.class, (byte)1);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, byte.class)).
-                    invoke(0, (byte)1);
+                    invokeExact(0, (byte)1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, byte.class, Class.class)).
-                    invoke(recv, (byte)1, Void.class);
+                    invokeExact(recv, (byte)1, Void.class);
             });
         }
 
@@ -513,32 +515,32 @@
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             // Incorrect arity
             checkWMTE(() -> { // >
                 byte x = (byte) hs.get(am, methodType(Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, byte.class, Class.class)).
-                    invoke((byte)1, Void.class);
+                    invokeExact((byte)1, Void.class);
             });
         }
 
@@ -783,71 +785,71 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                byte x = (byte) hs.get(am, methodType(byte.class, Void.class, int.class)).
-                    invoke(null, 0);
+                byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class)).
+                    invokeExact((byte[]) null, 0);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 byte x = (byte) hs.get(am, methodType(byte.class, Class.class, int.class)).
-                    invoke(Void.class, 0);
+                    invokeExact(Void.class, 0);
             });
             checkWMTE(() -> { // array primitive class
                 byte x = (byte) hs.get(am, methodType(byte.class, int.class, int.class)).
-                    invoke(0, 0);
+                    invokeExact(0, 0);
             });
             checkWMTE(() -> { // index reference class
                 byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, Class.class)).
-                    invoke(array, Void.class);
+                    invokeExact(array, Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 byte x = (byte) hs.get(am, methodType(byte.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                hs.get(am, methodType(void.class, Void.class, int.class, byte.class)).
-                    invoke(null, 0, (byte)1);
+                hs.get(am, methodType(void.class, byte[].class, int.class, byte.class)).
+                    invokeExact((byte[]) null, 0, (byte)1);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 hs.get(am, methodType(void.class, Class.class, int.class, byte.class)).
-                    invoke(Void.class, 0, (byte)1);
+                    invokeExact(Void.class, 0, (byte)1);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, byte[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, int.class, byte.class)).
-                    invoke(0, 0, (byte)1);
+                    invokeExact(0, 0, (byte)1);
             });
             checkWMTE(() -> { // index reference class
                 hs.get(am, methodType(void.class, byte[].class, Class.class, byte.class)).
-                    invoke(array, Void.class, (byte)1);
+                    invokeExact(array, Void.class, (byte)1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, byte[].class, int.class, Class.class)).
-                    invoke(array, 0, (byte)1, Void.class);
+                    invokeExact(array, 0, (byte)1, Void.class);
             });
         }
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java	Tue May 17 05:38:15 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8156486
  * @run testng/othervm VarHandleTestMethodTypeChar
  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeChar
  */
@@ -81,27 +82,28 @@
     public Object[][] accessTestCaseProvider() throws Exception {
         List<AccessTestCase<?>> cases = new ArrayList<>();
 
-        cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Instance field",
                                               vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Static field",
                                               vhStaticField, VarHandleTestMethodTypeChar::testStaticFieldWrongMethodType,
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Array wrong method type",
+        cases.add(new VarHandleAccessTestCase("Array",
                                               vhArray, VarHandleTestMethodTypeChar::testArrayWrongMethodType,
                                               false));
+
         for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
-            cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Instance field",
                                                      vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Static field",
                                                      vhStaticField, f, VarHandleTestMethodTypeChar::testStaticFieldWrongMethodType,
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Array",
                                                      vhArray, f, VarHandleTestMethodTypeChar::testArrayWrongMethodType,
                                                      false));
         }
@@ -329,63 +331,63 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                char x = (char) hs.get(am, methodType(char.class, Void.class)).
-                    invoke(null);
+                char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class)).
+                    invokeExact((VarHandleTestMethodTypeChar) null);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 char x = (char) hs.get(am, methodType(char.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 char x = (char) hs.get(am, methodType(char.class, int.class)).
-                    invoke(0);
+                    invokeExact(0);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
-                Void x = (Void) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class)).
-                    invoke(recv);
+                Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeChar.class)).
+                    invokeExact(recv);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeChar.class)).
-                    invoke(recv);
+                    invokeExact(recv);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 char x = (char) hs.get(am, methodType(char.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                hs.get(am, methodType(void.class, Void.class, char.class)).
-                    invoke(null, 'a');
+                hs.get(am, methodType(void.class, VarHandleTestMethodTypeChar.class, char.class)).
+                    invokeExact((VarHandleTestMethodTypeChar) null, 'a');
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 hs.get(am, methodType(void.class, Class.class, char.class)).
-                    invoke(Void.class, 'a');
+                    invokeExact(Void.class, 'a');
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeChar.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, char.class)).
-                    invoke(0, 'a');
+                    invokeExact(0, 'a');
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeChar.class, char.class, Class.class)).
-                    invoke(recv, 'a', Void.class);
+                    invokeExact(recv, 'a', Void.class);
             });
         }
 
@@ -513,32 +515,32 @@
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             // Incorrect arity
             checkWMTE(() -> { // >
                 char x = (char) hs.get(am, methodType(Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, char.class, Class.class)).
-                    invoke('a', Void.class);
+                    invokeExact('a', Void.class);
             });
         }
 
@@ -783,71 +785,71 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                char x = (char) hs.get(am, methodType(char.class, Void.class, int.class)).
-                    invoke(null, 0);
+                char x = (char) hs.get(am, methodType(char.class, char[].class, int.class)).
+                    invokeExact((char[]) null, 0);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 char x = (char) hs.get(am, methodType(char.class, Class.class, int.class)).
-                    invoke(Void.class, 0);
+                    invokeExact(Void.class, 0);
             });
             checkWMTE(() -> { // array primitive class
                 char x = (char) hs.get(am, methodType(char.class, int.class, int.class)).
-                    invoke(0, 0);
+                    invokeExact(0, 0);
             });
             checkWMTE(() -> { // index reference class
                 char x = (char) hs.get(am, methodType(char.class, char[].class, Class.class)).
-                    invoke(array, Void.class);
+                    invokeExact(array, Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class, char[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, char[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 char x = (char) hs.get(am, methodType(char.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 char x = (char) hs.get(am, methodType(char.class, char[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                hs.get(am, methodType(void.class, Void.class, int.class, char.class)).
-                    invoke(null, 0, 'a');
+                hs.get(am, methodType(void.class, char[].class, int.class, char.class)).
+                    invokeExact((char[]) null, 0, 'a');
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 hs.get(am, methodType(void.class, Class.class, int.class, char.class)).
-                    invoke(Void.class, 0, 'a');
+                    invokeExact(Void.class, 0, 'a');
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, char[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, int.class, char.class)).
-                    invoke(0, 0, 'a');
+                    invokeExact(0, 0, 'a');
             });
             checkWMTE(() -> { // index reference class
                 hs.get(am, methodType(void.class, char[].class, Class.class, char.class)).
-                    invoke(array, Void.class, 'a');
+                    invokeExact(array, Void.class, 'a');
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, char[].class, int.class, Class.class)).
-                    invoke(array, 0, 'a', Void.class);
+                    invokeExact(array, 0, 'a', Void.class);
             });
         }
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java	Tue May 17 05:38:15 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8156486
  * @run testng/othervm VarHandleTestMethodTypeDouble
  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeDouble
  */
@@ -81,27 +82,28 @@
     public Object[][] accessTestCaseProvider() throws Exception {
         List<AccessTestCase<?>> cases = new ArrayList<>();
 
-        cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Instance field",
                                               vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Static field",
                                               vhStaticField, VarHandleTestMethodTypeDouble::testStaticFieldWrongMethodType,
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Array wrong method type",
+        cases.add(new VarHandleAccessTestCase("Array",
                                               vhArray, VarHandleTestMethodTypeDouble::testArrayWrongMethodType,
                                               false));
+
         for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
-            cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Instance field",
                                                      vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Static field",
                                                      vhStaticField, f, VarHandleTestMethodTypeDouble::testStaticFieldWrongMethodType,
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Array",
                                                      vhArray, f, VarHandleTestMethodTypeDouble::testArrayWrongMethodType,
                                                      false));
         }
@@ -329,63 +331,63 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                double x = (double) hs.get(am, methodType(double.class, Void.class)).
-                    invoke(null);
+                double x = (double) hs.get(am, methodType(double.class, VarHandleTestMethodTypeDouble.class)).
+                    invokeExact((VarHandleTestMethodTypeDouble) null);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 double x = (double) hs.get(am, methodType(double.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 double x = (double) hs.get(am, methodType(double.class, int.class)).
-                    invoke(0);
+                    invokeExact(0);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
-                Void x = (Void) hs.get(am, methodType(double.class, VarHandleTestMethodTypeDouble.class)).
-                    invoke(recv);
+                Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeDouble.class)).
+                    invokeExact(recv);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeDouble.class)).
-                    invoke(recv);
+                    invokeExact(recv);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 double x = (double) hs.get(am, methodType(double.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 double x = (double) hs.get(am, methodType(double.class, VarHandleTestMethodTypeDouble.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                hs.get(am, methodType(void.class, Void.class, double.class)).
-                    invoke(null, 1.0d);
+                hs.get(am, methodType(void.class, VarHandleTestMethodTypeDouble.class, double.class)).
+                    invokeExact((VarHandleTestMethodTypeDouble) null, 1.0d);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 hs.get(am, methodType(void.class, Class.class, double.class)).
-                    invoke(Void.class, 1.0d);
+                    invokeExact(Void.class, 1.0d);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeDouble.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, double.class)).
-                    invoke(0, 1.0d);
+                    invokeExact(0, 1.0d);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeDouble.class, double.class, Class.class)).
-                    invoke(recv, 1.0d, Void.class);
+                    invokeExact(recv, 1.0d, Void.class);
             });
         }
 
@@ -513,32 +515,32 @@
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             // Incorrect arity
             checkWMTE(() -> { // >
                 double x = (double) hs.get(am, methodType(Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, double.class, Class.class)).
-                    invoke(1.0d, Void.class);
+                    invokeExact(1.0d, Void.class);
             });
         }
 
@@ -783,71 +785,71 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                double x = (double) hs.get(am, methodType(double.class, Void.class, int.class)).
-                    invoke(null, 0);
+                double x = (double) hs.get(am, methodType(double.class, double[].class, int.class)).
+                    invokeExact((double[]) null, 0);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 double x = (double) hs.get(am, methodType(double.class, Class.class, int.class)).
-                    invoke(Void.class, 0);
+                    invokeExact(Void.class, 0);
             });
             checkWMTE(() -> { // array primitive class
                 double x = (double) hs.get(am, methodType(double.class, int.class, int.class)).
-                    invoke(0, 0);
+                    invokeExact(0, 0);
             });
             checkWMTE(() -> { // index reference class
                 double x = (double) hs.get(am, methodType(double.class, double[].class, Class.class)).
-                    invoke(array, Void.class);
+                    invokeExact(array, Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class, double[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, double[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 double x = (double) hs.get(am, methodType(double.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 double x = (double) hs.get(am, methodType(double.class, double[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                hs.get(am, methodType(void.class, Void.class, int.class, double.class)).
-                    invoke(null, 0, 1.0d);
+                hs.get(am, methodType(void.class, double[].class, int.class, double.class)).
+                    invokeExact((double[]) null, 0, 1.0d);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 hs.get(am, methodType(void.class, Class.class, int.class, double.class)).
-                    invoke(Void.class, 0, 1.0d);
+                    invokeExact(Void.class, 0, 1.0d);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, double[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, int.class, double.class)).
-                    invoke(0, 0, 1.0d);
+                    invokeExact(0, 0, 1.0d);
             });
             checkWMTE(() -> { // index reference class
                 hs.get(am, methodType(void.class, double[].class, Class.class, double.class)).
-                    invoke(array, Void.class, 1.0d);
+                    invokeExact(array, Void.class, 1.0d);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, double[].class, int.class, Class.class)).
-                    invoke(array, 0, 1.0d, Void.class);
+                    invokeExact(array, 0, 1.0d, Void.class);
             });
         }
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java	Tue May 17 05:38:15 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8156486
  * @run testng/othervm VarHandleTestMethodTypeFloat
  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeFloat
  */
@@ -81,27 +82,28 @@
     public Object[][] accessTestCaseProvider() throws Exception {
         List<AccessTestCase<?>> cases = new ArrayList<>();
 
-        cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Instance field",
                                               vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Static field",
                                               vhStaticField, VarHandleTestMethodTypeFloat::testStaticFieldWrongMethodType,
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Array wrong method type",
+        cases.add(new VarHandleAccessTestCase("Array",
                                               vhArray, VarHandleTestMethodTypeFloat::testArrayWrongMethodType,
                                               false));
+
         for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
-            cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Instance field",
                                                      vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Static field",
                                                      vhStaticField, f, VarHandleTestMethodTypeFloat::testStaticFieldWrongMethodType,
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Array",
                                                      vhArray, f, VarHandleTestMethodTypeFloat::testArrayWrongMethodType,
                                                      false));
         }
@@ -329,63 +331,63 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                float x = (float) hs.get(am, methodType(float.class, Void.class)).
-                    invoke(null);
+                float x = (float) hs.get(am, methodType(float.class, VarHandleTestMethodTypeFloat.class)).
+                    invokeExact((VarHandleTestMethodTypeFloat) null);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 float x = (float) hs.get(am, methodType(float.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 float x = (float) hs.get(am, methodType(float.class, int.class)).
-                    invoke(0);
+                    invokeExact(0);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
-                Void x = (Void) hs.get(am, methodType(float.class, VarHandleTestMethodTypeFloat.class)).
-                    invoke(recv);
+                Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeFloat.class)).
+                    invokeExact(recv);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeFloat.class)).
-                    invoke(recv);
+                    invokeExact(recv);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 float x = (float) hs.get(am, methodType(float.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 float x = (float) hs.get(am, methodType(float.class, VarHandleTestMethodTypeFloat.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                hs.get(am, methodType(void.class, Void.class, float.class)).
-                    invoke(null, 1.0f);
+                hs.get(am, methodType(void.class, VarHandleTestMethodTypeFloat.class, float.class)).
+                    invokeExact((VarHandleTestMethodTypeFloat) null, 1.0f);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 hs.get(am, methodType(void.class, Class.class, float.class)).
-                    invoke(Void.class, 1.0f);
+                    invokeExact(Void.class, 1.0f);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeFloat.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, float.class)).
-                    invoke(0, 1.0f);
+                    invokeExact(0, 1.0f);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeFloat.class, float.class, Class.class)).
-                    invoke(recv, 1.0f, Void.class);
+                    invokeExact(recv, 1.0f, Void.class);
             });
         }
 
@@ -513,32 +515,32 @@
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             // Incorrect arity
             checkWMTE(() -> { // >
                 float x = (float) hs.get(am, methodType(Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, float.class, Class.class)).
-                    invoke(1.0f, Void.class);
+                    invokeExact(1.0f, Void.class);
             });
         }
 
@@ -783,71 +785,71 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                float x = (float) hs.get(am, methodType(float.class, Void.class, int.class)).
-                    invoke(null, 0);
+                float x = (float) hs.get(am, methodType(float.class, float[].class, int.class)).
+                    invokeExact((float[]) null, 0);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 float x = (float) hs.get(am, methodType(float.class, Class.class, int.class)).
-                    invoke(Void.class, 0);
+                    invokeExact(Void.class, 0);
             });
             checkWMTE(() -> { // array primitive class
                 float x = (float) hs.get(am, methodType(float.class, int.class, int.class)).
-                    invoke(0, 0);
+                    invokeExact(0, 0);
             });
             checkWMTE(() -> { // index reference class
                 float x = (float) hs.get(am, methodType(float.class, float[].class, Class.class)).
-                    invoke(array, Void.class);
+                    invokeExact(array, Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class, float[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, float[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 float x = (float) hs.get(am, methodType(float.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 float x = (float) hs.get(am, methodType(float.class, float[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                hs.get(am, methodType(void.class, Void.class, int.class, float.class)).
-                    invoke(null, 0, 1.0f);
+                hs.get(am, methodType(void.class, float[].class, int.class, float.class)).
+                    invokeExact((float[]) null, 0, 1.0f);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 hs.get(am, methodType(void.class, Class.class, int.class, float.class)).
-                    invoke(Void.class, 0, 1.0f);
+                    invokeExact(Void.class, 0, 1.0f);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, float[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, int.class, float.class)).
-                    invoke(0, 0, 1.0f);
+                    invokeExact(0, 0, 1.0f);
             });
             checkWMTE(() -> { // index reference class
                 hs.get(am, methodType(void.class, float[].class, Class.class, float.class)).
-                    invoke(array, Void.class, 1.0f);
+                    invokeExact(array, Void.class, 1.0f);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, float[].class, int.class, Class.class)).
-                    invoke(array, 0, 1.0f, Void.class);
+                    invokeExact(array, 0, 1.0f, Void.class);
             });
         }
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java	Tue May 17 05:38:15 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8156486
  * @run testng/othervm VarHandleTestMethodTypeInt
  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeInt
  */
@@ -81,27 +82,28 @@
     public Object[][] accessTestCaseProvider() throws Exception {
         List<AccessTestCase<?>> cases = new ArrayList<>();
 
-        cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Instance field",
                                               vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Static field",
                                               vhStaticField, VarHandleTestMethodTypeInt::testStaticFieldWrongMethodType,
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Array wrong method type",
+        cases.add(new VarHandleAccessTestCase("Array",
                                               vhArray, VarHandleTestMethodTypeInt::testArrayWrongMethodType,
                                               false));
+
         for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
-            cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Instance field",
                                                      vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Static field",
                                                      vhStaticField, f, VarHandleTestMethodTypeInt::testStaticFieldWrongMethodType,
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Array",
                                                      vhArray, f, VarHandleTestMethodTypeInt::testArrayWrongMethodType,
                                                      false));
         }
@@ -644,211 +646,211 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                int x = (int) hs.get(am, methodType(int.class, Void.class)).
-                    invoke(null);
+                int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class)).
+                    invokeExact((VarHandleTestMethodTypeInt) null);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 int x = (int) hs.get(am, methodType(int.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 int x = (int) hs.get(am, methodType(int.class, int.class)).
-                    invoke(0);
+                    invokeExact(0);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
-                Void x = (Void) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class)).
-                    invoke(recv);
+                Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class)).
+                    invokeExact(recv);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class)).
-                    invoke(recv);
+                    invokeExact(recv);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 int x = (int) hs.get(am, methodType(int.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                hs.get(am, methodType(void.class, Void.class, int.class)).
-                    invoke(null, 1);
+                hs.get(am, methodType(void.class, VarHandleTestMethodTypeInt.class, int.class)).
+                    invokeExact((VarHandleTestMethodTypeInt) null, 1);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 hs.get(am, methodType(void.class, Class.class, int.class)).
-                    invoke(Void.class, 1);
+                    invokeExact(Void.class, 1);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeInt.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, int.class)).
-                    invoke(0, 1);
+                    invokeExact(0, 1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeInt.class, int.class, Class.class)).
-                    invoke(recv, 1, Void.class);
+                    invokeExact(recv, 1, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, int.class)).
-                    invoke(null, 1, 1);
+                boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class, int.class)).
+                    invokeExact((VarHandleTestMethodTypeInt) null, 1, 1);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, int.class)).
-                    invoke(Void.class, 1, 1);
+                    invokeExact(Void.class, 1, 1);
             });
             checkWMTE(() -> { // expected reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, Class.class, int.class)).
-                    invoke(recv, Void.class, 1);
+                    invokeExact(recv, Void.class, 1);
             });
             checkWMTE(() -> { // actual reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class, Class.class)).
-                    invoke(recv, 1, Void.class);
+                    invokeExact(recv, 1, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , int.class, int.class)).
-                    invoke(0, 1, 1);
+                    invokeExact(0, 1, 1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean r = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class, int.class, Class.class)).
-                    invoke(recv, 1, 1, Void.class);
+                    invokeExact(recv, 1, 1, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
             checkNPE(() -> { // null receiver
-                int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class)).
-                    invoke(null, 1, 1);
+                int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class, int.class)).
+                    invokeExact((VarHandleTestMethodTypeInt) null, 1, 1);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class)).
-                    invoke(Void.class, 1, 1);
+                    invokeExact(Void.class, 1, 1);
             });
             checkWMTE(() -> { // expected reference class
                 int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class, int.class)).
-                    invoke(recv, Void.class, 1);
+                    invokeExact(recv, Void.class, 1);
             });
             checkWMTE(() -> { // actual reference class
                 int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class, Class.class)).
-                    invoke(recv, 1, Void.class);
+                    invokeExact(recv, 1, Void.class);
             });
             checkWMTE(() -> { // reciever primitive class
                 int x = (int) hs.get(am, methodType(int.class, int.class , int.class, int.class)).
-                    invoke(0, 1, 1);
+                    invokeExact(0, 1, 1);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class , int.class, int.class)).
-                    invoke(recv, 1, 1);
+                    invokeExact(recv, 1, 1);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class , int.class, int.class)).
-                    invoke(recv, 1, 1);
+                    invokeExact(recv, 1, 1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 int x = (int) hs.get(am, methodType(int.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class, int.class, Class.class)).
-                    invoke(recv, 1, 1, Void.class);
+                    invokeExact(recv, 1, 1, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
             checkNPE(() -> { // null receiver
-                int x = (int) hs.get(am, methodType(int.class, Void.class, int.class)).
-                    invoke(null, 1);
+                int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)).
+                    invokeExact((VarHandleTestMethodTypeInt) null, 1);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)).
-                    invoke(Void.class, 1);
+                    invokeExact(Void.class, 1);
             });
             checkWMTE(() -> { // value reference class
                 int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // reciever primitive class
                 int x = (int) hs.get(am, methodType(int.class, int.class, int.class)).
-                    invoke(0, 1);
+                    invokeExact(0, 1);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class, int.class)).
-                    invoke(recv, 1);
+                    invokeExact(recv, 1);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class)).
-                    invoke(recv, 1);
+                    invokeExact(recv, 1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 int x = (int) hs.get(am, methodType(int.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)).
-                    invoke(recv, 1, Void.class);
+                    invokeExact(recv, 1, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
             checkNPE(() -> { // null receiver
-                int x = (int) hs.get(am, methodType(int.class, Void.class, int.class)).
-                    invoke(null, 1);
+                int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)).
+                    invokeExact((VarHandleTestMethodTypeInt) null, 1);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)).
-                    invoke(Void.class, 1);
+                    invokeExact(Void.class, 1);
             });
             checkWMTE(() -> { // value reference class
                 int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // reciever primitive class
                 int x = (int) hs.get(am, methodType(int.class, int.class, int.class)).
-                    invoke(0, 1);
+                    invokeExact(0, 1);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class, int.class)).
-                    invoke(recv, 1);
+                    invokeExact(recv, 1);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class)).
-                    invoke(recv, 1);
+                    invokeExact(recv, 1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 int x = (int) hs.get(am, methodType(int.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)).
-                    invoke(recv, 1, Void.class);
+                    invokeExact(recv, 1, Void.class);
             });
         }
     }
@@ -1190,52 +1192,52 @@
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             // Incorrect arity
             checkWMTE(() -> { // >
                 int x = (int) hs.get(am, methodType(Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, int.class, Class.class)).
-                    invoke(1, Void.class);
+                    invokeExact(1, Void.class);
             });
         }
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
             // Incorrect argument types
             checkWMTE(() -> { // expected reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class)).
-                    invoke(Void.class, 1);
+                    invokeExact(Void.class, 1);
             });
             checkWMTE(() -> { // actual reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, Class.class)).
-                    invoke(1, Void.class);
+                    invokeExact(1, Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean r = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, Class.class)).
-                    invoke(1, 1, Void.class);
+                    invokeExact(1, 1, Void.class);
             });
         }
 
@@ -1243,29 +1245,29 @@
             // Incorrect argument types
             checkWMTE(() -> { // expected reference class
                 int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)).
-                    invoke(Void.class, 1);
+                    invokeExact(Void.class, 1);
             });
             checkWMTE(() -> { // actual reference class
                 int x = (int) hs.get(am, methodType(int.class, int.class, Class.class)).
-                    invoke(1, Void.class);
+                    invokeExact(1, Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, int.class, int.class)).
-                    invoke(1, 1);
+                    invokeExact(1, 1);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class)).
-                    invoke(1, 1);
+                    invokeExact(1, 1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 int x = (int) hs.get(am, methodType(int.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 int x = (int) hs.get(am, methodType(int.class, int.class, int.class, Class.class)).
-                    invoke(1, 1, Void.class);
+                    invokeExact(1, 1, Void.class);
             });
         }
 
@@ -1273,25 +1275,25 @@
             // Incorrect argument types
             checkWMTE(() -> { // value reference class
                 int x = (int) hs.get(am, methodType(int.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, int.class)).
-                    invoke(1);
+                    invokeExact(1);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class)).
-                    invoke(1);
+                    invokeExact(1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 int x = (int) hs.get(am, methodType(int.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 int x = (int) hs.get(am, methodType(int.class, int.class, Class.class)).
-                    invoke(1, Void.class);
+                    invokeExact(1, Void.class);
             });
         }
 
@@ -1299,25 +1301,25 @@
             // Incorrect argument types
             checkWMTE(() -> { // value reference class
                 int x = (int) hs.get(am, methodType(int.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, int.class)).
-                    invoke(1);
+                    invokeExact(1);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class)).
-                    invoke(1);
+                    invokeExact(1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 int x = (int) hs.get(am, methodType(int.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 int x = (int) hs.get(am, methodType(int.class, int.class, Class.class)).
-                    invoke(1, Void.class);
+                    invokeExact(1, Void.class);
             });
         }
     }
@@ -1909,237 +1911,237 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                int x = (int) hs.get(am, methodType(int.class, Void.class, int.class)).
-                    invoke(null, 0);
+                int x = (int) hs.get(am, methodType(int.class, int[].class, int.class)).
+                    invokeExact((int[]) null, 0);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)).
-                    invoke(Void.class, 0);
+                    invokeExact(Void.class, 0);
             });
             checkWMTE(() -> { // array primitive class
                 int x = (int) hs.get(am, methodType(int.class, int.class, int.class)).
-                    invoke(0, 0);
+                    invokeExact(0, 0);
             });
             checkWMTE(() -> { // index reference class
                 int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class)).
-                    invoke(array, Void.class);
+                    invokeExact(array, Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class, int[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 int x = (int) hs.get(am, methodType(int.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                hs.get(am, methodType(void.class, Void.class, int.class, int.class)).
-                    invoke(null, 0, 1);
+                hs.get(am, methodType(void.class, int[].class, int.class, int.class)).
+                    invokeExact((int[]) null, 0, 1);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 hs.get(am, methodType(void.class, Class.class, int.class, int.class)).
-                    invoke(Void.class, 0, 1);
+                    invokeExact(Void.class, 0, 1);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, int[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, int.class, int.class)).
-                    invoke(0, 0, 1);
+                    invokeExact(0, 0, 1);
             });
             checkWMTE(() -> { // index reference class
                 hs.get(am, methodType(void.class, int[].class, Class.class, int.class)).
-                    invoke(array, Void.class, 1);
+                    invokeExact(array, Void.class, 1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, int[].class, int.class, Class.class)).
-                    invoke(array, 0, 1, Void.class);
+                    invokeExact(array, 0, 1, Void.class);
             });
         }
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, int.class, int.class)).
-                    invoke(null, 0, 1, 1);
+                boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class, int.class)).
+                    invokeExact((int[]) null, 0, 1, 1);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, int.class, int.class)).
-                    invoke(Void.class, 0, 1, 1);
+                    invokeExact(Void.class, 0, 1, 1);
             });
             checkWMTE(() -> { // expected reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, Class.class, int.class)).
-                    invoke(array, 0, Void.class, 1);
+                    invokeExact(array, 0, Void.class, 1);
             });
             checkWMTE(() -> { // actual reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class, Class.class)).
-                    invoke(array, 0, 1, Void.class);
+                    invokeExact(array, 0, 1, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, int.class, int.class)).
-                    invoke(0, 0, 1, 1);
+                    invokeExact(0, 0, 1, 1);
             });
             checkWMTE(() -> { // index reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, Class.class, int.class, int.class)).
-                    invoke(array, Void.class, 1, 1);
+                    invokeExact(array, Void.class, 1, 1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean r = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class, int.class, Class.class)).
-                    invoke(array, 0, 1, 1, Void.class);
+                    invokeExact(array, 0, 1, 1, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class, int.class)).
-                    invoke(null, 0, 1, 1);
+                int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, int.class)).
+                    invokeExact((int[]) null, 0, 1, 1);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class, int.class)).
-                    invoke(Void.class, 0, 1, 1);
+                    invokeExact(Void.class, 0, 1, 1);
             });
             checkWMTE(() -> { // expected reference class
                 int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class, int.class)).
-                    invoke(array, 0, Void.class, 1);
+                    invokeExact(array, 0, Void.class, 1);
             });
             checkWMTE(() -> { // actual reference class
                 int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, Class.class)).
-                    invoke(array, 0, 1, Void.class);
+                    invokeExact(array, 0, 1, Void.class);
             });
             checkWMTE(() -> { // array primitive class
                 int x = (int) hs.get(am, methodType(int.class, int.class, int.class, int.class, int.class)).
-                    invoke(0, 0, 1, 1);
+                    invokeExact(0, 0, 1, 1);
             });
             checkWMTE(() -> { // index reference class
                 int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class, int.class, int.class)).
-                    invoke(array, Void.class, 1, 1);
+                    invokeExact(array, Void.class, 1, 1);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, int[].class, int.class, int.class, int.class)).
-                    invoke(array, 0, 1, 1);
+                    invokeExact(array, 0, 1, 1);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class, int.class)).
-                    invoke(array, 0, 1, 1);
+                    invokeExact(array, 0, 1, 1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 int x = (int) hs.get(am, methodType(int.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, int.class, Class.class)).
-                    invoke(array, 0, 1, 1, Void.class);
+                    invokeExact(array, 0, 1, 1, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class)).
-                    invoke(null, 0, 1);
+                int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class)).
+                    invokeExact((int[]) null, 0, 1);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class)).
-                    invoke(Void.class, 0, 1);
+                    invokeExact(Void.class, 0, 1);
             });
             checkWMTE(() -> { // value reference class
                 int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // array primitive class
                 int x = (int) hs.get(am, methodType(int.class, int.class, int.class, int.class)).
-                    invoke(0, 0, 1);
+                    invokeExact(0, 0, 1);
             });
             checkWMTE(() -> { // index reference class
                 int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class, int.class)).
-                    invoke(array, Void.class, 1);
+                    invokeExact(array, Void.class, 1);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, int[].class, int.class, int.class)).
-                    invoke(array, 0, 1);
+                    invokeExact(array, 0, 1);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class)).
-                    invoke(array, 0, 1);
+                    invokeExact(array, 0, 1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 int x = (int) hs.get(am, methodType(int.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, Class.class)).
-                    invoke(array, 0, 1, Void.class);
+                    invokeExact(array, 0, 1, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class)).
-                    invoke(null, 0, 1);
+                int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class)).
+                    invokeExact((int[]) null, 0, 1);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class)).
-                    invoke(Void.class, 0, 1);
+                    invokeExact(Void.class, 0, 1);
             });
             checkWMTE(() -> { // value reference class
                 int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // array primitive class
                 int x = (int) hs.get(am, methodType(int.class, int.class, int.class, int.class)).
-                    invoke(0, 0, 1);
+                    invokeExact(0, 0, 1);
             });
             checkWMTE(() -> { // index reference class
                 int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class, int.class)).
-                    invoke(array, Void.class, 1);
+                    invokeExact(array, Void.class, 1);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, int[].class, int.class, int.class)).
-                    invoke(array, 0, 1);
+                    invokeExact(array, 0, 1);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class)).
-                    invoke(array, 0, 1);
+                    invokeExact(array, 0, 1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 int x = (int) hs.get(am, methodType(int.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, Class.class)).
-                    invoke(array, 0, 1, Void.class);
+                    invokeExact(array, 0, 1, Void.class);
             });
         }
     }
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java	Tue May 17 05:38:15 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8156486
  * @run testng/othervm VarHandleTestMethodTypeLong
  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeLong
  */
@@ -81,27 +82,28 @@
     public Object[][] accessTestCaseProvider() throws Exception {
         List<AccessTestCase<?>> cases = new ArrayList<>();
 
-        cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Instance field",
                                               vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Static field",
                                               vhStaticField, VarHandleTestMethodTypeLong::testStaticFieldWrongMethodType,
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Array wrong method type",
+        cases.add(new VarHandleAccessTestCase("Array",
                                               vhArray, VarHandleTestMethodTypeLong::testArrayWrongMethodType,
                                               false));
+
         for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
-            cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Instance field",
                                                      vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Static field",
                                                      vhStaticField, f, VarHandleTestMethodTypeLong::testStaticFieldWrongMethodType,
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Array",
                                                      vhArray, f, VarHandleTestMethodTypeLong::testArrayWrongMethodType,
                                                      false));
         }
@@ -644,211 +646,211 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                long x = (long) hs.get(am, methodType(long.class, Void.class)).
-                    invoke(null);
+                long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class)).
+                    invokeExact((VarHandleTestMethodTypeLong) null);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 long x = (long) hs.get(am, methodType(long.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 long x = (long) hs.get(am, methodType(long.class, int.class)).
-                    invoke(0);
+                    invokeExact(0);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
-                Void x = (Void) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class)).
-                    invoke(recv);
+                Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class)).
+                    invokeExact(recv);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class)).
-                    invoke(recv);
+                    invokeExact(recv);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 long x = (long) hs.get(am, methodType(long.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                hs.get(am, methodType(void.class, Void.class, long.class)).
-                    invoke(null, 1L);
+                hs.get(am, methodType(void.class, VarHandleTestMethodTypeLong.class, long.class)).
+                    invokeExact((VarHandleTestMethodTypeLong) null, 1L);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 hs.get(am, methodType(void.class, Class.class, long.class)).
-                    invoke(Void.class, 1L);
+                    invokeExact(Void.class, 1L);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeLong.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, long.class)).
-                    invoke(0, 1L);
+                    invokeExact(0, 1L);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeLong.class, long.class, Class.class)).
-                    invoke(recv, 1L, Void.class);
+                    invokeExact(recv, 1L, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, long.class, long.class)).
-                    invoke(null, 1L, 1L);
+                boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class, long.class)).
+                    invokeExact((VarHandleTestMethodTypeLong) null, 1L, 1L);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, long.class, long.class)).
-                    invoke(Void.class, 1L, 1L);
+                    invokeExact(Void.class, 1L, 1L);
             });
             checkWMTE(() -> { // expected reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, Class.class, long.class)).
-                    invoke(recv, Void.class, 1L);
+                    invokeExact(recv, Void.class, 1L);
             });
             checkWMTE(() -> { // actual reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class, Class.class)).
-                    invoke(recv, 1L, Void.class);
+                    invokeExact(recv, 1L, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , long.class, long.class)).
-                    invoke(0, 1L, 1L);
+                    invokeExact(0, 1L, 1L);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean r = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class, long.class, Class.class)).
-                    invoke(recv, 1L, 1L, Void.class);
+                    invokeExact(recv, 1L, 1L, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
             checkNPE(() -> { // null receiver
-                long x = (long) hs.get(am, methodType(long.class, Void.class, long.class, long.class)).
-                    invoke(null, 1L, 1L);
+                long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class, long.class)).
+                    invokeExact((VarHandleTestMethodTypeLong) null, 1L, 1L);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 long x = (long) hs.get(am, methodType(long.class, Class.class, long.class, long.class)).
-                    invoke(Void.class, 1L, 1L);
+                    invokeExact(Void.class, 1L, 1L);
             });
             checkWMTE(() -> { // expected reference class
                 long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class, long.class)).
-                    invoke(recv, Void.class, 1L);
+                    invokeExact(recv, Void.class, 1L);
             });
             checkWMTE(() -> { // actual reference class
                 long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class, Class.class)).
-                    invoke(recv, 1L, Void.class);
+                    invokeExact(recv, 1L, Void.class);
             });
             checkWMTE(() -> { // reciever primitive class
                 long x = (long) hs.get(am, methodType(long.class, int.class , long.class, long.class)).
-                    invoke(0, 1L, 1L);
+                    invokeExact(0, 1L, 1L);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class , long.class, long.class)).
-                    invoke(recv, 1L, 1L);
+                    invokeExact(recv, 1L, 1L);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class , long.class, long.class)).
-                    invoke(recv, 1L, 1L);
+                    invokeExact(recv, 1L, 1L);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 long x = (long) hs.get(am, methodType(long.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class, long.class, Class.class)).
-                    invoke(recv, 1L, 1L, Void.class);
+                    invokeExact(recv, 1L, 1L, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
             checkNPE(() -> { // null receiver
-                long x = (long) hs.get(am, methodType(long.class, Void.class, long.class)).
-                    invoke(null, 1L);
+                long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)).
+                    invokeExact((VarHandleTestMethodTypeLong) null, 1L);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)).
-                    invoke(Void.class, 1L);
+                    invokeExact(Void.class, 1L);
             });
             checkWMTE(() -> { // value reference class
                 long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // reciever primitive class
                 long x = (long) hs.get(am, methodType(long.class, int.class, long.class)).
-                    invoke(0, 1L);
+                    invokeExact(0, 1L);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class, long.class)).
-                    invoke(recv, 1L);
+                    invokeExact(recv, 1L);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class)).
-                    invoke(recv, 1L);
+                    invokeExact(recv, 1L);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 long x = (long) hs.get(am, methodType(long.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)).
-                    invoke(recv, 1L, Void.class);
+                    invokeExact(recv, 1L, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
             checkNPE(() -> { // null receiver
-                long x = (long) hs.get(am, methodType(long.class, Void.class, long.class)).
-                    invoke(null, 1L);
+                long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)).
+                    invokeExact((VarHandleTestMethodTypeLong) null, 1L);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)).
-                    invoke(Void.class, 1L);
+                    invokeExact(Void.class, 1L);
             });
             checkWMTE(() -> { // value reference class
                 long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // reciever primitive class
                 long x = (long) hs.get(am, methodType(long.class, int.class, long.class)).
-                    invoke(0, 1L);
+                    invokeExact(0, 1L);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class, long.class)).
-                    invoke(recv, 1L);
+                    invokeExact(recv, 1L);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class)).
-                    invoke(recv, 1L);
+                    invokeExact(recv, 1L);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 long x = (long) hs.get(am, methodType(long.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)).
-                    invoke(recv, 1L, Void.class);
+                    invokeExact(recv, 1L, Void.class);
             });
         }
     }
@@ -1190,52 +1192,52 @@
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             // Incorrect arity
             checkWMTE(() -> { // >
                 long x = (long) hs.get(am, methodType(Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, long.class, Class.class)).
-                    invoke(1L, Void.class);
+                    invokeExact(1L, Void.class);
             });
         }
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
             // Incorrect argument types
             checkWMTE(() -> { // expected reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, long.class)).
-                    invoke(Void.class, 1L);
+                    invokeExact(Void.class, 1L);
             });
             checkWMTE(() -> { // actual reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, long.class, Class.class)).
-                    invoke(1L, Void.class);
+                    invokeExact(1L, Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean r = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, long.class, long.class, Class.class)).
-                    invoke(1L, 1L, Void.class);
+                    invokeExact(1L, 1L, Void.class);
             });
         }
 
@@ -1243,29 +1245,29 @@
             // Incorrect argument types
             checkWMTE(() -> { // expected reference class
                 long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)).
-                    invoke(Void.class, 1L);
+                    invokeExact(Void.class, 1L);
             });
             checkWMTE(() -> { // actual reference class
                 long x = (long) hs.get(am, methodType(long.class, long.class, Class.class)).
-                    invoke(1L, Void.class);
+                    invokeExact(1L, Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, long.class, long.class)).
-                    invoke(1L, 1L);
+                    invokeExact(1L, 1L);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, long.class, long.class)).
-                    invoke(1L, 1L);
+                    invokeExact(1L, 1L);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 long x = (long) hs.get(am, methodType(long.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 long x = (long) hs.get(am, methodType(long.class, long.class, long.class, Class.class)).
-                    invoke(1L, 1L, Void.class);
+                    invokeExact(1L, 1L, Void.class);
             });
         }
 
@@ -1273,25 +1275,25 @@
             // Incorrect argument types
             checkWMTE(() -> { // value reference class
                 long x = (long) hs.get(am, methodType(long.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, long.class)).
-                    invoke(1L);
+                    invokeExact(1L);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, long.class)).
-                    invoke(1L);
+                    invokeExact(1L);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 long x = (long) hs.get(am, methodType(long.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 long x = (long) hs.get(am, methodType(long.class, long.class, Class.class)).
-                    invoke(1L, Void.class);
+                    invokeExact(1L, Void.class);
             });
         }
 
@@ -1299,25 +1301,25 @@
             // Incorrect argument types
             checkWMTE(() -> { // value reference class
                 long x = (long) hs.get(am, methodType(long.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, long.class)).
-                    invoke(1L);
+                    invokeExact(1L);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, long.class)).
-                    invoke(1L);
+                    invokeExact(1L);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 long x = (long) hs.get(am, methodType(long.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 long x = (long) hs.get(am, methodType(long.class, long.class, Class.class)).
-                    invoke(1L, Void.class);
+                    invokeExact(1L, Void.class);
             });
         }
     }
@@ -1909,237 +1911,237 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                long x = (long) hs.get(am, methodType(long.class, Void.class, int.class)).
-                    invoke(null, 0);
+                long x = (long) hs.get(am, methodType(long.class, long[].class, int.class)).
+                    invokeExact((long[]) null, 0);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 long x = (long) hs.get(am, methodType(long.class, Class.class, int.class)).
-                    invoke(Void.class, 0);
+                    invokeExact(Void.class, 0);
             });
             checkWMTE(() -> { // array primitive class
                 long x = (long) hs.get(am, methodType(long.class, int.class, int.class)).
-                    invoke(0, 0);
+                    invokeExact(0, 0);
             });
             checkWMTE(() -> { // index reference class
                 long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class)).
-                    invoke(array, Void.class);
+                    invokeExact(array, Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class, long[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 long x = (long) hs.get(am, methodType(long.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                hs.get(am, methodType(void.class, Void.class, int.class, long.class)).
-                    invoke(null, 0, 1L);
+                hs.get(am, methodType(void.class, long[].class, int.class, long.class)).
+                    invokeExact((long[]) null, 0, 1L);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 hs.get(am, methodType(void.class, Class.class, int.class, long.class)).
-                    invoke(Void.class, 0, 1L);
+                    invokeExact(Void.class, 0, 1L);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, long[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, int.class, long.class)).
-                    invoke(0, 0, 1L);
+                    invokeExact(0, 0, 1L);
             });
             checkWMTE(() -> { // index reference class
                 hs.get(am, methodType(void.class, long[].class, Class.class, long.class)).
-                    invoke(array, Void.class, 1L);
+                    invokeExact(array, Void.class, 1L);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, long[].class, int.class, Class.class)).
-                    invoke(array, 0, 1L, Void.class);
+                    invokeExact(array, 0, 1L, Void.class);
             });
         }
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, long.class, long.class)).
-                    invoke(null, 0, 1L, 1L);
+                boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class, long.class)).
+                    invokeExact((long[]) null, 0, 1L, 1L);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, long.class, long.class)).
-                    invoke(Void.class, 0, 1L, 1L);
+                    invokeExact(Void.class, 0, 1L, 1L);
             });
             checkWMTE(() -> { // expected reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, Class.class, long.class)).
-                    invoke(array, 0, Void.class, 1L);
+                    invokeExact(array, 0, Void.class, 1L);
             });
             checkWMTE(() -> { // actual reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class, Class.class)).
-                    invoke(array, 0, 1L, Void.class);
+                    invokeExact(array, 0, 1L, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, long.class, long.class)).
-                    invoke(0, 0, 1L, 1L);
+                    invokeExact(0, 0, 1L, 1L);
             });
             checkWMTE(() -> { // index reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, Class.class, long.class, long.class)).
-                    invoke(array, Void.class, 1L, 1L);
+                    invokeExact(array, Void.class, 1L, 1L);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean r = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class, long.class, Class.class)).
-                    invoke(array, 0, 1L, 1L, Void.class);
+                    invokeExact(array, 0, 1L, 1L, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                long x = (long) hs.get(am, methodType(long.class, Void.class, int.class, long.class, long.class)).
-                    invoke(null, 0, 1L, 1L);
+                long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, long.class)).
+                    invokeExact((long[]) null, 0, 1L, 1L);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 long x = (long) hs.get(am, methodType(long.class, Class.class, int.class, long.class, long.class)).
-                    invoke(Void.class, 0, 1L, 1L);
+                    invokeExact(Void.class, 0, 1L, 1L);
             });
             checkWMTE(() -> { // expected reference class
                 long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class, long.class)).
-                    invoke(array, 0, Void.class, 1L);
+                    invokeExact(array, 0, Void.class, 1L);
             });
             checkWMTE(() -> { // actual reference class
                 long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, Class.class)).
-                    invoke(array, 0, 1L, Void.class);
+                    invokeExact(array, 0, 1L, Void.class);
             });
             checkWMTE(() -> { // array primitive class
                 long x = (long) hs.get(am, methodType(long.class, int.class, int.class, long.class, long.class)).
-                    invoke(0, 0, 1L, 1L);
+                    invokeExact(0, 0, 1L, 1L);
             });
             checkWMTE(() -> { // index reference class
                 long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class, long.class, long.class)).
-                    invoke(array, Void.class, 1L, 1L);
+                    invokeExact(array, Void.class, 1L, 1L);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, long[].class, int.class, long.class, long.class)).
-                    invoke(array, 0, 1L, 1L);
+                    invokeExact(array, 0, 1L, 1L);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class, long.class)).
-                    invoke(array, 0, 1L, 1L);
+                    invokeExact(array, 0, 1L, 1L);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 long x = (long) hs.get(am, methodType(long.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, long.class, Class.class)).
-                    invoke(array, 0, 1L, 1L, Void.class);
+                    invokeExact(array, 0, 1L, 1L, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                long x = (long) hs.get(am, methodType(long.class, Void.class, int.class, long.class)).
-                    invoke(null, 0, 1L);
+                long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class)).
+                    invokeExact((long[]) null, 0, 1L);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 long x = (long) hs.get(am, methodType(long.class, Class.class, int.class, long.class)).
-                    invoke(Void.class, 0, 1L);
+                    invokeExact(Void.class, 0, 1L);
             });
             checkWMTE(() -> { // value reference class
                 long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // array primitive class
                 long x = (long) hs.get(am, methodType(long.class, int.class, int.class, long.class)).
-                    invoke(0, 0, 1L);
+                    invokeExact(0, 0, 1L);
             });
             checkWMTE(() -> { // index reference class
                 long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class, long.class)).
-                    invoke(array, Void.class, 1L);
+                    invokeExact(array, Void.class, 1L);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, long[].class, int.class, long.class)).
-                    invoke(array, 0, 1L);
+                    invokeExact(array, 0, 1L);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class)).
-                    invoke(array, 0, 1L);
+                    invokeExact(array, 0, 1L);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 long x = (long) hs.get(am, methodType(long.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, Class.class)).
-                    invoke(array, 0, 1L, Void.class);
+                    invokeExact(array, 0, 1L, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                long x = (long) hs.get(am, methodType(long.class, Void.class, int.class, long.class)).
-                    invoke(null, 0, 1L);
+                long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class)).
+                    invokeExact((long[]) null, 0, 1L);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 long x = (long) hs.get(am, methodType(long.class, Class.class, int.class, long.class)).
-                    invoke(Void.class, 0, 1L);
+                    invokeExact(Void.class, 0, 1L);
             });
             checkWMTE(() -> { // value reference class
                 long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // array primitive class
                 long x = (long) hs.get(am, methodType(long.class, int.class, int.class, long.class)).
-                    invoke(0, 0, 1L);
+                    invokeExact(0, 0, 1L);
             });
             checkWMTE(() -> { // index reference class
                 long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class, long.class)).
-                    invoke(array, Void.class, 1L);
+                    invokeExact(array, Void.class, 1L);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, long[].class, int.class, long.class)).
-                    invoke(array, 0, 1L);
+                    invokeExact(array, 0, 1L);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class)).
-                    invoke(array, 0, 1L);
+                    invokeExact(array, 0, 1L);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 long x = (long) hs.get(am, methodType(long.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, Class.class)).
-                    invoke(array, 0, 1L, Void.class);
+                    invokeExact(array, 0, 1L, Void.class);
             });
         }
     }
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java	Tue May 17 05:38:15 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8156486
  * @run testng/othervm VarHandleTestMethodTypeShort
  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeShort
  */
@@ -81,27 +82,28 @@
     public Object[][] accessTestCaseProvider() throws Exception {
         List<AccessTestCase<?>> cases = new ArrayList<>();
 
-        cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Instance field",
                                               vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Static field",
                                               vhStaticField, VarHandleTestMethodTypeShort::testStaticFieldWrongMethodType,
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Array wrong method type",
+        cases.add(new VarHandleAccessTestCase("Array",
                                               vhArray, VarHandleTestMethodTypeShort::testArrayWrongMethodType,
                                               false));
+
         for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
-            cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Instance field",
                                                      vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Static field",
                                                      vhStaticField, f, VarHandleTestMethodTypeShort::testStaticFieldWrongMethodType,
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Array",
                                                      vhArray, f, VarHandleTestMethodTypeShort::testArrayWrongMethodType,
                                                      false));
         }
@@ -329,63 +331,63 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                short x = (short) hs.get(am, methodType(short.class, Void.class)).
-                    invoke(null);
+                short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class)).
+                    invokeExact((VarHandleTestMethodTypeShort) null);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 short x = (short) hs.get(am, methodType(short.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 short x = (short) hs.get(am, methodType(short.class, int.class)).
-                    invoke(0);
+                    invokeExact(0);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
-                Void x = (Void) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class)).
-                    invoke(recv);
+                Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeShort.class)).
+                    invokeExact(recv);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class)).
-                    invoke(recv);
+                    invokeExact(recv);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 short x = (short) hs.get(am, methodType(short.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                hs.get(am, methodType(void.class, Void.class, short.class)).
-                    invoke(null, (short)1);
+                hs.get(am, methodType(void.class, VarHandleTestMethodTypeShort.class, short.class)).
+                    invokeExact((VarHandleTestMethodTypeShort) null, (short)1);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 hs.get(am, methodType(void.class, Class.class, short.class)).
-                    invoke(Void.class, (short)1);
+                    invokeExact(Void.class, (short)1);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeShort.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, short.class)).
-                    invoke(0, (short)1);
+                    invokeExact(0, (short)1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeShort.class, short.class, Class.class)).
-                    invoke(recv, (short)1, Void.class);
+                    invokeExact(recv, (short)1, Void.class);
             });
         }
 
@@ -513,32 +515,32 @@
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             // Incorrect arity
             checkWMTE(() -> { // >
                 short x = (short) hs.get(am, methodType(Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, short.class, Class.class)).
-                    invoke((short)1, Void.class);
+                    invokeExact((short)1, Void.class);
             });
         }
 
@@ -783,71 +785,71 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                short x = (short) hs.get(am, methodType(short.class, Void.class, int.class)).
-                    invoke(null, 0);
+                short x = (short) hs.get(am, methodType(short.class, short[].class, int.class)).
+                    invokeExact((short[]) null, 0);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 short x = (short) hs.get(am, methodType(short.class, Class.class, int.class)).
-                    invoke(Void.class, 0);
+                    invokeExact(Void.class, 0);
             });
             checkWMTE(() -> { // array primitive class
                 short x = (short) hs.get(am, methodType(short.class, int.class, int.class)).
-                    invoke(0, 0);
+                    invokeExact(0, 0);
             });
             checkWMTE(() -> { // index reference class
                 short x = (short) hs.get(am, methodType(short.class, short[].class, Class.class)).
-                    invoke(array, Void.class);
+                    invokeExact(array, Void.class);
             });
             // Incorrect return type
             checkWMTE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class, short[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 short x = (short) hs.get(am, methodType(short.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                hs.get(am, methodType(void.class, Void.class, int.class, short.class)).
-                    invoke(null, 0, (short)1);
+                hs.get(am, methodType(void.class, short[].class, int.class, short.class)).
+                    invokeExact((short[]) null, 0, (short)1);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 hs.get(am, methodType(void.class, Class.class, int.class, short.class)).
-                    invoke(Void.class, 0, (short)1);
+                    invokeExact(Void.class, 0, (short)1);
             });
             checkWMTE(() -> { // value reference class
                 hs.get(am, methodType(void.class, short[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, int.class, short.class)).
-                    invoke(0, 0, (short)1);
+                    invokeExact(0, 0, (short)1);
             });
             checkWMTE(() -> { // index reference class
                 hs.get(am, methodType(void.class, short[].class, Class.class, short.class)).
-                    invoke(array, Void.class, (short)1);
+                    invokeExact(array, Void.class, (short)1);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, short[].class, int.class, Class.class)).
-                    invoke(array, 0, (short)1, Void.class);
+                    invokeExact(array, 0, (short)1, Void.class);
             });
         }
 
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java	Tue May 17 05:38:15 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8156486
  * @run testng/othervm VarHandleTestMethodTypeString
  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeString
  */
@@ -81,27 +82,28 @@
     public Object[][] accessTestCaseProvider() throws Exception {
         List<AccessTestCase<?>> cases = new ArrayList<>();
 
-        cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Instance field",
                                               vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Static field",
                                               vhStaticField, VarHandleTestMethodTypeString::testStaticFieldWrongMethodType,
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Array wrong method type",
+        cases.add(new VarHandleAccessTestCase("Array",
                                               vhArray, VarHandleTestMethodTypeString::testArrayWrongMethodType,
                                               false));
+
         for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
-            cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Instance field",
                                                      vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Static field",
                                                      vhStaticField, f, VarHandleTestMethodTypeString::testStaticFieldWrongMethodType,
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Array",
                                                      vhArray, f, VarHandleTestMethodTypeString::testArrayWrongMethodType,
                                                      false));
         }
@@ -586,174 +588,174 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                String x = (String) hs.get(am, methodType(String.class, Void.class)).
-                    invoke(null);
+                String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class)).
+                    invokeExact((VarHandleTestMethodTypeString) null);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 String x = (String) hs.get(am, methodType(String.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 String x = (String) hs.get(am, methodType(String.class, int.class)).
-                    invoke(0);
+                    invokeExact(0);
             });
             // Incorrect return type
-            checkCCE(() -> { // reference class
-                Void x = (Void) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class)).
-                    invoke(recv);
+            hs.checkWMTEOrCCE(() -> { // reference class
+                Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeString.class)).
+                    invokeExact(recv);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class)).
-                    invoke(recv);
+                    invokeExact(recv);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 String x = (String) hs.get(am, methodType(String.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                hs.get(am, methodType(void.class, Void.class, String.class)).
-                    invoke(null, "foo");
+                hs.get(am, methodType(void.class, VarHandleTestMethodTypeString.class, String.class)).
+                    invokeExact((VarHandleTestMethodTypeString) null, "foo");
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 hs.get(am, methodType(void.class, Class.class, String.class)).
-                    invoke(Void.class, "foo");
+                    invokeExact(Void.class, "foo");
             });
-            checkCCE(() -> { // value reference class
+            hs.checkWMTEOrCCE(() -> { // value reference class
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeString.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, String.class)).
-                    invoke(0, "foo");
+                    invokeExact(0, "foo");
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, VarHandleTestMethodTypeString.class, String.class, Class.class)).
-                    invoke(recv, "foo", Void.class);
+                    invokeExact(recv, "foo", Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, String.class, String.class)).
-                    invoke(null, "foo", "foo");
+                boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, String.class, String.class)).
+                    invokeExact((VarHandleTestMethodTypeString) null, "foo", "foo");
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, String.class, String.class)).
-                    invoke(Void.class, "foo", "foo");
+                    invokeExact(Void.class, "foo", "foo");
             });
-            checkCCE(() -> { // expected reference class
+            hs.checkWMTEOrCCE(() -> { // expected reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, Class.class, String.class)).
-                    invoke(recv, Void.class, "foo");
+                    invokeExact(recv, Void.class, "foo");
             });
-            checkCCE(() -> { // actual reference class
+            hs.checkWMTEOrCCE(() -> { // actual reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, String.class, Class.class)).
-                    invoke(recv, "foo", Void.class);
+                    invokeExact(recv, "foo", Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , String.class, String.class)).
-                    invoke(0, "foo", "foo");
+                    invokeExact(0, "foo", "foo");
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean r = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, String.class, String.class, Class.class)).
-                    invoke(recv, "foo", "foo", Void.class);
+                    invokeExact(recv, "foo", "foo", Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
             checkNPE(() -> { // null receiver
-                String x = (String) hs.get(am, methodType(String.class, Void.class, String.class, String.class)).
-                    invoke(null, "foo", "foo");
+                String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class, String.class)).
+                    invokeExact((VarHandleTestMethodTypeString) null, "foo", "foo");
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 String x = (String) hs.get(am, methodType(String.class, Class.class, String.class, String.class)).
-                    invoke(Void.class, "foo", "foo");
+                    invokeExact(Void.class, "foo", "foo");
             });
-            checkCCE(() -> { // expected reference class
+            hs.checkWMTEOrCCE(() -> { // expected reference class
                 String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, Class.class, String.class)).
-                    invoke(recv, Void.class, "foo");
+                    invokeExact(recv, Void.class, "foo");
             });
-            checkCCE(() -> { // actual reference class
+            hs.checkWMTEOrCCE(() -> { // actual reference class
                 String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class, Class.class)).
-                    invoke(recv, "foo", Void.class);
+                    invokeExact(recv, "foo", Void.class);
             });
             checkWMTE(() -> { // reciever primitive class
                 String x = (String) hs.get(am, methodType(String.class, int.class , String.class, String.class)).
-                    invoke(0, "foo", "foo");
+                    invokeExact(0, "foo", "foo");
             });
             // Incorrect return type
-            checkCCE(() -> { // reference class
+            hs.checkWMTEOrCCE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeString.class , String.class, String.class)).
-                    invoke(recv, "foo", "foo");
+                    invokeExact(recv, "foo", "foo");
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class , String.class, String.class)).
-                    invoke(recv, "foo", "foo");
+                    invokeExact(recv, "foo", "foo");
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 String x = (String) hs.get(am, methodType(String.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class, String.class, Class.class)).
-                    invoke(recv, "foo", "foo", Void.class);
+                    invokeExact(recv, "foo", "foo", Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
             checkNPE(() -> { // null receiver
-                String x = (String) hs.get(am, methodType(String.class, Void.class, String.class)).
-                    invoke(null, "foo");
+                String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class)).
+                    invokeExact((VarHandleTestMethodTypeString) null, "foo");
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 String x = (String) hs.get(am, methodType(String.class, Class.class, String.class)).
-                    invoke(Void.class, "foo");
+                    invokeExact(Void.class, "foo");
             });
-            checkCCE(() -> { // value reference class
+            hs.checkWMTEOrCCE(() -> { // value reference class
                 String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // reciever primitive class
                 String x = (String) hs.get(am, methodType(String.class, int.class, String.class)).
-                    invoke(0, "foo");
+                    invokeExact(0, "foo");
             });
             // Incorrect return type
-            checkCCE(() -> { // reference class
+            hs.checkWMTEOrCCE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeString.class, String.class)).
-                    invoke(recv, "foo");
+                    invokeExact(recv, "foo");
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, String.class)).
-                    invoke(recv, "foo");
+                    invokeExact(recv, "foo");
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 String x = (String) hs.get(am, methodType(String.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class)).
-                    invoke(recv, "foo", Void.class);
+                    invokeExact(recv, "foo", Void.class);
             });
         }
 
@@ -1054,110 +1056,110 @@
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect return type
-            checkCCE(() -> { // reference class
+            hs.checkWMTEOrCCE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             // Incorrect arity
             checkWMTE(() -> { // >
                 String x = (String) hs.get(am, methodType(Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
-            checkCCE(() -> { // value reference class
+            hs.checkWMTEOrCCE(() -> { // value reference class
                 hs.get(am, methodType(void.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, String.class, Class.class)).
-                    invoke("foo", Void.class);
+                    invokeExact("foo", Void.class);
             });
         }
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
             // Incorrect argument types
-            checkCCE(() -> { // expected reference class
+            hs.checkWMTEOrCCE(() -> { // expected reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, String.class)).
-                    invoke(Void.class, "foo");
+                    invokeExact(Void.class, "foo");
             });
-            checkCCE(() -> { // actual reference class
+            hs.checkWMTEOrCCE(() -> { // actual reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, String.class, Class.class)).
-                    invoke("foo", Void.class);
+                    invokeExact("foo", Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean r = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, String.class, String.class, Class.class)).
-                    invoke("foo", "foo", Void.class);
+                    invokeExact("foo", "foo", Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
             // Incorrect argument types
-            checkCCE(() -> { // expected reference class
+            hs.checkWMTEOrCCE(() -> { // expected reference class
                 String x = (String) hs.get(am, methodType(String.class, Class.class, String.class)).
-                    invoke(Void.class, "foo");
+                    invokeExact(Void.class, "foo");
             });
-            checkCCE(() -> { // actual reference class
+            hs.checkWMTEOrCCE(() -> { // actual reference class
                 String x = (String) hs.get(am, methodType(String.class, String.class, Class.class)).
-                    invoke("foo", Void.class);
+                    invokeExact("foo", Void.class);
             });
             // Incorrect return type
-            checkCCE(() -> { // reference class
+            hs.checkWMTEOrCCE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, String.class, String.class)).
-                    invoke("foo", "foo");
+                    invokeExact("foo", "foo");
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, String.class, String.class)).
-                    invoke("foo", "foo");
+                    invokeExact("foo", "foo");
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 String x = (String) hs.get(am, methodType(String.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 String x = (String) hs.get(am, methodType(String.class, String.class, String.class, Class.class)).
-                    invoke("foo", "foo", Void.class);
+                    invokeExact("foo", "foo", Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
             // Incorrect argument types
-            checkCCE(() -> { // value reference class
+            hs.checkWMTEOrCCE(() -> { // value reference class
                 String x = (String) hs.get(am, methodType(String.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect return type
-            checkCCE(() -> { // reference class
+            hs.checkWMTEOrCCE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, String.class)).
-                    invoke("foo");
+                    invokeExact("foo");
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, String.class)).
-                    invoke("foo");
+                    invokeExact("foo");
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 String x = (String) hs.get(am, methodType(String.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 String x = (String) hs.get(am, methodType(String.class, String.class, Class.class)).
-                    invoke("foo", Void.class);
+                    invokeExact("foo", Void.class);
             });
         }
 
@@ -1686,195 +1688,195 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                String x = (String) hs.get(am, methodType(String.class, Void.class, int.class)).
-                    invoke(null, 0);
+                String x = (String) hs.get(am, methodType(String.class, String[].class, int.class)).
+                    invokeExact((String[]) null, 0);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 String x = (String) hs.get(am, methodType(String.class, Class.class, int.class)).
-                    invoke(Void.class, 0);
+                    invokeExact(Void.class, 0);
             });
             checkWMTE(() -> { // array primitive class
                 String x = (String) hs.get(am, methodType(String.class, int.class, int.class)).
-                    invoke(0, 0);
+                    invokeExact(0, 0);
             });
             checkWMTE(() -> { // index reference class
                 String x = (String) hs.get(am, methodType(String.class, String[].class, Class.class)).
-                    invoke(array, Void.class);
+                    invokeExact(array, Void.class);
             });
             // Incorrect return type
-            checkCCE(() -> { // reference class
+            hs.checkWMTEOrCCE(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class, String[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 String x = (String) hs.get(am, methodType(String.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                hs.get(am, methodType(void.class, Void.class, int.class, String.class)).
-                    invoke(null, 0, "foo");
+                hs.get(am, methodType(void.class, String[].class, int.class, String.class)).
+                    invokeExact((String[]) null, 0, "foo");
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 hs.get(am, methodType(void.class, Class.class, int.class, String.class)).
-                    invoke(Void.class, 0, "foo");
+                    invokeExact(Void.class, 0, "foo");
             });
-            checkCCE(() -> { // value reference class
+            hs.checkWMTEOrCCE(() -> { // value reference class
                 hs.get(am, methodType(void.class, String[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, int.class, String.class)).
-                    invoke(0, 0, "foo");
+                    invokeExact(0, 0, "foo");
             });
             checkWMTE(() -> { // index reference class
                 hs.get(am, methodType(void.class, String[].class, Class.class, String.class)).
-                    invoke(array, Void.class, "foo");
+                    invokeExact(array, Void.class, "foo");
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, String[].class, int.class, Class.class)).
-                    invoke(array, 0, "foo", Void.class);
+                    invokeExact(array, 0, "foo", Void.class);
             });
         }
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, String.class, String.class)).
-                    invoke(null, 0, "foo", "foo");
+                boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class, String.class)).
+                    invokeExact((String[]) null, 0, "foo", "foo");
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, String.class, String.class)).
-                    invoke(Void.class, 0, "foo", "foo");
+                    invokeExact(Void.class, 0, "foo", "foo");
             });
-            checkCCE(() -> { // expected reference class
+            hs.checkWMTEOrCCE(() -> { // expected reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, Class.class, String.class)).
-                    invoke(array, 0, Void.class, "foo");
+                    invokeExact(array, 0, Void.class, "foo");
             });
-            checkCCE(() -> { // actual reference class
+            hs.checkWMTEOrCCE(() -> { // actual reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class, Class.class)).
-                    invoke(array, 0, "foo", Void.class);
+                    invokeExact(array, 0, "foo", Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, String.class, String.class)).
-                    invoke(0, 0, "foo", "foo");
+                    invokeExact(0, 0, "foo", "foo");
             });
             checkWMTE(() -> { // index reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, Class.class, String.class, String.class)).
-                    invoke(array, Void.class, "foo", "foo");
+                    invokeExact(array, Void.class, "foo", "foo");
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean r = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class, String.class, Class.class)).
-                    invoke(array, 0, "foo", "foo", Void.class);
+                    invokeExact(array, 0, "foo", "foo", Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                String x = (String) hs.get(am, methodType(String.class, Void.class, int.class, String.class, String.class)).
-                    invoke(null, 0, "foo", "foo");
+                String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class, String.class)).
+                    invokeExact((String[]) null, 0, "foo", "foo");
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 String x = (String) hs.get(am, methodType(String.class, Class.class, int.class, String.class, String.class)).
-                    invoke(Void.class, 0, "foo", "foo");
+                    invokeExact(Void.class, 0, "foo", "foo");
             });
-            checkCCE(() -> { // expected reference class
+            hs.checkWMTEOrCCE(() -> { // expected reference class
                 String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, Class.class, String.class)).
-                    invoke(array, 0, Void.class, "foo");
+                    invokeExact(array, 0, Void.class, "foo");
             });
-            checkCCE(() -> { // actual reference class
+            hs.checkWMTEOrCCE(() -> { // actual reference class
                 String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class, Class.class)).
-                    invoke(array, 0, "foo", Void.class);
+                    invokeExact(array, 0, "foo", Void.class);
             });
             checkWMTE(() -> { // array primitive class
                 String x = (String) hs.get(am, methodType(String.class, int.class, int.class, String.class, String.class)).
-                    invoke(0, 0, "foo", "foo");
+                    invokeExact(0, 0, "foo", "foo");
             });
             checkWMTE(() -> { // index reference class
                 String x = (String) hs.get(am, methodType(String.class, String[].class, Class.class, String.class, String.class)).
-                    invoke(array, Void.class, "foo", "foo");
+                    invokeExact(array, Void.class, "foo", "foo");
             });
             // Incorrect return type
-            checkCCE(() -> { // reference class
+            hs.checkWMTEOrCCE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, String[].class, int.class, String.class, String.class)).
-                    invoke(array, 0, "foo", "foo");
+                    invokeExact(array, 0, "foo", "foo");
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class, String.class)).
-                    invoke(array, 0, "foo", "foo");
+                    invokeExact(array, 0, "foo", "foo");
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 String x = (String) hs.get(am, methodType(String.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class, String.class, Class.class)).
-                    invoke(array, 0, "foo", "foo", Void.class);
+                    invokeExact(array, 0, "foo", "foo", Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                String x = (String) hs.get(am, methodType(String.class, Void.class, int.class, String.class)).
-                    invoke(null, 0, "foo");
+                String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class)).
+                    invokeExact((String[]) null, 0, "foo");
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 String x = (String) hs.get(am, methodType(String.class, Class.class, int.class, String.class)).
-                    invoke(Void.class, 0, "foo");
+                    invokeExact(Void.class, 0, "foo");
             });
-            checkCCE(() -> { // value reference class
+            hs.checkWMTEOrCCE(() -> { // value reference class
                 String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // array primitive class
                 String x = (String) hs.get(am, methodType(String.class, int.class, int.class, String.class)).
-                    invoke(0, 0, "foo");
+                    invokeExact(0, 0, "foo");
             });
             checkWMTE(() -> { // index reference class
                 String x = (String) hs.get(am, methodType(String.class, String[].class, Class.class, String.class)).
-                    invoke(array, Void.class, "foo");
+                    invokeExact(array, Void.class, "foo");
             });
             // Incorrect return type
-            checkCCE(() -> { // reference class
+            hs.checkWMTEOrCCE(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, String[].class, int.class, String.class)).
-                    invoke(array, 0, "foo");
+                    invokeExact(array, 0, "foo");
             });
             checkWMTE(() -> { // primitive class
                 boolean x = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class)).
-                    invoke(array, 0, "foo");
+                    invokeExact(array, 0, "foo");
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 String x = (String) hs.get(am, methodType(String.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class, Class.class)).
-                    invoke(array, 0, "foo", Void.class);
+                    invokeExact(array, 0, "foo", Void.class);
             });
         }
 
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccess$Type$
  * @run testng/othervm -Diters=20000                         VarHandleTestAccess$Type$
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestAccess$Type$
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccess$Type$
  */
 
 import org.testng.annotations.BeforeClass;
@@ -303,6 +304,10 @@
         checkUOE(() -> {
             boolean r = vh.weakCompareAndSetRelease(recv, $value1$, $value2$);
         });
+
+        checkUOE(() -> {
+            $type$ r = ($type$) vh.getAndSet(recv, $value1$);
+        });
 #end[CAS]
 
 #if[!AtomicAdd]
@@ -389,6 +394,10 @@
         checkUOE(() -> {
             boolean r = vh.weakCompareAndSetRelease($value1$, $value2$);
         });
+
+        checkUOE(() -> {
+            $type$ r = ($type$) vh.getAndSet($value1$);
+        });
 #end[CAS]
 
 #if[!AtomicAdd]
@@ -574,6 +583,10 @@
         checkUOE(() -> {
             boolean r = vh.weakCompareAndSetRelease(recv, $value1$, $value2$);
         });
+
+        checkUOE(() -> {
+            $type$ r = ($type$) vh.getAndSet(recv, $value1$);
+        });
 #end[CAS]
 
 #if[!AtomicAdd]
@@ -759,6 +772,10 @@
         checkUOE(() -> {
             boolean r = vh.weakCompareAndSetRelease($value1$, $value2$);
         });
+
+        checkUOE(() -> {
+            $type$ r = ($type$) vh.getAndSet($value1$);
+        });
 #end[CAS]
 
 #if[!AtomicAdd]
@@ -951,6 +968,10 @@
         checkUOE(() -> {
             boolean r = vh.weakCompareAndSetRelease(array, i, $value1$, $value2$);
         });
+
+        checkUOE(() -> {
+            $type$ r = ($type$) vh.getAndSet(array, i, $value1$);
+        });
 #end[CAS]
 
 #if[!AtomicAdd]
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,7 @@
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAs$Type$
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAs$Type$
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAs$Type$
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAs$Type$
  */
 
 import org.testng.annotations.DataProvider;
@@ -311,10 +312,12 @@
             checkROBE(() -> {
                 $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
             });
+
+#else[CAS]
             checkUOE(() -> {
                 boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
             });
-#else[CAS]
+
             checkUOE(() -> {
                 $type$ r = ($type$) vh.compareAndExchangeVolatile(array, ci, VALUE_2, VALUE_1);
             });
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template	Tue May 17 05:38:15 2016 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccess$Type$
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccess$Type$
  */
 
 import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template	Tue May 17 05:38:15 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8156486
  * @run testng/othervm VarHandleTestMethodType$Type$
  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodType$Type$
  */
@@ -81,27 +82,28 @@
     public Object[][] accessTestCaseProvider() throws Exception {
         List<AccessTestCase<?>> cases = new ArrayList<>();
 
-        cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Instance field",
                                               vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+        cases.add(new VarHandleAccessTestCase("Static field",
                                               vhStaticField, VarHandleTestMethodType$Type$::testStaticFieldWrongMethodType,
                                               false));
 
-        cases.add(new VarHandleAccessTestCase("Array wrong method type",
+        cases.add(new VarHandleAccessTestCase("Array",
                                               vhArray, VarHandleTestMethodType$Type$::testArrayWrongMethodType,
                                               false));
+
         for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
-            cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Instance field",
                                                      vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Static field",
                                                      vhStaticField, f, VarHandleTestMethodType$Type$::testStaticFieldWrongMethodType,
                                                      false));
 
-            cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+            cases.add(new MethodHandleAccessTestCase("Array",
                                                      vhArray, f, VarHandleTestMethodType$Type$::testArrayWrongMethodType,
                                                      false));
         }
@@ -648,63 +650,63 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class)).
-                    invoke(null);
+                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class)).
+                    invokeExact((VarHandleTestMethodType$Type$) null);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class)).
-                    invoke(0);
+                    invokeExact(0);
             });
             // Incorrect return type
-            check{#if[String]?CCE:WMTE}(() -> { // reference class
-                Void x = (Void) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class)).
-                    invoke(recv);
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
+                Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class)).
+                    invokeExact(recv);
             });
             checkWMTE(() -> { // primitive class
                 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class)).
-                    invoke(recv);
+                    invokeExact(recv);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 $type$ x = ($type$) hs.get(am, methodType($type$.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                hs.get(am, methodType(void.class, Void.class, $type$.class)).
-                    invoke(null, $value1$);
+                hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, $type$.class)).
+                    invokeExact((VarHandleTestMethodType$Type$) null, $value1$);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 hs.get(am, methodType(void.class, Class.class, $type$.class)).
-                    invoke(Void.class, $value1$);
+                    invokeExact(Void.class, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // value reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
                 hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, $type$.class)).
-                    invoke(0, $value1$);
+                    invokeExact(0, $value1$);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)).
-                    invoke(recv, $value1$, Void.class);
+                    invokeExact(recv, $value1$, Void.class);
             });
         }
 
@@ -712,111 +714,111 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, $type$.class, $type$.class)).
-                    invoke(null, $value1$, $value1$);
+                boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class)).
+                    invokeExact((VarHandleTestMethodType$Type$) null, $value1$, $value1$);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, $type$.class, $type$.class)).
-                    invoke(Void.class, $value1$, $value1$);
+                    invokeExact(Void.class, $value1$, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // expected reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, Class.class, $type$.class)).
-                    invoke(recv, Void.class, $value1$);
+                    invokeExact(recv, Void.class, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // actual reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)).
-                    invoke(recv, $value1$, Void.class);
+                    invokeExact(recv, $value1$, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , $type$.class, $type$.class)).
-                    invoke(0, $value1$, $value1$);
+                    invokeExact(0, $value1$, $value1$);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean r = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class, Class.class)).
-                    invoke(recv, $value1$, $value1$, Void.class);
+                    invokeExact(recv, $value1$, $value1$, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
             checkNPE(() -> { // null receiver
-                $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, $type$.class, $type$.class)).
-                    invoke(null, $value1$, $value1$);
+                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class)).
+                    invokeExact((VarHandleTestMethodType$Type$) null, $value1$, $value1$);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class, $type$.class)).
-                    invoke(Void.class, $value1$, $value1$);
+                    invokeExact(Void.class, $value1$, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // expected reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class, $type$.class)).
-                    invoke(recv, Void.class, $value1$);
+                    invokeExact(recv, Void.class, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // actual reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)).
-                    invoke(recv, $value1$, Void.class);
+                    invokeExact(recv, $value1$, Void.class);
             });
             checkWMTE(() -> { // reciever primitive class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class , $type$.class, $type$.class)).
-                    invoke(0, $value1$, $value1$);
+                    invokeExact(0, $value1$, $value1$);
             });
             // Incorrect return type
-            check{#if[String]?CCE:WMTE}(() -> { // reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class , $type$.class, $type$.class)).
-                    invoke(recv, $value1$, $value1$);
+                    invokeExact(recv, $value1$, $value1$);
             });
             checkWMTE(() -> { // primitive class
                 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class , $type$.class, $type$.class)).
-                    invoke(recv, $value1$, $value1$);
+                    invokeExact(recv, $value1$, $value1$);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 $type$ x = ($type$) hs.get(am, methodType($type$.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class, Class.class)).
-                    invoke(recv, $value1$, $value1$, Void.class);
+                    invokeExact(recv, $value1$, $value1$, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
             checkNPE(() -> { // null receiver
-                $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, $type$.class)).
-                    invoke(null, $value1$);
+                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
+                    invokeExact((VarHandleTestMethodType$Type$) null, $value1$);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)).
-                    invoke(Void.class, $value1$);
+                    invokeExact(Void.class, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // value reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // reciever primitive class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)).
-                    invoke(0, $value1$);
+                    invokeExact(0, $value1$);
             });
             // Incorrect return type
-            check{#if[String]?CCE:WMTE}(() -> { // reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)).
-                    invoke(recv, $value1$);
+                    invokeExact(recv, $value1$);
             });
             checkWMTE(() -> { // primitive class
                 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
-                    invoke(recv, $value1$);
+                    invokeExact(recv, $value1$);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 $type$ x = ($type$) hs.get(am, methodType($type$.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
-                    invoke(recv, $value1$, Void.class);
+                    invokeExact(recv, $value1$, Void.class);
             });
         }
 #end[CAS]
@@ -824,38 +826,38 @@
 #if[AtomicAdd]
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
             checkNPE(() -> { // null receiver
-                $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, $type$.class)).
-                    invoke(null, $value1$);
+                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
+                    invokeExact((VarHandleTestMethodType$Type$) null, $value1$);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)).
-                    invoke(Void.class, $value1$);
+                    invokeExact(Void.class, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // value reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)).
-                    invoke(recv, Void.class);
+                    invokeExact(recv, Void.class);
             });
             checkWMTE(() -> { // reciever primitive class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)).
-                    invoke(0, $value1$);
+                    invokeExact(0, $value1$);
             });
             // Incorrect return type
-            check{#if[String]?CCE:WMTE}(() -> { // reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)).
-                    invoke(recv, $value1$);
+                    invokeExact(recv, $value1$);
             });
             checkWMTE(() -> { // primitive class
                 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
-                    invoke(recv, $value1$);
+                    invokeExact(recv, $value1$);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 $type$ x = ($type$) hs.get(am, methodType($type$.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
-                    invoke(recv, $value1$, Void.class);
+                    invokeExact(recv, $value1$, Void.class);
             });
         }
 #end[AtomicAdd]
@@ -1200,111 +1202,111 @@
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect return type
-            check{#if[String]?CCE:WMTE}(() -> { // reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // primitive class
                 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class)).
-                    invoke();
+                    invokeExact();
             });
             // Incorrect arity
             checkWMTE(() -> { // >
                 $type$ x = ($type$) hs.get(am, methodType(Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
-            check{#if[String]?CCE:WMTE}(() -> { // value reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
                 hs.get(am, methodType(void.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, $type$.class, Class.class)).
-                    invoke($value1$, Void.class);
+                    invokeExact($value1$, Void.class);
             });
         }
 #if[CAS]
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
             // Incorrect argument types
-            check{#if[String]?CCE:WMTE}(() -> { // expected reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, $type$.class)).
-                    invoke(Void.class, $value1$);
+                    invokeExact(Void.class, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // actual reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$.class, Class.class)).
-                    invoke($value1$, Void.class);
+                    invokeExact($value1$, Void.class);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean r = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$.class, $type$.class, Class.class)).
-                    invoke($value1$, $value1$, Void.class);
+                    invokeExact($value1$, $value1$, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
             // Incorrect argument types
-            check{#if[String]?CCE:WMTE}(() -> { // expected reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)).
-                    invoke(Void.class, $value1$);
+                    invokeExact(Void.class, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // actual reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)).
-                    invoke($value1$, Void.class);
+                    invokeExact($value1$, Void.class);
             });
             // Incorrect return type
-            check{#if[String]?CCE:WMTE}(() -> { // reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, $type$.class, $type$.class)).
-                    invoke($value1$, $value1$);
+                    invokeExact($value1$, $value1$);
             });
             checkWMTE(() -> { // primitive class
                 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class, $type$.class)).
-                    invoke($value1$, $value1$);
+                    invokeExact($value1$, $value1$);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 $type$ x = ($type$) hs.get(am, methodType($type$.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, $type$.class, Class.class)).
-                    invoke($value1$, $value1$, Void.class);
+                    invokeExact($value1$, $value1$, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
             // Incorrect argument types
-            check{#if[String]?CCE:WMTE}(() -> { // value reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect return type
-            check{#if[String]?CCE:WMTE}(() -> { // reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)).
-                    invoke($value1$);
+                    invokeExact($value1$);
             });
             checkWMTE(() -> { // primitive class
                 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)).
-                    invoke($value1$);
+                    invokeExact($value1$);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 $type$ x = ($type$) hs.get(am, methodType($type$.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)).
-                    invoke($value1$, Void.class);
+                    invokeExact($value1$, Void.class);
             });
         }
 #end[CAS]
@@ -1314,25 +1316,25 @@
             // Incorrect argument types
             check{#if[String]?CCE:WMTE}(() -> { // value reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
-                    invoke(Void.class);
+                    invokeExact(Void.class);
             });
             // Incorrect return type
             check{#if[String]?CCE:WMTE}(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)).
-                    invoke($value1$);
+                    invokeExact($value1$);
             });
             checkWMTE(() -> { // primitive class
                 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)).
-                    invoke($value1$);
+                    invokeExact($value1$);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 $type$ x = ($type$) hs.get(am, methodType($type$.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)).
-                    invoke($value1$, Void.class);
+                    invokeExact($value1$, Void.class);
             });
         }
 #end[AtomicAdd]
@@ -1929,196 +1931,196 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class)).
-                    invoke(null, 0);
+                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class)).
+                    invokeExact(($type$[]) null, 0);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class)).
-                    invoke(Void.class, 0);
+                    invokeExact(Void.class, 0);
             });
             checkWMTE(() -> { // array primitive class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class)).
-                    invoke(0, 0);
+                    invokeExact(0, 0);
             });
             checkWMTE(() -> { // index reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class)).
-                    invoke(array, Void.class);
+                    invokeExact(array, Void.class);
             });
             // Incorrect return type
-            check{#if[String]?CCE:WMTE}(() -> { // reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
                 Void x = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             checkWMTE(() -> { // primitive class
                 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class)).
-                    invoke(array, 0);
+                    invokeExact(array, 0);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 $type$ x = ($type$) hs.get(am, methodType($type$.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                hs.get(am, methodType(void.class, Void.class, int.class, $type$.class)).
-                    invoke(null, 0, $value1$);
+                hs.get(am, methodType(void.class, $type$[].class, int.class, $type$.class)).
+                    invokeExact(($type$[]) null, 0, $value1$);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 hs.get(am, methodType(void.class, Class.class, int.class, $type$.class)).
-                    invoke(Void.class, 0, $value1$);
+                    invokeExact(Void.class, 0, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // value reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
                 hs.get(am, methodType(void.class, $type$[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 hs.get(am, methodType(void.class, int.class, int.class, $type$.class)).
-                    invoke(0, 0, $value1$);
+                    invokeExact(0, 0, $value1$);
             });
             checkWMTE(() -> { // index reference class
                 hs.get(am, methodType(void.class, $type$[].class, Class.class, $type$.class)).
-                    invoke(array, Void.class, $value1$);
+                    invokeExact(array, Void.class, $value1$);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 hs.get(am, methodType(void.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 hs.get(am, methodType(void.class, $type$[].class, int.class, Class.class)).
-                    invoke(array, 0, $value1$, Void.class);
+                    invokeExact(array, 0, $value1$, Void.class);
             });
         }
 #if[CAS]
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, $type$.class, $type$.class)).
-                    invoke(null, 0, $value1$, $value1$);
+                boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, $type$.class)).
+                    invokeExact(($type$[]) null, 0, $value1$, $value1$);
             });
-            checkCCE(() -> { // receiver reference class
+            hs.checkWMTEOrCCE(() -> { // receiver reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, $type$.class, $type$.class)).
-                    invoke(Void.class, 0, $value1$, $value1$);
+                    invokeExact(Void.class, 0, $value1$, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // expected reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, Class.class, $type$.class)).
-                    invoke(array, 0, Void.class, $value1$);
+                    invokeExact(array, 0, Void.class, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // actual reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, Class.class)).
-                    invoke(array, 0, $value1$, Void.class);
+                    invokeExact(array, 0, $value1$, Void.class);
             });
             checkWMTE(() -> { // receiver primitive class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, $type$.class, $type$.class)).
-                    invoke(0, 0, $value1$, $value1$);
+                    invokeExact(0, 0, $value1$, $value1$);
             });
             checkWMTE(() -> { // index reference class
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, Class.class, $type$.class, $type$.class)).
-                    invoke(array, Void.class, $value1$, $value1$);
+                    invokeExact(array, Void.class, $value1$, $value1$);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 boolean r = (boolean) hs.get(am, methodType(boolean.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, $type$.class, Class.class)).
-                    invoke(array, 0, $value1$, $value1$, Void.class);
+                    invokeExact(array, 0, $value1$, $value1$, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
             // Incorrect argument types
             checkNPE(() -> { // null receiver
-                $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class, $type$.class, $type$.class)).
-                    invoke(null, 0, $value1$, $value1$);
+                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, $type$.class)).
+                    invokeExact(($type$[]) null, 0, $value1$, $value1$);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class, $type$.class)).
-                    invoke(Void.class, 0, $value1$, $value1$);
+                    invokeExact(Void.class, 0, $value1$, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // expected reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class, $type$.class)).
-                    invoke(array, 0, Void.class, $value1$);
+                    invokeExact(array, 0, Void.class, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // actual reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)).
-                    invoke(array, 0, $value1$, Void.class);
+                    invokeExact(array, 0, $value1$, Void.class);
             });
             checkWMTE(() -> { // array primitive class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class, $type$.class)).
-                    invoke(0, 0, $value1$, $value1$);
+                    invokeExact(0, 0, $value1$, $value1$);
             });
             checkWMTE(() -> { // index reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class, $type$.class)).
-                    invoke(array, Void.class, $value1$, $value1$);
+                    invokeExact(array, Void.class, $value1$, $value1$);
             });
             // Incorrect return type
-            check{#if[String]?CCE:WMTE}(() -> { // reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class, $type$.class)).
-                    invoke(array, 0, $value1$, $value1$);
+                    invokeExact(array, 0, $value1$, $value1$);
             });
             checkWMTE(() -> { // primitive class
                 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class, $type$.class)).
-                    invoke(array, 0, $value1$, $value1$);
+                    invokeExact(array, 0, $value1$, $value1$);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 $type$ x = ($type$) hs.get(am, methodType($type$.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, $type$.class, Class.class)).
-                    invoke(array, 0, $value1$, $value1$, Void.class);
+                    invokeExact(array, 0, $value1$, $value1$, Void.class);
             });
         }
 
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class, $type$.class)).
-                    invoke(null, 0, $value1$);
+                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)).
+                    invokeExact(($type$[]) null, 0, $value1$);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)).
-                    invoke(Void.class, 0, $value1$);
+                    invokeExact(Void.class, 0, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // value reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // array primitive class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)).
-                    invoke(0, 0, $value1$);
+                    invokeExact(0, 0, $value1$);
             });
             checkWMTE(() -> { // index reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)).
-                    invoke(array, Void.class, $value1$);
+                    invokeExact(array, Void.class, $value1$);
             });
             // Incorrect return type
-            check{#if[String]?CCE:WMTE}(() -> { // reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)).
-                    invoke(array, 0, $value1$);
+                    invokeExact(array, 0, $value1$);
             });
             checkWMTE(() -> { // primitive class
                 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)).
-                    invoke(array, 0, $value1$);
+                    invokeExact(array, 0, $value1$);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 $type$ x = ($type$) hs.get(am, methodType($type$.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)).
-                    invoke(array, 0, $value1$, Void.class);
+                    invokeExact(array, 0, $value1$, Void.class);
             });
         }
 #end[CAS]
@@ -2127,42 +2129,42 @@
         for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
             // Incorrect argument types
             checkNPE(() -> { // null array
-                $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class, $type$.class)).
-                    invoke(null, 0, $value1$);
+                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)).
+                    invokeExact(($type$[]) null, 0, $value1$);
             });
-            checkCCE(() -> { // array reference class
+            hs.checkWMTEOrCCE(() -> { // array reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)).
-                    invoke(Void.class, 0, $value1$);
+                    invokeExact(Void.class, 0, $value1$);
             });
-            check{#if[String]?CCE:WMTE}(() -> { // value reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)).
-                    invoke(array, 0, Void.class);
+                    invokeExact(array, 0, Void.class);
             });
             checkWMTE(() -> { // array primitive class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)).
-                    invoke(0, 0, $value1$);
+                    invokeExact(0, 0, $value1$);
             });
             checkWMTE(() -> { // index reference class
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)).
-                    invoke(array, Void.class, $value1$);
+                    invokeExact(array, Void.class, $value1$);
             });
             // Incorrect return type
-            check{#if[String]?CCE:WMTE}(() -> { // reference class
+            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
                 Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)).
-                    invoke(array, 0, $value1$);
+                    invokeExact(array, 0, $value1$);
             });
             checkWMTE(() -> { // primitive class
                 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)).
-                    invoke(array, 0, $value1$);
+                    invokeExact(array, 0, $value1$);
             });
             // Incorrect arity
             checkWMTE(() -> { // 0
                 $type$ x = ($type$) hs.get(am, methodType($type$.class)).
-                    invoke();
+                    invokeExact();
             });
             checkWMTE(() -> { // >
                 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)).
-                    invoke(array, 0, $value1$, Void.class);
+                    invokeExact(array, 0, $value1$, Void.class);
             });
         }
 #end[AtomicAdd]
--- a/jdk/test/java/nio/Buffer/Basic-X.java.template	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/Basic-X.java.template	Tue May 17 05:38:15 2016 -0700
@@ -31,7 +31,6 @@
 #warn This file is preprocessed before being compiled
 
 import java.nio.*;
-import java.lang.reflect.Method;
 
 
 public class Basic$Type$
@@ -60,7 +59,6 @@
 
     private static void relGet($Type$Buffer b) {
         int n = b.capacity();
-        $type$ v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)(($type$)ic(i)));
         b.rewind();
@@ -68,7 +66,6 @@
 
     private static void relGet($Type$Buffer b, int start) {
         int n = b.remaining();
-        $type$ v;
         for (int i = start; i < n; i++)
             ck(b, (long)b.get(), (long)(($type$)ic(i)));
         b.rewind();
@@ -76,7 +73,6 @@
 
     private static void absGet($Type$Buffer b) {
         int n = b.capacity();
-        $type$ v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)(($type$)ic(i)));
         b.rewind();
@@ -86,8 +82,9 @@
         int n = b.capacity();
         $type$[] a = new $type$[n + 7];
         b.get(a, 7, n);
-        for (int i = 0; i < n; i++)
+        for (int i = 0; i < n; i++) {
             ck(b, (long)a[i + 7], (long)(($type$)ic(i)));
+        }
     }
 
     private static void relPut($Type$Buffer b) {
@@ -178,7 +175,7 @@
     private static void bulkPutString($Type$Buffer b) {
         int n = b.capacity();
         b.clear();
-        StringBuffer sb = new StringBuffer(n + 7);
+        StringBuilder sb = new StringBuilder(n + 7);
         sb.append("1234567");
         for (int i = 0; i < n; i++)
             sb.append((char)ic(i));
@@ -203,13 +200,14 @@
     private static void checkBytes(ByteBuffer b, byte[] bs) {
         int n = bs.length;
         int p = b.position();
-        byte v;
         if (b.order() == ByteOrder.BIG_ENDIAN) {
-            for (int i = 0; i < n; i++)
+            for (int i = 0; i < n; i++) {
                 ck(b, b.get(), bs[i]);
+            }
         } else {
-            for (int i = n - 1; i >= 0; i--)
+            for (int i = n - 1; i >= 0; i--) {
                 ck(b, b.get(), bs[i]);
+            }
         }
         b.position(p);
     }
@@ -217,7 +215,7 @@
     private static void compact(Buffer b) {
         try {
             Class<?> cl = b.getClass();
-            Method m = cl.getDeclaredMethod("compact");
+            java.lang.reflect.Method m = cl.getDeclaredMethod("compact");
             m.setAccessible(true);
             m.invoke(b);
         } catch (Exception e) {
@@ -226,12 +224,11 @@
     }
 
     private static void checkInvalidMarkException(final Buffer b) {
-        tryCatch(b, InvalidMarkException.class, new Runnable() {
-            public void run() {
+        tryCatch(b, InvalidMarkException.class, () -> {
                 b.mark();
                 compact(b);
                 b.reset();
-            }});
+            });
     }
 
     private static void testViews(int level, ByteBuffer b, boolean direct) {
@@ -338,41 +335,50 @@
 
     private static void testAlign(final ByteBuffer b, boolean direct) {
         // index out-of bounds
-        tryCatch(b, IllegalArgumentException.class, () -> b.alignmentOffset(-1, (short) 1));
+        catchIllegalArgument(b, () -> b.alignmentOffset(-1, (short) 1));
 
         // unit size values
-        tryCatch(b, IllegalArgumentException.class, () -> b.alignmentOffset(0, (short) 0));
+        catchIllegalArgument(b, () -> b.alignmentOffset(0, (short) 0));
         for (int us = 1; us < 65; us++) {
             int _us = us;
             if ((us & (us - 1)) != 0) {
                 // unit size not a power of two
-                tryCatch(b, IllegalArgumentException.class, () -> b.alignmentOffset(0, _us));
+                catchIllegalArgument(b, () -> b.alignmentOffset(0, _us));
             } else {
                 if (direct || us <= 8) {
                     b.alignmentOffset(0, us);
                 } else {
                     // unit size > 8 with non-direct buffer
-                    tryCatch(b, UnsupportedOperationException.class, () -> b.alignmentOffset(0, _us));
+                    tryCatch(b, UnsupportedOperationException.class,
+                            () -> b.alignmentOffset(0, _us));
                 }
             }
         }
 
         // Probe for long misalignment at index zero for a newly created buffer
-        ByteBuffer empty = direct ? ByteBuffer.allocateDirect(0) : ByteBuffer.allocate(0);
+        ByteBuffer empty =
+                direct ? ByteBuffer.allocateDirect(0) : ByteBuffer.allocate(0);
         int longMisalignmentAtZero = empty.alignmentOffset(0, 8);
 
         if (direct) {
             // Freshly created direct byte buffers should be aligned at index 0
             // for ref and primitive values (see Unsafe.allocateMemory)
-            if (longMisalignmentAtZero != 0)
-                fail("Direct byte buffer misalligned at index 0 for ref and primitive values " + longMisalignmentAtZero);
+            if (longMisalignmentAtZero != 0) {
+                fail("Direct byte buffer misaligned at index 0"
+                        + " for ref and primitive values "
+                        + longMisalignmentAtZero);
+            }
         } else {
             // For heap byte buffers misalignment may occur on 32-bit systems
             // where Unsafe.ARRAY_BYTE_BASE_OFFSET % 8 == 4 and not 0
             // Note the GC will preserve alignment of the base address of the
             // array
-            if (jdk.internal.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET % 8 != longMisalignmentAtZero)
-                fail("Heap byte buffer misalligned at index 0 for ref and primitive values " + longMisalignmentAtZero);
+            if (jdk.internal.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET % 8
+                    != longMisalignmentAtZero) {
+                fail("Heap byte buffer misaligned at index 0"
+                        + " for ref and primitive values "
+                        + longMisalignmentAtZero);
+            }
         }
 
         // Ensure test buffer is correctly aligned at index 0
@@ -385,8 +391,10 @@
                 int am = b.alignmentOffset(i, us);
                 int expectedAm = (longMisalignmentAtZero + i) % us;
 
-                if (am != expectedAm)
-                    fail(String.format("b.alignmentOffset(%d, %d) == %d incorrect, expected %d", i, us, am, expectedAm));
+                if (am != expectedAm) {
+                    String f = "b.alignmentOffset(%d, %d) == %d incorrect, expected %d";
+                    fail(String.format(f, i, us, am, expectedAm));
+                }
             }
         }
 
@@ -395,8 +403,10 @@
         int al = b.limit() - b.alignmentOffset(b.limit(), 8);
         ByteBuffer ab = b.position(ap).limit(al).
                 slice();
-        if (ab.limit() == 0)
-            fail("Test input buffer not sufficiently sized to cover an aligned region for all values", b);
+        if (ab.limit() == 0) {
+            fail("Test input buffer not sufficiently sized to cover" +
+                    " an aligned region for all values", b);
+        }
         if (ab.alignmentOffset(0, 8) != 0)
             fail("Aligned test input buffer not correctly aligned at index 0", ab);
 
@@ -428,8 +438,9 @@
                 l = l - l_mod;
 
                 int ec = l - p;
-                if (as.limit() != ec)
+                if (as.limit() != ec) {
                     fail("Buffer capacity incorrect, expected: " + ec, as);
+                }
             }
         }
     }
@@ -441,6 +452,22 @@
         fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
     }
 
+    private static void catchIllegalArgument(Buffer b, Runnable thunk) {
+        tryCatch(b, IllegalArgumentException.class, thunk);
+    }
+
+    private static void catchReadOnlyBuffer(Buffer b, Runnable thunk) {
+        tryCatch(b, ReadOnlyBufferException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(Buffer b, Runnable thunk) {
+        tryCatch(b, IndexOutOfBoundsException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds($type$[] t, Runnable thunk) {
+        tryCatch(t, IndexOutOfBoundsException.class, thunk);
+    }
+
     private static void tryCatch(Buffer b, Class<?> ex, Runnable thunk) {
         boolean caught = false;
         try {
@@ -452,11 +479,12 @@
                 fail(x.getMessage() + " not expected");
             }
         }
-        if (!caught)
+        if (!caught) {
             fail(ex.getName() + " not thrown", b);
+        }
     }
 
-    private static void tryCatch($type$ [] t, Class<?> ex, Runnable thunk) {
+    private static void tryCatch($type$[] t, Class<?> ex, Runnable thunk) {
         tryCatch($Type$Buffer.wrap(t), ex, thunk);
     }
 
@@ -513,11 +541,9 @@
         // 7190219
         b.clear();
         int pos = b.position();
-        tryCatch(b, BufferOverflowException.class, new Runnable() {
-            public void run() {
-                b.put(String.valueOf(new char[b.capacity() + 1]), 0,
-                        b.capacity() + 1);
-            }});
+        tryCatch(b, BufferOverflowException.class, () ->
+                b.put(String.valueOf(new char[b.capacity() + 1]), 0, b.capacity() + 1)
+            );
         ck(b, b.position(), pos);
         relGet(b);
 
@@ -537,38 +563,14 @@
         b.limit(b.capacity() / 2);
         b.position(b.limit());
 
-        tryCatch(b, BufferUnderflowException.class, new Runnable() {
-                public void run() {
-                    b.get();
-                }});
-
-        tryCatch(b, BufferOverflowException.class, new Runnable() {
-                public void run() {
-                    b.put(($type$)42);
-                }});
-
-        // The index must be non-negative and lesss than the buffer's limit.
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(b.limit());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(-1);
-                }});
-
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.put(b.limit(), ($type$)42);
-                }});
-
-        tryCatch(b, InvalidMarkException.class, new Runnable() {
-                public void run() {
-                    b.position(0);
-                    b.mark();
-                    b.compact();
-                    b.reset();
-                }});
+        tryCatch(b, BufferUnderflowException.class, () -> b.get());
+        tryCatch(b, BufferOverflowException.class, () -> b.put(($type$)42));
+        // The index must be non-negative and less than the buffer's limit.
+        catchIndexOutOfBounds(b, () -> b.get(b.limit()));
+        catchIndexOutOfBounds(b, () -> b.get(-1));
+        catchIndexOutOfBounds(b, () -> b.put(b.limit(), ($type$)42));
+        tryCatch(b, InvalidMarkException.class,
+                () -> b.position(0).mark().compact().reset());
 
         try {
             b.position(b.limit() + 1);
@@ -635,7 +637,6 @@
         b.put(0.5121609353879392);      // Changes value if incorrectly swapped
 #end[double]
 
-        $type$ v;
         b.flip();
         ck(b, b.get(), 0);
         ck(b, b.get(), ($type$)-1);
@@ -644,23 +645,27 @@
         ck(b, b.get(), $Fulltype$.MIN_VALUE);
 
 #if[float]
+        $type$ v;
         ck(b, b.get(), -Float.MAX_VALUE);
         ck(b, b.get(), -Float.MIN_VALUE);
         ck(b, b.get(), Float.NEGATIVE_INFINITY);
         ck(b, b.get(), Float.POSITIVE_INFINITY);
         if (Float.floatToRawIntBits(v = b.get()) !=
-            Float.floatToRawIntBits(Float.NaN))
+            Float.floatToRawIntBits(Float.NaN)) {
             fail(b, (long)Float.NaN, (long)v);
+        }
         ck(b, b.get(), 0.91697687f);
 #end[float]
 #if[double]
+        $type$ v;
         ck(b, b.get(), -Double.MAX_VALUE);
         ck(b, b.get(), -Double.MIN_VALUE);
         ck(b, b.get(), Double.NEGATIVE_INFINITY);
         ck(b, b.get(), Double.POSITIVE_INFINITY);
         if (Double.doubleToRawLongBits(v = b.get())
-            != Double.doubleToRawLongBits(Double.NaN))
+            != Double.doubleToRawLongBits(Double.NaN)) {
             fail(b, (long)Double.NaN, (long)v);
+        }
         ck(b, b.get(), 0.5121609353879392);
 #end[double]
 
@@ -683,14 +688,15 @@
 #if[float]
                     || Float.compare(x, y) != 0
 #end[float]
-                    )
+                    ) {
                     out.println("[" + i + "] " + x + " != " + y);
+                }
             }
             fail("Identical buffers not equal", b, b2);
         }
-        if (b.compareTo(b2) != 0)
+        if (b.compareTo(b2) != 0) {
             fail("Comparison to identical buffer != 0", b, b2);
-
+        }
         b.limit(b.limit() + 1);
         b.position(b.limit() - 1);
         b.put(($type$)99);
@@ -714,7 +720,7 @@
             if (xb.compareTo(xb) != 0) {
                 fail("compareTo not reflexive", xb, xb, x, x);
             }
-            if (! xb.equals(xb)) {
+            if (!xb.equals(xb)) {
                 fail("equals not reflexive", xb, xb, x, x);
             }
             for ($type$ y : VALUES) {
@@ -765,9 +771,10 @@
 
         if (!sb.equals(sb2))
             fail("Sliced slices do not match", sb, sb2);
-        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset()))
+        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset())) {
             fail("Array offsets do not match: "
                  + sb.arrayOffset() + " != " + sb2.arrayOffset(), sb, sb2);
+        }
 
 #if[byte]
 
@@ -808,129 +815,49 @@
             fail("Buffer not equal to read-only view", b, rb);
         show(level + 1, rb);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    relPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    absPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutArray(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutBuffer(rb);
-                }});
+        catchReadOnlyBuffer(b, () -> relPut(rb));
+        catchReadOnlyBuffer(b, () -> absPut(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
 
         // put($Type$Buffer) should not change source position
         final $Type$Buffer src = $Type$Buffer.allocate(1);
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.put(src);
-                 }});
+        catchReadOnlyBuffer(b, () -> rb.put(src));
         ck(src, src.position(), 0);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.compact();
-                }});
+        catchReadOnlyBuffer(b, () -> rb.compact());
 
 #if[byte]
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putChar((char)1);
-                }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putChar(0, (char)1);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putShort((short)1);
-                }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putShort(0, (short)1);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putInt(1);
-                }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putInt(0, 1);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putLong((long)1);
-                }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putLong(0, (long)1);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putFloat((float)1);
-                }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putFloat(0, (float)1);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putDouble((double)1);
-                }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putDouble(0, (double)1);
-                }});
+        catchReadOnlyBuffer(b, () -> rb.putChar((char)1));
+        catchReadOnlyBuffer(b, () -> rb.putChar(0, (char)1));
+        catchReadOnlyBuffer(b, () -> rb.putShort((short)1));
+        catchReadOnlyBuffer(b, () -> rb.putShort(0, (short)1));
+        catchReadOnlyBuffer(b, () -> rb.putInt(1));
+        catchReadOnlyBuffer(b, () -> rb.putInt(0, 1));
+        catchReadOnlyBuffer(b, () -> rb.putLong((long)1));
+        catchReadOnlyBuffer(b, () -> rb.putLong(0, (long)1));
+        catchReadOnlyBuffer(b, () -> rb.putFloat((float)1));
+        catchReadOnlyBuffer(b, () -> rb.putFloat(0, (float)1));
+        catchReadOnlyBuffer(b, () -> rb.putDouble((double)1));
+        catchReadOnlyBuffer(b, () -> rb.putDouble(0, (double)1));
 
 #end[byte]
 
 #if[char]
 
         // 7199551
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-            public void run() {
-                String s = new String(new char[rb.remaining() + 1]);
-                rb.put(s);
-            }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-            public void run() {
-                String s = new String(new char[rb.remaining() + 1]);
-                rb.append(s);
-            }});
+        catchReadOnlyBuffer(b, () -> rb.put(new String(new char[rb.remaining() + 1])));
+        catchReadOnlyBuffer(b, () -> rb.append(new String(new char[rb.remaining() + 1])));
 
 #end[char]
 
         if (rb.getClass().getName().startsWith("java.nio.Heap")) {
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.array();
-                    }});
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.arrayOffset();
-                    }});
-
-            if (rb.hasArray())
-                fail("Read-only heap buffer's backing array is accessible",
-                     rb);
-
+            catchReadOnlyBuffer(b, () -> rb.array());
+            catchReadOnlyBuffer(b, () -> rb.arrayOffset());
+            if (rb.hasArray()) {
+                fail("Read-only heap buffer's backing array is accessible", rb);
+            }
         }
 
         // Bulk puts from read-only buffers
@@ -969,10 +896,7 @@
         ck(b, b.toString().equals(s.substring(start, end)));
         ck(b, b.toString().equals("defghi"));
         ck(b, b.isReadOnly());
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    b.put('x');
-                }});
+        catchReadOnlyBuffer(b, () -> b.put('x'));
         ck(b, start, b.position());
         ck(b, end, b.limit());
         ck(b, s.length(), b.capacity());
@@ -981,63 +905,25 @@
 
         // The index, relative to the position, must be non-negative and
         // smaller than remaining().
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.charAt(-1);
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.charAt(b.remaining());
-                }});
-
+        catchIndexOutOfBounds(b, () -> b.charAt(-1));
+        catchIndexOutOfBounds(b, () -> b.charAt(b.remaining()));
         // The index must be non-negative and less than the buffer's limit.
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(b.limit());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(-1);
-                }});
-
+        catchIndexOutOfBounds(b, () -> b.get(b.limit()));
+        catchIndexOutOfBounds(b, () -> b.get(-1));
         // The start must be non-negative and no larger than remaining().
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.subSequence(-1, b.remaining());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.subSequence(b.remaining() + 1, b.remaining());
-                }});
+        catchIndexOutOfBounds(b, () -> b.subSequence(-1, b.remaining()));
+        catchIndexOutOfBounds(b, () -> b.subSequence(b.remaining() + 1, b.remaining()));
 
         // The end must be no smaller than start and no larger than
         // remaining().
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.subSequence(2, 1);
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.subSequence(0, b.remaining() + 1);
-                }});
+        catchIndexOutOfBounds(b, () -> b.subSequence(2, 1));
+        catchIndexOutOfBounds(b, () -> b.subSequence(0, b.remaining() + 1));
 
         // The offset must be non-negative and no larger than <array.length>.
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    $Type$Buffer.wrap(s, -1, s.length());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    $Type$Buffer.wrap(s, s.length() + 1, s.length());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    $Type$Buffer.wrap(s, 1, 0);
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    $Type$Buffer.wrap(s, 0, s.length() + 1);
-                }});
+        catchIndexOutOfBounds(b, () -> $Type$Buffer.wrap(s, -1, s.length()));
+        catchIndexOutOfBounds(b, () -> $Type$Buffer.wrap(s, s.length() + 1, s.length()));
+        catchIndexOutOfBounds(b, () -> $Type$Buffer.wrap(s, 1, 0));
+        catchIndexOutOfBounds(b, () -> $Type$Buffer.wrap(s, 0, s.length() + 1));
     }
 
 #end[char]
@@ -1052,40 +938,21 @@
         ck(b, b.limit(), offset + length);
 
         // The offset must be non-negative and no larger than <array.length>.
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    $Type$Buffer.wrap(ba, -1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    $Type$Buffer.wrap(ba, ba.length + 1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    $Type$Buffer.wrap(ba, 0, -1);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    $Type$Buffer.wrap(ba, 0, ba.length + 1);
-                }});
+        catchIndexOutOfBounds(ba, () -> $Type$Buffer.wrap(ba, -1, ba.length));
+        catchIndexOutOfBounds(ba, () -> $Type$Buffer.wrap(ba, ba.length + 1, ba.length));
+        catchIndexOutOfBounds(ba, () -> $Type$Buffer.wrap(ba, 0, -1));
+        catchIndexOutOfBounds(ba, () -> $Type$Buffer.wrap(ba, 0, ba.length + 1));
 
         // A NullPointerException will be thrown if the array is null.
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    $Type$Buffer.wrap(($type$ []) null, 0, 5);
-                }});
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    $Type$Buffer.wrap(($type$ []) null);
-                }});
+        tryCatch(ba, NullPointerException.class,
+                () -> $Type$Buffer.wrap(($type$ []) null, 0, 5));
+        tryCatch(ba, NullPointerException.class,
+                () -> $Type$Buffer.wrap(($type$ []) null));
     }
 
     private static void testAllocate() {
         // An IllegalArgumentException will be thrown for negative capacities.
-        tryCatch((Buffer) null, IllegalArgumentException.class, new Runnable() {
-                public void run() {
-                    $Type$Buffer.allocate(-1);
-                }});
+        catchIllegalArgument((Buffer) null, () -> $Type$Buffer.allocate(-1));
         try {
             $Type$Buffer.allocate(-1);
         } catch (IllegalArgumentException e) {
@@ -1095,10 +962,7 @@
             }
         }
 #if[byte]
-        tryCatch((Buffer) null, IllegalArgumentException.class, new Runnable() {
-                public void run() {
-                    $Type$Buffer.allocateDirect(-1);
-                }});
+        catchIllegalArgument((Buffer) null, () -> $Type$Buffer.allocateDirect(-1));
         try {
             $Type$Buffer.allocateDirect(-1);
         } catch (IllegalArgumentException e) {
--- a/jdk/test/java/nio/Buffer/BasicByte.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/BasicByte.java	Tue May 17 05:38:15 2016 -0700
@@ -31,7 +31,6 @@
 // -- This file was mechanically generated: Do not edit! -- //
 
 import java.nio.*;
-import java.lang.reflect.Method;
 
 
 public class BasicByte
@@ -60,7 +59,6 @@
 
     private static void relGet(ByteBuffer b) {
         int n = b.capacity();
-        byte v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((byte)ic(i)));
         b.rewind();
@@ -68,7 +66,6 @@
 
     private static void relGet(ByteBuffer b, int start) {
         int n = b.remaining();
-        byte v;
         for (int i = start; i < n; i++)
             ck(b, (long)b.get(), (long)((byte)ic(i)));
         b.rewind();
@@ -76,7 +73,6 @@
 
     private static void absGet(ByteBuffer b) {
         int n = b.capacity();
-        byte v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((byte)ic(i)));
         b.rewind();
@@ -86,8 +82,9 @@
         int n = b.capacity();
         byte[] a = new byte[n + 7];
         b.get(a, 7, n);
-        for (int i = 0; i < n; i++)
+        for (int i = 0; i < n; i++) {
             ck(b, (long)a[i + 7], (long)((byte)ic(i)));
+        }
     }
 
     private static void relPut(ByteBuffer b) {
@@ -203,13 +200,14 @@
     private static void checkBytes(ByteBuffer b, byte[] bs) {
         int n = bs.length;
         int p = b.position();
-        byte v;
         if (b.order() == ByteOrder.BIG_ENDIAN) {
-            for (int i = 0; i < n; i++)
+            for (int i = 0; i < n; i++) {
                 ck(b, b.get(), bs[i]);
+            }
         } else {
-            for (int i = n - 1; i >= 0; i--)
+            for (int i = n - 1; i >= 0; i--) {
                 ck(b, b.get(), bs[i]);
+            }
         }
         b.position(p);
     }
@@ -217,7 +215,7 @@
     private static void compact(Buffer b) {
         try {
             Class<?> cl = b.getClass();
-            Method m = cl.getDeclaredMethod("compact");
+            java.lang.reflect.Method m = cl.getDeclaredMethod("compact");
             m.setAccessible(true);
             m.invoke(b);
         } catch (Exception e) {
@@ -226,12 +224,11 @@
     }
 
     private static void checkInvalidMarkException(final Buffer b) {
-        tryCatch(b, InvalidMarkException.class, new Runnable() {
-            public void run() {
+        tryCatch(b, InvalidMarkException.class, () -> {
                 b.mark();
                 compact(b);
                 b.reset();
-            }});
+            });
     }
 
     private static void testViews(int level, ByteBuffer b, boolean direct) {
@@ -338,41 +335,50 @@
 
     private static void testAlign(final ByteBuffer b, boolean direct) {
         // index out-of bounds
-        tryCatch(b, IllegalArgumentException.class, () -> b.alignmentOffset(-1, (short) 1));
+        catchIllegalArgument(b, () -> b.alignmentOffset(-1, (short) 1));
 
         // unit size values
-        tryCatch(b, IllegalArgumentException.class, () -> b.alignmentOffset(0, (short) 0));
+        catchIllegalArgument(b, () -> b.alignmentOffset(0, (short) 0));
         for (int us = 1; us < 65; us++) {
             int _us = us;
             if ((us & (us - 1)) != 0) {
                 // unit size not a power of two
-                tryCatch(b, IllegalArgumentException.class, () -> b.alignmentOffset(0, _us));
+                catchIllegalArgument(b, () -> b.alignmentOffset(0, _us));
             } else {
                 if (direct || us <= 8) {
                     b.alignmentOffset(0, us);
                 } else {
                     // unit size > 8 with non-direct buffer
-                    tryCatch(b, UnsupportedOperationException.class, () -> b.alignmentOffset(0, _us));
+                    tryCatch(b, UnsupportedOperationException.class,
+                            () -> b.alignmentOffset(0, _us));
                 }
             }
         }
 
         // Probe for long misalignment at index zero for a newly created buffer
-        ByteBuffer empty = direct ? ByteBuffer.allocateDirect(0) : ByteBuffer.allocate(0);
+        ByteBuffer empty =
+                direct ? ByteBuffer.allocateDirect(0) : ByteBuffer.allocate(0);
         int longMisalignmentAtZero = empty.alignmentOffset(0, 8);
 
         if (direct) {
             // Freshly created direct byte buffers should be aligned at index 0
             // for ref and primitive values (see Unsafe.allocateMemory)
-            if (longMisalignmentAtZero != 0)
-                fail("Direct byte buffer misalligned at index 0 for ref and primitive values " + longMisalignmentAtZero);
+            if (longMisalignmentAtZero != 0) {
+                fail("Direct byte buffer misaligned at index 0"
+                        + " for ref and primitive values "
+                        + longMisalignmentAtZero);
+            }
         } else {
             // For heap byte buffers misalignment may occur on 32-bit systems
             // where Unsafe.ARRAY_BYTE_BASE_OFFSET % 8 == 4 and not 0
             // Note the GC will preserve alignment of the base address of the
             // array
-            if (jdk.internal.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET % 8 != longMisalignmentAtZero)
-                fail("Heap byte buffer misalligned at index 0 for ref and primitive values " + longMisalignmentAtZero);
+            if (jdk.internal.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET % 8
+                    != longMisalignmentAtZero) {
+                fail("Heap byte buffer misaligned at index 0"
+                        + " for ref and primitive values "
+                        + longMisalignmentAtZero);
+            }
         }
 
         // Ensure test buffer is correctly aligned at index 0
@@ -385,8 +391,10 @@
                 int am = b.alignmentOffset(i, us);
                 int expectedAm = (longMisalignmentAtZero + i) % us;
 
-                if (am != expectedAm)
-                    fail(String.format("b.alignmentOffset(%d, %d) == %d incorrect, expected %d", i, us, am, expectedAm));
+                if (am != expectedAm) {
+                    String f = "b.alignmentOffset(%d, %d) == %d incorrect, expected %d";
+                    fail(String.format(f, i, us, am, expectedAm));
+                }
             }
         }
 
@@ -395,8 +403,10 @@
         int al = b.limit() - b.alignmentOffset(b.limit(), 8);
         ByteBuffer ab = b.position(ap).limit(al).
                 slice();
-        if (ab.limit() == 0)
-            fail("Test input buffer not sufficiently sized to cover an aligned region for all values", b);
+        if (ab.limit() == 0) {
+            fail("Test input buffer not sufficiently sized to cover" +
+                    " an aligned region for all values", b);
+        }
         if (ab.alignmentOffset(0, 8) != 0)
             fail("Aligned test input buffer not correctly aligned at index 0", ab);
 
@@ -428,8 +438,9 @@
                 l = l - l_mod;
 
                 int ec = l - p;
-                if (as.limit() != ec)
+                if (as.limit() != ec) {
                     fail("Buffer capacity incorrect, expected: " + ec, as);
+                }
             }
         }
     }
@@ -441,6 +452,22 @@
         fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
     }
 
+    private static void catchIllegalArgument(Buffer b, Runnable thunk) {
+        tryCatch(b, IllegalArgumentException.class, thunk);
+    }
+
+    private static void catchReadOnlyBuffer(Buffer b, Runnable thunk) {
+        tryCatch(b, ReadOnlyBufferException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(Buffer b, Runnable thunk) {
+        tryCatch(b, IndexOutOfBoundsException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(byte[] t, Runnable thunk) {
+        tryCatch(t, IndexOutOfBoundsException.class, thunk);
+    }
+
     private static void tryCatch(Buffer b, Class<?> ex, Runnable thunk) {
         boolean caught = false;
         try {
@@ -452,11 +479,12 @@
                 fail(x.getMessage() + " not expected");
             }
         }
-        if (!caught)
+        if (!caught) {
             fail(ex.getName() + " not thrown", b);
+        }
     }
 
-    private static void tryCatch(byte [] t, Class<?> ex, Runnable thunk) {
+    private static void tryCatch(byte[] t, Class<?> ex, Runnable thunk) {
         tryCatch(ByteBuffer.wrap(t), ex, thunk);
     }
 
@@ -521,8 +549,6 @@
 
 
 
-
-
         // Compact
 
         relPut(b);
@@ -537,38 +563,14 @@
         b.limit(b.capacity() / 2);
         b.position(b.limit());
 
-        tryCatch(b, BufferUnderflowException.class, new Runnable() {
-                public void run() {
-                    b.get();
-                }});
-
-        tryCatch(b, BufferOverflowException.class, new Runnable() {
-                public void run() {
-                    b.put((byte)42);
-                }});
-
-        // The index must be non-negative and lesss than the buffer's limit.
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(b.limit());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(-1);
-                }});
-
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.put(b.limit(), (byte)42);
-                }});
-
-        tryCatch(b, InvalidMarkException.class, new Runnable() {
-                public void run() {
-                    b.position(0);
-                    b.mark();
-                    b.compact();
-                    b.reset();
-                }});
+        tryCatch(b, BufferUnderflowException.class, () -> b.get());
+        tryCatch(b, BufferOverflowException.class, () -> b.put((byte)42));
+        // The index must be non-negative and less than the buffer's limit.
+        catchIndexOutOfBounds(b, () -> b.get(b.limit()));
+        catchIndexOutOfBounds(b, () -> b.get(-1));
+        catchIndexOutOfBounds(b, () -> b.put(b.limit(), (byte)42));
+        tryCatch(b, InvalidMarkException.class,
+                () -> b.position(0).mark().compact().reset());
 
         try {
             b.position(b.limit() + 1);
@@ -635,7 +637,6 @@
 
 
 
-        byte v;
         b.flip();
         ck(b, b.get(), 0);
         ck(b, b.get(), (byte)-1);
@@ -665,6 +666,10 @@
 
 
 
+
+
+
+
         // Comparison
         b.rewind();
         ByteBuffer b2 = ByteBuffer.allocate(b.capacity());
@@ -683,14 +688,15 @@
 
 
 
-                    )
+                    ) {
                     out.println("[" + i + "] " + x + " != " + y);
+                }
             }
             fail("Identical buffers not equal", b, b2);
         }
-        if (b.compareTo(b2) != 0)
+        if (b.compareTo(b2) != 0) {
             fail("Comparison to identical buffer != 0", b, b2);
-
+        }
         b.limit(b.limit() + 1);
         b.position(b.limit() - 1);
         b.put((byte)99);
@@ -714,7 +720,7 @@
             if (xb.compareTo(xb) != 0) {
                 fail("compareTo not reflexive", xb, xb, x, x);
             }
-            if (! xb.equals(xb)) {
+            if (!xb.equals(xb)) {
                 fail("equals not reflexive", xb, xb, x, x);
             }
             for (byte y : VALUES) {
@@ -765,9 +771,10 @@
 
         if (!sb.equals(sb2))
             fail("Sliced slices do not match", sb, sb2);
-        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset()))
+        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset())) {
             fail("Array offsets do not match: "
                  + sb.arrayOffset() + " != " + sb2.arrayOffset(), sb, sb2);
+        }
 
 
 
@@ -808,102 +815,32 @@
             fail("Buffer not equal to read-only view", b, rb);
         show(level + 1, rb);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    relPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    absPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutArray(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutBuffer(rb);
-                }});
+        catchReadOnlyBuffer(b, () -> relPut(rb));
+        catchReadOnlyBuffer(b, () -> absPut(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
 
         // put(ByteBuffer) should not change source position
         final ByteBuffer src = ByteBuffer.allocate(1);
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.put(src);
-                 }});
+        catchReadOnlyBuffer(b, () -> rb.put(src));
         ck(src, src.position(), 0);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.compact();
-                }});
+        catchReadOnlyBuffer(b, () -> rb.compact());
 
 
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putChar((char)1);
-                }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putChar(0, (char)1);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putShort((short)1);
-                }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putShort(0, (short)1);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putInt(1);
-                }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putInt(0, 1);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putLong((long)1);
-                }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putLong(0, (long)1);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putFloat((float)1);
-                }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putFloat(0, (float)1);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putDouble((double)1);
-                }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.putDouble(0, (double)1);
-                }});
-
-
-
-
-
-
-
-
+        catchReadOnlyBuffer(b, () -> rb.putChar((char)1));
+        catchReadOnlyBuffer(b, () -> rb.putChar(0, (char)1));
+        catchReadOnlyBuffer(b, () -> rb.putShort((short)1));
+        catchReadOnlyBuffer(b, () -> rb.putShort(0, (short)1));
+        catchReadOnlyBuffer(b, () -> rb.putInt(1));
+        catchReadOnlyBuffer(b, () -> rb.putInt(0, 1));
+        catchReadOnlyBuffer(b, () -> rb.putLong((long)1));
+        catchReadOnlyBuffer(b, () -> rb.putLong(0, (long)1));
+        catchReadOnlyBuffer(b, () -> rb.putFloat((float)1));
+        catchReadOnlyBuffer(b, () -> rb.putFloat(0, (float)1));
+        catchReadOnlyBuffer(b, () -> rb.putDouble((double)1));
+        catchReadOnlyBuffer(b, () -> rb.putDouble(0, (double)1));
 
 
 
@@ -916,21 +853,11 @@
 
 
         if (rb.getClass().getName().startsWith("java.nio.Heap")) {
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.array();
-                    }});
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.arrayOffset();
-                    }});
-
-            if (rb.hasArray())
-                fail("Read-only heap buffer's backing array is accessible",
-                     rb);
-
+            catchReadOnlyBuffer(b, () -> rb.array());
+            catchReadOnlyBuffer(b, () -> rb.arrayOffset());
+            if (rb.hasArray()) {
+                fail("Read-only heap buffer's backing array is accessible", rb);
+            }
         }
 
         // Bulk puts from read-only buffers
@@ -1001,47 +928,6 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     public static void test(final byte [] ba) {
         int offset = 47;
         int length = 900;
@@ -1052,40 +938,21 @@
         ck(b, b.limit(), offset + length);
 
         // The offset must be non-negative and no larger than <array.length>.
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    ByteBuffer.wrap(ba, -1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    ByteBuffer.wrap(ba, ba.length + 1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    ByteBuffer.wrap(ba, 0, -1);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    ByteBuffer.wrap(ba, 0, ba.length + 1);
-                }});
+        catchIndexOutOfBounds(ba, () -> ByteBuffer.wrap(ba, -1, ba.length));
+        catchIndexOutOfBounds(ba, () -> ByteBuffer.wrap(ba, ba.length + 1, ba.length));
+        catchIndexOutOfBounds(ba, () -> ByteBuffer.wrap(ba, 0, -1));
+        catchIndexOutOfBounds(ba, () -> ByteBuffer.wrap(ba, 0, ba.length + 1));
 
         // A NullPointerException will be thrown if the array is null.
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    ByteBuffer.wrap((byte []) null, 0, 5);
-                }});
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    ByteBuffer.wrap((byte []) null);
-                }});
+        tryCatch(ba, NullPointerException.class,
+                () -> ByteBuffer.wrap((byte []) null, 0, 5));
+        tryCatch(ba, NullPointerException.class,
+                () -> ByteBuffer.wrap((byte []) null));
     }
 
     private static void testAllocate() {
         // An IllegalArgumentException will be thrown for negative capacities.
-        tryCatch((Buffer) null, IllegalArgumentException.class, new Runnable() {
-                public void run() {
-                    ByteBuffer.allocate(-1);
-                }});
+        catchIllegalArgument((Buffer) null, () -> ByteBuffer.allocate(-1));
         try {
             ByteBuffer.allocate(-1);
         } catch (IllegalArgumentException e) {
@@ -1095,10 +962,7 @@
             }
         }
 
-        tryCatch((Buffer) null, IllegalArgumentException.class, new Runnable() {
-                public void run() {
-                    ByteBuffer.allocateDirect(-1);
-                }});
+        catchIllegalArgument((Buffer) null, () -> ByteBuffer.allocateDirect(-1));
         try {
             ByteBuffer.allocateDirect(-1);
         } catch (IllegalArgumentException e) {
--- a/jdk/test/java/nio/Buffer/BasicChar.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/BasicChar.java	Tue May 17 05:38:15 2016 -0700
@@ -31,7 +31,6 @@
 // -- This file was mechanically generated: Do not edit! -- //
 
 import java.nio.*;
-import java.lang.reflect.Method;
 
 
 public class BasicChar
@@ -60,7 +59,6 @@
 
     private static void relGet(CharBuffer b) {
         int n = b.capacity();
-        char v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((char)ic(i)));
         b.rewind();
@@ -68,7 +66,6 @@
 
     private static void relGet(CharBuffer b, int start) {
         int n = b.remaining();
-        char v;
         for (int i = start; i < n; i++)
             ck(b, (long)b.get(), (long)((char)ic(i)));
         b.rewind();
@@ -76,7 +73,6 @@
 
     private static void absGet(CharBuffer b) {
         int n = b.capacity();
-        char v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((char)ic(i)));
         b.rewind();
@@ -86,8 +82,9 @@
         int n = b.capacity();
         char[] a = new char[n + 7];
         b.get(a, 7, n);
-        for (int i = 0; i < n; i++)
+        for (int i = 0; i < n; i++) {
             ck(b, (long)a[i + 7], (long)((char)ic(i)));
+        }
     }
 
     private static void relPut(CharBuffer b) {
@@ -178,7 +175,7 @@
     private static void bulkPutString(CharBuffer b) {
         int n = b.capacity();
         b.clear();
-        StringBuffer sb = new StringBuffer(n + 7);
+        StringBuilder sb = new StringBuilder(n + 7);
         sb.append("1234567");
         for (int i = 0; i < n; i++)
             sb.append((char)ic(i));
@@ -435,12 +432,42 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
     private static void fail(String problem,
                              CharBuffer xb, CharBuffer yb,
                              char x, char y) {
         fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
     }
 
+    private static void catchIllegalArgument(Buffer b, Runnable thunk) {
+        tryCatch(b, IllegalArgumentException.class, thunk);
+    }
+
+    private static void catchReadOnlyBuffer(Buffer b, Runnable thunk) {
+        tryCatch(b, ReadOnlyBufferException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(Buffer b, Runnable thunk) {
+        tryCatch(b, IndexOutOfBoundsException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(char[] t, Runnable thunk) {
+        tryCatch(t, IndexOutOfBoundsException.class, thunk);
+    }
+
     private static void tryCatch(Buffer b, Class<?> ex, Runnable thunk) {
         boolean caught = false;
         try {
@@ -452,11 +479,12 @@
                 fail(x.getMessage() + " not expected");
             }
         }
-        if (!caught)
+        if (!caught) {
             fail(ex.getName() + " not thrown", b);
+        }
     }
 
-    private static void tryCatch(char [] t, Class<?> ex, Runnable thunk) {
+    private static void tryCatch(char[] t, Class<?> ex, Runnable thunk) {
         tryCatch(CharBuffer.wrap(t), ex, thunk);
     }
 
@@ -513,11 +541,9 @@
         // 7190219
         b.clear();
         int pos = b.position();
-        tryCatch(b, BufferOverflowException.class, new Runnable() {
-            public void run() {
-                b.put(String.valueOf(new char[b.capacity() + 1]), 0,
-                        b.capacity() + 1);
-            }});
+        tryCatch(b, BufferOverflowException.class, () ->
+                b.put(String.valueOf(new char[b.capacity() + 1]), 0, b.capacity() + 1)
+            );
         ck(b, b.position(), pos);
         relGet(b);
 
@@ -537,38 +563,14 @@
         b.limit(b.capacity() / 2);
         b.position(b.limit());
 
-        tryCatch(b, BufferUnderflowException.class, new Runnable() {
-                public void run() {
-                    b.get();
-                }});
-
-        tryCatch(b, BufferOverflowException.class, new Runnable() {
-                public void run() {
-                    b.put((char)42);
-                }});
-
-        // The index must be non-negative and lesss than the buffer's limit.
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(b.limit());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(-1);
-                }});
-
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.put(b.limit(), (char)42);
-                }});
-
-        tryCatch(b, InvalidMarkException.class, new Runnable() {
-                public void run() {
-                    b.position(0);
-                    b.mark();
-                    b.compact();
-                    b.reset();
-                }});
+        tryCatch(b, BufferUnderflowException.class, () -> b.get());
+        tryCatch(b, BufferOverflowException.class, () -> b.put((char)42));
+        // The index must be non-negative and less than the buffer's limit.
+        catchIndexOutOfBounds(b, () -> b.get(b.limit()));
+        catchIndexOutOfBounds(b, () -> b.get(-1));
+        catchIndexOutOfBounds(b, () -> b.put(b.limit(), (char)42));
+        tryCatch(b, InvalidMarkException.class,
+                () -> b.position(0).mark().compact().reset());
 
         try {
             b.position(b.limit() + 1);
@@ -635,7 +637,6 @@
 
 
 
-        char v;
         b.flip();
         ck(b, b.get(), 0);
         ck(b, b.get(), (char)-1);
@@ -665,6 +666,10 @@
 
 
 
+
+
+
+
         // Comparison
         b.rewind();
         CharBuffer b2 = CharBuffer.allocate(b.capacity());
@@ -683,14 +688,15 @@
 
 
 
-                    )
+                    ) {
                     out.println("[" + i + "] " + x + " != " + y);
+                }
             }
             fail("Identical buffers not equal", b, b2);
         }
-        if (b.compareTo(b2) != 0)
+        if (b.compareTo(b2) != 0) {
             fail("Comparison to identical buffer != 0", b, b2);
-
+        }
         b.limit(b.limit() + 1);
         b.position(b.limit() - 1);
         b.put((char)99);
@@ -714,7 +720,7 @@
             if (xb.compareTo(xb) != 0) {
                 fail("compareTo not reflexive", xb, xb, x, x);
             }
-            if (! xb.equals(xb)) {
+            if (!xb.equals(xb)) {
                 fail("equals not reflexive", xb, xb, x, x);
             }
             for (char y : VALUES) {
@@ -765,9 +771,10 @@
 
         if (!sb.equals(sb2))
             fail("Sliced slices do not match", sb, sb2);
-        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset()))
+        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset())) {
             fail("Array offsets do not match: "
                  + sb.arrayOffset() + " != " + sb2.arrayOffset(), sb, sb2);
+        }
 
 
 
@@ -808,79 +815,17 @@
             fail("Buffer not equal to read-only view", b, rb);
         show(level + 1, rb);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    relPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    absPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutArray(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutBuffer(rb);
-                }});
+        catchReadOnlyBuffer(b, () -> relPut(rb));
+        catchReadOnlyBuffer(b, () -> absPut(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
 
         // put(CharBuffer) should not change source position
         final CharBuffer src = CharBuffer.allocate(1);
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.put(src);
-                 }});
+        catchReadOnlyBuffer(b, () -> rb.put(src));
         ck(src, src.position(), 0);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.compact();
-                }});
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+        catchReadOnlyBuffer(b, () -> rb.compact());
 
 
 
@@ -902,35 +847,17 @@
 
 
         // 7199551
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-            public void run() {
-                String s = new String(new char[rb.remaining() + 1]);
-                rb.put(s);
-            }});
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-            public void run() {
-                String s = new String(new char[rb.remaining() + 1]);
-                rb.append(s);
-            }});
+        catchReadOnlyBuffer(b, () -> rb.put(new String(new char[rb.remaining() + 1])));
+        catchReadOnlyBuffer(b, () -> rb.append(new String(new char[rb.remaining() + 1])));
 
 
 
         if (rb.getClass().getName().startsWith("java.nio.Heap")) {
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.array();
-                    }});
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.arrayOffset();
-                    }});
-
-            if (rb.hasArray())
-                fail("Read-only heap buffer's backing array is accessible",
-                     rb);
-
+            catchReadOnlyBuffer(b, () -> rb.array());
+            catchReadOnlyBuffer(b, () -> rb.arrayOffset());
+            if (rb.hasArray()) {
+                fail("Read-only heap buffer's backing array is accessible", rb);
+            }
         }
 
         // Bulk puts from read-only buffers
@@ -969,10 +896,7 @@
         ck(b, b.toString().equals(s.substring(start, end)));
         ck(b, b.toString().equals("defghi"));
         ck(b, b.isReadOnly());
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    b.put('x');
-                }});
+        catchReadOnlyBuffer(b, () -> b.put('x'));
         ck(b, start, b.position());
         ck(b, end, b.limit());
         ck(b, s.length(), b.capacity());
@@ -981,63 +905,25 @@
 
         // The index, relative to the position, must be non-negative and
         // smaller than remaining().
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.charAt(-1);
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.charAt(b.remaining());
-                }});
-
+        catchIndexOutOfBounds(b, () -> b.charAt(-1));
+        catchIndexOutOfBounds(b, () -> b.charAt(b.remaining()));
         // The index must be non-negative and less than the buffer's limit.
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(b.limit());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(-1);
-                }});
-
+        catchIndexOutOfBounds(b, () -> b.get(b.limit()));
+        catchIndexOutOfBounds(b, () -> b.get(-1));
         // The start must be non-negative and no larger than remaining().
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.subSequence(-1, b.remaining());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.subSequence(b.remaining() + 1, b.remaining());
-                }});
+        catchIndexOutOfBounds(b, () -> b.subSequence(-1, b.remaining()));
+        catchIndexOutOfBounds(b, () -> b.subSequence(b.remaining() + 1, b.remaining()));
 
         // The end must be no smaller than start and no larger than
         // remaining().
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.subSequence(2, 1);
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.subSequence(0, b.remaining() + 1);
-                }});
+        catchIndexOutOfBounds(b, () -> b.subSequence(2, 1));
+        catchIndexOutOfBounds(b, () -> b.subSequence(0, b.remaining() + 1));
 
         // The offset must be non-negative and no larger than <array.length>.
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    CharBuffer.wrap(s, -1, s.length());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    CharBuffer.wrap(s, s.length() + 1, s.length());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    CharBuffer.wrap(s, 1, 0);
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    CharBuffer.wrap(s, 0, s.length() + 1);
-                }});
+        catchIndexOutOfBounds(b, () -> CharBuffer.wrap(s, -1, s.length()));
+        catchIndexOutOfBounds(b, () -> CharBuffer.wrap(s, s.length() + 1, s.length()));
+        catchIndexOutOfBounds(b, () -> CharBuffer.wrap(s, 1, 0));
+        catchIndexOutOfBounds(b, () -> CharBuffer.wrap(s, 0, s.length() + 1));
     }
 
 
@@ -1052,40 +938,21 @@
         ck(b, b.limit(), offset + length);
 
         // The offset must be non-negative and no larger than <array.length>.
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    CharBuffer.wrap(ba, -1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    CharBuffer.wrap(ba, ba.length + 1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    CharBuffer.wrap(ba, 0, -1);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    CharBuffer.wrap(ba, 0, ba.length + 1);
-                }});
+        catchIndexOutOfBounds(ba, () -> CharBuffer.wrap(ba, -1, ba.length));
+        catchIndexOutOfBounds(ba, () -> CharBuffer.wrap(ba, ba.length + 1, ba.length));
+        catchIndexOutOfBounds(ba, () -> CharBuffer.wrap(ba, 0, -1));
+        catchIndexOutOfBounds(ba, () -> CharBuffer.wrap(ba, 0, ba.length + 1));
 
         // A NullPointerException will be thrown if the array is null.
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    CharBuffer.wrap((char []) null, 0, 5);
-                }});
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    CharBuffer.wrap((char []) null);
-                }});
+        tryCatch(ba, NullPointerException.class,
+                () -> CharBuffer.wrap((char []) null, 0, 5));
+        tryCatch(ba, NullPointerException.class,
+                () -> CharBuffer.wrap((char []) null));
     }
 
     private static void testAllocate() {
         // An IllegalArgumentException will be thrown for negative capacities.
-        tryCatch((Buffer) null, IllegalArgumentException.class, new Runnable() {
-                public void run() {
-                    CharBuffer.allocate(-1);
-                }});
+        catchIllegalArgument((Buffer) null, () -> CharBuffer.allocate(-1));
         try {
             CharBuffer.allocate(-1);
         } catch (IllegalArgumentException e) {
@@ -1105,9 +972,6 @@
 
 
 
-
-
-
     }
 
     public static void test() {
--- a/jdk/test/java/nio/Buffer/BasicDouble.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/BasicDouble.java	Tue May 17 05:38:15 2016 -0700
@@ -31,7 +31,6 @@
 // -- This file was mechanically generated: Do not edit! -- //
 
 import java.nio.*;
-import java.lang.reflect.Method;
 
 
 public class BasicDouble
@@ -60,7 +59,6 @@
 
     private static void relGet(DoubleBuffer b) {
         int n = b.capacity();
-        double v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((double)ic(i)));
         b.rewind();
@@ -68,7 +66,6 @@
 
     private static void relGet(DoubleBuffer b, int start) {
         int n = b.remaining();
-        double v;
         for (int i = start; i < n; i++)
             ck(b, (long)b.get(), (long)((double)ic(i)));
         b.rewind();
@@ -76,7 +73,6 @@
 
     private static void absGet(DoubleBuffer b) {
         int n = b.capacity();
-        double v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((double)ic(i)));
         b.rewind();
@@ -86,8 +82,9 @@
         int n = b.capacity();
         double[] a = new double[n + 7];
         b.get(a, 7, n);
-        for (int i = 0; i < n; i++)
+        for (int i = 0; i < n; i++) {
             ck(b, (long)a[i + 7], (long)((double)ic(i)));
+        }
     }
 
     private static void relPut(DoubleBuffer b) {
@@ -435,12 +432,42 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
     private static void fail(String problem,
                              DoubleBuffer xb, DoubleBuffer yb,
                              double x, double y) {
         fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
     }
 
+    private static void catchIllegalArgument(Buffer b, Runnable thunk) {
+        tryCatch(b, IllegalArgumentException.class, thunk);
+    }
+
+    private static void catchReadOnlyBuffer(Buffer b, Runnable thunk) {
+        tryCatch(b, ReadOnlyBufferException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(Buffer b, Runnable thunk) {
+        tryCatch(b, IndexOutOfBoundsException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(double[] t, Runnable thunk) {
+        tryCatch(t, IndexOutOfBoundsException.class, thunk);
+    }
+
     private static void tryCatch(Buffer b, Class<?> ex, Runnable thunk) {
         boolean caught = false;
         try {
@@ -452,11 +479,12 @@
                 fail(x.getMessage() + " not expected");
             }
         }
-        if (!caught)
+        if (!caught) {
             fail(ex.getName() + " not thrown", b);
+        }
     }
 
-    private static void tryCatch(double [] t, Class<?> ex, Runnable thunk) {
+    private static void tryCatch(double[] t, Class<?> ex, Runnable thunk) {
         tryCatch(DoubleBuffer.wrap(t), ex, thunk);
     }
 
@@ -521,8 +549,6 @@
 
 
 
-
-
         // Compact
 
         relPut(b);
@@ -537,38 +563,14 @@
         b.limit(b.capacity() / 2);
         b.position(b.limit());
 
-        tryCatch(b, BufferUnderflowException.class, new Runnable() {
-                public void run() {
-                    b.get();
-                }});
-
-        tryCatch(b, BufferOverflowException.class, new Runnable() {
-                public void run() {
-                    b.put((double)42);
-                }});
-
-        // The index must be non-negative and lesss than the buffer's limit.
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(b.limit());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(-1);
-                }});
-
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.put(b.limit(), (double)42);
-                }});
-
-        tryCatch(b, InvalidMarkException.class, new Runnable() {
-                public void run() {
-                    b.position(0);
-                    b.mark();
-                    b.compact();
-                    b.reset();
-                }});
+        tryCatch(b, BufferUnderflowException.class, () -> b.get());
+        tryCatch(b, BufferOverflowException.class, () -> b.put((double)42));
+        // The index must be non-negative and less than the buffer's limit.
+        catchIndexOutOfBounds(b, () -> b.get(b.limit()));
+        catchIndexOutOfBounds(b, () -> b.get(-1));
+        catchIndexOutOfBounds(b, () -> b.put(b.limit(), (double)42));
+        tryCatch(b, InvalidMarkException.class,
+                () -> b.position(0).mark().compact().reset());
 
         try {
             b.position(b.limit() + 1);
@@ -635,7 +637,6 @@
         b.put(0.5121609353879392);      // Changes value if incorrectly swapped
 
 
-        double v;
         b.flip();
         ck(b, b.get(), 0);
         ck(b, b.get(), (double)-1);
@@ -654,13 +655,17 @@
 
 
 
+
+
+        double v;
         ck(b, b.get(), -Double.MAX_VALUE);
         ck(b, b.get(), -Double.MIN_VALUE);
         ck(b, b.get(), Double.NEGATIVE_INFINITY);
         ck(b, b.get(), Double.POSITIVE_INFINITY);
         if (Double.doubleToRawLongBits(v = b.get())
-            != Double.doubleToRawLongBits(Double.NaN))
+            != Double.doubleToRawLongBits(Double.NaN)) {
             fail(b, (long)Double.NaN, (long)v);
+        }
         ck(b, b.get(), 0.5121609353879392);
 
 
@@ -683,14 +688,15 @@
 
 
 
-                    )
+                    ) {
                     out.println("[" + i + "] " + x + " != " + y);
+                }
             }
             fail("Identical buffers not equal", b, b2);
         }
-        if (b.compareTo(b2) != 0)
+        if (b.compareTo(b2) != 0) {
             fail("Comparison to identical buffer != 0", b, b2);
-
+        }
         b.limit(b.limit() + 1);
         b.position(b.limit() - 1);
         b.put((double)99);
@@ -714,7 +720,7 @@
             if (xb.compareTo(xb) != 0) {
                 fail("compareTo not reflexive", xb, xb, x, x);
             }
-            if (! xb.equals(xb)) {
+            if (!xb.equals(xb)) {
                 fail("equals not reflexive", xb, xb, x, x);
             }
             for (double y : VALUES) {
@@ -765,9 +771,10 @@
 
         if (!sb.equals(sb2))
             fail("Sliced slices do not match", sb, sb2);
-        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset()))
+        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset())) {
             fail("Array offsets do not match: "
                  + sb.arrayOffset() + " != " + sb2.arrayOffset(), sb, sb2);
+        }
 
 
 
@@ -808,87 +815,17 @@
             fail("Buffer not equal to read-only view", b, rb);
         show(level + 1, rb);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    relPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    absPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutArray(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutBuffer(rb);
-                }});
+        catchReadOnlyBuffer(b, () -> relPut(rb));
+        catchReadOnlyBuffer(b, () -> absPut(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
 
         // put(DoubleBuffer) should not change source position
         final DoubleBuffer src = DoubleBuffer.allocate(1);
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.put(src);
-                 }});
+        catchReadOnlyBuffer(b, () -> rb.put(src));
         ck(src, src.position(), 0);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.compact();
-                }});
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+        catchReadOnlyBuffer(b, () -> rb.compact());
 
 
 
@@ -916,21 +853,11 @@
 
 
         if (rb.getClass().getName().startsWith("java.nio.Heap")) {
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.array();
-                    }});
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.arrayOffset();
-                    }});
-
-            if (rb.hasArray())
-                fail("Read-only heap buffer's backing array is accessible",
-                     rb);
-
+            catchReadOnlyBuffer(b, () -> rb.array());
+            catchReadOnlyBuffer(b, () -> rb.arrayOffset());
+            if (rb.hasArray()) {
+                fail("Read-only heap buffer's backing array is accessible", rb);
+            }
         }
 
         // Bulk puts from read-only buffers
@@ -1001,47 +928,6 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     public static void test(final double [] ba) {
         int offset = 47;
         int length = 900;
@@ -1052,40 +938,21 @@
         ck(b, b.limit(), offset + length);
 
         // The offset must be non-negative and no larger than <array.length>.
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    DoubleBuffer.wrap(ba, -1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    DoubleBuffer.wrap(ba, ba.length + 1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    DoubleBuffer.wrap(ba, 0, -1);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    DoubleBuffer.wrap(ba, 0, ba.length + 1);
-                }});
+        catchIndexOutOfBounds(ba, () -> DoubleBuffer.wrap(ba, -1, ba.length));
+        catchIndexOutOfBounds(ba, () -> DoubleBuffer.wrap(ba, ba.length + 1, ba.length));
+        catchIndexOutOfBounds(ba, () -> DoubleBuffer.wrap(ba, 0, -1));
+        catchIndexOutOfBounds(ba, () -> DoubleBuffer.wrap(ba, 0, ba.length + 1));
 
         // A NullPointerException will be thrown if the array is null.
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    DoubleBuffer.wrap((double []) null, 0, 5);
-                }});
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    DoubleBuffer.wrap((double []) null);
-                }});
+        tryCatch(ba, NullPointerException.class,
+                () -> DoubleBuffer.wrap((double []) null, 0, 5));
+        tryCatch(ba, NullPointerException.class,
+                () -> DoubleBuffer.wrap((double []) null));
     }
 
     private static void testAllocate() {
         // An IllegalArgumentException will be thrown for negative capacities.
-        tryCatch((Buffer) null, IllegalArgumentException.class, new Runnable() {
-                public void run() {
-                    DoubleBuffer.allocate(-1);
-                }});
+        catchIllegalArgument((Buffer) null, () -> DoubleBuffer.allocate(-1));
         try {
             DoubleBuffer.allocate(-1);
         } catch (IllegalArgumentException e) {
@@ -1105,9 +972,6 @@
 
 
 
-
-
-
     }
 
     public static void test() {
--- a/jdk/test/java/nio/Buffer/BasicFloat.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/BasicFloat.java	Tue May 17 05:38:15 2016 -0700
@@ -31,7 +31,6 @@
 // -- This file was mechanically generated: Do not edit! -- //
 
 import java.nio.*;
-import java.lang.reflect.Method;
 
 
 public class BasicFloat
@@ -60,7 +59,6 @@
 
     private static void relGet(FloatBuffer b) {
         int n = b.capacity();
-        float v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((float)ic(i)));
         b.rewind();
@@ -68,7 +66,6 @@
 
     private static void relGet(FloatBuffer b, int start) {
         int n = b.remaining();
-        float v;
         for (int i = start; i < n; i++)
             ck(b, (long)b.get(), (long)((float)ic(i)));
         b.rewind();
@@ -76,7 +73,6 @@
 
     private static void absGet(FloatBuffer b) {
         int n = b.capacity();
-        float v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((float)ic(i)));
         b.rewind();
@@ -86,8 +82,9 @@
         int n = b.capacity();
         float[] a = new float[n + 7];
         b.get(a, 7, n);
-        for (int i = 0; i < n; i++)
+        for (int i = 0; i < n; i++) {
             ck(b, (long)a[i + 7], (long)((float)ic(i)));
+        }
     }
 
     private static void relPut(FloatBuffer b) {
@@ -435,12 +432,42 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
     private static void fail(String problem,
                              FloatBuffer xb, FloatBuffer yb,
                              float x, float y) {
         fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
     }
 
+    private static void catchIllegalArgument(Buffer b, Runnable thunk) {
+        tryCatch(b, IllegalArgumentException.class, thunk);
+    }
+
+    private static void catchReadOnlyBuffer(Buffer b, Runnable thunk) {
+        tryCatch(b, ReadOnlyBufferException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(Buffer b, Runnable thunk) {
+        tryCatch(b, IndexOutOfBoundsException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(float[] t, Runnable thunk) {
+        tryCatch(t, IndexOutOfBoundsException.class, thunk);
+    }
+
     private static void tryCatch(Buffer b, Class<?> ex, Runnable thunk) {
         boolean caught = false;
         try {
@@ -452,11 +479,12 @@
                 fail(x.getMessage() + " not expected");
             }
         }
-        if (!caught)
+        if (!caught) {
             fail(ex.getName() + " not thrown", b);
+        }
     }
 
-    private static void tryCatch(float [] t, Class<?> ex, Runnable thunk) {
+    private static void tryCatch(float[] t, Class<?> ex, Runnable thunk) {
         tryCatch(FloatBuffer.wrap(t), ex, thunk);
     }
 
@@ -521,8 +549,6 @@
 
 
 
-
-
         // Compact
 
         relPut(b);
@@ -537,38 +563,14 @@
         b.limit(b.capacity() / 2);
         b.position(b.limit());
 
-        tryCatch(b, BufferUnderflowException.class, new Runnable() {
-                public void run() {
-                    b.get();
-                }});
-
-        tryCatch(b, BufferOverflowException.class, new Runnable() {
-                public void run() {
-                    b.put((float)42);
-                }});
-
-        // The index must be non-negative and lesss than the buffer's limit.
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(b.limit());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(-1);
-                }});
-
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.put(b.limit(), (float)42);
-                }});
-
-        tryCatch(b, InvalidMarkException.class, new Runnable() {
-                public void run() {
-                    b.position(0);
-                    b.mark();
-                    b.compact();
-                    b.reset();
-                }});
+        tryCatch(b, BufferUnderflowException.class, () -> b.get());
+        tryCatch(b, BufferOverflowException.class, () -> b.put((float)42));
+        // The index must be non-negative and less than the buffer's limit.
+        catchIndexOutOfBounds(b, () -> b.get(b.limit()));
+        catchIndexOutOfBounds(b, () -> b.get(-1));
+        catchIndexOutOfBounds(b, () -> b.put(b.limit(), (float)42));
+        tryCatch(b, InvalidMarkException.class,
+                () -> b.position(0).mark().compact().reset());
 
         try {
             b.position(b.limit() + 1);
@@ -635,7 +637,6 @@
 
 
 
-        float v;
         b.flip();
         ck(b, b.get(), 0);
         ck(b, b.get(), (float)-1);
@@ -644,13 +645,15 @@
         ck(b, b.get(), Float.MIN_VALUE);
 
 
+        float v;
         ck(b, b.get(), -Float.MAX_VALUE);
         ck(b, b.get(), -Float.MIN_VALUE);
         ck(b, b.get(), Float.NEGATIVE_INFINITY);
         ck(b, b.get(), Float.POSITIVE_INFINITY);
         if (Float.floatToRawIntBits(v = b.get()) !=
-            Float.floatToRawIntBits(Float.NaN))
+            Float.floatToRawIntBits(Float.NaN)) {
             fail(b, (long)Float.NaN, (long)v);
+        }
         ck(b, b.get(), 0.91697687f);
 
 
@@ -665,6 +668,8 @@
 
 
 
+
+
         // Comparison
         b.rewind();
         FloatBuffer b2 = FloatBuffer.allocate(b.capacity());
@@ -683,14 +688,15 @@
 
                     || Float.compare(x, y) != 0
 
-                    )
+                    ) {
                     out.println("[" + i + "] " + x + " != " + y);
+                }
             }
             fail("Identical buffers not equal", b, b2);
         }
-        if (b.compareTo(b2) != 0)
+        if (b.compareTo(b2) != 0) {
             fail("Comparison to identical buffer != 0", b, b2);
-
+        }
         b.limit(b.limit() + 1);
         b.position(b.limit() - 1);
         b.put((float)99);
@@ -714,7 +720,7 @@
             if (xb.compareTo(xb) != 0) {
                 fail("compareTo not reflexive", xb, xb, x, x);
             }
-            if (! xb.equals(xb)) {
+            if (!xb.equals(xb)) {
                 fail("equals not reflexive", xb, xb, x, x);
             }
             for (float y : VALUES) {
@@ -765,9 +771,10 @@
 
         if (!sb.equals(sb2))
             fail("Sliced slices do not match", sb, sb2);
-        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset()))
+        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset())) {
             fail("Array offsets do not match: "
                  + sb.arrayOffset() + " != " + sb2.arrayOffset(), sb, sb2);
+        }
 
 
 
@@ -808,87 +815,17 @@
             fail("Buffer not equal to read-only view", b, rb);
         show(level + 1, rb);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    relPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    absPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutArray(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutBuffer(rb);
-                }});
+        catchReadOnlyBuffer(b, () -> relPut(rb));
+        catchReadOnlyBuffer(b, () -> absPut(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
 
         // put(FloatBuffer) should not change source position
         final FloatBuffer src = FloatBuffer.allocate(1);
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.put(src);
-                 }});
+        catchReadOnlyBuffer(b, () -> rb.put(src));
         ck(src, src.position(), 0);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.compact();
-                }});
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+        catchReadOnlyBuffer(b, () -> rb.compact());
 
 
 
@@ -916,21 +853,11 @@
 
 
         if (rb.getClass().getName().startsWith("java.nio.Heap")) {
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.array();
-                    }});
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.arrayOffset();
-                    }});
-
-            if (rb.hasArray())
-                fail("Read-only heap buffer's backing array is accessible",
-                     rb);
-
+            catchReadOnlyBuffer(b, () -> rb.array());
+            catchReadOnlyBuffer(b, () -> rb.arrayOffset());
+            if (rb.hasArray()) {
+                fail("Read-only heap buffer's backing array is accessible", rb);
+            }
         }
 
         // Bulk puts from read-only buffers
@@ -1001,47 +928,6 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     public static void test(final float [] ba) {
         int offset = 47;
         int length = 900;
@@ -1052,40 +938,21 @@
         ck(b, b.limit(), offset + length);
 
         // The offset must be non-negative and no larger than <array.length>.
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    FloatBuffer.wrap(ba, -1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    FloatBuffer.wrap(ba, ba.length + 1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    FloatBuffer.wrap(ba, 0, -1);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    FloatBuffer.wrap(ba, 0, ba.length + 1);
-                }});
+        catchIndexOutOfBounds(ba, () -> FloatBuffer.wrap(ba, -1, ba.length));
+        catchIndexOutOfBounds(ba, () -> FloatBuffer.wrap(ba, ba.length + 1, ba.length));
+        catchIndexOutOfBounds(ba, () -> FloatBuffer.wrap(ba, 0, -1));
+        catchIndexOutOfBounds(ba, () -> FloatBuffer.wrap(ba, 0, ba.length + 1));
 
         // A NullPointerException will be thrown if the array is null.
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    FloatBuffer.wrap((float []) null, 0, 5);
-                }});
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    FloatBuffer.wrap((float []) null);
-                }});
+        tryCatch(ba, NullPointerException.class,
+                () -> FloatBuffer.wrap((float []) null, 0, 5));
+        tryCatch(ba, NullPointerException.class,
+                () -> FloatBuffer.wrap((float []) null));
     }
 
     private static void testAllocate() {
         // An IllegalArgumentException will be thrown for negative capacities.
-        tryCatch((Buffer) null, IllegalArgumentException.class, new Runnable() {
-                public void run() {
-                    FloatBuffer.allocate(-1);
-                }});
+        catchIllegalArgument((Buffer) null, () -> FloatBuffer.allocate(-1));
         try {
             FloatBuffer.allocate(-1);
         } catch (IllegalArgumentException e) {
@@ -1105,9 +972,6 @@
 
 
 
-
-
-
     }
 
     public static void test() {
--- a/jdk/test/java/nio/Buffer/BasicInt.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/BasicInt.java	Tue May 17 05:38:15 2016 -0700
@@ -31,7 +31,6 @@
 // -- This file was mechanically generated: Do not edit! -- //
 
 import java.nio.*;
-import java.lang.reflect.Method;
 
 
 public class BasicInt
@@ -60,7 +59,6 @@
 
     private static void relGet(IntBuffer b) {
         int n = b.capacity();
-        int v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((int)ic(i)));
         b.rewind();
@@ -68,7 +66,6 @@
 
     private static void relGet(IntBuffer b, int start) {
         int n = b.remaining();
-        int v;
         for (int i = start; i < n; i++)
             ck(b, (long)b.get(), (long)((int)ic(i)));
         b.rewind();
@@ -76,7 +73,6 @@
 
     private static void absGet(IntBuffer b) {
         int n = b.capacity();
-        int v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((int)ic(i)));
         b.rewind();
@@ -86,8 +82,9 @@
         int n = b.capacity();
         int[] a = new int[n + 7];
         b.get(a, 7, n);
-        for (int i = 0; i < n; i++)
+        for (int i = 0; i < n; i++) {
             ck(b, (long)a[i + 7], (long)((int)ic(i)));
+        }
     }
 
     private static void relPut(IntBuffer b) {
@@ -435,12 +432,42 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
     private static void fail(String problem,
                              IntBuffer xb, IntBuffer yb,
                              int x, int y) {
         fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
     }
 
+    private static void catchIllegalArgument(Buffer b, Runnable thunk) {
+        tryCatch(b, IllegalArgumentException.class, thunk);
+    }
+
+    private static void catchReadOnlyBuffer(Buffer b, Runnable thunk) {
+        tryCatch(b, ReadOnlyBufferException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(Buffer b, Runnable thunk) {
+        tryCatch(b, IndexOutOfBoundsException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(int[] t, Runnable thunk) {
+        tryCatch(t, IndexOutOfBoundsException.class, thunk);
+    }
+
     private static void tryCatch(Buffer b, Class<?> ex, Runnable thunk) {
         boolean caught = false;
         try {
@@ -452,11 +479,12 @@
                 fail(x.getMessage() + " not expected");
             }
         }
-        if (!caught)
+        if (!caught) {
             fail(ex.getName() + " not thrown", b);
+        }
     }
 
-    private static void tryCatch(int [] t, Class<?> ex, Runnable thunk) {
+    private static void tryCatch(int[] t, Class<?> ex, Runnable thunk) {
         tryCatch(IntBuffer.wrap(t), ex, thunk);
     }
 
@@ -521,8 +549,6 @@
 
 
 
-
-
         // Compact
 
         relPut(b);
@@ -537,38 +563,14 @@
         b.limit(b.capacity() / 2);
         b.position(b.limit());
 
-        tryCatch(b, BufferUnderflowException.class, new Runnable() {
-                public void run() {
-                    b.get();
-                }});
-
-        tryCatch(b, BufferOverflowException.class, new Runnable() {
-                public void run() {
-                    b.put((int)42);
-                }});
-
-        // The index must be non-negative and lesss than the buffer's limit.
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(b.limit());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(-1);
-                }});
-
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.put(b.limit(), (int)42);
-                }});
-
-        tryCatch(b, InvalidMarkException.class, new Runnable() {
-                public void run() {
-                    b.position(0);
-                    b.mark();
-                    b.compact();
-                    b.reset();
-                }});
+        tryCatch(b, BufferUnderflowException.class, () -> b.get());
+        tryCatch(b, BufferOverflowException.class, () -> b.put((int)42));
+        // The index must be non-negative and less than the buffer's limit.
+        catchIndexOutOfBounds(b, () -> b.get(b.limit()));
+        catchIndexOutOfBounds(b, () -> b.get(-1));
+        catchIndexOutOfBounds(b, () -> b.put(b.limit(), (int)42));
+        tryCatch(b, InvalidMarkException.class,
+                () -> b.position(0).mark().compact().reset());
 
         try {
             b.position(b.limit() + 1);
@@ -635,7 +637,6 @@
 
 
 
-        int v;
         b.flip();
         ck(b, b.get(), 0);
         ck(b, b.get(), (int)-1);
@@ -665,6 +666,10 @@
 
 
 
+
+
+
+
         // Comparison
         b.rewind();
         IntBuffer b2 = IntBuffer.allocate(b.capacity());
@@ -683,14 +688,15 @@
 
 
 
-                    )
+                    ) {
                     out.println("[" + i + "] " + x + " != " + y);
+                }
             }
             fail("Identical buffers not equal", b, b2);
         }
-        if (b.compareTo(b2) != 0)
+        if (b.compareTo(b2) != 0) {
             fail("Comparison to identical buffer != 0", b, b2);
-
+        }
         b.limit(b.limit() + 1);
         b.position(b.limit() - 1);
         b.put((int)99);
@@ -714,7 +720,7 @@
             if (xb.compareTo(xb) != 0) {
                 fail("compareTo not reflexive", xb, xb, x, x);
             }
-            if (! xb.equals(xb)) {
+            if (!xb.equals(xb)) {
                 fail("equals not reflexive", xb, xb, x, x);
             }
             for (int y : VALUES) {
@@ -765,9 +771,10 @@
 
         if (!sb.equals(sb2))
             fail("Sliced slices do not match", sb, sb2);
-        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset()))
+        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset())) {
             fail("Array offsets do not match: "
                  + sb.arrayOffset() + " != " + sb2.arrayOffset(), sb, sb2);
+        }
 
 
 
@@ -808,87 +815,17 @@
             fail("Buffer not equal to read-only view", b, rb);
         show(level + 1, rb);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    relPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    absPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutArray(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutBuffer(rb);
-                }});
+        catchReadOnlyBuffer(b, () -> relPut(rb));
+        catchReadOnlyBuffer(b, () -> absPut(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
 
         // put(IntBuffer) should not change source position
         final IntBuffer src = IntBuffer.allocate(1);
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.put(src);
-                 }});
+        catchReadOnlyBuffer(b, () -> rb.put(src));
         ck(src, src.position(), 0);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.compact();
-                }});
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+        catchReadOnlyBuffer(b, () -> rb.compact());
 
 
 
@@ -916,21 +853,11 @@
 
 
         if (rb.getClass().getName().startsWith("java.nio.Heap")) {
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.array();
-                    }});
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.arrayOffset();
-                    }});
-
-            if (rb.hasArray())
-                fail("Read-only heap buffer's backing array is accessible",
-                     rb);
-
+            catchReadOnlyBuffer(b, () -> rb.array());
+            catchReadOnlyBuffer(b, () -> rb.arrayOffset());
+            if (rb.hasArray()) {
+                fail("Read-only heap buffer's backing array is accessible", rb);
+            }
         }
 
         // Bulk puts from read-only buffers
@@ -1001,47 +928,6 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     public static void test(final int [] ba) {
         int offset = 47;
         int length = 900;
@@ -1052,40 +938,21 @@
         ck(b, b.limit(), offset + length);
 
         // The offset must be non-negative and no larger than <array.length>.
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    IntBuffer.wrap(ba, -1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    IntBuffer.wrap(ba, ba.length + 1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    IntBuffer.wrap(ba, 0, -1);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    IntBuffer.wrap(ba, 0, ba.length + 1);
-                }});
+        catchIndexOutOfBounds(ba, () -> IntBuffer.wrap(ba, -1, ba.length));
+        catchIndexOutOfBounds(ba, () -> IntBuffer.wrap(ba, ba.length + 1, ba.length));
+        catchIndexOutOfBounds(ba, () -> IntBuffer.wrap(ba, 0, -1));
+        catchIndexOutOfBounds(ba, () -> IntBuffer.wrap(ba, 0, ba.length + 1));
 
         // A NullPointerException will be thrown if the array is null.
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    IntBuffer.wrap((int []) null, 0, 5);
-                }});
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    IntBuffer.wrap((int []) null);
-                }});
+        tryCatch(ba, NullPointerException.class,
+                () -> IntBuffer.wrap((int []) null, 0, 5));
+        tryCatch(ba, NullPointerException.class,
+                () -> IntBuffer.wrap((int []) null));
     }
 
     private static void testAllocate() {
         // An IllegalArgumentException will be thrown for negative capacities.
-        tryCatch((Buffer) null, IllegalArgumentException.class, new Runnable() {
-                public void run() {
-                    IntBuffer.allocate(-1);
-                }});
+        catchIllegalArgument((Buffer) null, () -> IntBuffer.allocate(-1));
         try {
             IntBuffer.allocate(-1);
         } catch (IllegalArgumentException e) {
@@ -1105,9 +972,6 @@
 
 
 
-
-
-
     }
 
     public static void test() {
--- a/jdk/test/java/nio/Buffer/BasicLong.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/BasicLong.java	Tue May 17 05:38:15 2016 -0700
@@ -31,7 +31,6 @@
 // -- This file was mechanically generated: Do not edit! -- //
 
 import java.nio.*;
-import java.lang.reflect.Method;
 
 
 public class BasicLong
@@ -60,7 +59,6 @@
 
     private static void relGet(LongBuffer b) {
         int n = b.capacity();
-        long v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((long)ic(i)));
         b.rewind();
@@ -68,7 +66,6 @@
 
     private static void relGet(LongBuffer b, int start) {
         int n = b.remaining();
-        long v;
         for (int i = start; i < n; i++)
             ck(b, (long)b.get(), (long)((long)ic(i)));
         b.rewind();
@@ -76,7 +73,6 @@
 
     private static void absGet(LongBuffer b) {
         int n = b.capacity();
-        long v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((long)ic(i)));
         b.rewind();
@@ -86,8 +82,9 @@
         int n = b.capacity();
         long[] a = new long[n + 7];
         b.get(a, 7, n);
-        for (int i = 0; i < n; i++)
+        for (int i = 0; i < n; i++) {
             ck(b, (long)a[i + 7], (long)((long)ic(i)));
+        }
     }
 
     private static void relPut(LongBuffer b) {
@@ -435,12 +432,42 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
     private static void fail(String problem,
                              LongBuffer xb, LongBuffer yb,
                              long x, long y) {
         fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
     }
 
+    private static void catchIllegalArgument(Buffer b, Runnable thunk) {
+        tryCatch(b, IllegalArgumentException.class, thunk);
+    }
+
+    private static void catchReadOnlyBuffer(Buffer b, Runnable thunk) {
+        tryCatch(b, ReadOnlyBufferException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(Buffer b, Runnable thunk) {
+        tryCatch(b, IndexOutOfBoundsException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(long[] t, Runnable thunk) {
+        tryCatch(t, IndexOutOfBoundsException.class, thunk);
+    }
+
     private static void tryCatch(Buffer b, Class<?> ex, Runnable thunk) {
         boolean caught = false;
         try {
@@ -452,11 +479,12 @@
                 fail(x.getMessage() + " not expected");
             }
         }
-        if (!caught)
+        if (!caught) {
             fail(ex.getName() + " not thrown", b);
+        }
     }
 
-    private static void tryCatch(long [] t, Class<?> ex, Runnable thunk) {
+    private static void tryCatch(long[] t, Class<?> ex, Runnable thunk) {
         tryCatch(LongBuffer.wrap(t), ex, thunk);
     }
 
@@ -521,8 +549,6 @@
 
 
 
-
-
         // Compact
 
         relPut(b);
@@ -537,38 +563,14 @@
         b.limit(b.capacity() / 2);
         b.position(b.limit());
 
-        tryCatch(b, BufferUnderflowException.class, new Runnable() {
-                public void run() {
-                    b.get();
-                }});
-
-        tryCatch(b, BufferOverflowException.class, new Runnable() {
-                public void run() {
-                    b.put((long)42);
-                }});
-
-        // The index must be non-negative and lesss than the buffer's limit.
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(b.limit());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(-1);
-                }});
-
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.put(b.limit(), (long)42);
-                }});
-
-        tryCatch(b, InvalidMarkException.class, new Runnable() {
-                public void run() {
-                    b.position(0);
-                    b.mark();
-                    b.compact();
-                    b.reset();
-                }});
+        tryCatch(b, BufferUnderflowException.class, () -> b.get());
+        tryCatch(b, BufferOverflowException.class, () -> b.put((long)42));
+        // The index must be non-negative and less than the buffer's limit.
+        catchIndexOutOfBounds(b, () -> b.get(b.limit()));
+        catchIndexOutOfBounds(b, () -> b.get(-1));
+        catchIndexOutOfBounds(b, () -> b.put(b.limit(), (long)42));
+        tryCatch(b, InvalidMarkException.class,
+                () -> b.position(0).mark().compact().reset());
 
         try {
             b.position(b.limit() + 1);
@@ -635,7 +637,6 @@
 
 
 
-        long v;
         b.flip();
         ck(b, b.get(), 0);
         ck(b, b.get(), (long)-1);
@@ -665,6 +666,10 @@
 
 
 
+
+
+
+
         // Comparison
         b.rewind();
         LongBuffer b2 = LongBuffer.allocate(b.capacity());
@@ -683,14 +688,15 @@
 
 
 
-                    )
+                    ) {
                     out.println("[" + i + "] " + x + " != " + y);
+                }
             }
             fail("Identical buffers not equal", b, b2);
         }
-        if (b.compareTo(b2) != 0)
+        if (b.compareTo(b2) != 0) {
             fail("Comparison to identical buffer != 0", b, b2);
-
+        }
         b.limit(b.limit() + 1);
         b.position(b.limit() - 1);
         b.put((long)99);
@@ -714,7 +720,7 @@
             if (xb.compareTo(xb) != 0) {
                 fail("compareTo not reflexive", xb, xb, x, x);
             }
-            if (! xb.equals(xb)) {
+            if (!xb.equals(xb)) {
                 fail("equals not reflexive", xb, xb, x, x);
             }
             for (long y : VALUES) {
@@ -765,9 +771,10 @@
 
         if (!sb.equals(sb2))
             fail("Sliced slices do not match", sb, sb2);
-        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset()))
+        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset())) {
             fail("Array offsets do not match: "
                  + sb.arrayOffset() + " != " + sb2.arrayOffset(), sb, sb2);
+        }
 
 
 
@@ -808,87 +815,17 @@
             fail("Buffer not equal to read-only view", b, rb);
         show(level + 1, rb);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    relPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    absPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutArray(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutBuffer(rb);
-                }});
+        catchReadOnlyBuffer(b, () -> relPut(rb));
+        catchReadOnlyBuffer(b, () -> absPut(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
 
         // put(LongBuffer) should not change source position
         final LongBuffer src = LongBuffer.allocate(1);
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.put(src);
-                 }});
+        catchReadOnlyBuffer(b, () -> rb.put(src));
         ck(src, src.position(), 0);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.compact();
-                }});
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+        catchReadOnlyBuffer(b, () -> rb.compact());
 
 
 
@@ -916,21 +853,11 @@
 
 
         if (rb.getClass().getName().startsWith("java.nio.Heap")) {
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.array();
-                    }});
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.arrayOffset();
-                    }});
-
-            if (rb.hasArray())
-                fail("Read-only heap buffer's backing array is accessible",
-                     rb);
-
+            catchReadOnlyBuffer(b, () -> rb.array());
+            catchReadOnlyBuffer(b, () -> rb.arrayOffset());
+            if (rb.hasArray()) {
+                fail("Read-only heap buffer's backing array is accessible", rb);
+            }
         }
 
         // Bulk puts from read-only buffers
@@ -1001,47 +928,6 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     public static void test(final long [] ba) {
         int offset = 47;
         int length = 900;
@@ -1052,40 +938,21 @@
         ck(b, b.limit(), offset + length);
 
         // The offset must be non-negative and no larger than <array.length>.
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    LongBuffer.wrap(ba, -1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    LongBuffer.wrap(ba, ba.length + 1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    LongBuffer.wrap(ba, 0, -1);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    LongBuffer.wrap(ba, 0, ba.length + 1);
-                }});
+        catchIndexOutOfBounds(ba, () -> LongBuffer.wrap(ba, -1, ba.length));
+        catchIndexOutOfBounds(ba, () -> LongBuffer.wrap(ba, ba.length + 1, ba.length));
+        catchIndexOutOfBounds(ba, () -> LongBuffer.wrap(ba, 0, -1));
+        catchIndexOutOfBounds(ba, () -> LongBuffer.wrap(ba, 0, ba.length + 1));
 
         // A NullPointerException will be thrown if the array is null.
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    LongBuffer.wrap((long []) null, 0, 5);
-                }});
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    LongBuffer.wrap((long []) null);
-                }});
+        tryCatch(ba, NullPointerException.class,
+                () -> LongBuffer.wrap((long []) null, 0, 5));
+        tryCatch(ba, NullPointerException.class,
+                () -> LongBuffer.wrap((long []) null));
     }
 
     private static void testAllocate() {
         // An IllegalArgumentException will be thrown for negative capacities.
-        tryCatch((Buffer) null, IllegalArgumentException.class, new Runnable() {
-                public void run() {
-                    LongBuffer.allocate(-1);
-                }});
+        catchIllegalArgument((Buffer) null, () -> LongBuffer.allocate(-1));
         try {
             LongBuffer.allocate(-1);
         } catch (IllegalArgumentException e) {
@@ -1105,9 +972,6 @@
 
 
 
-
-
-
     }
 
     public static void test() {
--- a/jdk/test/java/nio/Buffer/BasicShort.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/BasicShort.java	Tue May 17 05:38:15 2016 -0700
@@ -31,7 +31,6 @@
 // -- This file was mechanically generated: Do not edit! -- //
 
 import java.nio.*;
-import java.lang.reflect.Method;
 
 
 public class BasicShort
@@ -60,7 +59,6 @@
 
     private static void relGet(ShortBuffer b) {
         int n = b.capacity();
-        short v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((short)ic(i)));
         b.rewind();
@@ -68,7 +66,6 @@
 
     private static void relGet(ShortBuffer b, int start) {
         int n = b.remaining();
-        short v;
         for (int i = start; i < n; i++)
             ck(b, (long)b.get(), (long)((short)ic(i)));
         b.rewind();
@@ -76,7 +73,6 @@
 
     private static void absGet(ShortBuffer b) {
         int n = b.capacity();
-        short v;
         for (int i = 0; i < n; i++)
             ck(b, (long)b.get(), (long)((short)ic(i)));
         b.rewind();
@@ -86,8 +82,9 @@
         int n = b.capacity();
         short[] a = new short[n + 7];
         b.get(a, 7, n);
-        for (int i = 0; i < n; i++)
+        for (int i = 0; i < n; i++) {
             ck(b, (long)a[i + 7], (long)((short)ic(i)));
+        }
     }
 
     private static void relPut(ShortBuffer b) {
@@ -435,12 +432,42 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
     private static void fail(String problem,
                              ShortBuffer xb, ShortBuffer yb,
                              short x, short y) {
         fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
     }
 
+    private static void catchIllegalArgument(Buffer b, Runnable thunk) {
+        tryCatch(b, IllegalArgumentException.class, thunk);
+    }
+
+    private static void catchReadOnlyBuffer(Buffer b, Runnable thunk) {
+        tryCatch(b, ReadOnlyBufferException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(Buffer b, Runnable thunk) {
+        tryCatch(b, IndexOutOfBoundsException.class, thunk);
+    }
+
+    private static void catchIndexOutOfBounds(short[] t, Runnable thunk) {
+        tryCatch(t, IndexOutOfBoundsException.class, thunk);
+    }
+
     private static void tryCatch(Buffer b, Class<?> ex, Runnable thunk) {
         boolean caught = false;
         try {
@@ -452,11 +479,12 @@
                 fail(x.getMessage() + " not expected");
             }
         }
-        if (!caught)
+        if (!caught) {
             fail(ex.getName() + " not thrown", b);
+        }
     }
 
-    private static void tryCatch(short [] t, Class<?> ex, Runnable thunk) {
+    private static void tryCatch(short[] t, Class<?> ex, Runnable thunk) {
         tryCatch(ShortBuffer.wrap(t), ex, thunk);
     }
 
@@ -521,8 +549,6 @@
 
 
 
-
-
         // Compact
 
         relPut(b);
@@ -537,38 +563,14 @@
         b.limit(b.capacity() / 2);
         b.position(b.limit());
 
-        tryCatch(b, BufferUnderflowException.class, new Runnable() {
-                public void run() {
-                    b.get();
-                }});
-
-        tryCatch(b, BufferOverflowException.class, new Runnable() {
-                public void run() {
-                    b.put((short)42);
-                }});
-
-        // The index must be non-negative and lesss than the buffer's limit.
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(b.limit());
-                }});
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.get(-1);
-                }});
-
-        tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    b.put(b.limit(), (short)42);
-                }});
-
-        tryCatch(b, InvalidMarkException.class, new Runnable() {
-                public void run() {
-                    b.position(0);
-                    b.mark();
-                    b.compact();
-                    b.reset();
-                }});
+        tryCatch(b, BufferUnderflowException.class, () -> b.get());
+        tryCatch(b, BufferOverflowException.class, () -> b.put((short)42));
+        // The index must be non-negative and less than the buffer's limit.
+        catchIndexOutOfBounds(b, () -> b.get(b.limit()));
+        catchIndexOutOfBounds(b, () -> b.get(-1));
+        catchIndexOutOfBounds(b, () -> b.put(b.limit(), (short)42));
+        tryCatch(b, InvalidMarkException.class,
+                () -> b.position(0).mark().compact().reset());
 
         try {
             b.position(b.limit() + 1);
@@ -635,7 +637,6 @@
 
 
 
-        short v;
         b.flip();
         ck(b, b.get(), 0);
         ck(b, b.get(), (short)-1);
@@ -665,6 +666,10 @@
 
 
 
+
+
+
+
         // Comparison
         b.rewind();
         ShortBuffer b2 = ShortBuffer.allocate(b.capacity());
@@ -683,14 +688,15 @@
 
 
 
-                    )
+                    ) {
                     out.println("[" + i + "] " + x + " != " + y);
+                }
             }
             fail("Identical buffers not equal", b, b2);
         }
-        if (b.compareTo(b2) != 0)
+        if (b.compareTo(b2) != 0) {
             fail("Comparison to identical buffer != 0", b, b2);
-
+        }
         b.limit(b.limit() + 1);
         b.position(b.limit() - 1);
         b.put((short)99);
@@ -714,7 +720,7 @@
             if (xb.compareTo(xb) != 0) {
                 fail("compareTo not reflexive", xb, xb, x, x);
             }
-            if (! xb.equals(xb)) {
+            if (!xb.equals(xb)) {
                 fail("equals not reflexive", xb, xb, x, x);
             }
             for (short y : VALUES) {
@@ -765,9 +771,10 @@
 
         if (!sb.equals(sb2))
             fail("Sliced slices do not match", sb, sb2);
-        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset()))
+        if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset())) {
             fail("Array offsets do not match: "
                  + sb.arrayOffset() + " != " + sb2.arrayOffset(), sb, sb2);
+        }
 
 
 
@@ -808,87 +815,17 @@
             fail("Buffer not equal to read-only view", b, rb);
         show(level + 1, rb);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    relPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    absPut(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutArray(rb);
-                }});
-
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    bulkPutBuffer(rb);
-                }});
+        catchReadOnlyBuffer(b, () -> relPut(rb));
+        catchReadOnlyBuffer(b, () -> absPut(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
+        catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
 
         // put(ShortBuffer) should not change source position
         final ShortBuffer src = ShortBuffer.allocate(1);
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.put(src);
-                 }});
+        catchReadOnlyBuffer(b, () -> rb.put(src));
         ck(src, src.position(), 0);
 
-        tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                public void run() {
-                    rb.compact();
-                }});
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+        catchReadOnlyBuffer(b, () -> rb.compact());
 
 
 
@@ -916,21 +853,11 @@
 
 
         if (rb.getClass().getName().startsWith("java.nio.Heap")) {
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.array();
-                    }});
-
-            tryCatch(b, ReadOnlyBufferException.class, new Runnable() {
-                    public void run() {
-                        rb.arrayOffset();
-                    }});
-
-            if (rb.hasArray())
-                fail("Read-only heap buffer's backing array is accessible",
-                     rb);
-
+            catchReadOnlyBuffer(b, () -> rb.array());
+            catchReadOnlyBuffer(b, () -> rb.arrayOffset());
+            if (rb.hasArray()) {
+                fail("Read-only heap buffer's backing array is accessible", rb);
+            }
         }
 
         // Bulk puts from read-only buffers
@@ -1001,47 +928,6 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     public static void test(final short [] ba) {
         int offset = 47;
         int length = 900;
@@ -1052,40 +938,21 @@
         ck(b, b.limit(), offset + length);
 
         // The offset must be non-negative and no larger than <array.length>.
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    ShortBuffer.wrap(ba, -1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    ShortBuffer.wrap(ba, ba.length + 1, ba.length);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    ShortBuffer.wrap(ba, 0, -1);
-                }});
-        tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() {
-                public void run() {
-                    ShortBuffer.wrap(ba, 0, ba.length + 1);
-                }});
+        catchIndexOutOfBounds(ba, () -> ShortBuffer.wrap(ba, -1, ba.length));
+        catchIndexOutOfBounds(ba, () -> ShortBuffer.wrap(ba, ba.length + 1, ba.length));
+        catchIndexOutOfBounds(ba, () -> ShortBuffer.wrap(ba, 0, -1));
+        catchIndexOutOfBounds(ba, () -> ShortBuffer.wrap(ba, 0, ba.length + 1));
 
         // A NullPointerException will be thrown if the array is null.
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    ShortBuffer.wrap((short []) null, 0, 5);
-                }});
-        tryCatch(ba, NullPointerException.class, new Runnable() {
-                public void run() {
-                    ShortBuffer.wrap((short []) null);
-                }});
+        tryCatch(ba, NullPointerException.class,
+                () -> ShortBuffer.wrap((short []) null, 0, 5));
+        tryCatch(ba, NullPointerException.class,
+                () -> ShortBuffer.wrap((short []) null));
     }
 
     private static void testAllocate() {
         // An IllegalArgumentException will be thrown for negative capacities.
-        tryCatch((Buffer) null, IllegalArgumentException.class, new Runnable() {
-                public void run() {
-                    ShortBuffer.allocate(-1);
-                }});
+        catchIllegalArgument((Buffer) null, () -> ShortBuffer.allocate(-1));
         try {
             ShortBuffer.allocate(-1);
         } catch (IllegalArgumentException e) {
@@ -1105,9 +972,6 @@
 
 
 
-
-
-
     }
 
     public static void test() {
--- a/jdk/test/java/nio/Buffer/LimitDirectMemory.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/LimitDirectMemory.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 import java.util.Properties;
 
 public class LimitDirectMemory {
-    private static int K = 1024;
+    private static final int K = 1024;
 
     public static void main(String [] args) throws Exception {
         if (args.length < 2)
@@ -83,7 +83,7 @@
 
         int idx = 0, len = size.length();
 
-        int result = 1;
+
         for (int i = 0; i < len; i++) {
             if (Character.isDigit(size.charAt(i))) idx++;
             else break;
@@ -92,7 +92,7 @@
         if (idx == 0)
             throw new RuntimeException("No digits detected: " + size);
 
-        result = Integer.parseInt(size.substring(0, idx));
+        int result = Integer.parseInt(size.substring(0, idx));
 
         if (idx < len) {
             for (int i = idx; i < len; i++) {
--- a/jdk/test/java/nio/Buffer/Order-X.java.template	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/Order-X.java.template	Tue May 17 05:38:15 2016 -0700
@@ -52,8 +52,5 @@
         buf = $Type$Buffer.allocate(LENGTH);
         ck(buf.order(), nord);
         ck$Type$Buffer(buf, nord);
-
-        ck$Type$Buffer(ByteBuffer.allocate(LENGTH).as$Type$Buffer(), be);
-        ck$Type$Buffer(ByteBuffer.allocateDirect(LENGTH).as$Type$Buffer(), be);
     }
 }
--- a/jdk/test/java/nio/Buffer/Order.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/Order.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,41 +39,49 @@
 
     static void ck(ByteOrder ord, ByteOrder expected) {
         if (ord != expected)
-            throw new RuntimeException("Got " + ord
-                                       + ", expected " + expected);
+            throw new RuntimeException("Got " + ord + ", expected " + expected);
     }
 
-    static void ckViews(ByteBuffer bb, ByteOrder ord) {
+    private static void ckViews(ByteBuffer bb) {
         ck(bb.asCharBuffer().order(), bb.order());
+        ck(bb.asShortBuffer().order(), bb.order());
         ck(bb.asIntBuffer().order(), bb.order());
         ck(bb.asLongBuffer().order(), bb.order());
         ck(bb.asFloatBuffer().order(), bb.order());
         ck(bb.asDoubleBuffer().order(), bb.order());
     }
 
-    static void ckByteBuffer(ByteBuffer bb) {
-        ckViews(bb, bb.order());
-        bb.order(be);
-        ckViews(bb, be);
-        bb.order(le);
-        ckViews(bb, le);
+    private static void ckCopyViews(ByteBuffer bb) {
+        ck(bb.asReadOnlyBuffer().order(), be);
+        ck(bb.duplicate().order(), be);
+        ck(bb.slice().order(), be);
+    }
 
-        if (bb.hasArray()) {
-            byte[] array = bb.array();
-            ck(ByteBuffer.wrap(array, LENGTH/2, LENGTH/2).order(), be);
-            ck(ByteBuffer.wrap(array).order(), be);
-            ck(bb.asReadOnlyBuffer().order(), be);
-            ck(bb.duplicate().order(), be);
-            ck(bb.slice().order(), be);
-        }
+    private static void ckByteBuffer(ByteBuffer bb) {
+        ckViews(bb);
+        ckCopyViews(bb);
+        bb.order(be);
+        ckViews(bb);
+        ckCopyViews(bb);
+        bb.order(le);
+        ckViews(bb);
+        ckCopyViews(bb);
     }
 
     public static void main(String args[]) throws Exception {
 
+        ck(ByteBuffer.wrap(new byte[LENGTH], LENGTH/2, LENGTH/2).order(), be);
+        ck(ByteBuffer.wrap(new byte[LENGTH]).order(), be);
+        ck(ByteBuffer.wrap(new byte[LENGTH], LENGTH/2, LENGTH/2).order(be).order(), be);
+        ck(ByteBuffer.wrap(new byte[LENGTH]).order(be).order(), be);
+        ck(ByteBuffer.wrap(new byte[LENGTH], LENGTH/2, LENGTH/2).order(le).order(), le);
+        ck(ByteBuffer.wrap(new byte[LENGTH]).order(le).order(), le);
         ck(ByteBuffer.allocate(LENGTH).order(), be);
         ck(ByteBuffer.allocateDirect(LENGTH).order(), be);
         ck(ByteBuffer.allocate(LENGTH).order(be).order(), be);
         ck(ByteBuffer.allocate(LENGTH).order(le).order(), le);
+        ck(ByteBuffer.allocateDirect(LENGTH).order(be).order(), be);
+        ck(ByteBuffer.allocateDirect(LENGTH).order(le).order(), le);
 
         ckByteBuffer(ByteBuffer.allocate(LENGTH));
         ckByteBuffer(ByteBuffer.allocateDirect(LENGTH));
@@ -85,5 +93,4 @@
         OrderFloat.ckFloatBuffer();
         OrderDouble.ckDoubleBuffer();
     }
-
 }
--- a/jdk/test/java/nio/Buffer/OrderChar.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/OrderChar.java	Tue May 17 05:38:15 2016 -0700
@@ -52,8 +52,5 @@
         buf = CharBuffer.allocate(LENGTH);
         ck(buf.order(), nord);
         ckCharBuffer(buf, nord);
-
-        ckCharBuffer(ByteBuffer.allocate(LENGTH).asCharBuffer(), be);
-        ckCharBuffer(ByteBuffer.allocateDirect(LENGTH).asCharBuffer(), be);
     }
 }
--- a/jdk/test/java/nio/Buffer/OrderDouble.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/OrderDouble.java	Tue May 17 05:38:15 2016 -0700
@@ -52,8 +52,5 @@
         buf = DoubleBuffer.allocate(LENGTH);
         ck(buf.order(), nord);
         ckDoubleBuffer(buf, nord);
-
-        ckDoubleBuffer(ByteBuffer.allocate(LENGTH).asDoubleBuffer(), be);
-        ckDoubleBuffer(ByteBuffer.allocateDirect(LENGTH).asDoubleBuffer(), be);
     }
 }
--- a/jdk/test/java/nio/Buffer/OrderFloat.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/OrderFloat.java	Tue May 17 05:38:15 2016 -0700
@@ -52,8 +52,5 @@
         buf = FloatBuffer.allocate(LENGTH);
         ck(buf.order(), nord);
         ckFloatBuffer(buf, nord);
-
-        ckFloatBuffer(ByteBuffer.allocate(LENGTH).asFloatBuffer(), be);
-        ckFloatBuffer(ByteBuffer.allocateDirect(LENGTH).asFloatBuffer(), be);
     }
 }
--- a/jdk/test/java/nio/Buffer/OrderInt.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/OrderInt.java	Tue May 17 05:38:15 2016 -0700
@@ -52,8 +52,5 @@
         buf = IntBuffer.allocate(LENGTH);
         ck(buf.order(), nord);
         ckIntBuffer(buf, nord);
-
-        ckIntBuffer(ByteBuffer.allocate(LENGTH).asIntBuffer(), be);
-        ckIntBuffer(ByteBuffer.allocateDirect(LENGTH).asIntBuffer(), be);
     }
 }
--- a/jdk/test/java/nio/Buffer/OrderLong.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/OrderLong.java	Tue May 17 05:38:15 2016 -0700
@@ -52,8 +52,5 @@
         buf = LongBuffer.allocate(LENGTH);
         ck(buf.order(), nord);
         ckLongBuffer(buf, nord);
-
-        ckLongBuffer(ByteBuffer.allocate(LENGTH).asLongBuffer(), be);
-        ckLongBuffer(ByteBuffer.allocateDirect(LENGTH).asLongBuffer(), be);
     }
 }
--- a/jdk/test/java/nio/Buffer/OrderShort.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/OrderShort.java	Tue May 17 05:38:15 2016 -0700
@@ -52,8 +52,5 @@
         buf = ShortBuffer.allocate(LENGTH);
         ck(buf.order(), nord);
         ckShortBuffer(buf, nord);
-
-        ckShortBuffer(ByteBuffer.allocate(LENGTH).asShortBuffer(), be);
-        ckShortBuffer(ByteBuffer.allocateDirect(LENGTH).asShortBuffer(), be);
     }
 }
--- a/jdk/test/java/nio/Buffer/SwapMicroBenchmark.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/nio/Buffer/SwapMicroBenchmark.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,6 @@
 
 import java.util.*;
 import java.nio.*;
-import java.util.concurrent.*;
 import java.util.regex.Pattern;
 
 public class SwapMicroBenchmark {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/sql/TEST.properties	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,2 @@
+modules = java.sql
+
--- a/jdk/test/java/util/Arrays/SortingNearlySortedPrimitive.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/java/util/Arrays/SortingNearlySortedPrimitive.java	Tue May 17 05:38:15 2016 -0700
@@ -1,6 +1,6 @@
 /*
  * Copyright 2015 Goldman Sachs.
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
  */
 /*
  * @test
+ * @bug 8154049
  * @summary Tests the sorting of a large array of sorted primitive values,
  *          predominently for cases where the array is nearly sorted. This tests
  *          code that detects patterns in the array to determine if it is nearly
@@ -32,32 +33,117 @@
  * @run testng SortingNearlySortedPrimitive
  */
 
-import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.function.Supplier;
+import java.util.List;
+import java.util.StringJoiner;
+import java.util.function.IntFunction;
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
 
 public class SortingNearlySortedPrimitive {
-    private static final int ARRAY_SIZE = 1_000_000;
+
+    static final int BASE = 3;
+    static final int WIDTH = 4;
+    // Should be > DualPivotQuicksort.QUICKSORT_THRESHOLD
+    static final int PAD = 300;
+
+    Stream<int[]> createCombinations() {
+        // Create all combinations for the BASE value and double the WIDTH
+        // elements
+        // This is create various combinations of ascending, descending and
+        // equal runs to exercise the nearly sorted code paths
+        return IntStream.range(0, (int) Math.pow(BASE, 2 * WIDTH)).
+                mapToObj(this::createArray);
+    }
 
-    @DataProvider(name = "arrays")
-    public Object[][] createData() {
-        return new Object[][]{
-                {"hiZeroLowTest", (Supplier<int[]>) this::hiZeroLowData},
-                {"endLessThanTest", (Supplier<int[]>) this::endLessThanData},
-                {"highFlatLowTest", (Supplier<int[]>) this::highFlatLowData},
-                {"identicalTest", (Supplier<int[]>) this::identicalData},
-                {"sortedReversedSortedTest", (Supplier<int[]>) this::sortedReversedSortedData},
-                {"pairFlipTest", (Supplier<int[]>) this::pairFlipData},
-                {"zeroHiTest", (Supplier<int[]>) this::zeroHiData},
-        };
+    // Create an array which at either end is filled with -ve and +ve elements
+    // according to the base value and padded with zeros in between
+    int[] createArray(int v) {
+        int[] a = new int[WIDTH + PAD + WIDTH];
+
+        // Fill head of array
+        for (int j = 0; j < WIDTH; j++) {
+            a[j] = (v % BASE) - (BASE / 2);
+            v /= BASE;
+        }
+        // Fill tail of array
+        for (int j = 0; j < WIDTH; j++) {
+            a[WIDTH + PAD + j] = (v % BASE) - (BASE / 2);
+            v /= BASE;
+        }
+        return a;
     }
 
-    @Test(dataProvider = "arrays")
-    public void runTests(String testName, Supplier<int[]> dataMethod) throws Exception {
-        int[] intSourceArray = dataMethod.get();
+    @Test
+    public void testCombination() {
+        createCombinations().forEach(a -> {
+            try {
+                // Clone source array to ensure it is not modified
+                this.sortAndAssert(a.clone());
+                this.sortAndAssert(floatCopyFromInt(a));
+                this.sortAndAssert(doubleCopyFromInt(a));
+                this.sortAndAssert(longCopyFromInt(a));
+                this.sortAndAssert(shortCopyFromInt(a));
+                this.sortAndAssert(charCopyFromInt(a));
+            } catch (AssertionError sae) {
+                AssertionError ae = new AssertionError("Sort failed for " + arrayToString(a));
+                ae.addSuppressed(sae);
+                throw ae;
+            }
+        });
+    }
+
+    String arrayToString(int[] a) {
+        int[] l = Arrays.copyOfRange(a, 0, WIDTH + 2);
+        int[] r = Arrays.copyOfRange(a, a.length - (WIDTH + 2), a.length);
+        StringJoiner sj = new StringJoiner(",", "[", "]");
+        for (int i : l) {
+            sj.add(Integer.toString(i));
+        }
+        sj.add("...");
+        for (int i : r) {
+            sj.add(Integer.toString(i));
+        }
+        return sj.toString();
+    }
+
+
+    @DataProvider(name = "shapes")
+    public Object[][] createShapes() {
+        Stream<List<Object>> baseCases = Stream.of(
+                List.of("hiZeroLowTest", (IntFunction<int[]>) this::hiZeroLowData),
+                List.of("endLessThanTest", (IntFunction<int[]>) this::endLessThanData),
+                List.of("highFlatLowTest", (IntFunction<int[]>) this::highFlatLowData),
+                List.of("identicalTest", (IntFunction<int[]>) this::identicalData),
+                List.of("sortedReversedSortedTest", (IntFunction<int[]>) this::sortedReversedSortedData),
+                List.of("pairFlipTest", (IntFunction<int[]>) this::pairFlipData),
+                List.of("zeroHiTest", (IntFunction<int[]>) this::zeroHiData)
+        );
+
+        // Ensure the following inequality holds for certain sizes
+        // DualPivotQuicksort.QUICKSORT_THRESHOLD <= size - 1
+        //   < DualPivotQuicksort.COUNTING_SORT_THRESHOLD_FOR_SHORT_OR_CHAR
+        // This guarantees that code paths are taken for checking nearly sorted
+        // arrays for all primitive types
+        List<Integer> sizes = List.of(100, 1_000, 10_000, 1_000_000);
+        return baseCases.
+                flatMap(l -> sizes.stream().map(s -> append(l, s))).
+                toArray(Object[][]::new);
+    }
+
+    Object[] append(List<Object> l, Object value) {
+        List<Object> nl = new ArrayList<>(l);
+        nl.add(value);
+        return nl.toArray();
+    }
+
+    @Test(dataProvider = "shapes")
+    public void testShapes(String testName, IntFunction<int[]> dataMethod, int size) {
+        int[] intSourceArray = dataMethod.apply(size);
 
         // Clone source array to ensure it is not modified
         this.sortAndAssert(intSourceArray.clone());
@@ -110,73 +196,67 @@
 
     private void sortAndAssert(int[] array) {
         Arrays.sort(array);
-        for (int i = 1; i < ARRAY_SIZE; i++) {
+        for (int i = 1; i < array.length; i++) {
             if (array[i] < array[i - 1]) {
                 throw new AssertionError("not sorted");
             }
         }
-        Assert.assertEquals(ARRAY_SIZE, array.length);
     }
 
     private void sortAndAssert(char[] array) {
         Arrays.sort(array);
-        for (int i = 1; i < ARRAY_SIZE; i++) {
+        for (int i = 1; i < array.length; i++) {
             if (array[i] < array[i - 1]) {
                 throw new AssertionError("not sorted");
             }
         }
-        Assert.assertEquals(ARRAY_SIZE, array.length);
     }
 
     private void sortAndAssert(short[] array) {
         Arrays.sort(array);
-        for (int i = 1; i < ARRAY_SIZE; i++) {
+        for (int i = 1; i < array.length; i++) {
             if (array[i] < array[i - 1]) {
                 throw new AssertionError("not sorted");
             }
         }
-        Assert.assertEquals(ARRAY_SIZE, array.length);
     }
 
     private void sortAndAssert(double[] array) {
         Arrays.sort(array);
-        for (int i = 1; i < ARRAY_SIZE; i++) {
+        for (int i = 1; i < array.length; i++) {
             if (array[i] < array[i - 1]) {
                 throw new AssertionError("not sorted");
             }
         }
-        Assert.assertEquals(ARRAY_SIZE, array.length);
     }
 
     private void sortAndAssert(float[] array) {
         Arrays.sort(array);
-        for (int i = 1; i < ARRAY_SIZE; i++) {
+        for (int i = 1; i < array.length; i++) {
             if (array[i] < array[i - 1]) {
                 throw new AssertionError("not sorted");
             }
         }
-        Assert.assertEquals(ARRAY_SIZE, array.length);
     }
 
     private void sortAndAssert(long[] array) {
         Arrays.sort(array);
-        for (int i = 1; i < ARRAY_SIZE; i++) {
+        for (int i = 1; i < array.length; i++) {
             if (array[i] < array[i - 1]) {
                 throw new AssertionError("not sorted");
             }
         }
-        Assert.assertEquals(ARRAY_SIZE, array.length);
     }
 
-    private int[] zeroHiData() {
-        int[] array = new int[ARRAY_SIZE];
+    private int[] zeroHiData(int size) {
+        int[] array = new int[size];
 
-        int threeQuarters = (int) (ARRAY_SIZE * 0.75);
+        int threeQuarters = (int) (size * 0.75);
         for (int i = 0; i < threeQuarters; i++) {
             array[i] = 0;
         }
         int k = 1;
-        for (int i = threeQuarters; i < ARRAY_SIZE; i++) {
+        for (int i = threeQuarters; i < size; i++) {
             array[i] = k;
             k++;
         }
@@ -184,10 +264,10 @@
         return array;
     }
 
-    private int[] hiZeroLowData() {
-        int[] array = new int[ARRAY_SIZE];
+    private int[] hiZeroLowData(int size) {
+        int[] array = new int[size];
 
-        int oneThird = ARRAY_SIZE / 3;
+        int oneThird = size / 3;
         for (int i = 0; i < oneThird; i++) {
             array[i] = i;
         }
@@ -195,16 +275,16 @@
         for (int i = oneThird; i < twoThirds; i++) {
             array[i] = 0;
         }
-        for (int i = twoThirds; i < ARRAY_SIZE; i++) {
+        for (int i = twoThirds; i < size; i++) {
             array[i] = oneThird - i + twoThirds;
         }
         return array;
     }
 
-    private int[] highFlatLowData() {
-        int[] array = new int[ARRAY_SIZE];
+    private int[] highFlatLowData(int size) {
+        int[] array = new int[size];
 
-        int oneThird = ARRAY_SIZE / 3;
+        int oneThird = size / 3;
         for (int i = 0; i < oneThird; i++) {
             array[i] = i;
         }
@@ -213,57 +293,57 @@
         for (int i = oneThird; i < twoThirds; i++) {
             array[i] = constant;
         }
-        for (int i = twoThirds; i < ARRAY_SIZE; i++) {
+        for (int i = twoThirds; i < size; i++) {
             array[i] = constant - i + twoThirds;
         }
 
         return array;
     }
 
-    private int[] identicalData() {
-        int[] array = new int[ARRAY_SIZE];
+    private int[] identicalData(int size) {
+        int[] array = new int[size];
         int listNumber = 24;
 
-        for (int i = 0; i < ARRAY_SIZE; i++) {
+        for (int i = 0; i < size; i++) {
             array[i] = listNumber;
         }
 
         return array;
     }
 
-    private int[] endLessThanData() {
-        int[] array = new int[ARRAY_SIZE];
+    private int[] endLessThanData(int size) {
+        int[] array = new int[size];
 
-        for (int i = 0; i < ARRAY_SIZE - 1; i++) {
+        for (int i = 0; i < size - 1; i++) {
             array[i] = 3;
         }
-        array[ARRAY_SIZE - 1] = 1;
+        array[size - 1] = 1;
 
         return array;
     }
 
-    private int[] sortedReversedSortedData() {
-        int[] array = new int[ARRAY_SIZE];
+    private int[] sortedReversedSortedData(int size) {
+        int[] array = new int[size];
 
-        for (int i = 0; i < ARRAY_SIZE / 2; i++) {
+        for (int i = 0; i < size / 2; i++) {
             array[i] = i;
         }
         int num = 0;
-        for (int i = ARRAY_SIZE / 2; i < ARRAY_SIZE; i++) {
-            array[i] = ARRAY_SIZE - num;
+        for (int i = size / 2; i < size; i++) {
+            array[i] = size - num;
             num++;
         }
 
         return array;
     }
 
-    private int[] pairFlipData() {
-        int[] array = new int[ARRAY_SIZE];
+    private int[] pairFlipData(int size) {
+        int[] array = new int[size];
 
-        for (int i = 0; i < ARRAY_SIZE; i++) {
+        for (int i = 0; i < size; i++) {
             array[i] = i;
         }
-        for (int i = 0; i < ARRAY_SIZE; i += 2) {
+        for (int i = 0; i < size; i += 2) {
             int temp = array[i];
             array[i] = array[i + 1];
             array[i + 1] = temp;
--- a/jdk/test/javax/net/ssl/HttpsURLConnection/Equals.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/javax/net/ssl/HttpsURLConnection/Equals.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /**
  * @test
  * @library /lib/testlibrary
+ * @modules jdk.httpserver
  * @build jdk.testlibrary.SimpleSSLContext
  * @run main Equals
  * @bug 8055299
--- a/jdk/test/javax/net/ssl/ServerName/BestEffortOnLazyConnected.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/javax/net/ssl/ServerName/BestEffortOnLazyConnected.java	Tue May 17 05:38:15 2016 -0700
@@ -34,9 +34,6 @@
  */
 
 import java.io.*;
-import java.nio.*;
-import java.nio.channels.*;
-import java.util.*;
 import java.net.*;
 import javax.net.ssl.*;
 
@@ -197,6 +194,7 @@
                 hostname);
         // Ignore the test if the hostname does not sound like a domain name.
         if ((hostname == null) || hostname.isEmpty() ||
+                !hostname.contains(".") || hostname.endsWith(".") ||
                 hostname.startsWith("localhost") ||
                 Character.isDigit(hostname.charAt(hostname.length() - 1))) {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/TEST.properties	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,1 @@
+modules = java.rmi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/script/TEST.properties	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,1 @@
+modules = java.scripting
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/TEST.properties	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,1 @@
+modules = java.xml
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/ImpactOnSNI.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/ImpactOnSNI.java	Tue May 17 05:38:15 2016 -0700
@@ -235,6 +235,7 @@
                 hostname);
         // Ignore the test if the hostname does not sound like a domain name.
         if ((hostname == null) || hostname.isEmpty() ||
+                !hostname.contains(".") || hostname.endsWith(".") ||
                 hostname.startsWith("localhost") ||
                 Character.isDigit(hostname.charAt(hostname.length() - 1))) {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/provider/PolicyFile/BadPolicyFile.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 8150468
+ * @summary check that a badly formatted policy file is handled correctly
+ * @run main/othervm BadPolicyFile
+ */
+
+import java.io.File;
+import java.net.URI;
+import java.security.AccessControlException;
+import java.security.Policy;
+import java.security.URIParameter;
+
+public class BadPolicyFile {
+
+    public static void main(String[] args) throws Exception {
+        URI uri = new File(System.getProperty("test.src", "."),
+                           "BadPolicyFile.policy").toURI();
+        Policy.setPolicy(Policy.getInstance("JavaPolicy", new URIParameter(uri)));
+        System.setSecurityManager(new SecurityManager());
+        try {
+            String javahome = System.getProperty("java.home");
+            throw new Exception("Expected AccessControlException");
+        } catch (AccessControlException ace) {
+            System.out.println("Test PASSED");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/provider/PolicyFile/BadPolicyFile.policy	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,4 @@
+grant {
+    // permission statement is missing trailing semi-colon
+    permission "java.util.PropertyPermission" "java.home", "read"
+};
--- a/jdk/test/tools/jlink/DefaultProviderTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/DefaultProviderTest.java	Tue May 17 05:38:15 2016 -0700
@@ -33,7 +33,7 @@
 import jdk.tools.jlink.internal.PluginRepository;
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 import tests.Helper;
 
@@ -65,26 +65,26 @@
         private boolean enabled = true;
 
         @Override
-        public Set<PluginType> getType() {
-            Set<PluginType> set = new HashSet<>();
-            set.add(CATEGORY.TRANSFORMER);
+        public Set<Category> getType() {
+            Set<Category> set = new HashSet<>();
+            set.add(Category.TRANSFORMER);
             return Collections.unmodifiableSet(set);
         }
 
         @Override
-        public Set<STATE> getState() {
-             return enabled ? EnumSet.of(STATE.AUTO_ENABLED, STATE.FUNCTIONAL)
-                : EnumSet.of(STATE.DISABLED);
+        public Set<State> getState() {
+             return enabled ? EnumSet.of(State.AUTO_ENABLED, State.FUNCTIONAL)
+                : EnumSet.of(State.DISABLED);
         }
 
         @Override
-        public void visit(Pool in, Pool out) {
+        public void visit(ModulePool in, ModulePool out) {
             if (!enabled) {
                 throw new PluginException(NAME + " was set");
             }
 
             DefaultProviderTest.isNewPluginsCalled = true;
-            in.visit((Pool.ModuleData content) -> {
+            in.transformAndCopy(content -> {
                 return content;
             }, out);
         }
--- a/jdk/test/tools/jlink/ImageFileCreatorTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/ImageFileCreatorTest.java	Tue May 17 05:38:15 2016 -0700
@@ -39,7 +39,7 @@
 import jdk.tools.jlink.internal.ImagePluginStack;
 import jdk.tools.jlink.plugin.ExecutableImage;
 import jdk.tools.jlink.builder.ImageBuilder;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModulePool;
 
 
 /*
@@ -47,6 +47,7 @@
  * @summary ImageFileCreator class test
  * @author Jean-Francois Denise
  * @modules jdk.jlink/jdk.tools.jlink.internal
+ *          jdk.jlink/jdk.tools.jlink.builder
  *          java.base/jdk.internal.jimage
  * @run main/othervm -verbose:gc -Xmx1g ImageFileCreatorTest
  */
@@ -214,7 +215,7 @@
             }
 
             @Override
-            public void storeFiles(Pool content) {
+            public void storeFiles(ModulePool content) {
             }
         };
 
--- a/jdk/test/tools/jlink/ImageFilePoolTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/ImageFilePoolTest.java	Tue May 17 05:38:15 2016 -0700
@@ -31,11 +31,12 @@
  */
 
 import java.io.ByteArrayInputStream;
-import jdk.tools.jlink.internal.PoolImpl;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
-import jdk.tools.jlink.plugin.Pool.ModuleDataType;
-import jdk.tools.jlink.plugin.Pool.Visitor;
+import java.util.Optional;
+import java.util.function.Function;
+import jdk.tools.jlink.internal.ModuleEntryImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 
 public class ImageFilePoolTest {
     public static void main(String[] args) throws Exception {
@@ -50,45 +51,45 @@
     private static final String SUFFIX = "END";
 
     private void checkVisitor() throws Exception {
-        Pool input = new PoolImpl();
+        ModulePool input = new ModulePoolImpl();
         for (int i = 0; i < 1000; ++i) {
             String module = "module" + (i / 100);
             input.add(new InMemoryImageFile(module, "/" + module + "/java/class" + i,
-                    ModuleDataType.CONFIG, "class" + i));
+                    ModuleEntry.Type.CONFIG, "class" + i));
         }
-        if (input.getContent().size() != 1000) {
+        if (input.getEntryCount() != 1000) {
             throw new AssertionError();
         }
-        Pool output = new PoolImpl();
+        ModulePool output = new ModulePoolImpl();
         ResourceVisitor visitor = new ResourceVisitor();
-        input.visit(visitor, output);
+        input.transformAndCopy(visitor, output);
         if (visitor.getAmountBefore() == 0) {
             throw new AssertionError("Resources not found");
         }
-        if (visitor.getAmountBefore() != input.getContent().size()) {
+        if (visitor.getAmountBefore() != input.getEntryCount()) {
             throw new AssertionError("Number of visited resources. Expected: " +
-                    visitor.getAmountBefore() + ", got: " + input.getContent().size());
+                    visitor.getAmountBefore() + ", got: " + input.getEntryCount());
         }
-        if (visitor.getAmountAfter() != output.getContent().size()) {
+        if (visitor.getAmountAfter() != output.getEntryCount()) {
             throw new AssertionError("Number of added resources. Expected: " +
-                    visitor.getAmountAfter() + ", got: " + output.getContent().size());
+                    visitor.getAmountAfter() + ", got: " + output.getEntryCount());
         }
-        for (ModuleData outFile : output.getContent()) {
+        output.entries().forEach(outFile -> {
             String path = outFile.getPath().replaceAll(SUFFIX + "$", "");
-            ModuleData inFile = input.get(path);
-            if (inFile == null) {
+            Optional<ModuleEntry> inFile = input.findEntry(path);
+            if (!inFile.isPresent()) {
                 throw new AssertionError("Unknown resource: " + path);
             }
-        }
+        });
     }
 
-    private static class ResourceVisitor implements Visitor {
+    private static class ResourceVisitor implements Function<ModuleEntry, ModuleEntry> {
 
         private int amountBefore;
         private int amountAfter;
 
         @Override
-        public ModuleData visit(ModuleData file) {
+        public ModuleEntry apply(ModuleEntry file) {
             int index = ++amountBefore % 3;
             switch (index) {
                 case 0:
@@ -113,7 +114,7 @@
     }
 
     private void checkNegative() throws Exception {
-        PoolImpl input = new PoolImpl();
+        ModulePoolImpl input = new ModulePoolImpl();
         try {
             input.add(null);
             throw new AssertionError("NullPointerException is not thrown");
@@ -126,30 +127,30 @@
         } catch (NullPointerException e) {
             // expected
         }
-        if (input.get("unknown") != null) {
-            throw new AssertionError("ImageFilePool does not return null for unknown file");
+        if (input.findEntry("unknown").isPresent()) {
+            throw new AssertionError("ImageFileModulePool does not return null for unknown file");
         }
-        if (input.contains(new InMemoryImageFile("", "unknown", ModuleDataType.CONFIG, "unknown"))) {
+        if (input.contains(new InMemoryImageFile("", "unknown", ModuleEntry.Type.CONFIG, "unknown"))) {
             throw new AssertionError("'contain' returns true for unknown file");
         }
-        input.add(new InMemoryImageFile("", "/aaa/bbb", ModuleDataType.CONFIG, ""));
+        input.add(new InMemoryImageFile("", "/aaa/bbb", ModuleEntry.Type.CONFIG, ""));
         try {
-            input.add(new InMemoryImageFile("", "/aaa/bbb", ModuleDataType.CONFIG, ""));
+            input.add(new InMemoryImageFile("", "/aaa/bbb", ModuleEntry.Type.CONFIG, ""));
             throw new AssertionError("Exception expected");
         } catch (Exception e) {
             // expected
         }
         input.setReadOnly();
         try {
-            input.add(new InMemoryImageFile("", "/aaa/ccc", ModuleDataType.CONFIG, ""));
+            input.add(new InMemoryImageFile("", "/aaa/ccc", ModuleEntry.Type.CONFIG, ""));
             throw new AssertionError("Exception expected");
         } catch (Exception e) {
             // expected
         }
     }
 
-    private static class InMemoryImageFile extends ModuleData {
-        public InMemoryImageFile(String module, String path, ModuleDataType type, String content) {
+    private static class InMemoryImageFile extends ModuleEntryImpl {
+        public InMemoryImageFile(String module, String path, ModuleEntry.Type type, String content) {
             super(module, path, type, new ByteArrayInputStream(content.getBytes()), content.getBytes().length);
         }
     }
--- a/jdk/test/tools/jlink/IntegrationTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/IntegrationTest.java	Tue May 17 05:38:15 2016 -0700
@@ -39,7 +39,7 @@
 import jdk.tools.jlink.Jlink.PluginsConfiguration;
 import jdk.tools.jlink.builder.DefaultImageBuilder;
 import jdk.tools.jlink.plugin.ExecutableImage;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.PostProcessorPlugin;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 import jdk.tools.jlink.internal.plugins.DefaultCompressPlugin;
@@ -56,6 +56,8 @@
  * @library ../lib
  * @modules java.base/jdk.internal.jimage
  *          jdk.jdeps/com.sun.tools.classfile
+ *          jdk.jlink/jdk.tools.jlink
+ *          jdk.jlink/jdk.tools.jlink.builder
  *          jdk.jlink/jdk.tools.jlink.internal
  *          jdk.jlink/jdk.tools.jlink.internal.plugins
  *          jdk.jlink/jdk.tools.jmod
@@ -88,9 +90,9 @@
         }
 
         @Override
-        public Set<PluginType> getType() {
-            Set<PluginType> set = new HashSet<>();
-            set.add(CATEGORY.PROCESSOR);
+        public Set<Category> getType() {
+            Set<Category> set = new HashSet<>();
+            set.add(Category.PROCESSOR);
             return Collections.unmodifiableSet(set);
         }
 
@@ -128,18 +130,18 @@
         }
 
         @Override
-        public void visit(Pool in, Pool out) {
+        public void visit(ModulePool in, ModulePool out) {
             System.err.println(NAME + index);
             ordered.add(index);
-            in.visit((file) -> {
+            in.transformAndCopy((file) -> {
                 return file;
             }, out);
         }
 
         @Override
-        public Set<PluginType> getType() {
-            Set<PluginType> set = new HashSet<>();
-            set.add(CATEGORY.TRANSFORMER);
+        public Set<Category> getType() {
+            Set<Category> set = new HashSet<>();
+            set.add(Category.TRANSFORMER);
             return Collections.unmodifiableSet(set);
         }
 
--- a/jdk/test/tools/jlink/JLinkOptimTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/JLinkOptimTest.java	Tue May 17 05:38:15 2016 -0700
@@ -23,15 +23,15 @@
 import jdk.internal.org.objectweb.asm.tree.MethodNode;
 import jdk.internal.org.objectweb.asm.tree.TryCatchBlockNode;
 import jdk.tools.jlink.internal.PluginRepository;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.internal.plugins.OptimizationPlugin;
 import jdk.tools.jlink.internal.plugins.asm.AsmModulePool;
 import jdk.tools.jlink.internal.plugins.asm.AsmPlugin;
 import jdk.tools.jlink.internal.plugins.asm.AsmPools;
 import jdk.tools.jlink.internal.plugins.optim.ControlFlow;
 import jdk.tools.jlink.internal.plugins.optim.ControlFlow.Block;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 
 import tests.Helper;
 import tests.JImageGenerator;
@@ -134,9 +134,9 @@
         }
 
         @Override
-        public Set<PluginType> getType() {
-            Set<PluginType> set = new HashSet<>();
-            set.add(CATEGORY.TRANSFORMER);
+        public Set<Category> getType() {
+            Set<Category> set = new HashSet<>();
+            set.add(Category.TRANSFORMER);
             return Collections.unmodifiableSet(set);
         }
     }
@@ -150,13 +150,13 @@
         FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
         Path root = fs.getPath("/modules/java.base");
         // Access module-info.class to be reused as fake module-info.class
-        List<ModuleData> javabaseResources = new ArrayList<>();
+        List<ModuleEntry> javabaseResources = new ArrayList<>();
         try (Stream<Path> stream = Files.walk(root)) {
             for (Iterator<Path> iterator = stream.iterator(); iterator.hasNext();) {
                 Path p = iterator.next();
                 if (Files.isRegularFile(p)) {
                     try {
-                        javabaseResources.add(Pool.newResource(p.toString().
+                        javabaseResources.add(ModuleEntry.create(p.toString().
                                 substring("/modules".length()), Files.readAllBytes(p)));
                     } catch (Exception ex) {
                         throw new RuntimeException(ex);
@@ -166,18 +166,18 @@
         }
 
         //forName folding
-        PoolImpl pool = new PoolImpl();
+        ModulePoolImpl pool = new ModulePoolImpl();
         byte[] content = Files.readAllBytes(classes.
                 resolve("optim").resolve("ForNameTestCase.class"));
         byte[] content2 = Files.readAllBytes(classes.
                 resolve("optim").resolve("AType.class"));
         byte[] mcontent = Files.readAllBytes(classes.resolve("module-info.class"));
 
-        pool.add(Pool.newResource("/optimplugin/optim/ForNameTestCase.class", content));
-        pool.add(Pool.newResource("/optimplugin/optim/AType.class", content2));
-        pool.add(Pool.newResource("/optimplugin/module-info.class", mcontent));
+        pool.add(ModuleEntry.create("/optimplugin/optim/ForNameTestCase.class", content));
+        pool.add(ModuleEntry.create("/optimplugin/optim/AType.class", content2));
+        pool.add(ModuleEntry.create("/optimplugin/module-info.class", mcontent));
 
-        for (ModuleData r : javabaseResources) {
+        for (ModuleEntry r : javabaseResources) {
             pool.add(r);
         }
 
@@ -186,10 +186,10 @@
         optional.put(OptimizationPlugin.NAME, OptimizationPlugin.FORNAME_REMOVAL);
         optional.put(OptimizationPlugin.LOG, "forName.log");
         plugin.configure(optional);
-        Pool out = new PoolImpl();
+        ModulePool out = new ModulePoolImpl();
         plugin.visit(pool, out);
 
-        ModuleData result = out.getContent().iterator().next();
+        ModuleEntry result = out.entries().iterator().next();
 
         ClassReader optimReader = new ClassReader(result.getBytes());
         ClassNode optimClass = new ClassNode();
--- a/jdk/test/tools/jlink/JLinkOptionsTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/JLinkOptionsTest.java	Tue May 17 05:38:15 2016 -0700
@@ -24,7 +24,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.internal.PluginRepository;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
@@ -62,7 +62,7 @@
         }
 
         @Override
-        public void visit(Pool in, Pool out) {
+        public void visit(ModulePool in, ModulePool out) {
 
         }
 
--- a/jdk/test/tools/jlink/JLinkPostProcessingTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/JLinkPostProcessingTest.java	Tue May 17 05:38:15 2016 -0700
@@ -75,9 +75,9 @@
         }
 
         @Override
-        public Set<PluginType> getType() {
-            Set<PluginType> set = new HashSet<>();
-            set.add(CATEGORY.PROCESSOR);
+        public Set<Category> getType() {
+            Set<Category> set = new HashSet<>();
+            set.add(Category.PROCESSOR);
             return Collections.unmodifiableSet(set);
         }
 
--- a/jdk/test/tools/jlink/ResourcePoolTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/ResourcePoolTest.java	Tue May 17 05:38:15 2016 -0700
@@ -37,14 +37,14 @@
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Optional;
 import java.util.Set;
-
-import jdk.tools.jlink.internal.PoolImpl;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.Module;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
-import jdk.tools.jlink.plugin.Pool.ModuleDataType;
-import jdk.tools.jlink.plugin.Pool.Visitor;
+import java.util.function.Function;
+import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.LinkModule;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 
 public class ResourcePoolTest {
 
@@ -61,54 +61,53 @@
     private static final String SUFFIX = "END";
 
     private void checkResourceVisitor() throws Exception {
-        Pool input = new PoolImpl();
+        ModulePool input = new ModulePoolImpl();
         for (int i = 0; i < 1000; ++i) {
             String module = "/module" + (i / 10);
             String resourcePath = module + "/java/package" + i;
             byte[] bytes = resourcePath.getBytes();
-            input.add(new ModuleData(module, resourcePath,
-                    ModuleDataType.CLASS_OR_RESOURCE,
+            input.add(ModuleEntry.create(module, resourcePath,
+                    ModuleEntry.Type.CLASS_OR_RESOURCE,
                     new ByteArrayInputStream(bytes), bytes.length));
         }
-        Pool output = new PoolImpl();
+        ModulePool output = new ModulePoolImpl();
         ResourceVisitor visitor = new ResourceVisitor();
-        input.visit(visitor, output);
+        input.transformAndCopy(visitor, output);
         if (visitor.getAmountBefore() == 0) {
             throw new AssertionError("Resources not found");
         }
-        if (visitor.getAmountBefore() != input.getContent().size()) {
+        if (visitor.getAmountBefore() != input.getEntryCount()) {
             throw new AssertionError("Number of visited resources. Expected: " +
-                    visitor.getAmountBefore() + ", got: " + input.getContent().size());
+                    visitor.getAmountBefore() + ", got: " + input.getEntryCount());
         }
-        if (visitor.getAmountAfter() != output.getContent().size()) {
+        if (visitor.getAmountAfter() != output.getEntryCount()) {
             throw new AssertionError("Number of added resources. Expected: " +
-                    visitor.getAmountAfter() + ", got: " + output.getContent().size());
+                    visitor.getAmountAfter() + ", got: " + output.getEntryCount());
         }
-        for (ModuleData outResource : output.getContent()) {
+        output.entries().forEach(outResource -> {
             String path = outResource.getPath().replaceAll(SUFFIX + "$", "");
-            ModuleData inResource = input.get(path);
-            if (inResource == null) {
+            if (!input.findEntry(path).isPresent()) {
                 throw new AssertionError("Unknown resource: " + path);
             }
-        }
+        });
     }
 
-    private static class ResourceVisitor implements Visitor {
+    private static class ResourceVisitor implements Function<ModuleEntry, ModuleEntry> {
 
         private int amountBefore;
         private int amountAfter;
 
         @Override
-        public ModuleData visit(ModuleData resource) {
+        public ModuleEntry apply(ModuleEntry resource) {
             int index = ++amountBefore % 3;
             switch (index) {
                 case 0:
                     ++amountAfter;
-                    return new ModuleData(resource.getModule(), resource.getPath() + SUFFIX,
+                    return ModuleEntry.create(resource.getModule(), resource.getPath() + SUFFIX,
                             resource.getType(), resource.stream(), resource.getLength());
                 case 1:
                     ++amountAfter;
-                    return new ModuleData(resource.getModule(), resource.getPath(),
+                    return ModuleEntry.create(resource.getModule(), resource.getPath(),
                             resource.getType(), resource.stream(), resource.getLength());
             }
             return null;
@@ -133,8 +132,8 @@
         samples.add("javax/management/ObjectName");
         test(samples, (resources, module, path) -> {
             try {
-                resources.add(new ModuleData(module, path,
-                        ModuleDataType.CLASS_OR_RESOURCE,
+                resources.add(ModuleEntry.create(module, path,
+                        ModuleEntry.Type.CLASS_OR_RESOURCE,
                         new ByteArrayInputStream(new byte[0]), 0));
             } catch (Exception ex) {
                 throw new RuntimeException(ex);
@@ -142,12 +141,12 @@
         });
         test(samples, (resources, module, path) -> {
             try {
-                resources.add(PoolImpl.
-                        newCompressedResource(new ModuleData(module, path,
-                                ModuleDataType.CLASS_OR_RESOURCE,
+                resources.add(ModulePoolImpl.
+                        newCompressedResource(ModuleEntry.create(module, path,
+                                ModuleEntry.Type.CLASS_OR_RESOURCE,
                                 new ByteArrayInputStream(new byte[0]), 0),
                                 ByteBuffer.allocate(99), "bitcruncher", null,
-                                ((PoolImpl)resources).getStringTable(), ByteOrder.nativeOrder()));
+                                ((ModulePoolImpl)resources).getStringTable(), ByteOrder.nativeOrder()));
             } catch (Exception ex) {
                 throw new RuntimeException(ex);
             }
@@ -158,7 +157,7 @@
         if (samples.isEmpty()) {
             throw new AssertionError("No sample to test");
         }
-        Pool resources = new PoolImpl();
+        ModulePool resources = new ModulePoolImpl();
         Set<String> modules = new HashSet<>();
         for (int i = 0; i < samples.size(); i++) {
             String module = samples.get(i);
@@ -173,70 +172,69 @@
             i++;
             String clazz = samples.get(i);
             String path = "/" + module + "/" + clazz + ".class";
-            ModuleData res = resources.get(path);
-            checkModule(resources, res);
-            if (res == null) {
+            Optional<ModuleEntry> res = resources.findEntry(path);
+            if (!res.isPresent()) {
                 throw new AssertionError("Resource not found " + path);
             }
-            ModuleData res2 = resources.get(clazz);
-            if (res2 != null) {
+            checkModule(resources, res.get());
+            if (resources.findEntry(clazz).isPresent()) {
                 throw new AssertionError("Resource found " + clazz);
             }
         }
-        if (resources.getContent().size() != samples.size() / 2) {
+        if (resources.getEntryCount() != samples.size() / 2) {
             throw new AssertionError("Invalid number of resources");
         }
     }
 
-    private void checkModule(Pool resources, ModuleData res) {
-        Module m = resources.getModule(res.getModule());
-        if (m == null) {
+    private void checkModule(ModulePool resources, ModuleEntry res) {
+        Optional<LinkModule> optMod = resources.findModule(res.getModule());
+        if (!optMod.isPresent()) {
             throw new AssertionError("No module " + res.getModule());
         }
+        LinkModule m = optMod.get();
         if (!m.getName().equals(res.getModule())) {
             throw new AssertionError("Not right module name " + res.getModule());
         }
-        if (m.get(res.getPath()) == null) {
+        if (!m.findEntry(res.getPath()).isPresent()) {
             throw new AssertionError("resource " + res.getPath()
                     + " not in module " + m.getName());
         }
     }
 
     private void checkResourcesAfterCompression() throws Exception {
-        PoolImpl resources1 = new PoolImpl();
-        ModuleData res1 = new ModuleData("module1", "/module1/toto1",
-                ModuleDataType.CLASS_OR_RESOURCE,
+        ModulePoolImpl resources1 = new ModulePoolImpl();
+        ModuleEntry res1 = ModuleEntry.create("module1", "/module1/toto1",
+                ModuleEntry.Type.CLASS_OR_RESOURCE,
                 new ByteArrayInputStream(new byte[0]), 0);
-        ModuleData res2 = new ModuleData("module2", "/module2/toto1",
-                ModuleDataType.CLASS_OR_RESOURCE,
+        ModuleEntry res2 = ModuleEntry.create("module2", "/module2/toto1",
+                ModuleEntry.Type.CLASS_OR_RESOURCE,
                 new ByteArrayInputStream(new byte[0]), 0);
         resources1.add(res1);
         resources1.add(res2);
 
         checkResources(resources1, res1, res2);
-        Pool resources2 = new PoolImpl();
-        ModuleData res3 = new ModuleData("module2", "/module2/toto1",
-                ModuleDataType.CLASS_OR_RESOURCE,
+        ModulePool resources2 = new ModulePoolImpl();
+        ModuleEntry res3 = ModuleEntry.create("module2", "/module2/toto1",
+                ModuleEntry.Type.CLASS_OR_RESOURCE,
                 new ByteArrayInputStream(new byte[7]), 7);
         resources2.add(res3);
-        resources2.add(PoolImpl.newCompressedResource(res1,
+        resources2.add(ModulePoolImpl.newCompressedResource(res1,
                 ByteBuffer.allocate(7), "zip", null, resources1.getStringTable(),
                 ByteOrder.nativeOrder()));
         checkResources(resources2, res1, res2);
     }
 
-    private void checkResources(Pool resources, ModuleData... expected) {
-        Collection<Module> ms = resources.getModules();
+    private void checkResources(ModulePool resources, ModuleEntry... expected) {
         List<String> modules = new ArrayList();
-        for(Module m : ms) {
+        resources.modules().forEach(m -> {
             modules.add(m.getName());
-        }
-        for (ModuleData res : expected) {
+        });
+        for (ModuleEntry res : expected) {
             if (!resources.contains(res)) {
                 throw new AssertionError("Resource not found: " + res);
             }
 
-            if (resources.get(res.getPath()) == null) {
+            if (!resources.findEntry(res.getPath()).isPresent()) {
                 throw new AssertionError("Resource not found: " + res);
             }
 
@@ -244,7 +242,7 @@
                 throw new AssertionError("Module not found: " + res.getModule());
             }
 
-            if (!resources.getContent().contains(res)) {
+            if (!resources.contains(res)) {
                 throw new AssertionError("Resources not found: " + res);
             }
 
@@ -260,17 +258,17 @@
             throw new AssertionError("ReadOnly resources");
         }
 
-        ((PoolImpl) resources).setReadOnly();
+        ((ModulePoolImpl) resources).setReadOnly();
         try {
-            resources.add(new ModuleData("module2",  "/module2/toto1",
-                    ModuleDataType.CLASS_OR_RESOURCE, new ByteArrayInputStream(new byte[0]), 0));
-            throw new AssertionError("Pool is read-only, but an exception is not thrown");
+            resources.add(ModuleEntry.create("module2",  "/module2/toto1",
+                    ModuleEntry.Type.CLASS_OR_RESOURCE, new ByteArrayInputStream(new byte[0]), 0));
+            throw new AssertionError("ModulePool is read-only, but an exception is not thrown");
         } catch (Exception ex) {
             // Expected
         }
     }
 
     interface ResourceAdder {
-        void add(Pool resources, String module, String path);
+        void add(ModulePool resources, String module, String path);
     }
 }
--- a/jdk/test/tools/jlink/SecurityTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/SecurityTest.java	Tue May 17 05:38:15 2016 -0700
@@ -25,6 +25,7 @@
  * @test
  * @summary Test JlinkPermission
  * @author Jean-Francois Denise
+ * @modules jdk.jlink/jdk.tools.jlink
  * @run main/othervm SecurityTest
  */
 
--- a/jdk/test/tools/jlink/asmplugin/AddForgetResourcesTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/asmplugin/AddForgetResourcesTest.java	Tue May 17 05:38:15 2016 -0700
@@ -55,8 +55,8 @@
 import jdk.tools.jlink.internal.plugins.asm.AsmPool.WritableClassPool;
 import jdk.tools.jlink.internal.plugins.asm.AsmPool.WritableResourcePool;
 import jdk.tools.jlink.internal.plugins.asm.AsmPools;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 
 public class AddForgetResourcesTest extends AsmPluginTestBase {
 
@@ -82,7 +82,7 @@
                 new ComboPlugin()
         };
         for (TestPlugin p : plugins) {
-            Pool out = p.visit(getPool());
+            ModulePool out = p.visit(getPool());
             p.test(getPool(), out);
         }
     }
@@ -124,7 +124,7 @@
             AsmGlobalPool globalPool = pools.getGlobalPool();
             WritableClassPool transformedClasses = globalPool.getTransformedClasses();
             expected = globalPool.getClasses().size();
-            for (ModuleData res : globalPool.getClasses()) {
+            for (ModuleEntry res : globalPool.getClasses()) {
                 ClassReader reader = globalPool.getClassReader(res);
                 String className = reader.getClassName();
                 if (!className.endsWith("module-info")) {
@@ -137,14 +137,14 @@
         }
 
         @Override
-        public void test(Pool inResources, Pool outResources) {
-            Collection<ModuleData> inClasses = extractClasses(inResources);
-            Collection<ModuleData> outClasses = extractClasses(outResources);
+        public void test(ModulePool inResources, ModulePool outResources) {
+            Collection<ModuleEntry> inClasses = extractClasses(inResources);
+            Collection<ModuleEntry> outClasses = extractClasses(outResources);
             if (expected != outClasses.size()) {
                 throw new AssertionError("Classes were not added. Expected: " + expected
                         + ", got: " + outClasses.size());
             }
-            for (ModuleData in : inClasses) {
+            for (ModuleEntry in : inClasses) {
                 String path = in.getPath();
                 if (!outClasses.contains(in)) {
                     throw new AssertionError("Class not found: " + path);
@@ -153,7 +153,7 @@
                     continue;
                 }
                 String modifiedPath = path.replace(".class", SUFFIX + ".class");
-                if (!outClasses.contains(Pool.newResource(modifiedPath, new byte[0]))) {
+                if (!outClasses.contains(ModuleEntry.create(modifiedPath, new byte[0]))) {
                     throw new AssertionError("Class not found: " + modifiedPath);
                 }
             }
@@ -166,7 +166,7 @@
         public void visit() {
             AsmPools pools = getPools();
             AsmGlobalPool globalPool = pools.getGlobalPool();
-            for (ModuleData res : globalPool.getResourceFiles()) {
+            for (ModuleEntry res : globalPool.getResourceFiles()) {
                 String path = res.getPath();
                 String moduleName = getModule(path);
                 AsmModulePool modulePool = pools.getModulePool(moduleName);
@@ -177,20 +177,20 @@
         }
 
         @Override
-        public void test(Pool in, Pool out) throws Exception {
-            Collection<ModuleData> inResources = extractResources(in);
-            Collection<ModuleData> outResources = extractResources(out);
+        public void test(ModulePool in, ModulePool out) throws Exception {
+            Collection<ModuleEntry> inResources = extractResources(in);
+            Collection<ModuleEntry> outResources = extractResources(out);
             if (2 * inResources.size() != outResources.size()) {
                 throw new AssertionError("Classes were not added. Expected: " + (2 * inResources.size())
                         + ", got: " + outResources.size());
             }
-            for (ModuleData r : inResources) {
+            for (ModuleEntry r : inResources) {
                 String path = r.getPath();
                 if (!outResources.contains(r)) {
                     throw new AssertionError("Class not found: " + path);
                 }
                 String modifiedPath = path + SUFFIX;
-                if (!outResources.contains(Pool.newResource(modifiedPath, new byte[0]))) {
+                if (!outResources.contains(ModuleEntry.create(modifiedPath, new byte[0]))) {
                     throw new AssertionError("Class not found: " + modifiedPath);
                 }
             }
@@ -204,7 +204,7 @@
             AsmPools pools = getPools();
             AsmGlobalPool globalPool = pools.getGlobalPool();
             WritableClassPool transformedClasses = globalPool.getTransformedClasses();
-            for (ModuleData res : globalPool.getClasses()) {
+            for (ModuleEntry res : globalPool.getClasses()) {
                 ClassReader reader = globalPool.getClassReader(res);
                 ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_FRAMES);
                 reader.accept(new AddMethodClassVisitor(writer), ClassReader.EXPAND_FRAMES);
@@ -213,14 +213,14 @@
         }
 
         @Override
-        public void test(Pool inResources, Pool outResources) throws Exception {
-            Collection<ModuleData> inClasses = extractClasses(inResources);
-            Collection<ModuleData> outClasses = extractClasses(outResources);
+        public void test(ModulePool inResources, ModulePool outResources) throws Exception {
+            Collection<ModuleEntry> inClasses = extractClasses(inResources);
+            Collection<ModuleEntry> outClasses = extractClasses(outResources);
             if (inClasses.size() != outClasses.size()) {
                 throw new AssertionError("Number of classes. Expected: " + (inClasses.size())
                         + ", got: " + outClasses.size());
             }
-            for (ModuleData out : outClasses) {
+            for (ModuleEntry out : outClasses) {
                 String path = out.getPath();
                 if (!inClasses.contains(out)) {
                     throw new AssertionError("Class not found: " + path);
@@ -248,7 +248,7 @@
         public void visit() {
             AsmPools pools = getPools();
             AsmGlobalPool globalPool = pools.getGlobalPool();
-            for (ModuleData res : globalPool.getResourceFiles()) {
+            for (ModuleEntry res : globalPool.getResourceFiles()) {
                 String path = res.getPath();
                 AsmModulePool modulePool = pools.getModulePool(getModule(path));
                 modulePool.getTransformedResourceFiles().addResourceFile(new ResourceFile(removeModule(path),
@@ -257,14 +257,14 @@
         }
 
         @Override
-        public void test(Pool in, Pool out) throws Exception {
-            Collection<ModuleData> inResources = extractResources(in);
-            Collection<ModuleData> outResources = extractResources(out);
+        public void test(ModulePool in, ModulePool out) throws Exception {
+            Collection<ModuleEntry> inResources = extractResources(in);
+            Collection<ModuleEntry> outResources = extractResources(out);
             if (inResources.size() != outResources.size()) {
                 throw new AssertionError("Number of resources. Expected: " + inResources.size()
                         + ", got: " + outResources.size());
             }
-            for (ModuleData r : outResources) {
+            for (ModuleEntry r : outResources) {
                 String path = r.getPath();
                 if (!inResources.contains(r)) {
                     throw new AssertionError("Resource not found: " + path);
@@ -287,7 +287,7 @@
             AsmGlobalPool globalPool = pools.getGlobalPool();
             WritableClassPool transformedClasses = globalPool.getTransformedClasses();
             int i = 0;
-            for (ModuleData res : globalPool.getClasses()) {
+            for (ModuleEntry res : globalPool.getClasses()) {
                 String path = removeModule(res.getPath());
                 String className = path.replace(".class", "");
                 if ((i & 1) == 0 && !className.endsWith("module-info")) {
@@ -300,8 +300,8 @@
         }
 
         @Override
-        public void test(Pool inResources, Pool outResources) throws Exception {
-            Collection<ModuleData> outClasses = extractClasses(outResources);
+        public void test(ModulePool inResources, ModulePool outResources) throws Exception {
+            Collection<ModuleEntry> outClasses = extractClasses(outResources);
             if (expected != outClasses.size()) {
                 throw new AssertionError("Number of classes. Expected: " + expected +
                         ", got: " + outClasses.size());
@@ -318,7 +318,7 @@
             AsmPools pools = getPools();
             AsmGlobalPool globalPool = pools.getGlobalPool();
             int i = 0;
-            for (ModuleData res : globalPool.getResourceFiles()) {
+            for (ModuleEntry res : globalPool.getResourceFiles()) {
                 String path = res.getPath();
                 if (!path.contains("META-INF/services")) {
                     if ((i & 1) == 0) {
@@ -335,8 +335,8 @@
         }
 
         @Override
-        public void test(Pool in, Pool out) throws Exception {
-            Collection<ModuleData> outResources = extractResources(out);
+        public void test(ModulePool in, ModulePool out) throws Exception {
+            Collection<ModuleEntry> outResources = extractResources(out);
             if (expectedAmount != outResources.size()) {
                 throw new AssertionError("Number of classes. Expected: " + expectedAmount
                         + ", got: " + outResources.size());
@@ -354,7 +354,7 @@
             AsmGlobalPool globalPool = pools.getGlobalPool();
             WritableClassPool transformedClasses = globalPool.getTransformedClasses();
             int i = 0;
-            for (ModuleData res : globalPool.getClasses()) {
+            for (ModuleEntry res : globalPool.getClasses()) {
                 ClassReader reader = globalPool.getClassReader(res);
                 String className = reader.getClassName();
                 ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_FRAMES);
@@ -374,8 +374,8 @@
         }
 
         @Override
-        public void test(Pool inResources, Pool outResources) throws Exception {
-            Collection<ModuleData> outClasses = extractClasses(outResources);
+        public void test(ModulePool inResources, ModulePool outResources) throws Exception {
+            Collection<ModuleEntry> outClasses = extractClasses(outResources);
             if (expected != outClasses.size()) {
                 throw new AssertionError("Number of classes. Expected: " + expected
                         + ", got: " + outClasses.size());
@@ -392,7 +392,7 @@
             AsmPools pools = getPools();
             AsmGlobalPool globalPool = pools.getGlobalPool();
             int i = 0;
-            for (ModuleData res : globalPool.getResourceFiles()) {
+            for (ModuleEntry res : globalPool.getResourceFiles()) {
                 String path = res.getPath();
                 String moduleName = getModule(path);
                 if (!path.contains("META-INF")) {
@@ -412,8 +412,8 @@
         }
 
         @Override
-        public void test(Pool inResources, Pool out) throws Exception {
-            Collection<ModuleData> outResources = extractResources(out);
+        public void test(ModulePool inResources, ModulePool out) throws Exception {
+            Collection<ModuleEntry> outResources = extractResources(out);
             if (expectedAmount != outResources.size()) {
                 throw new AssertionError("Number of classes. Expected: " + expectedAmount
                         + ", got: " + outResources.size());
@@ -446,7 +446,7 @@
         }
 
         @Override
-        public void test(Pool inResources, Pool outResources) throws Exception {
+        public void test(ModulePool inResources, ModulePool outResources) throws Exception {
             if (!isVisitCalled()) {
                 throw new AssertionError("Resources not visited");
             }
@@ -455,7 +455,7 @@
                 throw new AssertionError("Number of transformed classes not equal to expected");
             }
             // Check that only renamed classes and resource files are in the result.
-            for (ModuleData r : outResources.getContent()) {
+            outResources.entries().forEach(r -> {
                 String resourceName = r.getPath();
                 if (resourceName.endsWith(".class") && !resourceName.endsWith("module-info.class")) {
                     if (!resourceName.endsWith(SUFFIX + ".class")) {
@@ -467,7 +467,7 @@
                         throw new AssertionError("Resource file not renamed " + resourceName);
                     }
                 }
-            }
+            });
         }
 
         private void renameResources() throws IOException {
@@ -476,7 +476,7 @@
             for (Map.Entry<String, List<String>> mod : MODULES.entrySet()) {
                 String moduleName = mod.getKey();
                 AsmModulePool modulePool = pools.getModulePool(moduleName);
-                for (ModuleData res : modulePool.getResourceFiles()) {
+                for (ModuleEntry res : modulePool.getResourceFiles()) {
                     ResourceFile resFile = modulePool.getResourceFile(res);
                     if (resFile.getPath().startsWith("META-INF/services/")) {
                         String newContent = new String(resFile.getContent()) + SUFFIX;
@@ -492,7 +492,7 @@
             AsmPools pools = getPools();
             AsmGlobalPool globalPool = pools.getGlobalPool();
             WritableClassPool transformedClasses = globalPool.getTransformedClasses();
-            for (ModuleData res : globalPool.getClasses()) {
+            for (ModuleEntry res : globalPool.getClasses()) {
                 if (res.getPath().endsWith("module-info.class")) {
                     continue;
                 }
--- a/jdk/test/tools/jlink/asmplugin/AsmPluginTestBase.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/asmplugin/AsmPluginTestBase.java	Tue May 17 05:38:15 2016 -0700
@@ -38,23 +38,23 @@
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.internal.StringTable;
 
 import jdk.tools.jlink.internal.plugins.asm.AsmPlugin;
 import jdk.tools.jlink.internal.plugins.asm.AsmPools;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 
 public abstract class AsmPluginTestBase {
 
     protected static final String TEST_MODULE = "jlink.test";
     protected static final Map<String, List<String>> MODULES;
 
-    private static final Predicate<ModuleData> isClass = r -> r.getPath().endsWith(".class");
+    private static final Predicate<ModuleEntry> isClass = r -> r.getPath().endsWith(".class");
     private final List<String> classes;
     private final List<String> resources;
-    private final Pool pool;
+    private final ModulePool pool;
 
     static {
         Map<String, List<String>> map = new HashMap<>();
@@ -75,7 +75,7 @@
             List<String> classes = new ArrayList<>();
             List<String> resources = new ArrayList<>();
 
-            pool = new PoolImpl();
+            pool = new ModulePoolImpl();
 
             FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
             Path root = fs.getPath("/modules");
@@ -100,7 +100,7 @@
                                     MODULES.get(module).add(toResourceFile(p));
                                 }
                                 resources.add(toPath(p.toString()));
-                                ModuleData res = Pool.newResource(toPath(p.toString()), content);
+                                ModuleEntry res = ModuleEntry.create(toPath(p.toString()), content);
                                 pool.add(res);
                             } catch (Exception ex) {
                                 throw new RuntimeException(ex);
@@ -110,17 +110,17 @@
                 }
             }
             // There is more than 10 classes in java.base...
-            if (classes.size() < 10 || pool.getContent().size() < 10) {
+            if (classes.size() < 10 || pool.getEntryCount() < 10) {
                 throw new AssertionError("Not expected resource or class number");
             }
 
             //Add a fake resource file
             String content = "java.lang.Object";
             String path = "META-INF/services/com.foo.BarProvider";
-            ModuleData resFile = Pool.newResource("/" + TEST_MODULE + "/" +
+            ModuleEntry resFile = ModuleEntry.create("/" + TEST_MODULE + "/" +
                     path, content.getBytes());
             pool.add(resFile);
-            ModuleData fakeInfoFile = Pool.newResource("/" + TEST_MODULE
+            ModuleEntry fakeInfoFile = ModuleEntry.create("/" + TEST_MODULE
                     + "/module-info.class", moduleInfos.get(0));
             pool.add(fakeInfoFile);
             MODULES.get(TEST_MODULE).add(path);
@@ -144,20 +144,20 @@
         return resources;
     }
 
-    public Pool getPool() {
+    public ModulePool getPool() {
         return pool;
     }
 
     public abstract void test() throws Exception;
 
-    public Collection<ModuleData> extractClasses(Pool pool) {
-        return pool.getContent().stream()
+    public Collection<ModuleEntry> extractClasses(ModulePool pool) {
+        return pool.entries()
                 .filter(isClass)
                 .collect(Collectors.toSet());
     }
 
-    public Collection<ModuleData> extractResources(Pool pool) {
-        return pool.getContent().stream()
+    public Collection<ModuleEntry> extractResources(ModulePool pool) {
+        return pool.entries()
                 .filter(isClass.negate())
                 .collect(Collectors.toSet());
     }
@@ -209,9 +209,9 @@
             return pools != null;
         }
 
-        public Pool visit(Pool inResources) throws IOException {
+        public ModulePool visit(ModulePool inResources) throws IOException {
             try {
-                Pool outResources = new PoolImpl(inResources.getByteOrder(), new StringTable() {
+                ModulePool outResources = new ModulePoolImpl(inResources.getByteOrder(), new StringTable() {
                     @Override
                     public int addString(String str) {
                         return -1;
@@ -239,7 +239,7 @@
         }
 
         public abstract void visit();
-        public abstract void test(Pool inResources, Pool outResources) throws Exception;
+        public abstract void test(ModulePool inResources, ModulePool outResources) throws Exception;
 
         @Override
         public String getName() {
--- a/jdk/test/tools/jlink/asmplugin/BasicTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/asmplugin/BasicTest.java	Tue May 17 05:38:15 2016 -0700
@@ -45,8 +45,8 @@
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.tools.jlink.internal.plugins.asm.AsmModulePool;
 import jdk.tools.jlink.internal.plugins.asm.AsmPool;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 
 public class BasicTest extends AsmPluginTestBase {
 
@@ -61,7 +61,7 @@
     @Override
     public void test() throws Exception {
         BasicPlugin basicPlugin = new BasicPlugin(getClasses());
-        Pool res = basicPlugin.visit(getPool());
+        ModulePool res = basicPlugin.visit(getPool());
         basicPlugin.test(getPool(), res);
     }
 
@@ -107,13 +107,13 @@
         }
 
         @Override
-        public void test(Pool inResources, Pool outResources) throws Exception {
+        public void test(ModulePool inResources, ModulePool outResources) throws Exception {
             if (!isVisitCalled()) {
                 throw new AssertionError("Resources not visited");
             }
-            if (inResources.getContent().size() != outResources.getContent().size()) {
-                throw new AssertionError("Input size " + inResources.getContent().size() +
-                        " != to " + outResources.getContent().size());
+            if (inResources.getEntryCount() != outResources.getEntryCount()) {
+                throw new AssertionError("Input size " + inResources.getEntryCount() +
+                        " != to " + outResources.getEntryCount());
             }
         }
 
@@ -142,7 +142,7 @@
 
         private void testPools() throws IOException {
             Set<String> remain = new HashSet<>(classes);
-            for (ModuleData res : getPools().getGlobalPool().getClasses()) {
+            for (ModuleEntry res : getPools().getGlobalPool().getClasses()) {
                 ClassReader reader = getPools().getGlobalPool().getClassReader(res);
                 String className = reader.getClassName();
                 // Wrong naming of module-info.class in ASM
--- a/jdk/test/tools/jlink/asmplugin/IdentityPluginTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/asmplugin/IdentityPluginTest.java	Tue May 17 05:38:15 2016 -0700
@@ -35,14 +35,15 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.UncheckedIOException;
 
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.internal.org.objectweb.asm.ClassVisitor;
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.Opcodes;
 import jdk.tools.jlink.internal.plugins.asm.AsmPool.WritableClassPool;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 
 public class IdentityPluginTest extends AsmPluginTestBase {
 
@@ -56,7 +57,7 @@
 
     public void test() throws Exception {
         IdentityPlugin asm = new IdentityPlugin();
-        Pool resourcePool = asm.visit(getPool());
+        ModulePool resourcePool = asm.visit(getPool());
         asm.test(getPool(), resourcePool);
     }
 
@@ -64,7 +65,7 @@
 
         @Override
         public void visit() {
-            for (ModuleData res : getPools().getGlobalPool().getClasses()) {
+            for (ModuleEntry res : getPools().getGlobalPool().getClasses()) {
                 if (res.getPath().endsWith("module-info.class")) {
                     continue;
                 }
@@ -77,7 +78,7 @@
         }
 
         @Override
-        public void test(Pool inResources, Pool outResources) throws IOException {
+        public void test(ModulePool inResources, ModulePool outResources) throws IOException {
             if (outResources.isEmpty()) {
                 throw new AssertionError("Empty result");
             }
@@ -93,13 +94,17 @@
                     throw new AssertionError("Class not transformed " + className);
                 }
             }
-            for (ModuleData r : outResources.getContent()) {
+            outResources.entries().forEach(r -> {
                 if (r.getPath().endsWith(".class") && !r.getPath().endsWith("module-info.class")) {
-                    ClassReader reader = new ClassReader(new ByteArrayInputStream(r.getBytes()));
-                    ClassWriter w = new ClassWriter(reader, ClassWriter.COMPUTE_FRAMES);
-                    reader.accept(w, ClassReader.EXPAND_FRAMES);
+                    try {
+                        ClassReader reader = new ClassReader(new ByteArrayInputStream(r.getBytes()));
+                        ClassWriter w = new ClassWriter(reader, ClassWriter.COMPUTE_FRAMES);
+                        reader.accept(w, ClassReader.EXPAND_FRAMES);
+                    } catch (IOException exp) {
+                        throw new UncheckedIOException(exp);
+                    }
                 }
-            }
+            });
         }
 
         @Override
--- a/jdk/test/tools/jlink/asmplugin/NegativeTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/asmplugin/NegativeTest.java	Tue May 17 05:38:15 2016 -0700
@@ -43,7 +43,7 @@
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.Opcodes;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.internal.StringTable;
 import jdk.tools.jlink.internal.plugins.asm.AsmGlobalPool;
 import jdk.tools.jlink.internal.plugins.asm.AsmModulePool;
@@ -51,7 +51,7 @@
 import jdk.tools.jlink.internal.plugins.asm.AsmPool.ResourceFile;
 import jdk.tools.jlink.internal.plugins.asm.AsmPools;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModulePool;
 
 public class NegativeTest extends AsmPluginTestBase {
     public static void main(String[] args) throws Exception {
@@ -102,7 +102,7 @@
                 }
             }
         };
-        Pool resources = new PoolImpl(ByteOrder.BIG_ENDIAN, new StringTable() {
+        ModulePool resources = new ModulePoolImpl(ByteOrder.BIG_ENDIAN, new StringTable() {
             @Override
             public int addString(String str) {
                 return -1;
@@ -136,7 +136,7 @@
                 action(() -> pools.fillOutputResources(null), "Output resource is null", NullPointerException.class);
             }
         };
-        Pool resources = new PoolImpl(ByteOrder.BIG_ENDIAN, new StringTable() {
+        ModulePool resources = new ModulePoolImpl(ByteOrder.BIG_ENDIAN, new StringTable() {
             @Override
             public int addString(String str) {
                 return -1;
--- a/jdk/test/tools/jlink/asmplugin/PackageMappingTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/asmplugin/PackageMappingTest.java	Tue May 17 05:38:15 2016 -0700
@@ -48,8 +48,8 @@
 import jdk.tools.jlink.internal.plugins.asm.AsmPool.ResourceFile;
 import jdk.tools.jlink.internal.plugins.asm.AsmPool.WritableResourcePool;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 
 public class PackageMappingTest extends AsmPluginTestBase {
 
@@ -72,7 +72,7 @@
             new PackageMappingPlugin(newFiles, true)
         };
         for (TestPlugin p : plugins) {
-            Pool pool = p.visit(getPool());
+            ModulePool pool = p.visit(getPool());
             p.test(getPool(), pool);
         }
     }
@@ -105,12 +105,12 @@
         }
 
         @Override
-        public void test(Pool inResources, Pool outResources) {
+        public void test(ModulePool inResources, ModulePool outResources) {
             Set<String> in = getPools().getGlobalPool().getResourceFiles().stream()
-                    .map(ModuleData::getPath)
+                    .map(ModuleEntry::getPath)
                     .collect(Collectors.toSet());
             Set<String> out = extractResources(outResources).stream()
-                    .map(ModuleData::getPath)
+                    .map(ModuleEntry::getPath)
                     .collect(Collectors.toSet());
             in.addAll(PackageMappingTest.this.newFiles);
             if (!Objects.equals(in, out)) {
--- a/jdk/test/tools/jlink/asmplugin/SortingTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/asmplugin/SortingTest.java	Tue May 17 05:38:15 2016 -0700
@@ -35,12 +35,13 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 import jdk.tools.jlink.internal.plugins.asm.AsmModulePool;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 
 public class SortingTest extends AsmPluginTestBase {
 
@@ -66,7 +67,7 @@
         List<String> sorted = new ArrayList<>(getResources());
         sorted.sort(null);
         ClassSorterPlugin sorterPlugin = new ClassSorterPlugin(sorted);
-        Pool resourcePool = sorterPlugin.visit(getPool());
+        ModulePool resourcePool = sorterPlugin.visit(getPool());
         sorterPlugin.test(getPool(), resourcePool);
     }
 
@@ -78,7 +79,7 @@
         List<String> sorted = new ArrayList<>(getResources());
         sorted.sort((s1, s2) -> -getModuleName(s1).compareTo(getModuleName(s2)));
         ModuleSorterPlugin sorterPlugin = new ModuleSorterPlugin();
-        Pool resourcePool = sorterPlugin.visit(getPool());
+        ModulePool resourcePool = sorterPlugin.visit(getPool());
         sorterPlugin.test(getPool(), resourcePool);
     }
 
@@ -88,8 +89,8 @@
         public void visit() {
             for (AsmModulePool modulePool : getPools().getModulePools()) {
                 modulePool.setSorter(resources -> {
-                    List<String> sort = resources.getContent().stream()
-                            .map(ModuleData::getPath)
+                    List<String> sort = resources.entries()
+                            .map(ModuleEntry::getPath)
                             .collect(Collectors.toList());
                     sort.sort(null);
                     return sort;
@@ -102,21 +103,21 @@
         }
 
         @Override
-        public void test(Pool inResources, Pool outResources) throws Exception {
+        public void test(ModulePool inResources, ModulePool outResources) throws Exception {
             if (!isVisitCalled()) {
                 throw new AssertionError("Resources not visited");
             }
-            List<String> sortedResourcePaths = outResources.getContent().stream()
-                    .map(ModuleData::getPath)
+            List<String> sortedResourcePaths = outResources.entries()
+                    .map(ModuleEntry::getPath)
                     .collect(Collectors.toList());
 
             List<String> defaultResourceOrder = new ArrayList<>();
-            for (ModuleData r : inResources.getContent()) {
-                if (!inResources.getContent().contains(r)) {
+            inResources.entries().forEach(r -> {
+                if (!inResources.contains(r)) {
                     throw new AssertionError("Resource " + r.getPath() + " not in result pool");
                 }
                 defaultResourceOrder.add(r.getPath());
-            }
+            });
             // Check that default sorting is not equal to sorted one
             if (defaultResourceOrder.equals(sortedResourcePaths)) {
                 throw new AssertionError("Sorting not applied, default ordering");
@@ -147,27 +148,28 @@
         public void visit() {
             getPools().getGlobalPool().setSorter(
                     (resources) -> expectedClassesOrder.stream()
-                            .map(resources::get)
-                            .map(ModuleData::getPath)
+                            .map(resources::findEntry)
+                            .map(Optional::get)
+                            .map(ModuleEntry::getPath)
                             .collect(Collectors.toList()));
         }
 
         @Override
-        public void test(Pool inResources, Pool outResources) throws Exception {
+        public void test(ModulePool inResources, ModulePool outResources) throws Exception {
             if (!isVisitCalled()) {
                 throw new AssertionError("Resources not visited");
             }
-            List<String> sortedResourcePaths = outResources.getContent().stream()
-                    .map(ModuleData::getPath)
+            List<String> sortedResourcePaths = outResources.entries()
+                    .map(ModuleEntry::getPath)
                     .collect(Collectors.toList());
 
             List<String> defaultResourceOrder = new ArrayList<>();
-            for (ModuleData r : getPool().getContent()) {
-                if (!getPool().getContent().contains(r)) {
+            getPool().entries().forEach(r -> {
+                if (!getPool().contains(r)) {
                     throw new AssertionError("Resource " + r.getPath() + " not in result pool");
                 }
                 defaultResourceOrder.add(r.getPath());
-            }
+            });
             // Check that default sorting is not equal to sorted one
             if (defaultResourceOrder.equals(sortedResourcePaths)) {
                 throw new AssertionError("Sorting not applied, default ordering");
--- a/jdk/test/tools/jlink/asmplugin/VisitorTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/asmplugin/VisitorTest.java	Tue May 17 05:38:15 2016 -0700
@@ -46,8 +46,8 @@
 import jdk.tools.jlink.internal.plugins.asm.AsmPool.ResourceFile;
 import jdk.tools.jlink.internal.plugins.asm.AsmPool.ResourceFileVisitor;
 import jdk.tools.jlink.internal.plugins.asm.AsmPools;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 
 public class VisitorTest extends AsmPluginTestBase {
 
@@ -69,7 +69,7 @@
         };
         for (TestPlugin p : plugins) {
             System.err.println("Testing: " + p.getName());
-            Pool out = p.visit(getPool());
+            ModulePool out = p.visit(getPool());
             p.test(getPool(), out);
         }
     }
@@ -149,15 +149,15 @@
         }
 
         @Override
-        public void test(Pool in, Pool out) throws Exception {
-            Collection<ModuleData> inClasses = getPool.apply(getPools()).getClasses();
+        public void test(ModulePool in, ModulePool out) throws Exception {
+            Collection<ModuleEntry> inClasses = getPool.apply(getPools()).getClasses();
             if (inClasses.size() != classReaderVisitor.getAmount()) {
                 throw new AssertionError("Testing " + name + ". Number of visited classes. Expected: " +
                         inClasses.size() + ", got: " + classReaderVisitor.getAmount());
             }
-            Collection<ModuleData> outClasses = extractClasses(out);
+            Collection<ModuleEntry> outClasses = extractClasses(out);
             int changedClasses = 0;
-            for (ModuleData r : outClasses) {
+            for (ModuleEntry r : outClasses) {
                 if (r.getPath().endsWith("Changed.class")) {
                     ++changedClasses;
                 }
@@ -192,15 +192,15 @@
         }
 
         @Override
-        public void test(Pool in, Pool out) throws Exception {
-            Collection<ModuleData> inResources = getPool.apply(getPools()).getResourceFiles();
+        public void test(ModulePool in, ModulePool out) throws Exception {
+            Collection<ModuleEntry> inResources = getPool.apply(getPools()).getResourceFiles();
             if (inResources.size() != resourceFileVisitor.getAmount()) {
                 throw new AssertionError("Testing " + name + ". Number of visited resources. Expected: " +
                         inResources.size() + ", got: " + resourceFileVisitor.getAmount());
             }
-            Collection<ModuleData> outResources = extractResources(out);
+            Collection<ModuleEntry> outResources = extractResources(out);
             int changedClasses = 0;
-            for (ModuleData r : outResources) {
+            for (ModuleEntry r : outResources) {
                 if (r.getPath().endsWith("Changed")) {
                     ++changedClasses;
                 }
--- a/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -26,7 +26,9 @@
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-import jdk.tools.jlink.plugin.Pool;
+import java.util.function.Function;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 public class CustomPlugin implements TransformerPlugin {
@@ -37,13 +39,8 @@
     }
 
     @Override
-    public void visit(Pool in, Pool out) {
-        in.visit(new Pool.Visitor() {
-            @Override
-            public Pool.ModuleData visit(Pool.ModuleData content) {
-                return content;
-            }
-        }, out);
+    public void visit(ModulePool in, ModulePool out) {
+        in.transformAndCopy(Function.identity(), out);
     }
 
     @Override
@@ -61,9 +58,9 @@
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.PROCESSOR);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.PROCESSOR);
         return Collections.unmodifiableSet(set);
     }
 }
--- a/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java	Tue May 17 05:38:15 2016 -0700
@@ -29,8 +29,8 @@
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 /**
@@ -49,23 +49,23 @@
     }
 
     @Override
-    public void visit(Pool inResources, Pool outResources) {
+    public void visit(ModulePool inResources, ModulePool outResources) {
         try {
             System.out.println("Hello!!!!!!!!!!");
             File f = new File(OUTPUT_FILE);
             f.createNewFile();
-            for (ModuleData res : inResources.getContent()) {
+            inResources.entries().forEach(res -> {
                 outResources.add(res);
-            }
+            });
         } catch (IOException ex) {
             throw new UncheckedIOException(ex);
         }
     }
 
     @Override
-    public Set<PluginType> getType() {
-        Set<PluginType> set = new HashSet<>();
-        set.add(CATEGORY.TRANSFORMER);
+    public Set<Category> getType() {
+        Set<Category> set = new HashSet<>();
+        set.add(Category.TRANSFORMER);
         return Collections.unmodifiableSet(set);
     }
 
--- a/jdk/test/tools/jlink/plugins/CompressorPluginTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/CompressorPluginTest.java	Tue May 17 05:38:15 2016 -0700
@@ -53,14 +53,14 @@
 import jdk.internal.jimage.decompressor.ResourceDecompressorFactory;
 import jdk.internal.jimage.decompressor.StringSharingDecompressorFactory;
 import jdk.internal.jimage.decompressor.ZipDecompressorFactory;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.internal.StringTable;
 import jdk.tools.jlink.internal.plugins.DefaultCompressPlugin;
 import jdk.tools.jlink.internal.plugins.StringSharingPlugin;
 import jdk.tools.jlink.internal.plugins.ZipPlugin;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 public class CompressorPluginTest {
@@ -86,7 +86,7 @@
                     new ZipDecompressorFactory()
                 });
 
-        Pool classes = gatherClasses(javabase);
+        ModulePool classes = gatherClasses(javabase);
         // compress = String sharing
         checkCompress(classes, new StringSharingPlugin(), null,
                 new ResourceDecompressorFactory[]{
@@ -173,8 +173,8 @@
                 Collections.singletonList(".*IOException.class"));
     }
 
-    private Pool gatherResources(Path module) throws Exception {
-        Pool pool = new PoolImpl(ByteOrder.nativeOrder(), new StringTable() {
+    private ModulePool gatherResources(Path module) throws Exception {
+        ModulePool pool = new ModulePoolImpl(ByteOrder.nativeOrder(), new StringTable() {
 
             @Override
             public int addString(String str) {
@@ -191,15 +191,15 @@
                 Path p = iterator.next();
                 if (Files.isRegularFile(p)) {
                     byte[] content = Files.readAllBytes(p);
-                    pool.add(Pool.newResource(p.toString(), content));
+                    pool.add(ModuleEntry.create(p.toString(), content));
                 }
             }
         }
         return pool;
     }
 
-    private Pool gatherClasses(Path module) throws Exception {
-        Pool pool = new PoolImpl(ByteOrder.nativeOrder(), new StringTable() {
+    private ModulePool gatherClasses(Path module) throws Exception {
+        ModulePool pool = new ModulePoolImpl(ByteOrder.nativeOrder(), new StringTable() {
 
             @Override
             public int addString(String str) {
@@ -216,27 +216,27 @@
                 Path p = iterator.next();
                 if (Files.isRegularFile(p) && p.toString().endsWith(".class")) {
                     byte[] content = Files.readAllBytes(p);
-                    pool.add(Pool.newResource(p.toString(), content));
+                    pool.add(ModuleEntry.create(p.toString(), content));
                 }
             }
         }
         return pool;
     }
 
-    private void checkCompress(Pool resources, Plugin prov,
+    private void checkCompress(ModulePool resources, Plugin prov,
             Properties config,
             ResourceDecompressorFactory[] factories) throws Exception {
         checkCompress(resources, prov, config, factories, Collections.emptyList(), Collections.emptyList());
     }
 
-    private void checkCompress(Pool resources, Plugin prov,
+    private void checkCompress(ModulePool resources, Plugin prov,
             Properties config,
             ResourceDecompressorFactory[] factories,
             List<String> includes,
             List<String> excludes) throws Exception {
-        long original = 0;
-        long compressed = 0;
-        for (ModuleData resource : resources.getContent()) {
+        long[] original = new long[1];
+        long[] compressed = new long[1];
+        resources.entries().forEach(resource -> {
             List<Pattern> includesPatterns = includes.stream()
                     .map(Pattern::compile)
                     .collect(Collectors.toList());
@@ -252,7 +252,7 @@
             }
             prov.configure(props);
             final Map<Integer, String> strings = new HashMap<>();
-            PoolImpl inputResources = new PoolImpl(ByteOrder.nativeOrder(), new StringTable() {
+            ModulePoolImpl inputResources = new ModulePoolImpl(ByteOrder.nativeOrder(), new StringTable() {
                 @Override
                 public int addString(String str) {
                     int id = strID;
@@ -267,32 +267,32 @@
                 }
             });
             inputResources.add(resource);
-            Pool compressedResources = applyCompressor(prov, inputResources, resource, includesPatterns, excludesPatterns);
-            original += resource.getLength();
-            compressed += compressedResources.get(resource.getPath()).getLength();
+            ModulePool compressedResources = applyCompressor(prov, inputResources, resource, includesPatterns, excludesPatterns);
+            original[0] += resource.getLength();
+            compressed[0] += compressedResources.findEntry(resource.getPath()).get().getLength();
             applyDecompressors(factories, inputResources, compressedResources, strings, includesPatterns, excludesPatterns);
-        }
+        });
         String compressors = Stream.of(factories)
                 .map(Object::getClass)
                 .map(Class::getSimpleName)
                 .collect(Collectors.joining(", "));
-        String size = "Compressed size: " + compressed + ", original size: " + original;
+        String size = "Compressed size: " + compressed[0] + ", original size: " + original[0];
         System.out.println("Used " + compressors + ". " + size);
-        if (original <= compressed) {
+        if (original[0] <= compressed[0]) {
             throw new AssertionError("java.base not compressed.");
         }
     }
 
-    private Pool applyCompressor(Plugin plugin,
-            PoolImpl inputResources,
-            ModuleData res,
+    private ModulePool applyCompressor(Plugin plugin,
+            ModulePoolImpl inputResources,
+            ModuleEntry res,
             List<Pattern> includesPatterns,
-            List<Pattern> excludesPatterns) throws Exception {
+            List<Pattern> excludesPatterns) {
         TransformerPlugin compressor = (TransformerPlugin) plugin;
-        Pool compressedPool = new PoolImpl(ByteOrder.nativeOrder(), inputResources.getStringTable());
-        compressor.visit(inputResources, compressedPool);
+        ModulePool compressedModulePool = new ModulePoolImpl(ByteOrder.nativeOrder(), inputResources.getStringTable());
+        compressor.visit(inputResources, compressedModulePool);
         String path = res.getPath();
-        ModuleData compressed = compressedPool.get(path);
+        ModuleEntry compressed = compressedModulePool.findEntry(path).get();
         CompressedResourceHeader header
                 = CompressedResourceHeader.readFromResource(ByteOrder.nativeOrder(), compressed.getBytes());
         if (isIncluded(includesPatterns, excludesPatterns, path)) {
@@ -310,29 +310,33 @@
         } else if (header != null) {
             throw new AssertionError("Path should not be compressed: " + path);
         }
-        return compressedPool;
+        return compressedModulePool;
     }
 
     private void applyDecompressors(ResourceDecompressorFactory[] decompressors,
-            Pool inputResources,
-            Pool compressedResources,
+            ModulePool inputResources,
+            ModulePool compressedResources,
             Map<Integer, String> strings,
             List<Pattern> includesPatterns,
-            List<Pattern> excludesPatterns) throws Exception {
-        for (ModuleData compressed : compressedResources.getContent()) {
+            List<Pattern> excludesPatterns) {
+        compressedResources.entries().forEach(compressed -> {
             CompressedResourceHeader header = CompressedResourceHeader.readFromResource(
                     ByteOrder.nativeOrder(), compressed.getBytes());
             String path = compressed.getPath();
-            ModuleData orig = inputResources.get(path);
+            ModuleEntry orig = inputResources.findEntry(path).get();
             if (!isIncluded(includesPatterns, excludesPatterns, path)) {
-                continue;
+                return;
             }
             byte[] decompressed = compressed.getBytes();
             for (ResourceDecompressorFactory factory : decompressors) {
-                ResourceDecompressor decompressor = factory.newDecompressor(new Properties());
-                decompressed = decompressor.decompress(
+                try {
+                    ResourceDecompressor decompressor = factory.newDecompressor(new Properties());
+                    decompressed = decompressor.decompress(
                         strings::get, decompressed,
                         CompressedResourceHeader.getSize(), header.getUncompressedSize());
+                } catch (Exception exp) {
+                    throw new RuntimeException(exp);
+                }
             }
 
             if (decompressed.length != orig.getLength()) {
@@ -345,7 +349,7 @@
                     throw new AssertionError("Decompressed and original differ at index " + i);
                 }
             }
-        }
+        });
     }
 
     private boolean isIncluded(List<Pattern> includesPatterns, List<Pattern> excludesPatterns, String path) {
--- a/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java	Tue May 17 05:38:15 2016 -0700
@@ -35,12 +35,11 @@
 import java.nio.file.Files;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 
 import jdk.tools.jlink.internal.plugins.ExcludeFilesPlugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
-import jdk.tools.jlink.plugin.Pool.ModuleDataType;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 public class ExcludeFilesPluginTest {
@@ -73,20 +72,20 @@
         prop.put(ExcludeFilesPlugin.NAME, s);
         ExcludeFilesPlugin fplug = new ExcludeFilesPlugin();
         fplug.configure(prop);
-        PoolImpl files = new PoolImpl();
-        PoolImpl fresult = new PoolImpl();
-        ModuleData f = Pool.newImageFile(module, "/" + module + "/" + sample,
-                ModuleDataType.CONFIG, new ByteArrayInputStream(new byte[0]), 0);
+        ModulePoolImpl files = new ModulePoolImpl();
+        ModulePoolImpl fresult = new ModulePoolImpl();
+        ModuleEntry f = ModuleEntry.create(module, "/" + module + "/" + sample,
+                ModuleEntry.Type.CONFIG, new ByteArrayInputStream(new byte[0]), 0);
         files.add(f);
 
         fplug.visit(files, fresult);
 
         if (exclude) {
-            if (fresult.getContent().contains(f)) {
+            if (fresult.contains(f)) {
                 throw new Exception(sample + " should be excluded by " + s);
             }
         } else {
-            if (!fresult.getContent().contains(f)) {
+            if (!fresult.contains(f)) {
                 throw new Exception(sample + " shouldn't be excluded by " + s);
             }
         }
--- a/jdk/test/tools/jlink/plugins/ExcludePluginTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/ExcludePluginTest.java	Tue May 17 05:38:15 2016 -0700
@@ -34,11 +34,11 @@
 import java.nio.file.Files;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 
 import jdk.tools.jlink.internal.plugins.ExcludePlugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 
 public class ExcludePluginTest {
 
@@ -75,17 +75,17 @@
         prop.put(ExcludePlugin.NAME, s);
         ExcludePlugin excludePlugin = new ExcludePlugin();
         excludePlugin.configure(prop);
-        Pool resources = new PoolImpl();
-        ModuleData resource = Pool.newResource(sample, new byte[0]);
+        ModulePool resources = new ModulePoolImpl();
+        ModuleEntry resource = ModuleEntry.create(sample, new byte[0]);
         resources.add(resource);
-        Pool result = new PoolImpl();
+        ModulePool result = new ModulePoolImpl();
         excludePlugin.visit(resources, result);
         if (exclude) {
-            if (result.getContent().contains(resource)) {
+            if (result.contains(resource)) {
                 throw new AssertionError(sample + " should be excluded by " + s);
             }
         } else {
-            if (!result.getContent().contains(resource)) {
+            if (!result.contains(resource)) {
                 throw new AssertionError(sample + " shouldn't be excluded by " + s);
             }
         }
--- a/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java	Tue May 17 05:38:15 2016 -0700
@@ -32,13 +32,12 @@
 import java.io.ByteArrayInputStream;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 
 import jdk.tools.jlink.internal.plugins.ExcludeVMPlugin;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
-import jdk.tools.jlink.plugin.Pool.ModuleDataType;
+import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ModuleEntry;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 public class ExcludeVMPluginTest {
@@ -165,14 +164,14 @@
     private void doCheckVM(String vm, String[] input, String jvmcfg, String[] expectedOutput, String expectdJvmCfg) throws Exception {
         // Create a pool with jvm.cfg and the input paths.
         byte[] jvmcfgContent = jvmcfg.getBytes();
-        Pool pool = new PoolImpl();
-        pool.add(Pool.newImageFile("java.base", "/java.base/native/jvm.cfg",
-                ModuleDataType.NATIVE_LIB, new ByteArrayInputStream(jvmcfgContent), jvmcfgContent.length));
+        ModulePool pool = new ModulePoolImpl();
+        pool.add(ModuleEntry.create("java.base", "/java.base/native/jvm.cfg",
+                ModuleEntry.Type.NATIVE_LIB, new ByteArrayInputStream(jvmcfgContent), jvmcfgContent.length));
         for (String in : input) {
-            pool.add(Pool.newImageFile("java.base", in,
-                    ModuleDataType.NATIVE_LIB, new ByteArrayInputStream(new byte[0]), 0));
+            pool.add(ModuleEntry.create("java.base", in,
+                    ModuleEntry.Type.NATIVE_LIB, new ByteArrayInputStream(new byte[0]), 0));
         }
-        Pool out = new PoolImpl();
+        ModulePool out = new ModulePoolImpl();
 
         TransformerPlugin p = new ExcludeVMPlugin();
         Map<String, String> config = new HashMap<>();
@@ -182,22 +181,22 @@
         p.configure(config);
         p.visit(pool, out);
 
-        String newContent = new String(out.get("/java.base/native/jvm.cfg").stream().readAllBytes());
+        String newContent = new String(out.findEntry("/java.base/native/jvm.cfg").get().stream().readAllBytes());
 
         if (!expectdJvmCfg.equals(newContent)) {
             throw new Exception("Got content " + newContent + " expected " + expectdJvmCfg);
         }
 
-        if (out.getContent().size() != (expectedOutput.length + 1)) {
-            for (ModuleData m : out.getContent()) {
+        if (out.getEntryCount() != (expectedOutput.length + 1)) {
+            out.entries().forEach(m -> {
                 System.err.println(m.getPath());
-            }
-            throw new Exception("Invalid output size " + out.getContent().size() + " expected " + (expectedOutput.length + 1));
+            });
+            throw new Exception("Invalid output size " + out.getEntryCount() + " expected " + (expectedOutput.length + 1));
         }
 
-        for (ModuleData md : out.getContent()) {
+        out.entries().forEach(md -> {
             if (md.getPath().equals("/java.base/native/jvm.cfg")) {
-                continue;
+                return;
             }
             boolean contained = false;
             for (String o : expectedOutput) {
@@ -207,9 +206,9 @@
                 }
             }
             if (!contained) {
-                throw new Exception(md.getPath() + " not expected");
+                throw new RuntimeException(md.getPath() + " not expected");
             }
-        }
+        });
 
     }
 
--- a/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java	Tue May 17 05:38:15 2016 -0700
@@ -26,6 +26,7 @@
  * @summary Test files copy plugin
  * @author Jean-Francois Denise
  * @modules jdk.jlink/jdk.tools.jlink.internal
+ *          jdk.jlink/jdk.tools.jlink.builder
  *          jdk.jlink/jdk.tools.jlink.internal.plugins
  * @run main FileCopierPluginTest
  */
@@ -36,13 +37,12 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.builder.DefaultImageBuilder;
 
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
-import jdk.tools.jlink.plugin.Pool.ModuleDataType;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 
 public class FileCopierPluginTest {
 
@@ -85,21 +85,20 @@
         Map<String, String> conf = new HashMap<>();
         conf.put(FileCopierPlugin.NAME, builder.toString());
         plug.configure(conf);
-        Pool pool = new PoolImpl();
-        plug.visit(new PoolImpl(), pool);
-        if (pool.getContent().size() != expected) {
+        ModulePool pool = new ModulePoolImpl();
+        plug.visit(new ModulePoolImpl(), pool);
+        if (pool.getEntryCount() != expected) {
             throw new AssertionError("Wrong number of added files");
         }
-        for (ModuleData f : pool.getContent()) {
-            if (!f.getType().equals(ModuleDataType.OTHER)) {
+        pool.entries().forEach(f -> {
+            if (!f.getType().equals(ModuleEntry.Type.OTHER)) {
                 throw new AssertionError("Invalid type " + f.getType()
                         + " for file " + f.getPath());
             }
             if (f.stream() == null) {
                 throw new AssertionError("Null stream for file " + f.getPath());
             }
-
-        }
+        });
         Path root = new File(".").toPath();
         DefaultImageBuilder imgbuilder = new DefaultImageBuilder(root);
         imgbuilder.storeFiles(pool);
--- a/jdk/test/tools/jlink/plugins/LastSorterTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/LastSorterTest.java	Tue May 17 05:38:15 2016 -0700
@@ -26,6 +26,7 @@
  * @summary Test last sorter property
  * @author Jean-Francois Denise
  * @modules jdk.jlink/jdk.tools.jlink.internal
+ *          jdk.jlink/jdk.tools.jlink
  * @run main/othervm LastSorterTest
  */
 
@@ -40,12 +41,12 @@
 import jdk.tools.jlink.internal.ImagePluginConfiguration;
 import jdk.tools.jlink.internal.PluginRepository;
 import jdk.tools.jlink.internal.ImagePluginStack;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.Jlink;
 import jdk.tools.jlink.Jlink.PluginsConfiguration;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 public class LastSorterTest {
@@ -80,7 +81,7 @@
         ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(config);
 
         // check order
-        PoolImpl res = fillOutResourcePool();
+        ModulePoolImpl res = fillOutResourceModulePool();
 
         try {
             stack.visitResources(res);
@@ -91,18 +92,18 @@
         }
     }
 
-    private PoolImpl fillOutResourcePool() throws Exception {
-        PoolImpl res = new PoolImpl();
-        res.add(Pool.newResource("/eee/bbb/res1.class", new byte[90]));
-        res.add(Pool.newResource("/aaaa/bbb/res2.class", new byte[90]));
-        res.add(Pool.newResource("/bbb/aa/res1.class", new byte[90]));
-        res.add(Pool.newResource("/aaaa/bbb/res3.class", new byte[90]));
-        res.add(Pool.newResource("/bbb/aa/res2.class", new byte[90]));
-        res.add(Pool.newResource("/fff/bbb/res1.class", new byte[90]));
-        res.add(Pool.newResource("/aaaa/bbb/res1.class", new byte[90]));
-        res.add(Pool.newResource("/bbb/aa/res3.class", new byte[90]));
-        res.add(Pool.newResource("/ccc/bbb/res1.class", new byte[90]));
-        res.add(Pool.newResource("/ddd/bbb/res1.class", new byte[90]));
+    private ModulePoolImpl fillOutResourceModulePool() throws Exception {
+        ModulePoolImpl res = new ModulePoolImpl();
+        res.add(ModuleEntry.create("/eee/bbb/res1.class", new byte[90]));
+        res.add(ModuleEntry.create("/aaaa/bbb/res2.class", new byte[90]));
+        res.add(ModuleEntry.create("/bbb/aa/res1.class", new byte[90]));
+        res.add(ModuleEntry.create("/aaaa/bbb/res3.class", new byte[90]));
+        res.add(ModuleEntry.create("/bbb/aa/res2.class", new byte[90]));
+        res.add(ModuleEntry.create("/fff/bbb/res1.class", new byte[90]));
+        res.add(ModuleEntry.create("/aaaa/bbb/res1.class", new byte[90]));
+        res.add(ModuleEntry.create("/bbb/aa/res3.class", new byte[90]));
+        res.add(ModuleEntry.create("/ccc/bbb/res1.class", new byte[90]));
+        res.add(ModuleEntry.create("/ddd/bbb/res1.class", new byte[90]));
         return res;
     }
 
@@ -124,7 +125,7 @@
         ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(config);
 
         // check order
-        PoolImpl res = fillOutResourcePool();
+        ModulePoolImpl res = fillOutResourceModulePool();
 
         stack.visitResources(res);
     }
@@ -159,7 +160,7 @@
         ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(config);
 
         // check order
-        PoolImpl res = fillOutResourcePool();
+        ModulePoolImpl res = fillOutResourceModulePool();
         try {
             stack.visitResources(res);
             throw new AssertionError("Order was changed after the last sorter, but no exception occurred");
@@ -178,17 +179,17 @@
         }
 
         @Override
-        public void visit(Pool resources, Pool output) {
-            List<ModuleData> paths = new ArrayList<>();
-            for (ModuleData res : resources.getContent()) {
+        public void visit(ModulePool resources, ModulePool output) {
+            List<ModuleEntry> paths = new ArrayList<>();
+            resources.entries().forEach(res -> {
                 if (res.getPath().startsWith(starts)) {
                     paths.add(0, res);
                 } else {
                     paths.add(res);
                 }
-            }
+            });
 
-            for (ModuleData r : paths) {
+            for (ModuleEntry r : paths) {
                 output.add(r);
             }
         }
@@ -199,9 +200,9 @@
         }
 
         @Override
-        public Set<PluginType> getType() {
-            Set<PluginType> set = new HashSet<>();
-            set.add(CATEGORY.TRANSFORMER);
+        public Set<Category> getType() {
+            Set<Category> set = new HashSet<>();
+            set.add(Category.TRANSFORMER);
             return Collections.unmodifiableSet(set);
         }
 
--- a/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java	Tue May 17 05:38:15 2016 -0700
@@ -36,11 +36,12 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.tools.jlink.internal.PoolImpl;
+import java.util.stream.Collectors;
 
+import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.internal.plugins.OrderResourcesPlugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 public class OrderResourcesPluginTest {
@@ -50,52 +51,52 @@
     }
 
     public void test() throws Exception {
-        ModuleData[] array = {
-                Pool.newResource("/module1/toto1.class", new byte[0]),
-                Pool.newResource("/module2/toto2.class", new byte[0]),
-                Pool.newResource("/module3/toto3.class", new byte[0]),
-                Pool.newResource("/module3/toto3/module-info.class", new byte[0]),
-                Pool.newResource("/zazou/toto.class", new byte[0]),
-                Pool.newResource("/module4/zazou.class", new byte[0]),
-                Pool.newResource("/module5/toto5.class", new byte[0]),
-                Pool.newResource("/module6/toto6/module-info.class", new byte[0])
+        ModuleEntry[] array = {
+                ModuleEntry.create("/module1/toto1.class", new byte[0]),
+                ModuleEntry.create("/module2/toto2.class", new byte[0]),
+                ModuleEntry.create("/module3/toto3.class", new byte[0]),
+                ModuleEntry.create("/module3/toto3/module-info.class", new byte[0]),
+                ModuleEntry.create("/zazou/toto.class", new byte[0]),
+                ModuleEntry.create("/module4/zazou.class", new byte[0]),
+                ModuleEntry.create("/module5/toto5.class", new byte[0]),
+                ModuleEntry.create("/module6/toto6/module-info.class", new byte[0])
         };
 
-        ModuleData[] sorted = {
-                Pool.newResource("/zazou/toto.class", new byte[0]),
-                Pool.newResource("/module3/toto3/module-info.class", new byte[0]),
-                Pool.newResource("/module6/toto6/module-info.class", new byte[0]),
-                Pool.newResource("/module1/toto1.class", new byte[0]),
-                Pool.newResource("/module2/toto2.class", new byte[0]),
-                Pool.newResource("/module3/toto3.class", new byte[0]),
-                Pool.newResource("/module4/zazou.class", new byte[0]),
-                Pool.newResource("/module5/toto5.class", new byte[0])
+        ModuleEntry[] sorted = {
+                ModuleEntry.create("/zazou/toto.class", new byte[0]),
+                ModuleEntry.create("/module3/toto3/module-info.class", new byte[0]),
+                ModuleEntry.create("/module6/toto6/module-info.class", new byte[0]),
+                ModuleEntry.create("/module1/toto1.class", new byte[0]),
+                ModuleEntry.create("/module2/toto2.class", new byte[0]),
+                ModuleEntry.create("/module3/toto3.class", new byte[0]),
+                ModuleEntry.create("/module4/zazou.class", new byte[0]),
+                ModuleEntry.create("/module5/toto5.class", new byte[0])
         };
 
-        ModuleData[] sorted2 = {
-            Pool.newResource("/module5/toto5.class", new byte[0]),
-            Pool.newResource("/module6/toto6/module-info.class", new byte[0]),
-            Pool.newResource("/module4/zazou.class", new byte[0]),
-            Pool.newResource("/module3/toto3.class", new byte[0]),
-            Pool.newResource("/module3/toto3/module-info.class", new byte[0]),
-            Pool.newResource("/module1/toto1.class", new byte[0]),
-            Pool.newResource("/module2/toto2.class", new byte[0]),
-            Pool.newResource("/zazou/toto.class", new byte[0])
+        ModuleEntry[] sorted2 = {
+            ModuleEntry.create("/module5/toto5.class", new byte[0]),
+            ModuleEntry.create("/module6/toto6/module-info.class", new byte[0]),
+            ModuleEntry.create("/module4/zazou.class", new byte[0]),
+            ModuleEntry.create("/module3/toto3.class", new byte[0]),
+            ModuleEntry.create("/module3/toto3/module-info.class", new byte[0]),
+            ModuleEntry.create("/module1/toto1.class", new byte[0]),
+            ModuleEntry.create("/module2/toto2.class", new byte[0]),
+            ModuleEntry.create("/zazou/toto.class", new byte[0])
         };
 
-        Pool resources = new PoolImpl();
-        for (ModuleData r : array) {
+        ModulePool resources = new ModulePoolImpl();
+        for (ModuleEntry r : array) {
             resources.add(r);
         }
 
         {
-            Pool out = new PoolImpl();
+            ModulePool out = new ModulePoolImpl();
             Map<String, String> config = new HashMap<>();
             config.put(OrderResourcesPlugin.NAME, "/zazou/*,*/module-info.class");
             TransformerPlugin p = new OrderResourcesPlugin();
             p.configure(config);
             p.visit(resources, out);
-            check(out.getContent(), sorted);
+            check(out.entries().collect(Collectors.toList()), sorted);
         }
 
         {
@@ -112,26 +113,26 @@
             }
             Files.write(order.toPath(), builder.toString().getBytes());
 
-            Pool out = new PoolImpl();
+            ModulePool out = new ModulePoolImpl();
             Map<String, String> config = new HashMap<>();
             config.put(OrderResourcesPlugin.NAME, "@" + order.getAbsolutePath());
             TransformerPlugin p = new OrderResourcesPlugin();
             p.configure(config);
             p.visit(resources, out);
-            check(out.getContent(), sorted2);
+            check(out.entries().collect(Collectors.toList()), sorted2);
 
         }
     }
 
-    private void check(Collection<ModuleData> outResources,
-            ModuleData[] sorted) {
+    private void check(Collection<ModuleEntry> outResources,
+            ModuleEntry[] sorted) {
         if (outResources.size() != sorted.length) {
             throw new AssertionError("Wrong number of resources:\n"
                     + "expected: " + Arrays.toString(sorted) + ",\n"
                     + "     got: " + outResources);
         }
         int i = 0;
-        for (ModuleData r : outResources) {
+        for (ModuleEntry r : outResources) {
             System.err.println("Resource: " + r);
             if (!sorted[i].getPath().equals(r.getPath())) {
                 throw new AssertionError("Resource not properly sorted, difference at: " + i + "\n"
--- a/jdk/test/tools/jlink/plugins/PluginOrderTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/PluginOrderTest.java	Tue May 17 05:38:15 2016 -0700
@@ -44,8 +44,8 @@
 
 import jdk.tools.jlink.internal.PluginOrderingGraph;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.Plugin.CATEGORY;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.Plugin.Category;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 public class PluginOrderTest {
@@ -96,8 +96,8 @@
         set.add("plug2");
         List<Plugin> plugins = new ArrayList<>();
         plugins.add(new Plug("plug2", Collections.emptySet(), Collections.emptySet(),
-                CATEGORY.TRANSFORMER));
-        plugins.add(new Plug("plug1", set, Collections.emptySet(), CATEGORY.TRANSFORMER));
+                Category.TRANSFORMER));
+        plugins.add(new Plug("plug1", set, Collections.emptySet(), Category.TRANSFORMER));
         List<Plugin> ordered = PluginOrderingGraph.sort(plugins);
         if (ordered.get(0) != plugins.get(1) || ordered.get(1) != plugins.get(0)) {
             throw new Exception("Invalid sorting");
@@ -108,32 +108,32 @@
         Set<String> lst1 = new HashSet<>();
         lst1.add("plug2");
         lst1.add("plug3");
-        Plugin p1 = new Plug("plug1", lst1, Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p1 = new Plug("plug1", lst1, Collections.emptySet(), Category.TRANSFORMER);
 
-        Plugin p2 = new Plug("plug2", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p2 = new Plug("plug2", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER);
 
         Set<String> lst3 = new HashSet<>();
         lst3.add("plug4");
         lst3.add("plug6");
-        Plugin p3 = new Plug("plug3", lst3, Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p3 = new Plug("plug3", lst3, Collections.emptySet(), Category.TRANSFORMER);
 
-        Plugin p4 = new Plug("plug4", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p4 = new Plug("plug4", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER);
 
         Set<String> lst5 = new HashSet<>();
         lst5.add("plug3");
         lst5.add("plug1");
         lst5.add("plug2");
         lst5.add("plug6");
-        Plugin p5 = new Plug("plug5", lst5, Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p5 = new Plug("plug5", lst5, Collections.emptySet(), Category.TRANSFORMER);
 
         Set<String> lst6 = new HashSet<>();
         lst6.add("plug4");
         lst6.add("plug2");
-        Plugin p6 = new Plug("plug6", lst6, Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p6 = new Plug("plug6", lst6, Collections.emptySet(), Category.TRANSFORMER);
 
-        Plugin p7 = new Plug("plug7", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p7 = new Plug("plug7", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER);
 
-        Plugin p8 = new Plug("plug8", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p8 = new Plug("plug8", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER);
 
         List<Plugin> plugins = new ArrayList<>();
         plugins.add(p1);
@@ -153,11 +153,11 @@
         set2.add("plug1");
         List<Plugin> plugins = new ArrayList<>();
         plugins.add(new Plug("plug2", set2, Collections.emptySet(),
-                CATEGORY.TRANSFORMER));
+                Category.TRANSFORMER));
 
         Set<String> set1 = new HashSet<>();
         set1.add("plug2");
-        plugins.add(new Plug("plug1", set1, Collections.emptySet(), CATEGORY.TRANSFORMER));
+        plugins.add(new Plug("plug1", set1, Collections.emptySet(), Category.TRANSFORMER));
         PluginOrderingGraph.sort(plugins);
 
     }
@@ -166,31 +166,31 @@
         Set<String> lst1 = new HashSet<>();
         lst1.add("plug2");
         lst1.add("plug3");
-        Plugin p1 = new Plug("plug1", lst1, Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p1 = new Plug("plug1", lst1, Collections.emptySet(), Category.TRANSFORMER);
 
-        Plugin p2 = new Plug("plug2", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p2 = new Plug("plug2", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER);
 
         Set<String> lst3 = new HashSet<>();
         lst3.add("plug4");
         lst3.add("plug6");
-        Plugin p3 = new Plug("plug3", lst3, Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p3 = new Plug("plug3", lst3, Collections.emptySet(), Category.TRANSFORMER);
 
-        Plugin p4 = new Plug("plug4", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p4 = new Plug("plug4", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER);
 
         Set<String> lst5 = new HashSet<>();
         lst5.add("plug3");
         lst5.add("plug1");
         lst5.add("plug2");
-        Plugin p5 = new Plug("plug5", lst5, Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p5 = new Plug("plug5", lst5, Collections.emptySet(), Category.TRANSFORMER);
 
         Set<String> lst6 = new HashSet<>();
         lst6.add("plug4");
         lst6.add("plug1");
-        Plugin p6 = new Plug("plug6", lst6, Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p6 = new Plug("plug6", lst6, Collections.emptySet(), Category.TRANSFORMER);
 
-        Plugin p7 = new Plug("plug7", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p7 = new Plug("plug7", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER);
 
-        Plugin p8 = new Plug("plug8", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p8 = new Plug("plug8", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER);
 
         List<Plugin> plugins = new ArrayList<>();
         plugins.add(p1);
@@ -208,8 +208,8 @@
         Set<String> lst1 = new HashSet<>();
         lst1.add("plug2");
         lst1.add("plug3");
-        Plugin p = new Plug("plug1", lst1, Collections.emptySet(), CATEGORY.TRANSFORMER);
-        Plugin p2 = new Plug("plug2", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER);
+        Plugin p = new Plug("plug1", lst1, Collections.emptySet(), Category.TRANSFORMER);
+        Plugin p2 = new Plug("plug2", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER);
 
         Set<String> lst3 = new HashSet<>();
         lst3.add("plug2");
@@ -217,7 +217,7 @@
         Set<String> lst4 = new HashSet<>();
         lst4.add("plug1");
 
-        Plugin p3 = new Plug("plug3", lst4, lst3, CATEGORY.TRANSFORMER);
+        Plugin p3 = new Plug("plug3", lst4, lst3, Category.TRANSFORMER);
         List<Plugin> plugins = new ArrayList<>();
         plugins.add(p);
         plugins.add(p2);
@@ -229,10 +229,10 @@
 
         private final Set<String> isBefore;
         private final Set<String> isAfter;
-        private final CATEGORY category;
+        private final Category category;
         private final String name;
 
-        private Plug(String name, Set<String> isBefore, Set<String> isAfter, CATEGORY category) {
+        private Plug(String name, Set<String> isBefore, Set<String> isAfter, Category category) {
             this.name = name;
             this.isBefore = isBefore;
             this.isAfter = isAfter;
@@ -255,12 +255,12 @@
         }
 
         @Override
-        public void visit(Pool in, Pool out) {
+        public void visit(ModulePool in, ModulePool out) {
 
         }
 
         @Override
-        public Set<PluginType> getType() {
+        public Set<Category> getType() {
             return Collections.singleton(category);
         }
 
--- a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java	Tue May 17 05:38:15 2016 -0700
@@ -26,6 +26,7 @@
  * @summary Negative test for ImagePluginStack.
  * @author Andrei Eremeev
  * @modules jdk.jlink/jdk.tools.jlink.internal
+ *          jdk.jlink/jdk.tools.jlink
  * @run main/othervm PluginsNegativeTest
  */
 import java.lang.reflect.Layer;
@@ -39,11 +40,12 @@
 import jdk.tools.jlink.internal.ImagePluginConfiguration;
 import jdk.tools.jlink.internal.PluginRepository;
 import jdk.tools.jlink.internal.ImagePluginStack;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.Jlink;
 import jdk.tools.jlink.Jlink.PluginsConfiguration;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 public class PluginsNegativeTest {
@@ -96,8 +98,8 @@
         plugins.add(createPlugin("plugin"));
         ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(new PluginsConfiguration(plugins,
                 null, null));
-        PoolImpl inResources = new PoolImpl();
-        inResources.add(Pool.newResource("/aaa/bbb/A", new byte[10]));
+        ModulePoolImpl inResources = new ModulePoolImpl();
+        inResources.add(ModuleEntry.create("/aaa/bbb/A", new byte[10]));
         try {
             stack.visitResources(inResources);
             throw new AssertionError("Exception expected when output resource is empty");
@@ -110,8 +112,8 @@
         plugins.add(createPlugin("plugin"));
         ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(new PluginsConfiguration(plugins,
                 null, null));
-        PoolImpl inResources = new PoolImpl();
-        PoolImpl outResources = (PoolImpl) stack.visitResources(inResources);
+        ModulePoolImpl inResources = new ModulePoolImpl();
+        ModulePoolImpl outResources = (ModulePoolImpl) stack.visitResources(inResources);
         if (!outResources.isEmpty()) {
             throw new AssertionError("Output resource is not empty");
         }
@@ -126,7 +128,7 @@
         }
 
         @Override
-        public void visit(Pool inResources, Pool outResources) {
+        public void visit(ModulePool inResources, ModulePool outResources) {
             // do nothing
         }
 
@@ -136,9 +138,9 @@
         }
 
         @Override
-        public Set<PluginType> getType() {
-            Set<PluginType> set = new HashSet<>();
-            set.add(CATEGORY.TRANSFORMER);
+        public Set<Category> getType() {
+            Set<Category> set = new HashSet<>();
+            set.add(Category.TRANSFORMER);
             return Collections.unmodifiableSet(set);
         }
 
--- a/jdk/test/tools/jlink/plugins/PrevisitorTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/PrevisitorTest.java	Tue May 17 05:38:15 2016 -0700
@@ -26,6 +26,7 @@
  * @summary Test previsitor
  * @author Andrei Eremeev
  * @modules jdk.jlink/jdk.tools.jlink.internal
+ *          jdk.jlink/jdk.tools.jlink
  * @run main/othervm PrevisitorTest
  */
 import java.nio.ByteOrder;
@@ -36,19 +37,20 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
 
 import jdk.tools.jlink.internal.ImagePluginConfiguration;
 import jdk.tools.jlink.internal.PluginRepository;
 import jdk.tools.jlink.internal.ImagePluginStack;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.internal.ResourcePrevisitor;
 import jdk.tools.jlink.internal.StringTable;
 import jdk.tools.jlink.Jlink;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 
 public class PrevisitorTest {
@@ -68,17 +70,17 @@
         plugins.add(createPlugin(CustomPlugin.NAME));
         ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(new Jlink.PluginsConfiguration(plugins,
                 null, null));
-        PoolImpl inResources = new PoolImpl(ByteOrder.nativeOrder(), new CustomStringTable());
-        inResources.add(Pool.newResource("/aaa/bbb/res1.class", new byte[90]));
-        inResources.add(Pool.newResource("/aaa/bbb/res2.class", new byte[90]));
-        inResources.add(Pool.newResource("/aaa/bbb/res3.class", new byte[90]));
-        inResources.add(Pool.newResource("/aaa/ddd/res1.class", new byte[90]));
-        inResources.add(Pool.newResource("/aaa/res1.class", new byte[90]));
-        Pool outResources = stack.visitResources(inResources);
-        Collection<String> input = inResources.getContent().stream()
+        ModulePoolImpl inResources = new ModulePoolImpl(ByteOrder.nativeOrder(), new CustomStringTable());
+        inResources.add(ModuleEntry.create("/aaa/bbb/res1.class", new byte[90]));
+        inResources.add(ModuleEntry.create("/aaa/bbb/res2.class", new byte[90]));
+        inResources.add(ModuleEntry.create("/aaa/bbb/res3.class", new byte[90]));
+        inResources.add(ModuleEntry.create("/aaa/ddd/res1.class", new byte[90]));
+        inResources.add(ModuleEntry.create("/aaa/res1.class", new byte[90]));
+        ModulePool outResources = stack.visitResources(inResources);
+        Collection<String> input = inResources.entries()
                 .map(Object::toString)
                 .collect(Collectors.toList());
-        Collection<String> output = outResources.getContent().stream()
+        Collection<String> output = outResources.entries()
                 .map(Object::toString)
                 .collect(Collectors.toList());
         if (!input.equals(output)) {
@@ -114,19 +116,20 @@
         private boolean isPrevisitCalled = false;
 
         @Override
-        public void visit(Pool inResources, Pool outResources) {
+        public void visit(ModulePool inResources, ModulePool outResources) {
             if (!isPrevisitCalled) {
                 throw new AssertionError("Previsit was not called");
             }
             CustomStringTable table = (CustomStringTable)
-                    ((PoolImpl) inResources).getStringTable();
+                    ((ModulePoolImpl) inResources).getStringTable();
             if (table.size() == 0) {
                 throw new AssertionError("Table is empty");
             }
             Map<String, Integer> count = new HashMap<>();
             for (int i = 0; i < table.size(); ++i) {
                 String s = table.getString(i);
-                if (inResources.get(s) != null) {
+                Optional<ModuleEntry> e = inResources.findEntry(s);
+                if (e.isPresent()) {
                     throw new AssertionError();
                 }
                 count.compute(s, (k, c) -> 1 + (c == null ? 0 : c));
@@ -136,9 +139,9 @@
                     throw new AssertionError("Expected one entry in the table, got: " + v + " for " + k);
                 }
             });
-            for (ModuleData r : inResources.getContent()) {
+            inResources.entries().forEach(r -> {
                 outResources.add(r);
-            }
+            });
         }
 
         @Override
@@ -147,21 +150,21 @@
         }
 
         @Override
-        public void previsit(Pool resources, StringTable strings) {
+        public void previsit(ModulePool resources, StringTable strings) {
             isPrevisitCalled = true;
-            for (ModuleData r : resources.getContent()) {
+            resources.entries().forEach(r -> {
                 String s = r.getPath();
                 int lastIndexOf = s.lastIndexOf('/');
                 if (lastIndexOf >= 0) {
                     strings.addString(s.substring(0, lastIndexOf));
                 }
-            }
+            });
         }
 
         @Override
-        public Set<PluginType> getType() {
-            Set<PluginType> set = new HashSet<>();
-            set.add(CATEGORY.TRANSFORMER);
+        public Set<Category> getType() {
+            Set<Category> set = new HashSet<>();
+            set.add(Category.TRANSFORMER);
             return Collections.unmodifiableSet(set);
         }
     }
--- a/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java	Tue May 17 05:38:15 2016 -0700
@@ -38,6 +38,8 @@
  * @run main StringSharingPluginTest
  */
 
+import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.nio.file.Files;
@@ -50,11 +52,11 @@
 
 import jdk.internal.jimage.decompressor.CompressedResourceHeader;
 import jdk.internal.jimage.decompressor.StringSharingDecompressor;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.internal.StringTable;
 import jdk.tools.jlink.internal.plugins.StringSharingPlugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 import tests.Helper;
 import tests.JImageValidator;
@@ -78,7 +80,7 @@
         Map<String, Integer> map = new HashMap<>();
         Map<Integer, String> reversedMap = new HashMap<>();
 
-        PoolImpl resources = new PoolImpl(ByteOrder.nativeOrder(), new StringTable() {
+        ModulePoolImpl resources = new ModulePoolImpl(ByteOrder.nativeOrder(), new StringTable() {
             @Override
             public int addString(String str) {
                 Integer id = map.get(str);
@@ -104,7 +106,7 @@
                     byte[] content = Files.readAllBytes(p);
                     String path = p.toString().replace('\\', '/');
                     path = path.substring("/modules".length());
-                    ModuleData res = Pool.newResource(path, content);
+                    ModuleEntry res = ModuleEntry.create(path, content);
                     resources.add(res);
                 } catch (Exception ex) {
                     throw new RuntimeException(ex);
@@ -115,19 +117,23 @@
             stream.forEach(c);
         }
         TransformerPlugin plugin = new StringSharingPlugin();
-        PoolImpl result = new PoolImpl(resources.getByteOrder(), resources.getStringTable());
+        ModulePoolImpl result = new ModulePoolImpl(resources.getByteOrder(), resources.getStringTable());
         plugin.visit(resources, result);
 
         if (result.isEmpty()) {
             throw new AssertionError("No result");
         }
 
-        for (ModuleData res : result.getContent()) {
+        result.entries().forEach(res -> {
             if (res.getPath().endsWith(".class")) {
-                byte[] uncompacted = StringSharingDecompressor.normalize(reversedMap::get, res.getBytes(),
+                try {
+                    byte[] uncompacted = StringSharingDecompressor.normalize(reversedMap::get, res.getBytes(),
                         CompressedResourceHeader.getSize());
-                JImageValidator.readClass(uncompacted);
+                    JImageValidator.readClass(uncompacted);
+                } catch (IOException exp) {
+                    throw new UncheckedIOException(exp);
+                }
             }
-        }
+        });
     }
 }
--- a/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java	Tue May 17 05:38:15 2016 -0700
@@ -54,10 +54,10 @@
 import com.sun.tools.classfile.Method;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.tools.jlink.internal.PoolImpl;
+import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.internal.plugins.StripDebugPlugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.Pool.ModuleData;
+import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 import tests.Helper;
 
@@ -106,7 +106,7 @@
         path = path.replace('\\', '/');
         StripDebugPlugin debug = new StripDebugPlugin();
         debug.configure(new HashMap<>());
-        ModuleData result1 = stripDebug(debug, Pool.newResource(path,content), path, infoPath, moduleInfo);
+        ModuleEntry result1 = stripDebug(debug, ModuleEntry.create(path,content), path, infoPath, moduleInfo);
 
         if (!path.endsWith("module-info.class")) {
             if (result1.getLength() >= content.length) {
@@ -116,7 +116,7 @@
             checkDebugAttributes(result1.getBytes());
         }
 
-        ModuleData result2 = stripDebug(debug, result1, path, infoPath, moduleInfo);
+        ModuleEntry result2 = stripDebug(debug, result1, path, infoPath, moduleInfo);
         if (result1.getLength() != result2.getLength()) {
             throw new AssertionError("removing debug info twice reduces class size of "
                     + path);
@@ -124,18 +124,18 @@
         checkDebugAttributes(result1.getBytes());
     }
 
-    private ModuleData stripDebug(TransformerPlugin debug, ModuleData classResource,
+    private ModuleEntry stripDebug(TransformerPlugin debug, ModuleEntry classResource,
             String path, String infoPath, byte[] moduleInfo) throws Exception {
-        Pool resources = new PoolImpl();
+        ModulePool resources = new ModulePoolImpl();
         resources.add(classResource);
         if (!path.endsWith("module-info.class")) {
-            ModuleData res2 = Pool.newResource(infoPath, moduleInfo);
+            ModuleEntry res2 = ModuleEntry.create(infoPath, moduleInfo);
             resources.add(res2);
         }
-        Pool results = new PoolImpl();
+        ModulePool results = new ModulePoolImpl();
         debug.visit(resources, results);
         System.out.println(classResource.getPath());
-        return results.get(classResource.getPath());
+        return results.findEntry(classResource.getPath()).get();
     }
 
     private void checkDebugAttributes(byte[] strippedClassFile) throws IOException, ConstantPoolException {
--- a/langtools/.hgtags	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/.hgtags	Tue May 17 05:38:15 2016 -0700
@@ -360,3 +360,4 @@
 31c8b18fdc5b94a2ddd5ea0694f350a2c907e9f7 jdk-9+115
 3e3553ee39d9e081573bc7c88a252214a3152763 jdk-9+116
 59adcdd0cd3b6724b4fc0083c258bf4682689f2f jdk-9+117
+59a16fa5dedea9ff5bea0a501e4d0d40193426f3 jdk-9+118
--- a/langtools/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 import java.io.IOException;
 import java.nio.file.Path;
 import java.util.Arrays;
+import java.util.Collection;
 
 import static javax.tools.FileManagerUtils.*;
 
@@ -176,7 +177,8 @@
     /**
      * Returns file objects representing the given paths.
      *
-     * <p>The default implementation converts each path to a file and calls
+     * @implSpec
+     * The default implementation converts each path to a file and calls
      * {@link #getJavaFileObjectsFromFiles getJavaObjectsFromFiles}.
      * IllegalArgumentException will be thrown if any of the paths
      * cannot be converted to a file.
@@ -280,10 +282,21 @@
      * Associates the given search path with the given location.  Any
      * previous value will be discarded.
      *
-     * <p>The default implementation converts each path to a file and calls
+     * @apiNote
+     * The type of the {@code paths} parameter is a {@code Collection}
+     * and not {@code Iterable}. This is to prevent the possibility of
+     * accidentally calling the method with a single {@code Path} as
+     * the second argument, because although {@code Path} implements
+     * {@code Iterable<Path>}, it would almost never be correct to call
+     * this method with a single {@code Path} and have it be treated as
+     * an {@code Iterable} of its components.
+     *
+     *
+     * @implSpec
+     * The default implementation converts each path to a file and calls
      * {@link #getJavaFileObjectsFromFiles getJavaObjectsFromFiles}.
      * IllegalArgumentException will be thrown if any of the paths
-     * cannot be converted to a file.</p>
+     * cannot be converted to a file.
      *
      * @param location a location
      * @param paths a list of paths, if {@code null} use the default
@@ -297,8 +310,8 @@
      *
      * @since 9
      */
-    default void setLocationFromPaths(Location location, Iterable<? extends Path> paths)
-        throws IOException {
+    default void setLocationFromPaths(Location location, Collection<? extends Path> paths)
+            throws IOException {
         setLocation(location, asFiles(paths));
     }
 
@@ -319,6 +332,11 @@
     /**
      * Returns the search path associated with the given location.
      *
+     * @implSpec
+     * The default implementation calls {@link #getLocation getLocation}
+     * and then returns an {@code Iterable} formed by calling {@code toPath()}
+     * on each {@code File} returned from {@code getLocation}.
+     *
      * @param location a location
      * @return a list of paths or {@code null} if this location has no
      * associated search path
@@ -337,8 +355,9 @@
      * {@link java.nio.file.Path Path} object. In such cases, this method may be
      * used to access that object.
      *
-     * <p>The default implementation throws {@link UnsupportedOperationException}
-     * for all files.</p>
+     * @implSpec
+     * The default implementation throws {@link UnsupportedOperationException}
+     * for all files.
      *
      * @param file a file object
      * @return a path representing the same underlying file system artifact
@@ -351,4 +370,36 @@
         throw new UnsupportedOperationException();
     }
 
+    /**
+     * Factory to create {@code Path} objects from strings.
+     *
+     * @since 9
+     */
+    interface PathFactory {
+        /**
+         * Converts a path string, or a sequence of strings that when joined form a path string, to a Path.
+         *
+         * @param first  the path string or initial part of the path string
+         * @param more   additional strings to be joined to form the path string
+         * @return       the resulting {@code Path}
+         */
+        Path getPath(String first, String... more);
+    }
+
+     /**
+      * Specify a factory that can be used to generate a path from a string, or series of strings.
+      *
+      * If this method is not called, a factory whose {@code getPath} method is
+      * equivalent to calling
+      * {@link java.nio.file.Paths#get(String, String...) java.nio.file.Paths.get(first, more)}
+      * will be used.
+      *
+      * @implSpec
+      * The default implementation of this method ignores the factory that is provided.
+      *
+      * @param f  the factory
+      *
+      * @since 9
+      */
+    default void setPathFactory(PathFactory f) { }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -492,7 +492,7 @@
         }
 
         @Override @DefinedBy(Api.COMPILER)
-        public void setLocationFromPaths(Location location, Iterable<? extends Path> paths) throws IOException {
+        public void setLocationFromPaths(Location location, Collection<? extends Path> paths) throws IOException {
             try {
                 ((StandardJavaFileManager)clientJavaFileManager).setLocationFromPaths(location, paths);
             } catch (ClientCodeException e) {
@@ -534,6 +534,17 @@
                 throw new ClientCodeException(e);
             }
         }
+
+        @Override @DefinedBy(Api.COMPILER)
+        public void setPathFactory(PathFactory f) {
+            try {
+                ((StandardJavaFileManager)clientJavaFileManager).setPathFactory(f);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException | Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
     }
 
     protected class WrappedFileObject implements FileObject {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Directive.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Directive.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,7 +98,9 @@
 
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public java.util.List<? extends ModuleElement> getTargetModules() {
-            return Collections.unmodifiableList(modules);
+            return modules == null
+                    ? null
+                    : Collections.unmodifiableList(modules);
         }
 
         @Override
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Tue May 17 05:38:15 2016 -0700
@@ -841,6 +841,28 @@
             super(CompletionCause.MEMBERS_PHASE, null);
         }
 
+        private boolean completing;
+        private List<Env<AttrContext>> todo = List.nil();
+
+        @Override
+        protected void doCompleteEnvs(List<Env<AttrContext>> envs) {
+            todo = todo.prependList(envs);
+            if (completing) {
+                return ; //the top-level invocation will handle all envs
+            }
+            boolean prevCompleting = completing;
+            completing = true;
+            try {
+                while (todo.nonEmpty()) {
+                    Env<AttrContext> head = todo.head;
+                    todo = todo.tail;
+                    super.doCompleteEnvs(List.of(head));
+                }
+            } finally {
+                completing = prevCompleting;
+            }
+        }
+
         @Override
         protected void runPhase(Env<AttrContext> env) {
             JCClassDecl tree = env.enclClass;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/FSInfo.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/FSInfo.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package com.sun.tools.javac.file;
 
 import java.io.IOException;
+import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -108,7 +109,7 @@
             for (StringTokenizer st = new StringTokenizer(path);
                  st.hasMoreTokens(); ) {
                 String elt = st.nextToken();
-                Path f = Paths.get(elt);
+                Path f = FileSystems.getDefault().getPath(elt);
                 if (!f.isAbsolute() && parent != null)
                     f = parent.resolve(f).toAbsolutePath();
                 list.add(f);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Tue May 17 05:38:15 2016 -0700
@@ -109,6 +109,8 @@
 
     protected boolean symbolFileEnabled;
 
+    private PathFactory pathFactory = Paths::get;
+
     protected enum SortFiles implements Comparator<Path> {
         FORWARD {
             @Override
@@ -166,6 +168,16 @@
         }
     }
 
+    @Override @DefinedBy(DefinedBy.Api.COMPILER)
+    public void setPathFactory(PathFactory f) {
+        pathFactory = Objects.requireNonNull(f);
+        locations.setPathFactory(f);
+    }
+
+    private Path getPath(String first, String... more) {
+        return pathFactory.getPath(first, more);
+    }
+
     /**
      * Set whether or not to use ct.sym as an alternate to rt.jar.
      */
@@ -199,7 +211,7 @@
     public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
         ListBuffer<Path> paths = new ListBuffer<>();
         for (String name : names)
-            paths.append(Paths.get(nullCheck(name)));
+            paths.append(getPath(nullCheck(name)));
         return getJavaFileObjectsFromPaths(paths.toList());
     }
 
@@ -837,7 +849,7 @@
                 if (sibling != null && sibling instanceof PathFileObject) {
                     return ((PathFileObject) sibling).getSibling(baseName);
                 } else {
-                    Path p = Paths.get(baseName);
+                    Path p = getPath(baseName);
                     Path real = fsInfo.getCanonicalFile(p);
                     return PathFileObject.forSimplePath(this, real, p);
                 }
@@ -855,7 +867,7 @@
 
         try {
             if (dir == null) {
-                dir = Paths.get(System.getProperty("user.dir"));
+                dir = getPath(System.getProperty("user.dir"));
             }
             Path path = fileName.resolveAgainst(fsInfo.getCanonicalFile(dir));
             return PathFileObject.forDirectoryPath(this, path, dir, fileName);
@@ -918,7 +930,7 @@
 
     @Override @DefinedBy(Api.COMPILER)
     public void setLocationFromPaths(Location location,
-                            Iterable<? extends Path> searchpath)
+                            Collection<? extends Path> searchpath)
         throws IOException
     {
         nullCheck(location);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Tue May 17 05:38:15 2016 -0700
@@ -68,6 +68,7 @@
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileManager.Location;
 import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardJavaFileManager.PathFactory;
 import javax.tools.StandardLocation;
 
 import com.sun.tools.javac.code.Lint;
@@ -121,7 +122,9 @@
 
     private ModuleNameReader moduleNameReader;
 
-    static final Path javaHome = Paths.get(System.getProperty("java.home"));
+    private PathFactory pathFactory = Paths::get;
+
+    static final Path javaHome = FileSystems.getDefault().getPath(System.getProperty("java.home"));
     static final Path thisSystemModules = javaHome.resolve("lib").resolve("modules");
 
     Map<Path, FileSystem> fileSystems = new LinkedHashMap<>();
@@ -131,6 +134,10 @@
         initHandlers();
     }
 
+    Path getPath(String first, String... more) {
+        return pathFactory.getPath(first, more);
+    }
+
     public void close() throws IOException {
         ListBuffer<IOException> list = new ListBuffer<>();
         closeables.forEach(closeable -> {
@@ -155,6 +162,10 @@
         this.fsInfo = fsInfo;
     }
 
+    void setPathFactory(PathFactory f) {
+        pathFactory = f;
+    }
+
     boolean isDefaultBootClassPath() {
         BootClassPathLocationHandler h
                 = (BootClassPathLocationHandler) getHandler(PLATFORM_CLASS_PATH);
@@ -167,7 +178,7 @@
      * @param searchPath The search path to be split
      * @return The elements of the path
      */
-    private static Iterable<Path> getPathEntries(String searchPath) {
+    private Iterable<Path> getPathEntries(String searchPath) {
         return getPathEntries(searchPath, null);
     }
 
@@ -181,7 +192,7 @@
      * empty path elements
      * @return The elements of the path
      */
-    private static Iterable<Path> getPathEntries(String searchPath, Path emptyPathDefault) {
+    private Iterable<Path> getPathEntries(String searchPath, Path emptyPathDefault) {
         ListBuffer<Path> entries = new ListBuffer<>();
         for (String s: searchPath.split(Pattern.quote(File.pathSeparator), -1)) {
             if (s.isEmpty()) {
@@ -189,7 +200,7 @@
                     entries.add(emptyPathDefault);
                 }
             } else {
-                entries.add(Paths.get(s));
+                entries.add(getPath(s));
             }
         }
         return entries;
@@ -465,7 +476,7 @@
             // need to decide how best to report issue for benefit of
             // direct API call on JavaFileManager.handleOption(specifies IAE)
             // vs. command line decoding.
-            outputDir = (value == null) ? null : Paths.get(value);
+            outputDir = (value == null) ? null : getPath(value);
             return true;
         }
 
@@ -606,7 +617,7 @@
         protected SearchPath createPath() {
             return new SearchPath()
                     .expandJarClassPaths(true) // Only search user jars for Class-Paths
-                    .emptyPathDefault(Paths.get("."));  // Empty path elt ==> current directory
+                    .emptyPathDefault(getPath("."));  // Empty path elt ==> current directory
         }
 
         private void lazy() {
@@ -791,7 +802,7 @@
             paths.addAll(modules);
 
             for (String s : files.split(Pattern.quote(File.pathSeparator))) {
-                paths.add(Paths.get(s));
+                paths.add(getPath(s));
             }
 
             return paths;
@@ -1170,12 +1181,12 @@
             for (String seg: segments) {
                 int markStart = seg.indexOf(MARKER);
                 if (markStart == -1) {
-                    add(map, Paths.get(seg), null);
+                    add(map, getPath(seg), null);
                 } else {
                     if (markStart == 0 || !isSeparator(seg.charAt(markStart - 1))) {
                         throw new IllegalArgumentException("illegal use of " + MARKER + " in " + seg);
                     }
-                    Path prefix = Paths.get(seg.substring(0, markStart - 1));
+                    Path prefix = getPath(seg.substring(0, markStart - 1));
                     Path suffix;
                     int markEnd = markStart + MARKER.length();
                     if (markEnd == seg.length()) {
@@ -1184,7 +1195,7 @@
                             || seg.indexOf(MARKER, markEnd) != -1) {
                         throw new IllegalArgumentException("illegal use of " + MARKER + " in " + seg);
                     } else {
-                        suffix = Paths.get(seg.substring(markEnd + 1));
+                        suffix = getPath(seg.substring(markEnd + 1));
                     }
                     add(map, prefix, suffix);
                 }
@@ -1331,13 +1342,13 @@
     }
 
     private class SystemModulesLocationHandler extends BasicLocationHandler {
-        private Path javaHome;
+        private Path systemJavaHome;
         private Path modules;
         private Map<String, ModuleLocationHandler> systemModules;
 
         SystemModulesLocationHandler() {
             super(StandardLocation.SYSTEM_MODULES, Option.SYSTEM);
-            javaHome = Paths.get(System.getProperty("java.home"));
+            systemJavaHome = Locations.javaHome;
         }
 
         @Override
@@ -1347,11 +1358,11 @@
             }
 
             if (value == null) {
-                javaHome = Paths.get(System.getProperty("java.home"));
+                systemJavaHome = Locations.javaHome;
             } else if (value.equals("none")) {
-                javaHome = null;
+                systemJavaHome = null;
             } else {
-                update(Paths.get(value));
+                update(getPath(value));
             }
 
             modules = null;
@@ -1360,13 +1371,13 @@
 
         @Override
         Collection<Path> getPaths() {
-            return (javaHome == null) ? null : Collections.singleton(javaHome);
+            return (systemJavaHome == null) ? null : Collections.singleton(systemJavaHome);
         }
 
         @Override
         void setPaths(Iterable<? extends Path> files) throws IOException {
             if (files == null) {
-                javaHome = null;
+                systemJavaHome = null;
             } else {
                 Iterator<? extends Path> pathIter = files.iterator();
                 if (!pathIter.hasNext()) {
@@ -1386,16 +1397,15 @@
         }
 
         private void update(Path p) {
-            if (!isCurrentPlatform(p) && !Files.exists(p.resolve("jrt-fs.jar")) && !Files.exists(javaHome.resolve("modules")))
+            if (!isCurrentPlatform(p) && !Files.exists(p.resolve("jrt-fs.jar")) && !Files.exists(systemJavaHome.resolve("modules")))
                 throw new IllegalArgumentException(p.toString());
-            javaHome = p;
+            systemJavaHome = p;
             modules = null;
         }
 
         private boolean isCurrentPlatform(Path p) {
-            Path jh = Paths.get(System.getProperty("java.home"));
             try {
-                return Files.isSameFile(p, jh);
+                return Files.isSameFile(p, Locations.javaHome);
             } catch (IOException ex) {
                 throw new IllegalArgumentException(p.toString(), ex);
             }
@@ -1421,7 +1431,7 @@
                 return;
             }
 
-            if (javaHome == null) {
+            if (systemJavaHome == null) {
                 systemModules = Collections.emptyMap();
                 return;
             }
@@ -1431,15 +1441,15 @@
                     URI jrtURI = URI.create("jrt:/");
                     FileSystem jrtfs;
 
-                    if (isCurrentPlatform(javaHome)) {
+                    if (isCurrentPlatform(systemJavaHome)) {
                         jrtfs = FileSystems.getFileSystem(jrtURI);
                     } else {
                         try {
                             Map<String, String> attrMap =
-                                    Collections.singletonMap("java.home", javaHome.toString());
+                                    Collections.singletonMap("java.home", systemJavaHome.toString());
                             jrtfs = FileSystems.newFileSystem(jrtURI, attrMap);
                         } catch (ProviderNotFoundException ex) {
-                            URL javaHomeURL = javaHome.resolve("jrt-fs.jar").toUri().toURL();
+                            URL javaHomeURL = systemJavaHome.resolve("jrt-fs.jar").toUri().toURL();
                             ClassLoader currentLoader = Locations.class.getClassLoader();
                             URLClassLoader fsLoader =
                                     new URLClassLoader(new URL[] {javaHomeURL}, currentLoader);
@@ -1454,7 +1464,7 @@
 
                     modules = jrtfs.getPath("/modules");
                 } catch (FileSystemNotFoundException | ProviderNotFoundException e) {
-                    modules = javaHome.resolve("modules");
+                    modules = systemJavaHome.resolve("modules");
                     if (!Files.exists(modules))
                         throw new IOException("can't find system classes", e);
                 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java	Tue May 17 05:38:15 2016 -0700
@@ -109,7 +109,7 @@
         private DirectoryFileObject(BaseFileManager fileManager, Path path,
                 Path userPackageRootDir, RelativePath relativePath) {
             super(fileManager, path);
-            this.userPackageRootDir = userPackageRootDir;
+            this.userPackageRootDir = Objects.requireNonNull(userPackageRootDir);
             this.relativePath = relativePath;
         }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java	Tue May 17 05:38:15 2016 -0700
@@ -26,10 +26,8 @@
 package com.sun.tools.javac.file;
 
 import java.nio.file.FileSystem;
-import java.nio.file.FileSystems;
 import java.nio.file.InvalidPathException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
@@ -58,13 +56,8 @@
     public abstract String basename();
 
     public Path resolveAgainst(Path directory) throws /*unchecked*/ InvalidPathException {
-        if (directory == null) {
-            String sep = FileSystems.getDefault().getSeparator();
-            return Paths.get(path.replace("/", sep));
-        } else {
-            String sep = directory.getFileSystem().getSeparator();
-            return directory.resolve(path.replace("/", sep));
-        }
+        String sep = directory.getFileSystem().getSeparator();
+        return directory.resolve(path.replace("/", sep));
     }
 
     public Path resolveAgainst(FileSystem fs) throws /*unchecked*/ InvalidPathException {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -108,7 +108,7 @@
         V50(50, 0),   // JDK 1.6: stackmaps
         V51(51, 0),   // JDK 1.7
         V52(52, 0),   // JDK 1.8: lambda, type annos, param names
-        V53(52, 0);   // JDK 1.9: modules  **** FIXME TO 53 BEFORE RELEASE *****
+        V53(53, 0);   // JDK 1.9: modules, indy string concat
         Version(int major, int minor) {
             this.major = major;
             this.minor = minor;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java	Tue May 17 05:38:15 2016 -0700
@@ -60,8 +60,8 @@
     /** JDK 8. */
     JDK1_8("1.8", 52, 0),
 
-    /** JDK 9, initially an alias for 8. */
-    JDK1_9("1.9", 52, 0);
+    /** JDK 9. */
+    JDK1_9("1.9", 53, 0);
 
     private static final Context.Key<Target> targetKey = new Context.Key<>();
 
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -28,7 +28,7 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
-import com.sun.tools.javadoc.RootDocImpl;
+import com.sun.tools.javadoc.main.RootDocImpl;
 import com.sun.tools.doclets.formats.html.markup.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.builders.*;
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -40,7 +40,7 @@
 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;
+import com.sun.tools.javadoc.main.RootDocImpl;
 
 /**
  * Configure the output based on the command line options.
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Tue May 17 05:38:15 2016 -0700
@@ -149,8 +149,8 @@
                 return;
             Reader r;
             // temp hack until we can update SourcePosition API.
-            if (sp instanceof com.sun.tools.javadoc.SourcePositionImpl) {
-                FileObject fo = ((com.sun.tools.javadoc.SourcePositionImpl) sp).fileObject();
+            if (sp instanceof com.sun.tools.javadoc.main.SourcePositionImpl) {
+                FileObject fo = ((com.sun.tools.javadoc.main.SourcePositionImpl) sp).fileObject();
                 if (fo == null)
                     return;
                 r = fo.openReader(true);
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AbstractTypeImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Type;
-
-
-/**
- * Abstract implementation of <code>Type</code>, with useful
- * defaults for the methods in <code>Type</code> (and a couple from
- * <code>ProgramElementDoc</code>).
- *
- *  <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>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-abstract class AbstractTypeImpl implements com.sun.javadoc.Type {
-
-    protected final DocEnv env;
-    protected final Type type;
-
-    protected AbstractTypeImpl(DocEnv env, Type type) {
-        this.env = env;
-        this.type = type;
-    }
-
-    public String typeName() {
-        return type.tsym.name.toString();
-    }
-
-    public String qualifiedTypeName() {
-        return type.tsym.getQualifiedName().toString();
-    }
-
-    public com.sun.javadoc.Type getElementType() {
-        return null;
-    }
-
-    public String simpleTypeName() {
-        return type.tsym.name.toString();
-    }
-
-    public String name() {
-        return typeName();
-    }
-
-    public String qualifiedName() {
-        return qualifiedTypeName();
-    }
-
-    public String toString() {
-        return qualifiedTypeName();
-    }
-
-    public String dimension() {
-        return "";
-    }
-
-    public boolean isPrimitive() {
-        return false;
-    }
-
-    public ClassDoc asClassDoc() {
-        return null;
-    }
-
-    public TypeVariable asTypeVariable() {
-        return null;
-    }
-
-    public WildcardType asWildcardType() {
-        return null;
-    }
-
-    public ParameterizedType asParameterizedType() {
-        return null;
-    }
-
-    public AnnotationTypeDoc asAnnotationTypeDoc() {
-        return null;
-    }
-
-    public AnnotatedType asAnnotatedType() {
-        return null;
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotatedTypeImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Attribute.TypeCompound;
-import com.sun.tools.javac.util.List;
-
-/**
- * Implementation of <code>AnnotatedType</code>, which
- * represents an annotated type.
- *
- * @author Mahmood Ali
- * @since 1.8
- */
-public class AnnotatedTypeImpl
-        extends AbstractTypeImpl implements AnnotatedType {
-
-    AnnotatedTypeImpl(DocEnv env, com.sun.tools.javac.code.Type type) {
-        super(env, type);
-    }
-
-    /**
-     * Get the annotations of this program element.
-     * Return an empty array if there are none.
-     */
-    @Override
-    public AnnotationDesc[] annotations() {
-        List<? extends TypeCompound> tas = type.getAnnotationMirrors();
-        if (tas == null ||
-                tas.isEmpty()) {
-            return new AnnotationDesc[0];
-        }
-        AnnotationDesc res[] = new AnnotationDesc[tas.length()];
-        int i = 0;
-        for (Attribute.Compound a : tas) {
-            res[i++] = new AnnotationDescImpl(env, a);
-        }
-        return res;
-    }
-
-    @Override
-    public com.sun.javadoc.Type underlyingType() {
-        return TypeMaker.getType(env, type, true, false);
-    }
-
-    @Override
-    public AnnotatedType asAnnotatedType() {
-        return this;
-    }
-
-    @Override
-    public String toString() {
-        return typeName();
-    }
-
-    @Override
-    public String typeName() {
-        return this.underlyingType().typeName();
-    }
-
-    @Override
-    public String qualifiedTypeName() {
-        return this.underlyingType().qualifiedTypeName();
-    }
-
-    @Override
-    public String simpleTypeName() {
-        return this.underlyingType().simpleTypeName();
-    }
-
-    @Override
-    public String dimension() {
-        return this.underlyingType().dimension();
-    }
-
-    @Override
-    public boolean isPrimitive() {
-        return this.underlyingType().isPrimitive();
-    }
-
-    @Override
-    public ClassDoc asClassDoc() {
-        return this.underlyingType().asClassDoc();
-    }
-
-    @Override
-    public TypeVariable asTypeVariable() {
-        return this.underlyingType().asTypeVariable();
-    }
-
-    @Override
-    public WildcardType asWildcardType() {
-        return this.underlyingType().asWildcardType();
-    }
-
-    @Override
-    public ParameterizedType asParameterizedType() {
-        return this.underlyingType().asParameterizedType();
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationDescImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.Pair;
-
-
-/**
- * Represents an annotation.
- * An annotation associates a value with each element of an annotation type.
- * Sure it ought to be called "Annotation", but that clashes with
- * java.lang.annotation.Annotation.
- *
- *  <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>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-
-public class AnnotationDescImpl implements AnnotationDesc {
-
-    private final DocEnv env;
-    private final Attribute.Compound annotation;
-
-
-    AnnotationDescImpl(DocEnv env, Attribute.Compound annotation) {
-        this.env = env;
-        this.annotation = annotation;
-    }
-
-    /**
-     * Returns the annotation type of this annotation.
-     */
-    public AnnotationTypeDoc annotationType() {
-        ClassSymbol atsym = (ClassSymbol)annotation.type.tsym;
-        if (annotation.type.isErroneous()) {
-            env.warning(null, "javadoc.class_not_found", annotation.type.toString());
-            return new AnnotationTypeDocImpl(env, atsym);
-        } else {
-            return (AnnotationTypeDoc)env.getClassDoc(atsym);
-        }
-    }
-
-    /**
-     * Returns this annotation's elements and their values.
-     * Only those explicitly present in the annotation are
-     * included, not those assuming their default values.
-     * Returns an empty array if there are none.
-     */
-    public ElementValuePair[] elementValues() {
-        List<Pair<MethodSymbol,Attribute>> vals = annotation.values;
-        ElementValuePair res[] = new ElementValuePair[vals.length()];
-        int i = 0;
-        for (Pair<MethodSymbol,Attribute> val : vals) {
-            res[i++] = new ElementValuePairImpl(env, val.fst, val.snd);
-        }
-        return res;
-    }
-
-    /**
-     * Check for the synthesized bit on the annotation.
-     *
-     * @return true if the annotation is synthesized.
-     */
-    public boolean isSynthesized() {
-        return annotation.isSynthesized();
-    }
-
-    /**
-     * Returns a string representation of this annotation.
-     * String is of one of the forms:
-     * <pre>
-     *     {@code @com.example.foo(name1=val1, name2=val2)}
-     *     {@code @com.example.foo(val)}
-     *     {@code @com.example.foo}
-     * </pre>
-     * Omit parens for marker annotations, and omit "value=" when allowed.
-     */
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder("@");
-        sb.append(annotation.type.tsym);
-
-        ElementValuePair vals[] = elementValues();
-        if (vals.length > 0) {          // omit parens for marker annotation
-            sb.append('(');
-            boolean first = true;
-            for (ElementValuePair val : vals) {
-                if (!first) {
-                    sb.append(", ");
-                }
-                first = false;
-
-                String name = val.element().name();
-                if (vals.length == 1 && name.equals("value")) {
-                    sb.append(val.value());
-                } else {
-                    sb.append(val);
-                }
-            }
-            sb.append(')');
-        }
-        return sb.toString();
-    }
-
-
-    /**
-     * Represents an association between an annotation type element
-     * and one of its values.
-     */
-    public static class ElementValuePairImpl implements ElementValuePair {
-
-        private final DocEnv env;
-        private final MethodSymbol meth;
-        private final Attribute value;
-
-        ElementValuePairImpl(DocEnv env, MethodSymbol meth, Attribute value) {
-            this.env = env;
-            this.meth = meth;
-            this.value = value;
-        }
-
-        /**
-         * Returns the annotation type element.
-         */
-        public AnnotationTypeElementDoc element() {
-            return env.getAnnotationTypeElementDoc(meth);
-        }
-
-        /**
-         * Returns the value associated with the annotation type element.
-         */
-        public AnnotationValue value() {
-            return new AnnotationValueImpl(env, value);
-        }
-
-        /**
-         * Returns a string representation of this pair
-         * of the form "name=value".
-         */
-        @Override
-        public String toString() {
-            return meth.name + "=" + value();
-        }
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import com.sun.javadoc.*;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.util.List;
-
-import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
-
-import static com.sun.tools.javac.code.Kinds.Kind.*;
-
-/**
- * Represents an annotation type.
- *
- *  <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>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-
-public class AnnotationTypeDocImpl
-        extends ClassDocImpl implements AnnotationTypeDoc {
-
-    public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym) {
-        this(env, sym, null);
-    }
-
-    public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym, TreePath treePath) {
-        super(env, sym, treePath);
-    }
-
-    /**
-     * Returns true, as this is an annotation type.
-     * (For legacy doclets, return false.)
-     */
-    public boolean isAnnotationType() {
-        return !isInterface();
-    }
-
-    /**
-     * Returns false.  Though technically an interface, an annotation
-     * type is not considered an interface for this purpose.
-     * (For legacy doclets, returns true.)
-     */
-    public boolean isInterface() {
-        return env.legacyDoclet;
-    }
-
-    /**
-     * Returns an empty array, as all methods are annotation type elements.
-     * (For legacy doclets, returns the elements.)
-     * @see #elements()
-     */
-    public MethodDoc[] methods(boolean filter) {
-        return env.legacyDoclet
-                ? (MethodDoc[])elements()
-                : new MethodDoc[0];
-    }
-
-    /**
-     * Returns the elements of this annotation type.
-     * Returns an empty array if there are none.
-     * Elements are always public, so no need to filter them.
-     */
-    public AnnotationTypeElementDoc[] elements() {
-        List<AnnotationTypeElementDoc> elements = List.nil();
-        for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
-            if (sym != null && sym.kind == MTH) {
-                MethodSymbol s = (MethodSymbol)sym;
-                elements = elements.prepend(env.getAnnotationTypeElementDoc(s));
-            }
-        }
-        return
-            elements.toArray(new AnnotationTypeElementDoc[elements.length()]);
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationTypeElementDocImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import com.sun.javadoc.*;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Symbol.*;
-
-/**
- * Represents an element of an annotation type.
- *
- *  <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>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-
-public class AnnotationTypeElementDocImpl
-        extends MethodDocImpl implements AnnotationTypeElementDoc {
-
-    public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym) {
-        super(env, sym);
-    }
-
-    public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) {
-        super(env, sym, treePath);
-    }
-
-    /**
-     * Returns true, as this is an annotation type element.
-     * (For legacy doclets, return false.)
-     */
-    public boolean isAnnotationTypeElement() {
-        return !isMethod();
-    }
-
-    /**
-     * Returns false.  Although this is technically a method, we don't
-     * consider it one for this purpose.
-     * (For legacy doclets, return true.)
-     */
-    public boolean isMethod() {
-        return env.legacyDoclet;
-    }
-
-    /**
-     * Returns false, even though this is indeed abstract.  See
-     * MethodDocImpl.isAbstract() for the (il)logic behind this.
-     */
-    public boolean isAbstract() {
-        return false;
-    }
-
-    /**
-     * Returns the default value of this element.
-     * Returns null if this element has no default.
-     */
-    public AnnotationValue defaultValue() {
-        return (sym.defaultValue == null)
-               ? null
-               : new AnnotationValueImpl(env, sym.defaultValue);
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationValueImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Attribute;
-
-import static com.sun.tools.javac.code.TypeTag.BOOLEAN;
-
-/**
- * Represents a value of an annotation type element.
- *
- *  <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>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-
-public class AnnotationValueImpl implements AnnotationValue {
-
-    private final DocEnv env;
-    private final Attribute attr;
-
-
-    AnnotationValueImpl(DocEnv env, Attribute attr) {
-        this.env = env;
-        this.attr = attr;
-    }
-
-    /**
-     * Returns the value.
-     * The type of the returned object is one of the following:
-     * <ul><li> a wrapper class for a primitive type
-     *     <li> <code>String</code>
-     *     <li> <code>Type</code> (representing a class literal)
-     *     <li> <code>FieldDoc</code> (representing an enum constant)
-     *     <li> <code>AnnotationDesc</code>
-     *     <li> <code>AnnotationValue[]</code>
-     * </ul>
-     */
-    public Object value() {
-        ValueVisitor vv = new ValueVisitor();
-        attr.accept(vv);
-        return vv.value;
-    }
-
-    private class ValueVisitor implements Attribute.Visitor {
-        public Object value;
-
-        public void visitConstant(Attribute.Constant c) {
-            if (c.type.hasTag(BOOLEAN)) {
-                // javac represents false and true as integers 0 and 1
-                value = Boolean.valueOf(
-                                ((Integer)c.value).intValue() != 0);
-            } else {
-                value = c.value;
-            }
-        }
-
-        public void visitClass(Attribute.Class c) {
-            value = TypeMaker.getType(env,
-                                      env.types.erasure(c.classType));
-        }
-
-        public void visitEnum(Attribute.Enum e) {
-            value = env.getFieldDoc(e.value);
-        }
-
-        public void visitCompound(Attribute.Compound c) {
-            value = new AnnotationDescImpl(env, c);
-        }
-
-        public void visitArray(Attribute.Array a) {
-            AnnotationValue vals[] = new AnnotationValue[a.values.length];
-            for (int i = 0; i < vals.length; i++) {
-                vals[i] = new AnnotationValueImpl(env, a.values[i]);
-            }
-            value = vals;
-        }
-
-        public void visitError(Attribute.Error e) {
-            value = "<error>";
-        }
-    }
-
-    /**
-     * Returns a string representation of the value.
-     *
-     * @return the text of a Java language annotation value expression
-     *          whose value is the value of this annotation type element.
-     */
-    @Override
-    public String toString() {
-        ToStringVisitor tv = new ToStringVisitor();
-        attr.accept(tv);
-        return tv.toString();
-    }
-
-    private class ToStringVisitor implements Attribute.Visitor {
-        private final StringBuilder sb = new StringBuilder();
-
-        @Override
-        public String toString() {
-            return sb.toString();
-        }
-
-        public void visitConstant(Attribute.Constant c) {
-            if (c.type.hasTag(BOOLEAN)) {
-                // javac represents false and true as integers 0 and 1
-                sb.append(((Integer)c.value).intValue() != 0);
-            } else {
-                sb.append(FieldDocImpl.constantValueExpression(c.value));
-            }
-        }
-
-        public void visitClass(Attribute.Class c) {
-            sb.append(c);
-        }
-
-        public void visitEnum(Attribute.Enum e) {
-            sb.append(e);
-        }
-
-        public void visitCompound(Attribute.Compound c) {
-            sb.append(new AnnotationDescImpl(env, c));
-        }
-
-        public void visitArray(Attribute.Array a) {
-            // Omit braces from singleton.
-            if (a.values.length != 1) sb.append('{');
-
-            boolean first = true;
-            for (Attribute elem : a.values) {
-                if (first) {
-                    first = false;
-                } else {
-                    sb.append(", ");
-                }
-                elem.accept(this);
-            }
-            // Omit braces from singleton.
-            if (a.values.length != 1) sb.append('}');
-        }
-
-        public void visitError(Attribute.Error e) {
-            sb.append("<error>");
-        }
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1329 +0,0 @@
-/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.javadoc;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Modifier;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.tools.FileObject;
-import javax.tools.JavaFileManager.Location;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-
-import com.sun.javadoc.*;
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Kinds;
-import com.sun.tools.javac.code.Kinds.KindSelector;
-import com.sun.tools.javac.code.Scope;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.ClassType;
-import com.sun.tools.javac.code.TypeTag;
-import com.sun.tools.javac.comp.AttrContext;
-import com.sun.tools.javac.comp.Env;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
-import com.sun.tools.javac.tree.JCTree.JCImport;
-import com.sun.tools.javac.tree.TreeInfo;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Names;
-import com.sun.tools.javac.util.Position;
-import static com.sun.tools.javac.code.Kinds.Kind.*;
-import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
-import static com.sun.tools.javac.code.TypeTag.CLASS;
-import static com.sun.tools.javac.tree.JCTree.Tag.*;
-
-/**
- * Represents a java class and provides access to information
- * about the class, the class' comment and tags, and the
- * members of the class.  A ClassDocImpl only exists if it was
- * processed in this run of javadoc.  References to classes
- * which may or may not have been processed in this run are
- * referred to using Type (which can be converted to ClassDocImpl,
- * if possible).
- *
- *  <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>
- *
- * @see Type
- *
- * @since 1.2
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- * @author Scott Seligman (generics, enums, annotations)
- */
-
-public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
-
-    public final ClassType type;        // protected->public for debugging
-    public final ClassSymbol tsym;
-
-    boolean isIncluded = false;         // Set in RootDocImpl
-
-    private SerializedForm serializedForm;
-
-    /**
-     * Constructor
-     */
-    public ClassDocImpl(DocEnv env, ClassSymbol sym) {
-        this(env, sym, null);
-    }
-
-    /**
-     * Constructor
-     */
-    public ClassDocImpl(DocEnv env, ClassSymbol sym, TreePath treePath) {
-        super(env, sym, treePath);
-        this.type = (ClassType)sym.type;
-        this.tsym = sym;
-    }
-
-    public com.sun.javadoc.Type getElementType() {
-        return null;
-    }
-
-    /**
-     * Returns the flags in terms of javac's flags
-     */
-    protected long getFlags() {
-        return getFlags(tsym);
-    }
-
-    /**
-     * Returns the flags of a ClassSymbol in terms of javac's flags
-     */
-    static long getFlags(ClassSymbol clazz) {
-        try {
-            return clazz.flags();
-        } catch (CompletionFailure ex) {
-            /* Quietly ignore completion failures and try again - the type
-             * for which the CompletionFailure was thrown shouldn't be completed
-             * again by the completer that threw the CompletionFailure.
-             */
-            return getFlags(clazz);
-        }
-    }
-
-    /**
-     * Is a ClassSymbol an annotation type?
-     */
-    static boolean isAnnotationType(ClassSymbol clazz) {
-        return (getFlags(clazz) & Flags.ANNOTATION) != 0;
-    }
-
-    /**
-     * Identify the containing class
-     */
-    protected ClassSymbol getContainingClass() {
-        return tsym.owner.enclClass();
-    }
-
-    /**
-     * Return true if this is a class, not an interface.
-     */
-    @Override
-    public boolean isClass() {
-        return !Modifier.isInterface(getModifiers());
-    }
-
-    /**
-     * Return true if this is a ordinary class,
-     * not an enumeration, exception, an error, or an interface.
-     */
-    @Override
-    public boolean isOrdinaryClass() {
-        if (isEnum() || isInterface() || isAnnotationType()) {
-            return false;
-        }
-        for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
-            if (t.tsym == env.syms.errorType.tsym ||
-                t.tsym == env.syms.exceptionType.tsym) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Return true if this is an enumeration.
-     * (For legacy doclets, return false.)
-     */
-    @Override
-    public boolean isEnum() {
-        return (getFlags() & Flags.ENUM) != 0
-               &&
-               !env.legacyDoclet;
-    }
-
-    /**
-     * Return true if this is an interface, but not an annotation type.
-     * Overridden by AnnotationTypeDocImpl.
-     */
-    @Override
-    public boolean isInterface() {
-        return Modifier.isInterface(getModifiers());
-    }
-
-    /**
-     * Return true if this is an exception class
-     */
-    @Override
-    public boolean isException() {
-        if (isEnum() || isInterface() || isAnnotationType()) {
-            return false;
-        }
-        for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
-            if (t.tsym == env.syms.exceptionType.tsym) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Return true if this is an error class
-     */
-    @Override
-    public boolean isError() {
-        if (isEnum() || isInterface() || isAnnotationType()) {
-            return false;
-        }
-        for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
-            if (t.tsym == env.syms.errorType.tsym) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Return true if this is a throwable class
-     */
-    public boolean isThrowable() {
-        if (isEnum() || isInterface() || isAnnotationType()) {
-            return false;
-        }
-        for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
-            if (t.tsym == env.syms.throwableType.tsym) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Return true if this class is abstract
-     */
-    public boolean isAbstract() {
-        return Modifier.isAbstract(getModifiers());
-    }
-
-    /**
-     * Returns true if this class was synthesized by the compiler.
-     */
-    public boolean isSynthetic() {
-        return (getFlags() & Flags.SYNTHETIC) != 0;
-    }
-
-    /**
-     * Return true if this class is included in the active set.
-     * A ClassDoc is included iff either it is specified on the
-     * commandline, or if it's containing package is specified
-     * on the command line, or if it is a member class of an
-     * included class.
-     */
-
-    public boolean isIncluded() {
-        if (isIncluded) {
-            return true;
-        }
-        if (env.shouldDocument(tsym)) {
-            // Class is nameable from top-level and
-            // the class and all enclosing classes
-            // pass the modifier filter.
-            if (containingPackage().isIncluded()) {
-                return isIncluded=true;
-            }
-            ClassDoc outer = containingClass();
-            if (outer != null && outer.isIncluded()) {
-                return isIncluded=true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Return the package that this class is contained in.
-     */
-    @Override
-    public PackageDoc containingPackage() {
-        PackageDocImpl p = env.getPackageDoc(tsym.packge());
-        if (p.setDocPath == false) {
-            FileObject docPath;
-            try {
-                Location location = env.fileManager.hasLocation(StandardLocation.SOURCE_PATH)
-                    ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
-
-                docPath = env.fileManager.getFileForInput(
-                        location, p.qualifiedName(), "package.html");
-            } catch (IOException e) {
-                docPath = null;
-            }
-
-            if (docPath == null) {
-                // fall back on older semantics of looking in same directory as
-                // source file for this class
-                SourcePosition po = position();
-                if (env.fileManager instanceof StandardJavaFileManager &&
-                        po instanceof SourcePositionImpl) {
-                    URI uri = ((SourcePositionImpl) po).filename.toUri();
-                    if ("file".equals(uri.getScheme())) {
-                        File f = new File(uri);
-                        File dir = f.getParentFile();
-                        if (dir != null) {
-                            File pf = new File(dir, "package.html");
-                            if (pf.exists()) {
-                                StandardJavaFileManager sfm = (StandardJavaFileManager) env.fileManager;
-                                docPath = sfm.getJavaFileObjects(pf).iterator().next();
-                            }
-                        }
-
-                    }
-                }
-            }
-
-            p.setDocPath(docPath);
-        }
-        return p;
-    }
-
-    /**
-     * Return the class name without package qualifier - but with
-     * enclosing class qualifier - as a String.
-     * <pre>
-     * Examples:
-     *  for java.util.Hashtable
-     *  return Hashtable
-     *  for java.util.Map.Entry
-     *  return Map.Entry
-     * </pre>
-     */
-    public String name() {
-        if (name == null) {
-            name = getClassName(tsym, false);
-        }
-        return name;
-    }
-
-    private String name;
-
-    /**
-     * Return the qualified class name as a String.
-     * <pre>
-     * Example:
-     *  for java.util.Hashtable
-     *  return java.util.Hashtable
-     *  if no qualifier, just return flat name
-     * </pre>
-     */
-    public String qualifiedName() {
-        if (qualifiedName == null) {
-            qualifiedName = getClassName(tsym, true);
-        }
-        return qualifiedName;
-    }
-
-    private String qualifiedName;
-
-    /**
-     * Return unqualified name of type excluding any dimension information.
-     * <p>
-     * For example, a two dimensional array of String returns 'String'.
-     */
-    public String typeName() {
-        return name();
-    }
-
-    /**
-     * Return qualified name of type excluding any dimension information.
-     *<p>
-     * For example, a two dimensional array of String
-     * returns 'java.lang.String'.
-     */
-    public String qualifiedTypeName() {
-        return qualifiedName();
-    }
-
-    /**
-     * Return the simple name of this type.
-     */
-    public String simpleTypeName() {
-        if (simpleTypeName == null) {
-            simpleTypeName = tsym.name.toString();
-        }
-        return simpleTypeName;
-    }
-
-    private String simpleTypeName;
-
-    /**
-     * Return the qualified name and any type parameters.
-     * Each parameter is a type variable with optional bounds.
-     */
-    @Override
-    public String toString() {
-        return classToString(env, tsym, true);
-    }
-
-    /**
-     * Return the class name as a string.  If "full" is true the name is
-     * qualified, otherwise it is qualified by its enclosing class(es) only.
-     */
-    static String getClassName(ClassSymbol c, boolean full) {
-        if (full) {
-            return c.getQualifiedName().toString();
-        } else {
-            String n = "";
-            for ( ; c != null; c = c.owner.enclClass()) {
-                n = c.name + (n.equals("") ? "" : ".") + n;
-            }
-            return n;
-        }
-    }
-
-    /**
-     * Return the class name with any type parameters as a string.
-     * Each parameter is a type variable with optional bounds.
-     * If "full" is true all names are qualified, otherwise they are
-     * qualified by their enclosing class(es) only.
-     */
-    static String classToString(DocEnv env, ClassSymbol c, boolean full) {
-        StringBuilder s = new StringBuilder();
-        if (!c.isInner()) {             // if c is not an inner class
-            s.append(getClassName(c, full));
-        } else {
-            // c is an inner class, so include type params of outer.
-            ClassSymbol encl = c.owner.enclClass();
-            s.append(classToString(env, encl, full))
-             .append('.')
-             .append(c.name);
-        }
-        s.append(TypeMaker.typeParametersString(env, c, full));
-        return s.toString();
-    }
-
-    /**
-     * Is this class (or any enclosing class) generic?  That is, does
-     * it have type parameters?
-     */
-    static boolean isGeneric(ClassSymbol c) {
-        return c.type.allparams().nonEmpty();
-    }
-
-    /**
-     * Return the formal type parameters of this class or interface.
-     * Return an empty array if there are none.
-     */
-    public TypeVariable[] typeParameters() {
-        if (env.legacyDoclet) {
-            return new TypeVariable[0];
-        }
-        TypeVariable res[] = new TypeVariable[type.getTypeArguments().length()];
-        TypeMaker.getTypes(env, type.getTypeArguments(), res);
-        return res;
-    }
-
-    /**
-     * Return the type parameter tags of this class or interface.
-     */
-    public ParamTag[] typeParamTags() {
-        return (env.legacyDoclet)
-            ? new ParamTag[0]
-            : comment().typeParamTags();
-    }
-
-    /**
-     * Return the modifier string for this class. If it's an interface
-     * exclude 'abstract' keyword from the modifier string
-     */
-    @Override
-    public String modifiers() {
-        return Modifier.toString(modifierSpecifier());
-    }
-
-    @Override
-    public int modifierSpecifier() {
-        int modifiers = getModifiers();
-        return (isInterface() || isAnnotationType())
-                ? modifiers & ~Modifier.ABSTRACT
-                : modifiers;
-    }
-
-    /**
-     * Return the superclass of this class
-     *
-     * @return the ClassDocImpl for the superclass of this class, null
-     * if there is no superclass.
-     */
-    public ClassDoc superclass() {
-        if (isInterface() || isAnnotationType()) return null;
-        if (tsym == env.syms.objectType.tsym) return null;
-        ClassSymbol c = (ClassSymbol)env.types.supertype(type).tsym;
-        if (c == null || c == tsym) c = (ClassSymbol)env.syms.objectType.tsym;
-        return env.getClassDoc(c);
-    }
-
-    /**
-     * Return the superclass of this class.  Return null if this is an
-     * interface.  A superclass is represented by either a
-     * <code>ClassDoc</code> or a <code>ParameterizedType</code>.
-     */
-    public com.sun.javadoc.Type superclassType() {
-        if (isInterface() || isAnnotationType() ||
-                (tsym == env.syms.objectType.tsym))
-            return null;
-        Type sup = env.types.supertype(type);
-        return TypeMaker.getType(env,
-                                 (sup.hasTag(TypeTag.NONE)) ? env.syms.objectType : sup);
-    }
-
-    /**
-     * Test whether this class is a subclass of the specified class.
-     *
-     * @param cd the candidate superclass.
-     * @return true if cd is a superclass of this class.
-     */
-    public boolean subclassOf(ClassDoc cd) {
-        return tsym.isSubClass(((ClassDocImpl)cd).tsym, env.types);
-    }
-
-    /**
-     * Return interfaces implemented by this class or interfaces
-     * extended by this interface.
-     *
-     * @return An array of ClassDocImpl representing the interfaces.
-     * Return an empty array if there are no interfaces.
-     */
-    public ClassDoc[] interfaces() {
-        ListBuffer<ClassDocImpl> ta = new ListBuffer<>();
-        for (Type t : env.types.interfaces(type)) {
-            ta.append(env.getClassDoc((ClassSymbol)t.tsym));
-        }
-        //### Cache ta here?
-        return ta.toArray(new ClassDocImpl[ta.length()]);
-    }
-
-    /**
-     * Return interfaces implemented by this class or interfaces extended
-     * by this interface. Includes only directly-declared interfaces, not
-     * inherited interfaces.
-     * Return an empty array if there are no interfaces.
-     */
-    public com.sun.javadoc.Type[] interfaceTypes() {
-        //### Cache result here?
-        return TypeMaker.getTypes(env, env.types.interfaces(type));
-    }
-
-    /**
-     * Return fields in class.
-     * @param filter include only the included fields if filter==true
-     */
-    public FieldDoc[] fields(boolean filter) {
-        return fields(filter, false);
-    }
-
-    /**
-     * Return included fields in class.
-     */
-    public FieldDoc[] fields() {
-        return fields(true, false);
-    }
-
-    /**
-     * Return the enum constants if this is an enum type.
-     */
-    public FieldDoc[] enumConstants() {
-        return fields(false, true);
-    }
-
-    /**
-     * Return fields in class.
-     * @param filter  if true, return only the included fields
-     * @param enumConstants  if true, return the enum constants instead
-     */
-    private FieldDoc[] fields(boolean filter, boolean enumConstants) {
-        List<FieldDocImpl> fields = List.nil();
-        for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
-            if (sym != null && sym.kind == VAR) {
-                VarSymbol s = (VarSymbol)sym;
-                boolean isEnum = ((s.flags() & Flags.ENUM) != 0) &&
-                                 !env.legacyDoclet;
-                if (isEnum == enumConstants &&
-                        (!filter || env.shouldDocument(s))) {
-                    fields = fields.prepend(env.getFieldDoc(s));
-                }
-            }
-        }
-        return fields.toArray(new FieldDocImpl[fields.length()]);
-    }
-
-    /**
-     * Return methods in class.
-     * This method is overridden by AnnotationTypeDocImpl.
-     *
-     * @param filter include only the included methods if filter==true
-     * @return an array of MethodDocImpl for representing the visible
-     * methods in this class.  Does not include constructors.
-     */
-    public MethodDoc[] methods(boolean filter) {
-        Names names = tsym.name.table.names;
-        List<MethodDocImpl> methods = List.nil();
-        for (Symbol sym :tsym.members().getSymbols(NON_RECURSIVE)) {
-            if (sym != null
-                && sym.kind == MTH
-                && sym.name != names.init
-                && sym.name != names.clinit) {
-                MethodSymbol s = (MethodSymbol)sym;
-                if (!filter || env.shouldDocument(s)) {
-                    methods = methods.prepend(env.getMethodDoc(s));
-                }
-            }
-        }
-        //### Cache methods here?
-        return methods.toArray(new MethodDocImpl[methods.length()]);
-    }
-
-    /**
-     * Return included methods in class.
-     *
-     * @return an array of MethodDocImpl for representing the visible
-     * methods in this class.  Does not include constructors.
-     */
-    public MethodDoc[] methods() {
-        return methods(true);
-    }
-
-    /**
-     * Return constructors in class.
-     *
-     * @param filter include only the included constructors if filter==true
-     * @return an array of ConstructorDocImpl for representing the visible
-     * constructors in this class.
-     */
-    public ConstructorDoc[] constructors(boolean filter) {
-        Names names = tsym.name.table.names;
-        List<ConstructorDocImpl> constructors = List.nil();
-        for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
-            if (sym != null &&
-                sym.kind == MTH && sym.name == names.init) {
-                MethodSymbol s = (MethodSymbol)sym;
-                if (!filter || env.shouldDocument(s)) {
-                    constructors = constructors.prepend(env.getConstructorDoc(s));
-                }
-            }
-        }
-        //### Cache constructors here?
-        return constructors.toArray(new ConstructorDocImpl[constructors.length()]);
-    }
-
-    /**
-     * Return included constructors in class.
-     *
-     * @return an array of ConstructorDocImpl for representing the visible
-     * constructors in this class.
-     */
-    public ConstructorDoc[] constructors() {
-        return constructors(true);
-    }
-
-    /**
-     * Adds all inner classes of this class, and their
-     * inner classes recursively, to the list l.
-     */
-    void addAllClasses(ListBuffer<ClassDocImpl> l, boolean filtered) {
-        try {
-            if (isSynthetic()) return;
-            // sometimes synthetic classes are not marked synthetic
-            if (!JavadocTool.isValidClassName(tsym.name.toString())) return;
-            if (filtered && !env.shouldDocument(tsym)) return;
-            if (l.contains(this)) return;
-            l.append(this);
-            List<ClassDocImpl> more = List.nil();
-            for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
-                if (sym != null && sym.kind == TYP) {
-                    ClassSymbol s = (ClassSymbol)sym;
-                    ClassDocImpl c = env.getClassDoc(s);
-                    if (c.isSynthetic()) continue;
-                    if (c != null) more = more.prepend(c);
-                }
-            }
-            // this extra step preserves the ordering from oldjavadoc
-            for (; more.nonEmpty(); more=more.tail) {
-                more.head.addAllClasses(l, filtered);
-            }
-        } catch (CompletionFailure e) {
-            // quietly ignore completion failures
-        }
-    }
-
-    /**
-     * Return inner classes within this class.
-     *
-     * @param filter include only the included inner classes if filter==true.
-     * @return an array of ClassDocImpl for representing the visible
-     * classes defined in this class. Anonymous and local classes
-     * are not included.
-     */
-    public ClassDoc[] innerClasses(boolean filter) {
-        ListBuffer<ClassDocImpl> innerClasses = new ListBuffer<>();
-        for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
-            if (sym != null && sym.kind == TYP) {
-                ClassSymbol s = (ClassSymbol)sym;
-                if ((s.flags_field & Flags.SYNTHETIC) != 0) continue;
-                if (!filter || env.isVisible(s)) {
-                    innerClasses.prepend(env.getClassDoc(s));
-                }
-            }
-        }
-        //### Cache classes here?
-        return innerClasses.toArray(new ClassDocImpl[innerClasses.length()]);
-    }
-
-    /**
-     * Return included inner classes within this class.
-     *
-     * @return an array of ClassDocImpl for representing the visible
-     * classes defined in this class. Anonymous and local classes
-     * are not included.
-     */
-    public ClassDoc[] innerClasses() {
-        return innerClasses(true);
-    }
-
-    /**
-     * Find a class within the context of this class.
-     * Search order: qualified name, in this class (inner),
-     * in this package, in the class imports, in the package
-     * imports.
-     * Return the ClassDocImpl if found, null if not found.
-     */
-    //### The specified search order is not the normal rule the
-    //### compiler would use.  Leave as specified or change it?
-    public ClassDoc findClass(String className) {
-        ClassDoc searchResult = searchClass(className);
-        if (searchResult == null) {
-            ClassDocImpl enclosingClass = (ClassDocImpl)containingClass();
-            //Expand search space to include enclosing class.
-            while (enclosingClass != null && enclosingClass.containingClass() != null) {
-                enclosingClass = (ClassDocImpl)enclosingClass.containingClass();
-            }
-            searchResult = enclosingClass == null ?
-                null : enclosingClass.searchClass(className);
-        }
-        return searchResult;
-    }
-
-    private ClassDoc searchClass(String className) {
-        Names names = tsym.name.table.names;
-
-        // search by qualified name first
-        ClassDoc cd = env.lookupClass(className);
-        if (cd != null) {
-            return cd;
-        }
-
-        // search inner classes
-        //### Add private entry point to avoid creating array?
-        //### Replicate code in innerClasses here to avoid consing?
-        for (ClassDoc icd : innerClasses()) {
-            if (icd.name().equals(className) ||
-                    //### This is from original javadoc but it looks suspicious to me...
-                    //### I believe it is attempting to compensate for the confused
-                    //### convention of including the nested class qualifiers in the
-                    //### 'name' of the inner class, rather than the true simple name.
-                    icd.name().endsWith("." + className)) {
-                return icd;
-            } else {
-                ClassDoc innercd = ((ClassDocImpl) icd).searchClass(className);
-                if (innercd != null) {
-                    return innercd;
-                }
-            }
-        }
-
-        // check in this package
-        cd = containingPackage().findClass(className);
-        if (cd != null) {
-            return cd;
-        }
-
-        // make sure that this symbol has been completed
-        tsym.complete();
-
-        // search imports
-
-        if (tsym.sourcefile != null) {
-
-            //### This information is available only for source classes.
-
-            Env<AttrContext> compenv = env.enter.getEnv(tsym);
-            if (compenv == null) return null;
-
-            Scope s = compenv.toplevel.namedImportScope;
-            for (Symbol sym : s.getSymbolsByName(names.fromString(className))) {
-                if (sym.kind == TYP) {
-                    ClassDoc c = env.getClassDoc((ClassSymbol)sym);
-                    return c;
-                }
-            }
-
-            s = compenv.toplevel.starImportScope;
-            for (Symbol sym : s.getSymbolsByName(names.fromString(className))) {
-                if (sym.kind == TYP) {
-                    ClassDoc c = env.getClassDoc((ClassSymbol)sym);
-                    return c;
-                }
-            }
-        }
-
-        return null; // not found
-    }
-
-
-    private boolean hasParameterTypes(MethodSymbol method, String[] argTypes) {
-
-        if (argTypes == null) {
-            // wildcard
-            return true;
-        }
-
-        int i = 0;
-        List<Type> types = method.type.getParameterTypes();
-
-        if (argTypes.length != types.length()) {
-            return false;
-        }
-
-        for (Type t : types) {
-            String argType = argTypes[i++];
-            // For vararg method, "T..." matches type T[].
-            if (i == argTypes.length) {
-                argType = argType.replace("...", "[]");
-            }
-            if (!hasTypeName(env.types.erasure(t), argType)) {  //###(gj)
-                return false;
-            }
-        }
-        return true;
-    }
-    // where
-    private boolean hasTypeName(Type t, String name) {
-        return
-            name.equals(TypeMaker.getTypeName(t, true))
-            ||
-            name.equals(TypeMaker.getTypeName(t, false))
-            ||
-            (qualifiedName() + "." + name).equals(TypeMaker.getTypeName(t, true));
-    }
-
-
-
-    /**
-     * Find a method in this class scope.
-     * Search order: this class, interfaces, superclasses, outerclasses.
-     * Note that this is not necessarily what the compiler would do!
-     *
-     * @param methodName the unqualified name to search for.
-     * @param paramTypes the array of Strings for method parameter types.
-     * @return the first MethodDocImpl which matches, null if not found.
-     */
-    public MethodDocImpl findMethod(String methodName, String[] paramTypes) {
-        // Use hash table 'searched' to avoid searching same class twice.
-        //### It is not clear how this could happen.
-        return searchMethod(methodName, paramTypes, new HashSet<ClassDocImpl>());
-    }
-
-    private MethodDocImpl searchMethod(String methodName,
-                                       String[] paramTypes, Set<ClassDocImpl> searched) {
-        //### Note that this search is not necessarily what the compiler would do!
-
-        Names names = tsym.name.table.names;
-        // do not match constructors
-        if (names.init.contentEquals(methodName)) {
-            return null;
-        }
-
-        ClassDocImpl cdi;
-        MethodDocImpl mdi;
-
-        if (searched.contains(this)) {
-            return null;
-        }
-        searched.add(this);
-
-        //DEBUG
-        /*---------------------------------*
-         System.out.print("searching " + this + " for " + methodName);
-         if (paramTypes == null) {
-         System.out.println("()");
-         } else {
-         System.out.print("(");
-         for (int k=0; k < paramTypes.length; k++) {
-         System.out.print(paramTypes[k]);
-         if ((k + 1) < paramTypes.length) {
-         System.out.print(", ");
-         }
-         }
-         System.out.println(")");
-         }
-         *---------------------------------*/
-
-        // search current class
-
-        //### Using modifier filter here isn't really correct,
-        //### but emulates the old behavior.  Instead, we should
-        //### apply the normal rules of visibility and inheritance.
-
-        if (paramTypes == null) {
-            // If no parameters specified, we are allowed to return
-            // any method with a matching name.  In practice, the old
-            // code returned the first method, which is now the last!
-            // In order to provide textually identical results, we
-            // attempt to emulate the old behavior.
-            MethodSymbol lastFound = null;
-            for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(methodName))) {
-                if (sym.kind == MTH) {
-                    //### Should intern methodName as Name.
-                    if (sym.name.toString().equals(methodName)) {
-                        lastFound = (MethodSymbol)sym;
-                    }
-                }
-            }
-            if (lastFound != null) {
-                return env.getMethodDoc(lastFound);
-            }
-        } else {
-            for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(methodName))) {
-                if (sym != null &&
-                    sym.kind == MTH) {
-                    //### Should intern methodName as Name.
-                    if (hasParameterTypes((MethodSymbol)sym, paramTypes)) {
-                        return env.getMethodDoc((MethodSymbol)sym);
-                    }
-                }
-            }
-        }
-
-        //### If we found a MethodDoc above, but which did not pass
-        //### the modifier filter, we should return failure here!
-
-        // search superclass
-        cdi = (ClassDocImpl)superclass();
-        if (cdi != null) {
-            mdi = cdi.searchMethod(methodName, paramTypes, searched);
-            if (mdi != null) {
-                return mdi;
-            }
-        }
-
-        // search interfaces
-        for (ClassDoc intf : interfaces()) {
-            cdi = (ClassDocImpl) intf;
-            mdi = cdi.searchMethod(methodName, paramTypes, searched);
-            if (mdi != null) {
-                return mdi;
-            }
-        }
-
-        // search enclosing class
-        cdi = (ClassDocImpl)containingClass();
-        if (cdi != null) {
-            mdi = cdi.searchMethod(methodName, paramTypes, searched);
-            if (mdi != null) {
-                return mdi;
-            }
-        }
-
-        //###(gj) As a temporary measure until type variables are better
-        //### handled, try again without the parameter types.
-        //### This should most often find the right method, and occassionally
-        //### find the wrong one.
-        //if (paramTypes != null) {
-        //    return findMethod(methodName, null);
-        //}
-
-        return null;
-    }
-
-    /**
-     * Find constructor in this class.
-     *
-     * @param constrName the unqualified name to search for.
-     * @param paramTypes the array of Strings for constructor parameters.
-     * @return the first ConstructorDocImpl which matches, null if not found.
-     */
-    public ConstructorDoc findConstructor(String constrName,
-                                          String[] paramTypes) {
-        Names names = tsym.name.table.names;
-        for (Symbol sym : tsym.members().getSymbolsByName(names.fromString("<init>"))) {
-            if (sym.kind == MTH) {
-                if (hasParameterTypes((MethodSymbol)sym, paramTypes)) {
-                    return env.getConstructorDoc((MethodSymbol)sym);
-                }
-            }
-        }
-
-        //###(gj) As a temporary measure until type variables are better
-        //### handled, try again without the parameter types.
-        //### This will often find the right constructor, and occassionally
-        //### find the wrong one.
-        //if (paramTypes != null) {
-        //    return findConstructor(constrName, null);
-        //}
-
-        return null;
-    }
-
-    /**
-     * Find a field in this class scope.
-     * Search order: this class, outerclasses, interfaces,
-     * superclasses. IMP: If see tag is defined in an inner class,
-     * which extends a super class and if outerclass and the super
-     * class have a visible field in common then Java compiler cribs
-     * about the ambiguity, but the following code will search in the
-     * above given search order.
-     *
-     * @param fieldName the unqualified name to search for.
-     * @return the first FieldDocImpl which matches, null if not found.
-     */
-    public FieldDoc findField(String fieldName) {
-        return searchField(fieldName, new HashSet<ClassDocImpl>());
-    }
-
-    private FieldDocImpl searchField(String fieldName, Set<ClassDocImpl> searched) {
-        Names names = tsym.name.table.names;
-        if (searched.contains(this)) {
-            return null;
-        }
-        searched.add(this);
-
-        for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(fieldName))) {
-            if (sym.kind == VAR) {
-                //### Should intern fieldName as Name.
-                return env.getFieldDoc((VarSymbol)sym);
-            }
-        }
-
-        //### If we found a FieldDoc above, but which did not pass
-        //### the modifier filter, we should return failure here!
-
-        ClassDocImpl cdi = (ClassDocImpl)containingClass();
-        if (cdi != null) {
-            FieldDocImpl fdi = cdi.searchField(fieldName, searched);
-            if (fdi != null) {
-                return fdi;
-            }
-        }
-
-        // search superclass
-        cdi = (ClassDocImpl)superclass();
-        if (cdi != null) {
-            FieldDocImpl fdi = cdi.searchField(fieldName, searched);
-            if (fdi != null) {
-                return fdi;
-            }
-        }
-
-        // search interfaces
-        for (ClassDoc intf : interfaces()) {
-            cdi = (ClassDocImpl) intf;
-            FieldDocImpl fdi = cdi.searchField(fieldName, searched);
-            if (fdi != null) {
-                return fdi;
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * Get the list of classes declared as imported.
-     * These are called "single-type-import declarations" in the JLS.
-     * This method is deprecated in the ClassDoc interface.
-     *
-     * @return an array of ClassDocImpl representing the imported classes.
-     *
-     * @deprecated  Import declarations are implementation details that
-     *          should not be exposed here.  In addition, not all imported
-     *          classes are imported through single-type-import declarations.
-     */
-    @Deprecated
-    public ClassDoc[] importedClasses() {
-        // information is not available for binary classfiles
-        if (tsym.sourcefile == null) return new ClassDoc[0];
-
-        ListBuffer<ClassDocImpl> importedClasses = new ListBuffer<>();
-
-        Env<AttrContext> compenv = env.enter.getEnv(tsym);
-        if (compenv == null) return new ClassDocImpl[0];
-
-        Name asterisk = tsym.name.table.names.asterisk;
-        for (JCTree t : compenv.toplevel.defs) {
-            if (t.hasTag(IMPORT)) {
-                JCTree imp = ((JCImport) t).qualid;
-                if ((TreeInfo.name(imp) != asterisk) &&
-                    imp.type.tsym.kind.matches(KindSelector.TYP)) {
-                    importedClasses.append(
-                            env.getClassDoc((ClassSymbol)imp.type.tsym));
-                }
-            }
-        }
-
-        return importedClasses.toArray(new ClassDocImpl[importedClasses.length()]);
-    }
-
-    /**
-     * Get the list of packages declared as imported.
-     * These are called "type-import-on-demand declarations" in the JLS.
-     * This method is deprecated in the ClassDoc interface.
-     *
-     * @return an array of PackageDocImpl representing the imported packages.
-     *
-     * ###NOTE: the syntax supports importing all inner classes from a class as well.
-     * @deprecated  Import declarations are implementation details that
-     *          should not be exposed here.  In addition, this method's
-     *          return type does not allow for all type-import-on-demand
-     *          declarations to be returned.
-     */
-    @Deprecated
-    public PackageDoc[] importedPackages() {
-        // information is not available for binary classfiles
-        if (tsym.sourcefile == null) return new PackageDoc[0];
-
-        ListBuffer<PackageDocImpl> importedPackages = new ListBuffer<>();
-
-        //### Add the implicit "import java.lang.*" to the result
-        Names names = tsym.name.table.names;
-        importedPackages.append(env.getPackageDoc(env.syms.enterPackage(env.syms.java_base, names.java_lang)));
-
-        Env<AttrContext> compenv = env.enter.getEnv(tsym);
-        if (compenv == null) return new PackageDocImpl[0];
-
-        for (JCTree t : compenv.toplevel.defs) {
-            if (t.hasTag(IMPORT)) {
-                JCTree imp = ((JCImport) t).qualid;
-                if (TreeInfo.name(imp) == names.asterisk) {
-                    JCFieldAccess sel = (JCFieldAccess)imp;
-                    Symbol s = sel.selected.type.tsym;
-                    PackageDocImpl pdoc = env.getPackageDoc(s.packge());
-                    if (!importedPackages.contains(pdoc))
-                        importedPackages.append(pdoc);
-                }
-            }
-        }
-
-        return importedPackages.toArray(new PackageDocImpl[importedPackages.length()]);
-    }
-
-    /**
-     * Return the type's dimension information.
-     * Always return "", as this is not an array type.
-     */
-    public String dimension() {
-        return "";
-    }
-
-    /**
-     * Return this type as a class, which it already is.
-     */
-    public ClassDoc asClassDoc() {
-        return this;
-    }
-
-    /**
-     * Return null (unless overridden), as this is not an annotation type.
-     */
-    public AnnotationTypeDoc asAnnotationTypeDoc() {
-        return null;
-    }
-
-    /**
-     * Return null, as this is not a class instantiation.
-     */
-    public ParameterizedType asParameterizedType() {
-        return null;
-    }
-
-    /**
-     * Return null, as this is not a type variable.
-     */
-    public TypeVariable asTypeVariable() {
-        return null;
-    }
-
-    /**
-     * Return null, as this is not a wildcard type.
-     */
-    public WildcardType asWildcardType() {
-        return null;
-    }
-
-    /**
-     * Returns null, as this is not an annotated type.
-     */
-    public AnnotatedType asAnnotatedType() {
-        return null;
-    }
-
-    /**
-     * Return false, as this is not a primitive type.
-     */
-    public boolean isPrimitive() {
-        return false;
-    }
-
-    //--- Serialization ---
-
-    //### These methods ignore modifier filter.
-
-    /**
-     * Return true if this class implements <code>java.io.Serializable</code>.
-     *
-     * Since <code>java.io.Externalizable</code> extends
-     * <code>java.io.Serializable</code>,
-     * Externalizable objects are also Serializable.
-     */
-    public boolean isSerializable() {
-        try {
-            return env.types.isSubtype(type, env.syms.serializableType);
-        } catch (CompletionFailure ex) {
-            // quietly ignore completion failures
-            return false;
-        }
-    }
-
-    /**
-     * Return true if this class implements
-     * <code>java.io.Externalizable</code>.
-     */
-    public boolean isExternalizable() {
-        try {
-            return env.types.isSubtype(type, env.externalizableSym.type);
-        } catch (CompletionFailure ex) {
-            // quietly ignore completion failures
-            return false;
-        }
-    }
-
-    /**
-     * Return the serialization methods for this class.
-     *
-     * @return an array of <code>MethodDocImpl</code> that represents
-     * the serialization methods for this class.
-     */
-    public MethodDoc[] serializationMethods() {
-        if (serializedForm == null) {
-            serializedForm = new SerializedForm(env, tsym, this);
-        }
-        //### Clone this?
-        return serializedForm.methods();
-    }
-
-    /**
-     * Return the Serializable fields of class.<p>
-     *
-     * Return either a list of default fields documented by
-     * <code>serial</code> tag<br>
-     * or return a single <code>FieldDoc</code> for
-     * <code>serialPersistentField</code> member.
-     * There should be a <code>serialField</code> tag for
-     * each Serializable field defined by an <code>ObjectStreamField</code>
-     * array component of <code>serialPersistentField</code>.
-     *
-     * @return an array of {@code FieldDoc} for the Serializable fields
-     *         of this class.
-     *
-     * @see #definesSerializableFields()
-     * @see SerialFieldTagImpl
-     */
-    public FieldDoc[] serializableFields() {
-        if (serializedForm == null) {
-            serializedForm = new SerializedForm(env, tsym, this);
-        }
-        //### Clone this?
-        return serializedForm.fields();
-    }
-
-    /**
-     * Return true if Serializable fields are explicitly defined with
-     * the special class member <code>serialPersistentFields</code>.
-     *
-     * @see #serializableFields()
-     * @see SerialFieldTagImpl
-     */
-    public boolean definesSerializableFields() {
-        if (!isSerializable() || isExternalizable()) {
-            return false;
-        } else {
-            if (serializedForm == null) {
-                serializedForm = new SerializedForm(env, tsym, this);
-            }
-            //### Clone this?
-            return serializedForm.definesSerializableFields();
-        }
-    }
-
-    /**
-     * Determine if a class is a RuntimeException.
-     * <p>
-     * Used only by ThrowsTagImpl.
-     */
-    boolean isRuntimeException() {
-        return tsym.isSubClass(env.syms.runtimeExceptionType.tsym, env.types);
-    }
-
-    /**
-     * Return the source position of the entity, or null if
-     * no position is available.
-     */
-    @Override
-    public SourcePosition position() {
-        if (tsym.sourcefile == null) return null;
-        return SourcePositionImpl.make(tsym.sourcefile,
-                                       (tree==null) ? Position.NOPOS : tree.pos,
-                                       lineMap);
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Comment.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,460 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import com.sun.javadoc.*;
-import com.sun.tools.javac.util.ListBuffer;
-
-/**
- * Comment contains all information in comment part.
- *      It allows users to get first sentence of this comment, get
- *      comment for different tags...
- *
- *  <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>
- *
- * @author Kaiyang Liu (original)
- * @author Robert Field (rewrite)
- * @author Atul M Dambalkar
- * @author Neal Gafter (rewrite)
- */
-class Comment {
-
-    /**
-     * sorted comments with different tags.
-     */
-    private final ListBuffer<Tag> tagList = new ListBuffer<>();
-
-    /**
-     * text minus any tags.
-     */
-    private String text;
-
-    /**
-     * Doc environment
-     */
-    private final DocEnv docenv;
-
-    /**
-     * constructor of Comment.
-     */
-    Comment(final DocImpl holder, final String commentString) {
-        this.docenv = holder.env;
-
-        /**
-         * Separate the comment into the text part and zero to N tags.
-         * Simple state machine is in one of three states:
-         * <pre>
-         * IN_TEXT: parsing the comment text or tag text.
-         * TAG_NAME: parsing the name of a tag.
-         * TAG_GAP: skipping through the gap between the tag name and
-         * the tag text.
-         * </pre>
-         */
-        @SuppressWarnings("fallthrough")
-        class CommentStringParser {
-            /**
-             * The entry point to the comment string parser
-             */
-            void parseCommentStateMachine() {
-                final int IN_TEXT = 1;
-                final int TAG_GAP = 2;
-                final int TAG_NAME = 3;
-                int state = TAG_GAP;
-                boolean newLine = true;
-                String tagName = null;
-                int tagStart = 0;
-                int textStart = 0;
-                int lastNonWhite = -1;
-                int len = commentString.length();
-                for (int inx = 0; inx < len; ++inx) {
-                    char ch = commentString.charAt(inx);
-                    boolean isWhite = Character.isWhitespace(ch);
-                    switch (state)  {
-                        case TAG_NAME:
-                            if (isWhite) {
-                                tagName = commentString.substring(tagStart, inx);
-                                state = TAG_GAP;
-                            }
-                            break;
-                        case TAG_GAP:
-                            if (isWhite) {
-                                break;
-                            }
-                            textStart = inx;
-                            state = IN_TEXT;
-                            /* fall thru */
-                        case IN_TEXT:
-                            if (newLine && ch == '@') {
-                                parseCommentComponent(tagName, textStart,
-                                                      lastNonWhite+1);
-                                tagStart = inx;
-                                state = TAG_NAME;
-                            }
-                            break;
-                    }
-                    if (ch == '\n') {
-                        newLine = true;
-                    } else if (!isWhite) {
-                        lastNonWhite = inx;
-                        newLine = false;
-                    }
-                }
-                // Finish what's currently being processed
-                switch (state)  {
-                    case TAG_NAME:
-                        tagName = commentString.substring(tagStart, len);
-                        /* fall thru */
-                    case TAG_GAP:
-                        textStart = len;
-                        /* fall thru */
-                    case IN_TEXT:
-                        parseCommentComponent(tagName, textStart, lastNonWhite+1);
-                        break;
-                }
-            }
-
-            /**
-             * Save away the last parsed item.
-             */
-            void parseCommentComponent(String tagName,
-                                       int from, int upto) {
-                String tx = upto <= from ? "" : commentString.substring(from, upto);
-                if (tagName == null) {
-                    text = tx;
-                } else {
-                    TagImpl tag;
-                    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);
-                }
-            }
-
-            void warnIfEmpty(String tagName, String tx) {
-                if (tx.length() == 0) {
-                    docenv.warning(holder, "tag.tag_has_no_arguments", tagName);
-                }
-            }
-
-        }
-
-        new CommentStringParser().parseCommentStateMachine();
-    }
-
-    /**
-     * Return the text of the comment.
-     */
-    String commentText() {
-        return text;
-    }
-
-    /**
-     * Return all tags in this comment.
-     */
-    Tag[] tags() {
-        return tagList.toArray(new Tag[tagList.length()]);
-    }
-
-    /**
-     * Return tags of the specified kind in this comment.
-     */
-    Tag[] tags(String tagname) {
-        ListBuffer<Tag> found = new ListBuffer<>();
-        String target = tagname;
-        if (target.charAt(0) != '@') {
-            target = "@" + target;
-        }
-        for (Tag tag : tagList) {
-            if (tag.kind().equals(target)) {
-                found.append(tag);
-            }
-        }
-        return found.toArray(new Tag[found.length()]);
-    }
-
-    /**
-     * Return throws tags in this comment.
-     */
-    ThrowsTag[] throwsTags() {
-        ListBuffer<ThrowsTag> found = new ListBuffer<>();
-        for (Tag next : tagList) {
-            if (next instanceof ThrowsTag) {
-                found.append((ThrowsTag)next);
-            }
-        }
-        return found.toArray(new ThrowsTag[found.length()]);
-    }
-
-    /**
-     * Return param tags (excluding type param tags) in this comment.
-     */
-    ParamTag[] paramTags() {
-        return paramTags(false);
-    }
-
-    /**
-     * Return type param tags in this comment.
-     */
-    ParamTag[] typeParamTags() {
-        return paramTags(true);
-    }
-
-    /**
-     * Return param tags in this comment.  If typeParams is true
-     * include only type param tags, otherwise include only ordinary
-     * param tags.
-     */
-    private ParamTag[] paramTags(boolean typeParams) {
-        ListBuffer<ParamTag> found = new ListBuffer<>();
-        for (Tag next : tagList) {
-            if (next instanceof ParamTag) {
-                ParamTag p = (ParamTag)next;
-                if (typeParams == p.isTypeParameter()) {
-                    found.append(p);
-                }
-            }
-        }
-        return found.toArray(new ParamTag[found.length()]);
-    }
-
-    /**
-     * Return see also tags in this comment.
-     */
-    SeeTag[] seeTags() {
-        ListBuffer<SeeTag> found = new ListBuffer<>();
-        for (Tag next : tagList) {
-            if (next instanceof SeeTag) {
-                found.append((SeeTag)next);
-            }
-        }
-        return found.toArray(new SeeTag[found.length()]);
-    }
-
-    /**
-     * Return serialField tags in this comment.
-     */
-    SerialFieldTag[] serialFieldTags() {
-        ListBuffer<SerialFieldTag> found = new ListBuffer<>();
-        for (Tag next : tagList) {
-            if (next instanceof SerialFieldTag) {
-                found.append((SerialFieldTag)next);
-            }
-        }
-        return found.toArray(new SerialFieldTag[found.length()]);
-    }
-
-    /**
-     * 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<>();
-        int delimend = 0, textstart = 0, len = inlinetext.length();
-        boolean inPre = false;
-        DocEnv docenv = holder.env;
-
-        if (len == 0) {
-            return taglist.toArray(new Tag[taglist.length()]);
-        }
-        while (true) {
-            int linkstart;
-            if ((linkstart = inlineTagFound(holder, inlinetext,
-                                            textstart)) == -1) {
-                taglist.append(new TagImpl(holder, "Text",
-                                           inlinetext.substring(textstart)));
-                break;
-            } else {
-                inPre = scanForPre(inlinetext, textstart, linkstart, inPre);
-                int seetextstart = linkstart;
-                for (int i = linkstart; i < inlinetext.length(); i++) {
-                    char c = inlinetext.charAt(i);
-                    if (Character.isWhitespace(c) ||
-                        c == '}') {
-                        seetextstart = i;
-                        break;
-                     }
-                }
-                String linkName = inlinetext.substring(linkstart+2, seetextstart);
-                if (!(inPre && (linkName.equals("code") || linkName.equals("literal")))) {
-                    //Move past the white space after the inline tag name.
-                    while (Character.isWhitespace(inlinetext.
-                                                      charAt(seetextstart))) {
-                        if (inlinetext.length() <= seetextstart) {
-                            taglist.append(new TagImpl(holder, "Text",
-                                                       inlinetext.substring(textstart, seetextstart)));
-                            docenv.warning(holder,
-                                           "tag.Improper_Use_Of_Link_Tag",
-                                           inlinetext);
-                            return taglist.toArray(new Tag[taglist.length()]);
-                        } else {
-                            seetextstart++;
-                        }
-                    }
-                }
-                taglist.append(new TagImpl(holder, "Text",
-                                           inlinetext.substring(textstart, linkstart)));
-                textstart = seetextstart;   // this text is actually seetag
-                if ((delimend = findInlineTagDelim(inlinetext, textstart)) == -1) {
-                    //Missing closing '}' character.
-                    // store the text as it is with the {@link.
-                    taglist.append(new TagImpl(holder, "Text",
-                                               inlinetext.substring(textstart)));
-                    docenv.warning(holder,
-                                   "tag.End_delimiter_missing_for_possible_SeeTag",
-                                   inlinetext);
-                    return taglist.toArray(new Tag[taglist.length()]);
-                } else {
-                    //Found closing '}' character.
-                    if (linkName.equals("see")
-                           || linkName.equals("link")
-                           || linkName.equals("linkplain")) {
-                        taglist.append( new SeeTagImpl(holder, "@" + linkName,
-                              inlinetext.substring(textstart, delimend)));
-                    } else {
-                        taglist.append( new TagImpl(holder, "@" + linkName,
-                              inlinetext.substring(textstart, delimend)));
-                    }
-                    textstart = delimend + 1;
-                }
-            }
-            if (textstart == inlinetext.length()) {
-                break;
-            }
-        }
-        return taglist.toArray(new Tag[taglist.length()]);
-    }
-
-    /** regex for case-insensitive match for {@literal <pre> } and  {@literal </pre> }. */
-    private static final Pattern prePat = Pattern.compile("(?i)<(/?)pre>");
-
-    private static boolean scanForPre(String inlinetext, int start, int end, boolean inPre) {
-        Matcher m = prePat.matcher(inlinetext).region(start, end);
-        while (m.find()) {
-            inPre = m.group(1).isEmpty();
-        }
-        return inPre;
-    }
-
-    /**
-     * Recursively find the index of the closing '}' character for an inline tag
-     * and return it.  If it can't be found, return -1.
-     * @param inlineText the text to search in.
-     * @param searchStart the index of the place to start searching at.
-     * @return the index of the closing '}' character for an inline tag.
-     * If it can't be found, return -1.
-     */
-    private static int findInlineTagDelim(String inlineText, int searchStart) {
-        int delimEnd, nestedOpenBrace;
-        if ((delimEnd = inlineText.indexOf("}", searchStart)) == -1) {
-            return -1;
-        } else if (((nestedOpenBrace = inlineText.indexOf("{", searchStart)) != -1) &&
-            nestedOpenBrace < delimEnd){
-            //Found a nested open brace.
-            int nestedCloseBrace = findInlineTagDelim(inlineText, nestedOpenBrace + 1);
-            return (nestedCloseBrace != -1) ?
-                findInlineTagDelim(inlineText, nestedCloseBrace + 1) :
-                -1;
-        } else {
-            return delimEnd;
-        }
-    }
-
-    /**
-     * Recursively search for the characters '{', '@', followed by
-     * name of inline tag and white space,
-     * if found
-     *    return the index of the text following the white space.
-     * else
-     *    return -1.
-     */
-    private static int inlineTagFound(DocImpl holder, String inlinetext, int start) {
-        DocEnv docenv = holder.env;
-        int linkstart = inlinetext.indexOf("{@", start);
-        if (start == inlinetext.length() || linkstart == -1) {
-            return -1;
-        } else if (inlinetext.indexOf('}', linkstart) == -1) {
-            //Missing '}'.
-            docenv.warning(holder, "tag.Improper_Use_Of_Link_Tag",
-                    inlinetext.substring(linkstart, inlinetext.length()));
-            return -1;
-        } else {
-            return linkstart;
-        }
-    }
-
-
-    /**
-     * Return array of tags for the locale specific first sentence in the text.
-     */
-    static Tag[] firstSentenceTags(DocImpl holder, String text) {
-        DocLocale doclocale = holder.env.doclocale;
-        return getInlineTags(holder,
-                             doclocale.localeSpecificFirstSentence(holder, text));
-    }
-
-    /**
-     * Return text for this Doc comment.
-     */
-    @Override
-    public String toString() {
-        return text;
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ConstructorDocImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import com.sun.javadoc.*;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.MethodSymbol;
-
-/**
- * Represents a constructor of a java class.
- *
- *  <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>
- *
- * @since 1.2
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- */
-
-public class ConstructorDocImpl
-        extends ExecutableMemberDocImpl implements ConstructorDoc {
-
-    /**
-     * constructor.
-     */
-    public ConstructorDocImpl(DocEnv env, MethodSymbol sym) {
-        super(env, sym);
-    }
-
-    /**
-     * constructor.
-     */
-    public ConstructorDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) {
-        super(env, sym, treePath);
-    }
-
-    /**
-     * Return true if it is a constructor, which it is.
-     *
-     * @return true
-     */
-    public boolean isConstructor() {
-        return true;
-    }
-
-    /**
-     * Get the name.
-     *
-     * @return the name of the member.
-     */
-    public String name() {
-        ClassSymbol c = sym.enclClass();
-        return c.name.toString();
-    }
-
-    /**
-     * Get the name.
-     *
-     * @return the qualified name of the member.
-     */
-    public String qualifiedName() {
-        return sym.enclClass().getQualifiedName().toString();
-    }
-
-    /**
-     * Returns a string representation of this constructor.  Includes the
-     * qualified signature and any type parameters.
-     * Type parameters precede the class name, as they do in the syntax
-     * for invoking constructors with explicit type parameters using "new".
-     * (This is unlike the syntax for invoking methods with explicit type
-     * parameters.)
-     */
-    public String toString() {
-        return typeParametersString() + qualifiedName() + signature();
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,869 +0,0 @@
-/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.javadoc;
-
-import java.lang.reflect.Modifier;
-import java.util.*;
-
-import javax.tools.JavaFileManager;
-
-import com.sun.javadoc.*;
-import com.sun.source.tree.CompilationUnitTree;
-import com.sun.source.util.JavacTask;
-import com.sun.source.util.TreePath;
-import com.sun.tools.doclint.DocLint;
-import com.sun.tools.javac.api.BasicJavacTask;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.CompletionFailure;
-import com.sun.tools.javac.code.Symbol.MethodSymbol;
-import com.sun.tools.javac.code.Symbol.PackageSymbol;
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-import com.sun.tools.javac.code.Type.ClassType;
-import com.sun.tools.javac.comp.Check;
-import com.sun.tools.javac.comp.Enter;
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCClassDecl;
-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
-import com.sun.tools.javac.tree.JCTree.JCPackageDecl;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Convert;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Names;
-
-/**
- * Holds the environment for a run of javadoc.
- * Holds only the information needed throughout the
- * run and not the compiler info that could be GC'ed
- * or ported.
- *
- *  <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>
- *
- * @since 1.4
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- * @author Scott Seligman (generics)
- */
-public class DocEnv {
-    protected static final Context.Key<DocEnv> docEnvKey = new Context.Key<>();
-
-    public static DocEnv instance(Context context) {
-        DocEnv instance = context.get(docEnvKey);
-        if (instance == null)
-            instance = new DocEnv(context);
-        return instance;
-    }
-
-    DocLocale doclocale;
-
-    private final Messager messager;
-
-    /** Predefined symbols known to the compiler. */
-    final Symtab syms;
-
-    /** Referenced directly in RootDocImpl. */
-    private final ClassFinder finder;
-
-    /** Javadoc's own version of the compiler's enter phase. */
-    final Enter enter;
-
-    /** The name table. */
-    private Names names;
-
-    /** The encoding name. */
-    private String encoding;
-
-    final Symbol externalizableSym;
-
-    /** Access filter (public, protected, ...).  */
-    protected ModifierFilter showAccess;
-
-    /** True if we are using a sentence BreakIterator. */
-    boolean breakiterator;
-
-    /**
-     * True if we do not want to print any notifications at all.
-     */
-    boolean quiet = false;
-
-    Check chk;
-    Types types;
-    JavaFileManager fileManager;
-    Context context;
-    DocLint doclint;
-
-    WeakHashMap<JCTree, TreePath> treePaths = new WeakHashMap<>();
-
-    /** Allow documenting from class files? */
-    boolean docClasses = false;
-
-    /** Does the doclet only expect pre-1.5 doclet API? */
-    protected boolean legacyDoclet = true;
-
-    /**
-     * Set this to true if you would like to not emit any errors, warnings and
-     * notices.
-     */
-    private boolean silent = false;
-
-    /**
-     * The source language version.
-     */
-    protected Source source;
-
-    /**
-     * Constructor
-     *
-     * @param context      Context for this javadoc instance.
-     */
-    protected DocEnv(Context context) {
-        context.put(docEnvKey, this);
-        this.context = context;
-
-        messager = Messager.instance0(context);
-        syms = Symtab.instance(context);
-        finder = JavadocClassFinder.instance(context);
-        enter = JavadocEnter.instance(context);
-        names = Names.instance(context);
-        externalizableSym = syms.enterClass(syms.java_base, names.fromString("java.io.Externalizable"));
-        chk = Check.instance(context);
-        types = Types.instance(context);
-        fileManager = context.get(JavaFileManager.class);
-        if (fileManager instanceof JavacFileManager) {
-            ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
-        }
-
-        // Default.  Should normally be reset with setLocale.
-        this.doclocale = new DocLocale(this, "", breakiterator);
-        source = Source.instance(context);
-    }
-
-    public void setSilent(boolean silent) {
-        this.silent = silent;
-    }
-
-    /**
-     * Look up ClassDoc by qualified name.
-     */
-    public ClassDocImpl lookupClass(String name) {
-        ClassSymbol c = getClassSymbol(name);
-        if (c != null) {
-            return getClassDoc(c);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Load ClassDoc by qualified name.
-     */
-    public ClassDocImpl loadClass(String name) {
-        try {
-            Name nameImpl = names.fromString(name);
-            ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl));
-            ClassSymbol c = finder.loadClass(mod != null ? mod : syms.errModule, nameImpl);
-            return getClassDoc(c);
-        } catch (CompletionFailure ex) {
-            chk.completionError(null, ex);
-            return null;
-        }
-    }
-
-    /**
-     * Look up PackageDoc by qualified name.
-     */
-    public PackageDocImpl lookupPackage(String name) {
-        //### Jing alleges that class check is needed
-        //### to avoid a compiler bug.  Most likely
-        //### instead a dummy created for error recovery.
-        //### Should investigate this.
-        Name nameImpl = names.fromString(name);
-        ModuleSymbol mod = syms.inferModule(nameImpl);
-        PackageSymbol p = mod != null ? syms.getPackage(mod, nameImpl) : null;
-        ClassSymbol c = getClassSymbol(name);
-        if (p != null && c == null) {
-            return getPackageDoc(p);
-        } else {
-            return null;
-        }
-    }
-        // where
-        /** Retrieve class symbol by fully-qualified name.
-         */
-        ClassSymbol getClassSymbol(String name) {
-            // Name may contain nested class qualification.
-            // Generate candidate flatnames with successively shorter
-            // package qualifiers and longer nested class qualifiers.
-            int nameLen = name.length();
-            char[] nameChars = name.toCharArray();
-            int idx = name.length();
-            for (;;) {
-                Name nameImpl = names.fromChars(nameChars, 0, nameLen);
-                ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl));
-                ClassSymbol s = mod != null ? syms.getClass(mod, nameImpl) : null;
-                if (s != null)
-                    return s; // found it!
-                idx = name.substring(0, idx).lastIndexOf('.');
-                if (idx < 0) break;
-                nameChars[idx] = '$';
-            }
-            return null;
-        }
-
-    /**
-     * Set the locale.
-     */
-    public void setLocale(String localeName) {
-        // create locale specifics
-        doclocale = new DocLocale(this, localeName, breakiterator);
-        // update Messager if locale has changed.
-        messager.setLocale(doclocale.locale);
-    }
-
-    /** Check whether this member should be documented. */
-    public boolean shouldDocument(VarSymbol sym) {
-        long mod = sym.flags();
-
-        if ((mod & Flags.SYNTHETIC) != 0) {
-            return false;
-        }
-
-        return showAccess.checkModifier(translateModifiers(mod));
-    }
-
-    /** Check whether this member should be documented. */
-    public boolean shouldDocument(MethodSymbol sym) {
-        long mod = sym.flags();
-
-        if ((mod & Flags.SYNTHETIC) != 0) {
-            return false;
-        }
-
-        return showAccess.checkModifier(translateModifiers(mod));
-    }
-
-    /** check whether this class should be documented. */
-    public boolean shouldDocument(ClassSymbol sym) {
-        return
-            (sym.flags_field&Flags.SYNTHETIC) == 0 && // no synthetics
-            (docClasses || getClassDoc(sym).tree != null) &&
-            isVisible(sym);
-    }
-
-    //### Comment below is inaccurate wrt modifier filter testing
-    /**
-     * Check the visibility if this is an nested class.
-     * if this is not a nested class, return true.
-     * if this is an static visible nested class,
-     *    return true.
-     * if this is an visible nested class
-     *    if the outer class is visible return true.
-     *    else return false.
-     * IMPORTANT: This also allows, static nested classes
-     * to be defined inside an nested class, which is not
-     * allowed by the compiler. So such an test case will
-     * not reach upto this method itself, but if compiler
-     * allows it, then that will go through.
-     */
-    protected boolean isVisible(ClassSymbol sym) {
-        long mod = sym.flags_field;
-        if (!showAccess.checkModifier(translateModifiers(mod))) {
-            return false;
-        }
-        ClassSymbol encl = sym.owner.enclClass();
-        return (encl == null || (mod & Flags.STATIC) != 0 || isVisible(encl));
-    }
-
-    //---------------- print forwarders ----------------//
-
-    /**
-     * Print error message, increment error count.
-     *
-     * @param msg message to print.
-     */
-    public void printError(String msg) {
-        if (silent)
-            return;
-        messager.printError(msg);
-    }
-
-    /**
-     * Print error message, increment error count.
-     *
-     * @param key selects message from resource
-     */
-    public void error(DocImpl doc, String key) {
-        if (silent)
-            return;
-        messager.error(doc==null ? null : doc.position(), key);
-    }
-
-    /**
-     * Print error message, increment error count.
-     *
-     * @param key selects message from resource
-     */
-    public void error(SourcePosition pos, String key) {
-        if (silent)
-            return;
-        messager.error(pos, key);
-    }
-
-    /**
-     * Print error message, increment error count.
-     *
-     * @param msg message to print.
-     */
-    public void printError(SourcePosition pos, String msg) {
-        if (silent)
-            return;
-        messager.printError(pos, msg);
-    }
-
-    /**
-     * Print error message, increment error count.
-     *
-     * @param key selects message from resource
-     * @param a1 first argument
-     */
-    public void error(DocImpl doc, String key, String a1) {
-        if (silent)
-            return;
-        messager.error(doc==null ? null : doc.position(), key, a1);
-    }
-
-    /**
-     * Print error message, increment error count.
-     *
-     * @param key selects message from resource
-     * @param a1 first argument
-     * @param a2 second argument
-     */
-    public void error(DocImpl doc, String key, String a1, String a2) {
-        if (silent)
-            return;
-        messager.error(doc==null ? null : doc.position(), key, a1, a2);
-    }
-
-    /**
-     * Print error message, increment error count.
-     *
-     * @param key selects message from resource
-     * @param a1 first argument
-     * @param a2 second argument
-     * @param a3 third argument
-     */
-    public void error(DocImpl doc, String key, String a1, String a2, String a3) {
-        if (silent)
-            return;
-        messager.error(doc==null ? null : doc.position(), key, a1, a2, a3);
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param msg message to print.
-     */
-    public void printWarning(String msg) {
-        if (silent)
-            return;
-        messager.printWarning(msg);
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param key selects message from resource
-     */
-    public void warning(DocImpl doc, String key) {
-        if (silent)
-            return;
-        messager.warning(doc==null ? null : doc.position(), key);
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param msg message to print.
-     */
-    public void printWarning(SourcePosition pos, String msg) {
-        if (silent)
-            return;
-        messager.printWarning(pos, msg);
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param key selects message from resource
-     * @param a1 first argument
-     */
-    public void warning(DocImpl doc, String key, String a1) {
-        if (silent)
-            return;
-        // suppress messages that have (probably) been covered by doclint
-        if (doclint != null && doc != null && key.startsWith("tag"))
-            return;
-        messager.warning(doc==null ? null : doc.position(), key, a1);
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param key selects message from resource
-     * @param a1 first argument
-     * @param a2 second argument
-     */
-    public void warning(DocImpl doc, String key, String a1, String a2) {
-        if (silent)
-            return;
-        messager.warning(doc==null ? null : doc.position(), key, a1, a2);
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param key selects message from resource
-     * @param a1 first argument
-     * @param a2 second argument
-     * @param a3 third argument
-     */
-    public void warning(DocImpl doc, String key, String a1, String a2, String a3) {
-        if (silent)
-            return;
-        messager.warning(doc==null ? null : doc.position(), key, a1, a2, a3);
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param key selects message from resource
-     * @param a1 first argument
-     * @param a2 second argument
-     * @param a3 third argument
-     */
-    public void warning(DocImpl doc, String key, String a1, String a2, String a3,
-                        String a4) {
-        if (silent)
-            return;
-        messager.warning(doc==null ? null : doc.position(), key, a1, a2, a3, a4);
-    }
-
-    /**
-     * Print a message.
-     *
-     * @param msg message to print.
-     */
-    public void printNotice(String msg) {
-        if (silent || quiet)
-            return;
-        messager.printNotice(msg);
-    }
-
-
-    /**
-     * Print a message.
-     *
-     * @param key selects message from resource
-     */
-    public void notice(String key) {
-        if (silent || quiet)
-            return;
-        messager.notice(key);
-    }
-
-    /**
-     * Print a message.
-     *
-     * @param msg message to print.
-     */
-    public void printNotice(SourcePosition pos, String msg) {
-        if (silent || quiet)
-            return;
-        messager.printNotice(pos, msg);
-    }
-
-    /**
-     * Print a message.
-     *
-     * @param key selects message from resource
-     * @param a1 first argument
-     */
-    public void notice(String key, String a1) {
-        if (silent || quiet)
-            return;
-        messager.notice(key, a1);
-    }
-
-    /**
-     * Print a message.
-     *
-     * @param key selects message from resource
-     * @param a1 first argument
-     * @param a2 second argument
-     */
-    public void notice(String key, String a1, String a2) {
-        if (silent || quiet)
-            return;
-        messager.notice(key, a1, a2);
-    }
-
-    /**
-     * Print a message.
-     *
-     * @param key selects message from resource
-     * @param a1 first argument
-     * @param a2 second argument
-     * @param a3 third argument
-     */
-    public void notice(String key, String a1, String a2, String a3) {
-        if (silent || quiet)
-            return;
-        messager.notice(key, a1, a2, a3);
-    }
-
-    /**
-     * Exit, reporting errors and warnings.
-     */
-    public void exit() {
-        // Messager should be replaced by a more general
-        // compilation environment.  This can probably
-        // subsume DocEnv as well.
-        messager.exit();
-    }
-
-    protected Map<PackageSymbol, PackageDocImpl> packageMap = new HashMap<>();
-    /**
-     * Return the PackageDoc of this package symbol.
-     */
-    public PackageDocImpl getPackageDoc(PackageSymbol pack) {
-        PackageDocImpl result = packageMap.get(pack);
-        if (result != null) return result;
-        result = new PackageDocImpl(this, pack);
-        packageMap.put(pack, result);
-        return result;
-    }
-
-    /**
-     * Create the PackageDoc (or a subtype) for a package symbol.
-     */
-    void makePackageDoc(PackageSymbol pack, TreePath treePath) {
-        PackageDocImpl result = packageMap.get(pack);
-        if (result != null) {
-            if (treePath != null) result.setTreePath(treePath);
-        } else {
-            result = new PackageDocImpl(this, pack, treePath);
-            packageMap.put(pack, result);
-        }
-    }
-
-
-    protected Map<ClassSymbol, ClassDocImpl> classMap = new HashMap<>();
-    /**
-     * Return the ClassDoc (or a subtype) of this class symbol.
-     */
-    public ClassDocImpl getClassDoc(ClassSymbol clazz) {
-        ClassDocImpl result = classMap.get(clazz);
-        if (result != null) return result;
-        if (isAnnotationType(clazz)) {
-            result = new AnnotationTypeDocImpl(this, clazz);
-        } else {
-            result = new ClassDocImpl(this, clazz);
-        }
-        classMap.put(clazz, result);
-        return result;
-    }
-
-    /**
-     * Create the ClassDoc (or a subtype) for a class symbol.
-     */
-    protected void makeClassDoc(ClassSymbol clazz, TreePath treePath) {
-        ClassDocImpl result = classMap.get(clazz);
-        if (result != null) {
-            if (treePath != null) result.setTreePath(treePath);
-            return;
-        }
-        if (isAnnotationType((JCClassDecl) treePath.getLeaf())) {   // flags of clazz may not yet be set
-            result = new AnnotationTypeDocImpl(this, clazz, treePath);
-        } else {
-            result = new ClassDocImpl(this, clazz, treePath);
-        }
-        classMap.put(clazz, result);
-    }
-
-    protected static boolean isAnnotationType(ClassSymbol clazz) {
-        return ClassDocImpl.isAnnotationType(clazz);
-    }
-
-    protected static boolean isAnnotationType(JCClassDecl tree) {
-        return (tree.mods.flags & Flags.ANNOTATION) != 0;
-    }
-
-    protected Map<VarSymbol, FieldDocImpl> fieldMap = new HashMap<>();
-    /**
-     * Return the FieldDoc of this var symbol.
-     */
-    public FieldDocImpl getFieldDoc(VarSymbol var) {
-        FieldDocImpl result = fieldMap.get(var);
-        if (result != null) return result;
-        result = new FieldDocImpl(this, var);
-        fieldMap.put(var, result);
-        return result;
-    }
-    /**
-     * Create a FieldDoc for a var symbol.
-     */
-    protected void makeFieldDoc(VarSymbol var, TreePath treePath) {
-        FieldDocImpl result = fieldMap.get(var);
-        if (result != null) {
-            if (treePath != null) result.setTreePath(treePath);
-        } else {
-            result = new FieldDocImpl(this, var, treePath);
-            fieldMap.put(var, result);
-        }
-    }
-
-    protected Map<MethodSymbol, ExecutableMemberDocImpl> methodMap = new HashMap<>();
-    /**
-     * Create a MethodDoc for this MethodSymbol.
-     * Should be called only on symbols representing methods.
-     */
-    protected void makeMethodDoc(MethodSymbol meth, TreePath treePath) {
-        MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
-        if (result != null) {
-            if (treePath != null) result.setTreePath(treePath);
-        } else {
-            result = new MethodDocImpl(this, meth, treePath);
-            methodMap.put(meth, result);
-        }
-    }
-
-    /**
-     * Return the MethodDoc for a MethodSymbol.
-     * Should be called only on symbols representing methods.
-     */
-    public MethodDocImpl getMethodDoc(MethodSymbol meth) {
-        assert !meth.isConstructor() : "not expecting a constructor symbol";
-        MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
-        if (result != null) return result;
-        result = new MethodDocImpl(this, meth);
-        methodMap.put(meth, result);
-        return result;
-    }
-
-    /**
-     * Create the ConstructorDoc for a MethodSymbol.
-     * Should be called only on symbols representing constructors.
-     */
-    protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) {
-        ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
-        if (result != null) {
-            if (treePath != null) result.setTreePath(treePath);
-        } else {
-            result = new ConstructorDocImpl(this, meth, treePath);
-            methodMap.put(meth, result);
-        }
-    }
-
-    /**
-     * Return the ConstructorDoc for a MethodSymbol.
-     * Should be called only on symbols representing constructors.
-     */
-    public ConstructorDocImpl getConstructorDoc(MethodSymbol meth) {
-        assert meth.isConstructor() : "expecting a constructor symbol";
-        ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
-        if (result != null) return result;
-        result = new ConstructorDocImpl(this, meth);
-        methodMap.put(meth, result);
-        return result;
-    }
-
-    /**
-     * Create the AnnotationTypeElementDoc for a MethodSymbol.
-     * Should be called only on symbols representing annotation type elements.
-     */
-    protected void makeAnnotationTypeElementDoc(MethodSymbol meth, TreePath treePath) {
-        AnnotationTypeElementDocImpl result =
-            (AnnotationTypeElementDocImpl)methodMap.get(meth);
-        if (result != null) {
-            if (treePath != null) result.setTreePath(treePath);
-        } else {
-            result =
-                new AnnotationTypeElementDocImpl(this, meth, treePath);
-            methodMap.put(meth, result);
-        }
-    }
-
-    /**
-     * Return the AnnotationTypeElementDoc for a MethodSymbol.
-     * Should be called only on symbols representing annotation type elements.
-     */
-    public AnnotationTypeElementDocImpl getAnnotationTypeElementDoc(
-            MethodSymbol meth) {
-
-        AnnotationTypeElementDocImpl result =
-            (AnnotationTypeElementDocImpl)methodMap.get(meth);
-        if (result != null) return result;
-        result = new AnnotationTypeElementDocImpl(this, meth);
-        methodMap.put(meth, result);
-        return result;
-    }
-
-//  private Map<ClassType, ParameterizedTypeImpl> parameterizedTypeMap =
-//          new HashMap<ClassType, ParameterizedTypeImpl>();
-    /**
-     * Return the ParameterizedType of this instantiation.
-//   * ### Could use Type.sameTypeAs() instead of equality matching in hashmap
-//   * ### to avoid some duplication.
-     */
-    ParameterizedTypeImpl getParameterizedType(ClassType t) {
-        return new ParameterizedTypeImpl(this, t);
-//      ParameterizedTypeImpl result = parameterizedTypeMap.get(t);
-//      if (result != null) return result;
-//      result = new ParameterizedTypeImpl(this, t);
-//      parameterizedTypeMap.put(t, result);
-//      return result;
-    }
-
-    TreePath getTreePath(JCCompilationUnit tree) {
-        TreePath p = treePaths.get(tree);
-        if (p == null)
-            treePaths.put(tree, p = new TreePath(tree));
-        return p;
-    }
-
-    TreePath getTreePath(JCCompilationUnit toplevel, JCPackageDecl tree) {
-        TreePath p = treePaths.get(tree);
-        if (p == null)
-            treePaths.put(tree, p = new TreePath(getTreePath(toplevel), tree));
-        return p;
-    }
-
-    TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl tree) {
-        TreePath p = treePaths.get(tree);
-        if (p == null)
-            treePaths.put(tree, p = new TreePath(getTreePath(toplevel), tree));
-        return p;
-    }
-
-    TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl cdecl, JCTree tree) {
-        return new TreePath(getTreePath(toplevel, cdecl), tree);
-    }
-
-    /**
-     * Set the encoding.
-     */
-    public void setEncoding(String encoding) {
-        this.encoding = encoding;
-    }
-
-    /**
-     * Get the encoding.
-     */
-    public String getEncoding() {
-        return encoding;
-    }
-
-    /**
-     * Convert modifier bits from private coding used by
-     * the compiler to that of java.lang.reflect.Modifier.
-     */
-    static int translateModifiers(long flags) {
-        int result = 0;
-        if ((flags & Flags.ABSTRACT) != 0)
-            result |= Modifier.ABSTRACT;
-        if ((flags & Flags.FINAL) != 0)
-            result |= Modifier.FINAL;
-        if ((flags & Flags.INTERFACE) != 0)
-            result |= Modifier.INTERFACE;
-        if ((flags & Flags.NATIVE) != 0)
-            result |= Modifier.NATIVE;
-        if ((flags & Flags.PRIVATE) != 0)
-            result |= Modifier.PRIVATE;
-        if ((flags & Flags.PROTECTED) != 0)
-            result |= Modifier.PROTECTED;
-        if ((flags & Flags.PUBLIC) != 0)
-            result |= Modifier.PUBLIC;
-        if ((flags & Flags.STATIC) != 0)
-            result |= Modifier.STATIC;
-        if ((flags & Flags.SYNCHRONIZED) != 0)
-            result |= Modifier.SYNCHRONIZED;
-        if ((flags & Flags.TRANSIENT) != 0)
-            result |= Modifier.TRANSIENT;
-        if ((flags & Flags.VOLATILE) != 0)
-            result |= Modifier.VOLATILE;
-        return result;
-    }
-
-    void initDoclint(Collection<String> opts, Collection<String> customTagNames, String htmlVersion) {
-        ArrayList<String> doclintOpts = new ArrayList<>();
-        boolean msgOptionSeen = false;
-
-        for (String opt : opts) {
-            if (opt.startsWith(DocLint.XMSGS_OPTION)) {
-                if (opt.equals(DocLint.XMSGS_CUSTOM_PREFIX + "none"))
-                    return;
-                msgOptionSeen = true;
-            }
-            doclintOpts.add(opt);
-        }
-
-        if (!msgOptionSeen) {
-            doclintOpts.add(DocLint.XMSGS_OPTION);
-        }
-
-        String sep = "";
-        StringBuilder customTags = new StringBuilder();
-        for (String customTag : customTagNames) {
-            customTags.append(sep);
-            customTags.append(customTag);
-            sep = DocLint.SEPARATOR;
-        }
-        doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());
-        doclintOpts.add(DocLint.XHTML_VERSION_PREFIX + htmlVersion);
-
-        JavacTask t = BasicJavacTask.instance(context);
-        doclint = new DocLint();
-        // standard doclet normally generates H1, H2
-        doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
-        doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
-    }
-
-    boolean showTagMessages() {
-        return (doclint == null);
-    }
-
-    Map<CompilationUnitTree, Boolean> shouldCheck = new HashMap<>();
-
-    boolean shouldCheck(CompilationUnitTree unit) {
-        return shouldCheck.computeIfAbsent(unit, doclint :: shouldCheck);
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,444 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.text.CollationKey;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.tools.FileObject;
-
-import com.sun.javadoc.*;
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
-import com.sun.tools.javac.util.Position;
-
-/**
- * abstract base class of all Doc classes.  Doc item's are representations
- * of java language constructs (class, package, method,...) which have
- * comments and have been processed by this run of javadoc.  All Doc items
- * are unique, that is, they are == comparable.
- *
- *  <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>
- *
- * @since 1.2
- * @author Robert Field
- * @author Atul M Dambalkar
- * @author Neal Gafter (rewrite)
- */
-public abstract class DocImpl implements Doc, Comparable<Object> {
-
-    /**
-     * Doc environment
-     */
-    protected final DocEnv env;   //### Rename this everywhere to 'docenv' ?
-
-    /**
-     * Back pointer to the tree node for this doc item.
-     * May be null if there is no associated tree.
-     */
-    protected TreePath treePath;
-
-    /**
-     *  The complex comment object, lazily initialized.
-     */
-    private Comment comment;
-
-    /**
-     * The cached sort key, to take care of Natural Language Text sorting.
-     */
-    private CollationKey collationkey = null;
-
-    /**
-     *  Raw documentation string.
-     */
-    protected String documentation;  // Accessed in PackageDocImpl, RootDocImpl
-
-    /**
-     * Cached first sentence.
-     */
-    private Tag[] firstSentence;
-
-    /**
-     * Cached inline tags.
-     */
-    private Tag[] inlineTags;
-
-    /**
-     * Constructor.
-     */
-    DocImpl(DocEnv env, TreePath treePath) {
-        this.treePath = treePath;
-        this.documentation = getCommentText(treePath);
-        this.env = env;
-    }
-
-    private static String getCommentText(TreePath p) {
-        if (p == null)
-            return null;
-
-        JCCompilationUnit topLevel = (JCCompilationUnit) p.getCompilationUnit();
-        JCTree tree = (JCTree) p.getLeaf();
-        return topLevel.docComments.getCommentText(tree);
-    }
-
-    /**
-     * So subclasses have the option to do lazy initialization of
-     * "documentation" string.
-     */
-    protected String documentation() {
-        if (documentation == null) documentation = "";
-        return documentation;
-    }
-
-    /**
-     * For lazy initialization of comment.
-     */
-    Comment comment() {
-        if (comment == null) {
-            String d = documentation();
-            if (env.doclint != null
-                    && treePath != null
-                    && env.shouldCheck(treePath.getCompilationUnit())
-                    && d.equals(getCommentText(treePath))) {
-                env.doclint.scan(treePath);
-            }
-            comment = new Comment(this, d);
-        }
-        return comment;
-    }
-
-    /**
-     * Return the text of the comment for this doc item.
-     * TagImpls have been removed.
-     */
-    public String commentText() {
-        return comment().commentText();
-    }
-
-    /**
-     * Return all tags in this Doc item.
-     *
-     * @return an array of TagImpl containing all tags on this Doc item.
-     */
-    public Tag[] tags() {
-        return comment().tags();
-    }
-
-    /**
-     * Return tags of the specified kind in this Doc item.
-     *
-     * @param tagname name of the tag kind to search for.
-     * @return an array of TagImpl containing all tags whose 'kind()'
-     * matches 'tagname'.
-     */
-    public Tag[] tags(String tagname) {
-        return comment().tags(tagname);
-    }
-
-    /**
-     * Return the see also tags in this Doc item.
-     *
-     * @return an array of SeeTag containing all &#64;see tags.
-     */
-    public SeeTag[] seeTags() {
-        return comment().seeTags();
-    }
-
-    public Tag[] inlineTags() {
-        if (inlineTags == null) {
-            inlineTags = Comment.getInlineTags(this, commentText());
-        }
-        return inlineTags;
-    }
-
-    public Tag[] firstSentenceTags() {
-        if (firstSentence == null) {
-            //Parse all sentences first to avoid duplicate warnings.
-            inlineTags();
-            try {
-                env.setSilent(true);
-                firstSentence = Comment.firstSentenceTags(this, commentText());
-            } finally {
-                env.setSilent(false);
-            }
-        }
-        return firstSentence;
-    }
-
-    /**
-     * Utility for subclasses which read HTML documentation files.
-     */
-    String readHTMLDocumentation(InputStream input, FileObject filename) throws IOException {
-        byte[] filecontents = new byte[input.available()];
-        try {
-            DataInputStream dataIn = new DataInputStream(input);
-            dataIn.readFully(filecontents);
-        } finally {
-            input.close();
-        }
-        String encoding = env.getEncoding();
-        String rawDoc = (encoding!=null)
-            ? new String(filecontents, encoding)
-            : new String(filecontents);
-        Pattern bodyPat = Pattern.compile("(?is).*<body\\b[^>]*>(.*)</body\\b.*");
-        Matcher m = bodyPat.matcher(rawDoc);
-        if (m.matches()) {
-            return m.group(1);
-        } else {
-            String key = rawDoc.matches("(?is).*<body\\b.*")
-                    ? "javadoc.End_body_missing_from_html_file"
-                    : "javadoc.Body_missing_from_html_file";
-            env.error(SourcePositionImpl.make(filename, Position.NOPOS, null), key);
-            return "";
-        }
-    }
-
-    /**
-     * Return the full unprocessed text of the comment.  Tags
-     * are included as text.  Used mainly for store and retrieve
-     * operations like internalization.
-     */
-    public String getRawCommentText() {
-        return documentation();
-    }
-
-    /**
-     * Set the full unprocessed text of the comment.  Tags
-     * are included as text.  Used mainly for store and retrieve
-     * operations like internalization.
-     */
-    public void setRawCommentText(String rawDocumentation) {
-        treePath = null;
-        documentation = rawDocumentation;
-        comment = null;
-    }
-
-    /**
-     * Set the full unprocessed text of the comment and tree path.
-     */
-    void setTreePath(TreePath treePath) {
-        this.treePath = treePath;
-        documentation = getCommentText(treePath);
-        comment = null;
-    }
-
-    /**
-     * return a key for sorting.
-     */
-    CollationKey key() {
-        if (collationkey == null) {
-            collationkey = generateKey();
-        }
-        return collationkey;
-    }
-
-    /**
-     * Generate a key for sorting.
-     * <p>
-     * Default is name().
-     */
-    CollationKey generateKey() {
-        String k = name();
-        // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
-        return env.doclocale.collator.getCollationKey(k);
-    }
-
-    /**
-     * Returns a string representation of this Doc item.
-     */
-    @Override
-    public String toString() {
-        return qualifiedName();
-    }
-
-    /**
-     * Returns the name of this Doc item.
-     *
-     * @return  the name
-     */
-    public abstract String name();
-
-    /**
-     * Returns the qualified name of this Doc item.
-     *
-     * @return  the name
-     */
-    public abstract String qualifiedName();
-
-    /**
-     * Compares this Object with the specified Object for order.  Returns a
-     * negative integer, zero, or a positive integer as this Object is less
-     * than, equal to, or greater than the given Object.
-     * <p>
-     * Included so that Doc item are java.lang.Comparable.
-     *
-     * @param   obj the {@code Object} to be compared.
-     * @return  a negative integer, zero, or a positive integer as this Object
-     *          is less than, equal to, or greater than the given Object.
-     * @exception ClassCastException the specified Object's type prevents it
-     *            from being compared to this Object.
-     */
-    public int compareTo(Object obj) {
-        // System.out.println("COMPARE \"" + this + "\" to \"" + obj + "\" = " + key().compareTo(((DocImpl)obj).key()));
-        return key().compareTo(((DocImpl)obj).key());
-    }
-
-    /**
-     * Is this Doc item a field?  False until overridden.
-     *
-     * @return true if it represents a field
-     */
-    public boolean isField() {
-        return false;
-    }
-
-    /**
-     * Is this Doc item an enum constant?  False until overridden.
-     *
-     * @return true if it represents an enum constant
-     */
-    public boolean isEnumConstant() {
-        return false;
-    }
-
-    /**
-     * Is this Doc item a constructor?  False until overridden.
-     *
-     * @return true if it represents a constructor
-     */
-    public boolean isConstructor() {
-        return false;
-    }
-
-    /**
-     * Is this Doc item a method (but not a constructor or annotation
-     * type element)?
-     * False until overridden.
-     *
-     * @return true if it represents a method
-     */
-    public boolean isMethod() {
-        return false;
-    }
-
-    /**
-     * Is this Doc item an annotation type element?
-     * False until overridden.
-     *
-     * @return true if it represents an annotation type element
-     */
-    public boolean isAnnotationTypeElement() {
-        return false;
-    }
-
-    /**
-     * Is this Doc item a interface (but not an annotation type)?
-     * False until overridden.
-     *
-     * @return true if it represents a interface
-     */
-    public boolean isInterface() {
-        return false;
-    }
-
-    /**
-     * Is this Doc item a exception class?  False until overridden.
-     *
-     * @return true if it represents a exception
-     */
-    public boolean isException() {
-        return false;
-    }
-
-    /**
-     * Is this Doc item a error class?  False until overridden.
-     *
-     * @return true if it represents a error
-     */
-    public boolean isError() {
-        return false;
-    }
-
-    /**
-     * Is this Doc item an enum type?  False until overridden.
-     *
-     * @return true if it represents an enum type
-     */
-    public boolean isEnum() {
-        return false;
-    }
-
-    /**
-     * Is this Doc item an annotation type?  False until overridden.
-     *
-     * @return true if it represents an annotation type
-     */
-    public boolean isAnnotationType() {
-        return false;
-    }
-
-    /**
-     * Is this Doc item an ordinary class (i.e. not an interface,
-     * annotation type, enumeration, exception, or error)?
-     * False until overridden.
-     *
-     * @return true if it represents an ordinary class
-     */
-    public boolean isOrdinaryClass() {
-        return false;
-    }
-
-    /**
-     * Is this Doc item a class
-     * (and not an interface or annotation type)?
-     * This includes ordinary classes, enums, errors and exceptions.
-     * False until overridden.
-     *
-     * @return true if it represents a class
-     */
-    public boolean isClass() {
-        return false;
-    }
-
-    /**
-     * return true if this Doc is include in the active set.
-     */
-    public abstract boolean isIncluded();
-
-    /**
-     * Return the source position of the entity, or null if
-     * no position is available.
-     */
-    public SourcePosition position() { return null; }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocLocale.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +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.tools.javadoc;
-
-import java.text.BreakIterator;
-import java.text.Collator;
-import java.util.Locale;
-
-/**
- * This class holds the information about locales.
- *
- *  <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>
- *
- * @since 1.4
- * @author Robert Field
- */
-class DocLocale {
-
-    /**
-     * The locale name will be set by Main, if option is provided on the
-     * command line.
-     */
-    final String localeName;
-
-    /**
-     * The locale to be used. If user doesn't provide this,
-     * then set it to default locale value.
-     */
-    final Locale locale;
-
-    /**
-     * The collator for this application. This is to take care of Locale
-     * Specific or Natural Language Text sorting.
-     */
-    final Collator collator;
-
-    /**
-     * Enclosing DocEnv
-     */
-    private final DocEnv docenv;
-
-    /**
-     * Sentence instance from the BreakIterator.
-     */
-    private final BreakIterator sentenceBreaker;
-
-    /**
-     * True is we should use <code>BreakIterator</code>
-     * to compute first sentence.
-     */
-    private boolean useBreakIterator = false;
-
-    /**
-     * The HTML sentence terminators.
-     */
-    static final String[] sentenceTerminators =
-                    {
-                        "<p>", "</p>", "<h1>", "<h2>",
-                        "<h3>", "<h4>", "<h5>", "<h6>",
-                        "</h1>", "</h2>", "</h3>", "</h4>", "</h5>",
-                        "</h6>", "<hr>", "<pre>", "</pre>"
-                    };
-
-    /**
-     * Constructor
-     */
-    DocLocale(DocEnv docenv, String localeName, boolean useBreakIterator) {
-        this.docenv = docenv;
-        this.localeName = localeName;
-        this.useBreakIterator = useBreakIterator;
-        locale = getLocale();
-        if (locale == null) {
-            docenv.exit();
-        } else {
-            Locale.setDefault(locale); // NOTE: updating global state
-        }
-        collator = Collator.getInstance(locale);
-        sentenceBreaker = BreakIterator.getSentenceInstance(locale);
-    }
-
-    /**
-     * Get the locale if specified on the command line
-     * else return null and if locale option is not used
-     * then return default locale.
-     */
-    private Locale getLocale() {
-        Locale userlocale = null;
-        if (localeName.length() > 0) {
-            int firstuscore = localeName.indexOf('_');
-            int seconduscore = -1;
-            String language = null;
-            String country = null;
-            String variant = null;
-            if (firstuscore == 2) {
-                language = localeName.substring(0, firstuscore);
-                seconduscore = localeName.indexOf('_', firstuscore + 1);
-                if (seconduscore > 0) {
-                    if (seconduscore != firstuscore + 3 ||
-                           localeName.length() <= seconduscore + 1) {
-                        docenv.error(null, "main.malformed_locale_name", localeName);
-                        return null;
-                    }
-                    country = localeName.substring(firstuscore + 1,
-                                                   seconduscore);
-                    variant = localeName.substring(seconduscore + 1);
-                } else if (localeName.length() == firstuscore + 3) {
-                    country = localeName.substring(firstuscore + 1);
-                } else {
-                    docenv.error(null, "main.malformed_locale_name", localeName);
-                    return null;
-                }
-            } else if (firstuscore == -1 && localeName.length() == 2) {
-                language = localeName;
-            } else {
-                docenv.error(null, "main.malformed_locale_name", localeName);
-                return null;
-            }
-            userlocale = searchLocale(language, country, variant);
-            if (userlocale == null) {
-                docenv.error(null, "main.illegal_locale_name", localeName);
-                return null;
-            } else {
-                return userlocale;
-            }
-        } else {
-            return Locale.getDefault();
-        }
-    }
-
-    /**
-     * Search the locale for specified language, specified country and
-     * specified variant.
-     */
-    private Locale searchLocale(String language, String country,
-                                String variant) {
-        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;
-    }
-
-    String localeSpecificFirstSentence(DocImpl doc, String s) {
-        if (s == null || s.length() == 0) {
-            return "";
-        }
-        int index = s.indexOf("-->");
-        if(s.trim().startsWith("<!--") && index != -1) {
-            return localeSpecificFirstSentence(doc, s.substring(index + 3, s.length()));
-        }
-        if (useBreakIterator || !locale.getLanguage().equals("en")) {
-            sentenceBreaker.setText(s.replace('\n', ' '));
-            int start = sentenceBreaker.first();
-            int end = sentenceBreaker.next();
-            return s.substring(start, end).trim();
-        } else {
-            return englishLanguageFirstSentence(s).trim();
-        }
-    }
-
-    /**
-     * Return the first sentence of a string, where a sentence ends
-     * with a period followed be white space.
-     */
-    private String englishLanguageFirstSentence(String s) {
-        if (s == null) {
-            return null;
-        }
-        int len = s.length();
-        boolean period = false;
-        for (int i = 0 ; i < len ; i++) {
-            switch (s.charAt(i)) {
-                case '.':
-                    period = true;
-                    break;
-                case ' ':
-                case '\t':
-                case '\n':
-            case '\r':
-            case '\f':
-                    if (period) {
-                        return s.substring(0, i);
-                    }
-                    break;
-            case '<':
-                    if (i > 0) {
-                        if (htmlSentenceTerminatorFound(s, i)) {
-                            return s.substring(0, i);
-                        }
-                    }
-                    break;
-                default:
-                    period = false;
-            }
-        }
-        return s;
-    }
-
-    /**
-     * Find out if there is any HTML tag in the given string. If found
-     * return true else return false.
-     */
-    private boolean htmlSentenceTerminatorFound(String str, int index) {
-        for (String terminator : sentenceTerminators) {
-            if (str.regionMatches(true, index, terminator,
-                                  0, terminator.length())) {
-                return true;
-            }
-        }
-        return false;
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocletInvoker.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,439 +0,0 @@
-/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javadoc;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.regex.Pattern;
-
-import javax.tools.DocumentationTool;
-import javax.tools.JavaFileManager;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.util.ClientCodeException;
-import com.sun.tools.javac.util.List;
-
-import static com.sun.javadoc.LanguageVersion.*;
-
-
-/**
- * Class creates, controls and invokes doclets.
- *
- *  <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>
- *
- * @author Neal Gafter (rewrite)
- */
-public class DocletInvoker {
-
-    private final Class<?> docletClass;
-
-    private final String docletClassName;
-
-    private final ClassLoader appClassLoader;
-
-    private final Messager messager;
-
-    /**
-     * In API mode, exceptions thrown while calling the doclet are
-     * propagated using ClientCodeException.
-     */
-    private final boolean apiMode;
-
-    /**
-     * Whether javadoc internal API should be exported to doclets
-     * and (indirectly) to taglets
-     */
-    private final boolean exportInternalAPI;
-
-    private static class DocletInvokeException extends Exception {
-        private static final long serialVersionUID = 0;
-    }
-
-    private String appendPath(String path1, String path2) {
-        if (path1 == null || path1.length() == 0) {
-            return path2 == null ? "." : path2;
-        } else if (path2 == null || path2.length() == 0) {
-            return path1;
-        } else {
-            return path1  + File.pathSeparator + path2;
-        }
-    }
-
-    public DocletInvoker(Messager messager, Class<?> docletClass, boolean apiMode, boolean exportInternalAPI) {
-        this.messager = messager;
-        this.docletClass = docletClass;
-        docletClassName = docletClass.getName();
-        appClassLoader = null;
-        this.apiMode = apiMode;
-        this.exportInternalAPI = exportInternalAPI; // for backdoor use by standard doclet for taglets
-
-        // this may not be soon enough if the class has already been loaded
-        if (exportInternalAPI) {
-            exportInternalAPI(docletClass.getClassLoader());
-        }
-    }
-
-    public DocletInvoker(Messager messager, JavaFileManager fileManager,
-                         String docletClassName, String docletPath,
-                         ClassLoader docletParentClassLoader,
-                         boolean apiMode,
-                         boolean exportInternalAPI) {
-        this.messager = messager;
-        this.docletClassName = docletClassName;
-        this.apiMode = apiMode;
-        this.exportInternalAPI = exportInternalAPI; // for backdoor use by standard doclet for taglets
-
-        if (fileManager != null && fileManager.hasLocation(DocumentationTool.Location.DOCLET_PATH)) {
-            appClassLoader = fileManager.getClassLoader(DocumentationTool.Location.DOCLET_PATH);
-        } else {
-            // construct class loader
-            String cpString = null;   // make sure env.class.path defaults to dot
-
-            // do prepends to get correct ordering
-            cpString = appendPath(System.getProperty("env.class.path"), cpString);
-            cpString = appendPath(System.getProperty("java.class.path"), cpString);
-            cpString = appendPath(docletPath, cpString);
-            URL[] urls = pathToURLs(cpString);
-            if (docletParentClassLoader == null)
-                appClassLoader = new URLClassLoader(urls, getDelegationClassLoader(docletClassName));
-            else
-                appClassLoader = new URLClassLoader(urls, docletParentClassLoader);
-        }
-
-        if (exportInternalAPI) {
-            exportInternalAPI(appClassLoader);
-        }
-
-        // attempt to find doclet
-        Class<?> dc = null;
-        try {
-            dc = appClassLoader.loadClass(docletClassName);
-        } catch (ClassNotFoundException exc) {
-            messager.error(Messager.NOPOS, "main.doclet_class_not_found", docletClassName);
-            messager.exit();
-        }
-        docletClass = dc;
-    }
-
-    /*
-     * Returns the delegation class loader to use when creating
-     * appClassLoader (used to load the doclet).  The context class
-     * loader is the best choice, but legacy behavior was to use the
-     * default delegation class loader (aka system class loader).
-     *
-     * Here we favor using the context class loader.  To ensure
-     * compatibility with existing apps, we revert to legacy
-     * behavior if either or both of the following conditions hold:
-     *
-     * 1) the doclet is loadable from the system class loader but not
-     *    from the context class loader,
-     *
-     * 2) this.getClass() is loadable from the system class loader but not
-     *    from the context class loader.
-     */
-    private ClassLoader getDelegationClassLoader(String docletClassName) {
-        ClassLoader ctxCL = Thread.currentThread().getContextClassLoader();
-        ClassLoader sysCL = ClassLoader.getSystemClassLoader();
-        if (sysCL == null)
-            return ctxCL;
-        if (ctxCL == null)
-            return sysCL;
-
-        // Condition 1.
-        try {
-            sysCL.loadClass(docletClassName);
-            try {
-                ctxCL.loadClass(docletClassName);
-            } catch (ClassNotFoundException e) {
-                return sysCL;
-            }
-        } catch (ClassNotFoundException e) {
-        }
-
-        // Condition 2.
-        try {
-            if (getClass() == sysCL.loadClass(getClass().getName())) {
-                try {
-                    if (getClass() != ctxCL.loadClass(getClass().getName()))
-                        return sysCL;
-                } catch (ClassNotFoundException e) {
-                    return sysCL;
-                }
-            }
-        } catch (ClassNotFoundException e) {
-        }
-
-        return ctxCL;
-    }
-
-    /**
-     * Generate documentation here.  Return true on success.
-     */
-    public boolean start(RootDoc root) {
-        Object retVal;
-        String methodName = "start";
-        Class<?>[] paramTypes = { RootDoc.class };
-        Object[] params = { root };
-        try {
-            retVal = invoke(methodName, null, paramTypes, params);
-        } catch (DocletInvokeException exc) {
-            return false;
-        }
-        if (retVal instanceof Boolean) {
-            return ((Boolean)retVal);
-        } else {
-            messager.error(Messager.NOPOS, "main.must_return_boolean",
-                           docletClassName, methodName);
-            return false;
-        }
-    }
-
-    /**
-     * Check for doclet added options here. Zero return means
-     * option not known.  Positive value indicates number of
-     * arguments to option.  Negative value means error occurred.
-     */
-    public int optionLength(String option) {
-        Object retVal;
-        String methodName = "optionLength";
-        Class<?>[] paramTypes = { String.class };
-        Object[] params = { option };
-        try {
-            retVal = invoke(methodName, 0, paramTypes, params);
-        } catch (DocletInvokeException exc) {
-            return -1;
-        }
-        if (retVal instanceof Integer) {
-            return ((Integer)retVal);
-        } else {
-            messager.error(Messager.NOPOS, "main.must_return_int",
-                           docletClassName, methodName);
-            return -1;
-        }
-    }
-
-    /**
-     * Let doclet check that all options are OK. Returning true means
-     * options are OK.  If method does not exist, assume true.
-     */
-    public boolean validOptions(List<String[]> optlist) {
-        Object retVal;
-        String options[][] = optlist.toArray(new String[optlist.length()][]);
-        String methodName = "validOptions";
-        DocErrorReporter reporter = messager;
-        Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
-        Object[] params = { options, reporter };
-        try {
-            retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
-        } catch (DocletInvokeException exc) {
-            return false;
-        }
-        if (retVal instanceof Boolean) {
-            return ((Boolean)retVal);
-        } else {
-            messager.error(Messager.NOPOS, "main.must_return_boolean",
-                           docletClassName, methodName);
-            return false;
-        }
-    }
-
-    /**
-     * Return the language version supported by this doclet.
-     * If the method does not exist in the doclet, assume version 1.1.
-     */
-    public LanguageVersion languageVersion() {
-        try {
-            Object retVal;
-            String methodName = "languageVersion";
-            Class<?>[] paramTypes = new Class<?>[0];
-            Object[] params = new Object[0];
-            try {
-                retVal = invoke(methodName, JAVA_1_1, paramTypes, params);
-            } catch (DocletInvokeException exc) {
-                return JAVA_1_1;
-            }
-            if (retVal instanceof LanguageVersion) {
-                return (LanguageVersion)retVal;
-            } else {
-                messager.error(Messager.NOPOS, "main.must_return_languageversion",
-                               docletClassName, methodName);
-                return JAVA_1_1;
-            }
-        } catch (NoClassDefFoundError ex) { // for boostrapping, no Enum class.
-            return null;
-        }
-    }
-
-    /**
-     * Utility method for calling doclet functionality
-     */
-    private Object invoke(String methodName, Object returnValueIfNonExistent,
-                          Class<?>[] paramTypes, Object[] params)
-        throws DocletInvokeException {
-            Method meth;
-            try {
-                meth = docletClass.getMethod(methodName, paramTypes);
-            } catch (NoSuchMethodException exc) {
-                if (returnValueIfNonExistent == null) {
-                    messager.error(Messager.NOPOS, "main.doclet_method_not_found",
-                                   docletClassName, methodName);
-                    throw new DocletInvokeException();
-                } else {
-                    return returnValueIfNonExistent;
-                }
-            } catch (SecurityException exc) {
-                messager.error(Messager.NOPOS, "main.doclet_method_not_accessible",
-                               docletClassName, methodName);
-                throw new DocletInvokeException();
-            }
-            if (!Modifier.isStatic(meth.getModifiers())) {
-                messager.error(Messager.NOPOS, "main.doclet_method_must_be_static",
-                               docletClassName, methodName);
-                throw new DocletInvokeException();
-            }
-            ClassLoader savedCCL =
-                Thread.currentThread().getContextClassLoader();
-            try {
-                if (appClassLoader != null) // will be null if doclet class provided via API
-                    Thread.currentThread().setContextClassLoader(appClassLoader);
-                return meth.invoke(null , params);
-            } catch (IllegalArgumentException | NullPointerException exc) {
-                messager.error(Messager.NOPOS, "main.internal_error_exception_thrown",
-                               docletClassName, methodName, exc.toString());
-                throw new DocletInvokeException();
-            } catch (IllegalAccessException exc) {
-                messager.error(Messager.NOPOS, "main.doclet_method_not_accessible",
-                               docletClassName, methodName);
-                throw new DocletInvokeException();
-            }
-            catch (InvocationTargetException exc) {
-                Throwable err = exc.getTargetException();
-                if (apiMode)
-                    throw new ClientCodeException(err);
-                if (err instanceof java.lang.OutOfMemoryError) {
-                    messager.error(Messager.NOPOS, "main.out.of.memory");
-                } else {
-                    messager.error(Messager.NOPOS, "main.exception_thrown",
-                               docletClassName, methodName, exc.toString());
-                    exc.getTargetException().printStackTrace(System.err);
-                }
-                throw new DocletInvokeException();
-            } finally {
-                Thread.currentThread().setContextClassLoader(savedCCL);
-            }
-    }
-
-    /**
-     * Export javadoc internal API to the unnamed module for a classloader.
-     * This is to support continued use of existing non-standard doclets that
-     * use the internal toolkit API and related classes.
-     * @param cl the classloader
-     */
-    private void exportInternalAPI(ClassLoader cl) {
-        String[] packages = {
-            "com.sun.tools.doclets",
-            "com.sun.tools.doclets.standard",
-            "com.sun.tools.doclets.internal.toolkit",
-            "com.sun.tools.doclets.internal.toolkit.taglets",
-            "com.sun.tools.doclets.internal.toolkit.builders",
-            "com.sun.tools.doclets.internal.toolkit.util",
-            "com.sun.tools.doclets.internal.toolkit.util.links",
-            "com.sun.tools.doclets.formats.html",
-            "com.sun.tools.doclets.formats.html.markup"
-        };
-
-        try {
-            Method getModuleMethod = Class.class.getDeclaredMethod("getModule");
-            Object thisModule = getModuleMethod.invoke(getClass());
-
-            Class<?> moduleClass = Class.forName("java.lang.reflect.Module");
-            Method addExportsMethod = moduleClass.getDeclaredMethod("addExports", String.class, moduleClass);
-
-            Method getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule");
-            Object target = getUnnamedModuleMethod.invoke(cl);
-
-            for (String pack : packages) {
-                addExportsMethod.invoke(thisModule, pack, target);
-            }
-        } catch (Exception e) {
-            // do nothing
-        }
-    }
-
-    /**
-     * Utility method for converting a search path string to an array of directory and JAR file
-     * URLs.
-     *
-     * Note that this method is called by the DocletInvoker.
-     *
-     * @param path the search path string
-     * @return the resulting array of directory and JAR file URLs
-     */
-    private static URL[] pathToURLs(String path) {
-        java.util.List<URL> urls = new ArrayList<>();
-        for (String s: path.split(Pattern.quote(File.pathSeparator))) {
-            if (!s.isEmpty()) {
-                URL url = fileToURL(Paths.get(s));
-                if (url != null) {
-                    urls.add(url);
-                }
-            }
-        }
-        return urls.toArray(new URL[urls.size()]);
-    }
-
-    /**
-     * Returns the directory or JAR file URL corresponding to the specified local file name.
-     *
-     * @param file the Path object
-     * @return the resulting directory or JAR file URL, or null if unknown
-     */
-    private static URL fileToURL(Path file) {
-        Path p;
-        try {
-            p = file.toRealPath();
-        } catch (IOException e) {
-            p = file.toAbsolutePath();
-        }
-        try {
-            return p.normalize().toUri().toURL();
-        } catch (MalformedURLException e) {
-            return null;
-        }
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,288 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import java.lang.reflect.Modifier;
-import java.text.CollationKey;
-
-import com.sun.javadoc.*;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-
-/**
- * Represents a method or constructor of a java class.
- *
- *  <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>
- *
- * @since 1.2
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- * @author Scott Seligman (generics, annotations)
- */
-
-public abstract class ExecutableMemberDocImpl
-        extends MemberDocImpl implements ExecutableMemberDoc {
-
-    protected final MethodSymbol sym;
-
-    /**
-     * Constructor.
-     */
-    public ExecutableMemberDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) {
-        super(env, sym, treePath);
-        this.sym = sym;
-    }
-
-    /**
-     * Constructor.
-     */
-    public ExecutableMemberDocImpl(DocEnv env, MethodSymbol sym) {
-        this(env, sym, null);
-    }
-
-    /**
-     * Returns the flags in terms of javac's flags
-     */
-    protected long getFlags() {
-        return sym.flags();
-    }
-
-    /**
-     * Identify the containing class
-     */
-    protected ClassSymbol getContainingClass() {
-        return sym.enclClass();
-    }
-
-    /**
-     * Return true if this method is native
-     */
-    public boolean isNative() {
-        return Modifier.isNative(getModifiers());
-    }
-
-    /**
-     * Return true if this method is synchronized
-     */
-    public boolean isSynchronized() {
-        return Modifier.isSynchronized(getModifiers());
-    }
-
-    /**
-     * Return true if this method was declared to take a variable number
-     * of arguments.
-     */
-    public boolean isVarArgs() {
-        return ((sym.flags() & Flags.VARARGS) != 0
-                && !env.legacyDoclet);
-    }
-
-    /**
-     * Returns true if this field was synthesized by the compiler.
-     */
-    public boolean isSynthetic() {
-        return ((sym.flags() & Flags.SYNTHETIC) != 0);
-    }
-
-    public boolean isIncluded() {
-        return containingClass().isIncluded() && env.shouldDocument(sym);
-    }
-
-    /**
-     * Return the throws tags in this method.
-     *
-     * @return an array of ThrowTagImpl containing all {@code @exception}
-     * and {@code @throws} tags.
-     */
-    public ThrowsTag[] throwsTags() {
-        return comment().throwsTags();
-    }
-
-    /**
-     * Return the param tags in this method, excluding the type
-     * parameter tags.
-     *
-     * @return an array of ParamTagImpl containing all {@code @param} tags.
-     */
-    public ParamTag[] paramTags() {
-        return comment().paramTags();
-    }
-
-    /**
-     * Return the type parameter tags in this method.
-     */
-    public ParamTag[] typeParamTags() {
-        return env.legacyDoclet
-            ? new ParamTag[0]
-            : comment().typeParamTags();
-    }
-
-    /**
-     * Return exceptions this method or constructor throws.
-     *
-     * @return an array of ClassDoc[] representing the exceptions
-     * thrown by this method.
-     */
-    public ClassDoc[] thrownExceptions() {
-        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
-            //### errors in the documented code?
-            ClassDocImpl cdi = env.getClassDoc((ClassSymbol)ex.tsym);
-            if (cdi != null) l.append(cdi);
-        }
-        return l.toArray(new ClassDocImpl[l.length()]);
-    }
-
-    /**
-     * Return exceptions this method or constructor throws.
-     * Each array element is either a <code>ClassDoc</code> or a
-     * <code>TypeVariable</code>.
-     */
-    public com.sun.javadoc.Type[] thrownExceptionTypes() {
-        return TypeMaker.getTypes(env, sym.type.getThrownTypes());
-    }
-
-    /**
-     * Get argument information.
-     *
-     * @see ParameterImpl
-     *
-     * @return an array of ParameterImpl, one element per argument
-     * in the order the arguments are present.
-     */
-    public Parameter[] parameters() {
-        // generate the parameters on the fly:  they're not cached
-        List<VarSymbol> params = sym.params();
-        Parameter result[] = new Parameter[params.length()];
-
-        int i = 0;
-        for (VarSymbol param : params) {
-            result[i++] = new ParameterImpl(env, param);
-        }
-        return result;
-    }
-
-    /**
-     * Get the receiver type of this executable element.
-     *
-     * @return the receiver type of this executable element.
-     * @since 1.8
-     */
-    public com.sun.javadoc.Type receiverType() {
-        Type recvtype = sym.type.asMethodType().recvtype;
-        return (recvtype != null) ? TypeMaker.getType(env, recvtype, false, true) : null;
-    }
-
-    /**
-     * Return the formal type parameters of this method or constructor.
-     * Return an empty array if there are none.
-     */
-    public TypeVariable[] typeParameters() {
-        if (env.legacyDoclet) {
-            return new TypeVariable[0];
-        }
-        TypeVariable res[] = new TypeVariable[sym.type.getTypeArguments().length()];
-        TypeMaker.getTypes(env, sym.type.getTypeArguments(), res);
-        return res;
-    }
-
-    /**
-     * Get the signature. It is the parameter list, type is qualified.
-     * For instance, for a method <code>mymethod(String x, int y)</code>,
-     * it will return <code>(java.lang.String,int)</code>.
-     */
-    public String signature() {
-        return makeSignature(true);
-    }
-
-    /**
-     * Get flat signature.  All types are not qualified.
-     * Return a String, which is the flat signiture of this member.
-     * It is the parameter list, type is not qualified.
-     * For instance, for a method <code>mymethod(String x, int y)</code>,
-     * it will return <code>(String, int)</code>.
-     */
-    public String flatSignature() {
-        return makeSignature(false);
-    }
-
-    private String makeSignature(boolean full) {
-        StringBuilder result = new StringBuilder();
-        result.append("(");
-        for (List<Type> types = sym.type.getParameterTypes(); types.nonEmpty(); ) {
-            Type t = types.head;
-            result.append(TypeMaker.getTypeString(env, t, full));
-            types = types.tail;
-            if (types.nonEmpty()) {
-                result.append(", ");
-            }
-        }
-        if (isVarArgs()) {
-            int len = result.length();
-            result.replace(len - 2, len, "...");
-        }
-        result.append(")");
-        return result.toString();
-    }
-
-    protected String typeParametersString() {
-        return TypeMaker.typeParametersString(env, sym, true);
-    }
-
-    /**
-     * Generate a key for sorting.
-     */
-    @Override
-    CollationKey generateKey() {
-        String k = name() + flatSignature() + typeParametersString();
-        // ',' and '&' are between '$' and 'a':  normalize to spaces.
-        k = k.replace(',', ' ').replace('&', ' ');
-        // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
-        return env.doclocale.collator.getCollationKey(k);
-    }
-
-    /**
-     * Return the source position of the entity, or null if
-     * no position is available.
-     */
-    @Override
-    public SourcePosition position() {
-        if (sym.enclClass().sourcefile == null) return null;
-        return SourcePositionImpl.make(sym.enclClass().sourcefile,
-                                       (tree==null) ? 0 : tree.pos,
-                                       lineMap);
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/FieldDocImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,279 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import com.sun.source.util.TreePath;
-import java.lang.reflect.Modifier;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-
-import static com.sun.tools.javac.code.TypeTag.BOOLEAN;
-
-/**
- * Represents a field in a java class.
- *
- *  <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>
- *
- * @see MemberDocImpl
- *
- * @since 1.2
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- * @author Scott Seligman (generics, enums, annotations)
- */
-public class FieldDocImpl extends MemberDocImpl implements FieldDoc {
-
-    protected final VarSymbol sym;
-
-    /**
-     * Constructor.
-     */
-    public FieldDocImpl(DocEnv env, VarSymbol sym, TreePath treePath) {
-        super(env, sym, treePath);
-        this.sym = sym;
-    }
-
-    /**
-     * Constructor.
-     */
-    public FieldDocImpl(DocEnv env, VarSymbol sym) {
-        this(env, sym, null);
-    }
-
-    /**
-     * Returns the flags in terms of javac's flags
-     */
-    protected long getFlags() {
-        return sym.flags();
-    }
-
-    /**
-     * Identify the containing class
-     */
-    protected ClassSymbol getContainingClass() {
-        return sym.enclClass();
-    }
-
-    /**
-     * Get type of this field.
-     */
-    public com.sun.javadoc.Type type() {
-        return TypeMaker.getType(env, sym.type, false);
-    }
-
-    /**
-     * Get the value of a constant field.
-     *
-     * @return the value of a constant field. The value is
-     * automatically wrapped in an object if it has a primitive type.
-     * If the field is not constant, returns null.
-     */
-    public Object constantValue() {
-        Object result = sym.getConstValue();
-        if (result != null && sym.type.hasTag(BOOLEAN))
-            // javac represents false and true as Integers 0 and 1
-            result = Boolean.valueOf(((Integer)result).intValue() != 0);
-        return result;
-    }
-
-    /**
-     * Get the value of a constant field.
-     *
-     * @return the text of a Java language expression whose value
-     * is the value of the constant. The expression uses no identifiers
-     * other than primitive literals. If the field is
-     * not constant, returns null.
-     */
-    public String constantValueExpression() {
-        return constantValueExpression(constantValue());
-    }
-
-    /**
-     * A static version of the above.
-     */
-    static String constantValueExpression(Object cb) {
-        if (cb == null) return null;
-        if (cb instanceof Character) return sourceForm(((Character)cb).charValue());
-        if (cb instanceof Byte) return sourceForm(((Byte)cb).byteValue());
-        if (cb instanceof String) return sourceForm((String)cb);
-        if (cb instanceof Double) return sourceForm(((Double)cb).doubleValue(), 'd');
-        if (cb instanceof Float) return sourceForm(((Float)cb).doubleValue(), 'f');
-        if (cb instanceof Long) return cb + "L";
-        return cb.toString(); // covers int, short
-    }
-        // where
-        private static String sourceForm(double v, char suffix) {
-            if (Double.isNaN(v))
-                return "0" + suffix + "/0" + suffix;
-            if (v == Double.POSITIVE_INFINITY)
-                return "1" + suffix + "/0" + suffix;
-            if (v == Double.NEGATIVE_INFINITY)
-                return "-1" + suffix + "/0" + suffix;
-            return v + (suffix == 'f' || suffix == 'F' ? "" + suffix : "");
-        }
-        private static String sourceForm(char c) {
-            StringBuilder buf = new StringBuilder(8);
-            buf.append('\'');
-            sourceChar(c, buf);
-            buf.append('\'');
-            return buf.toString();
-        }
-        private static String sourceForm(byte c) {
-            return "0x" + Integer.toString(c & 0xff, 16);
-        }
-        private static String sourceForm(String s) {
-            StringBuilder buf = new StringBuilder(s.length() + 5);
-            buf.append('\"');
-            for (int i=0; i<s.length(); i++) {
-                char c = s.charAt(i);
-                sourceChar(c, buf);
-            }
-            buf.append('\"');
-            return buf.toString();
-        }
-        private static void sourceChar(char c, StringBuilder buf) {
-            switch (c) {
-            case '\b': buf.append("\\b"); return;
-            case '\t': buf.append("\\t"); return;
-            case '\n': buf.append("\\n"); return;
-            case '\f': buf.append("\\f"); return;
-            case '\r': buf.append("\\r"); return;
-            case '\"': buf.append("\\\""); return;
-            case '\'': buf.append("\\\'"); return;
-            case '\\': buf.append("\\\\"); return;
-            default:
-                if (isPrintableAscii(c)) {
-                    buf.append(c); return;
-                }
-                unicodeEscape(c, buf);
-                return;
-            }
-        }
-        private static void unicodeEscape(char c, StringBuilder buf) {
-            final String chars = "0123456789abcdef";
-            buf.append("\\u");
-            buf.append(chars.charAt(15 & (c>>12)));
-            buf.append(chars.charAt(15 & (c>>8)));
-            buf.append(chars.charAt(15 & (c>>4)));
-            buf.append(chars.charAt(15 & (c>>0)));
-        }
-        private static boolean isPrintableAscii(char c) {
-            return c >= ' ' && c <= '~';
-        }
-
-    /**
-     * Return true if this field is included in the active set.
-     */
-    public boolean isIncluded() {
-        return containingClass().isIncluded() && env.shouldDocument(sym);
-    }
-
-    /**
-     * Is this Doc item a field (but not an enum constant?
-     */
-    @Override
-    public boolean isField() {
-        return !isEnumConstant();
-    }
-
-    /**
-     * Is this Doc item an enum constant?
-     * (For legacy doclets, return false.)
-     */
-    @Override
-    public boolean isEnumConstant() {
-        return (getFlags() & Flags.ENUM) != 0 &&
-               !env.legacyDoclet;
-    }
-
-    /**
-     * Return true if this field is transient
-     */
-    public boolean isTransient() {
-        return Modifier.isTransient(getModifiers());
-    }
-
-    /**
-     * Return true if this field is volatile
-     */
-    public boolean isVolatile() {
-        return Modifier.isVolatile(getModifiers());
-    }
-
-    /**
-     * Returns true if this field was synthesized by the compiler.
-     */
-    public boolean isSynthetic() {
-        return (getFlags() & Flags.SYNTHETIC) != 0;
-    }
-
-    /**
-     * Return the serialField tags in this FieldDocImpl item.
-     *
-     * @return an array of <tt>SerialFieldTagImpl</tt> containing all
-     *         <code>&#64;serialField</code> tags.
-     */
-    public SerialFieldTag[] serialFieldTags() {
-        return comment().serialFieldTags();
-    }
-
-    public String name() {
-        if (name == null) {
-            name = sym.name.toString();
-        }
-        return name;
-    }
-
-    private String name;
-
-    public String qualifiedName() {
-        if (qualifiedName == null) {
-            qualifiedName = sym.enclClass().getQualifiedName() + "." + name();
-        }
-        return qualifiedName;
-    }
-
-    private String qualifiedName;
-
-    /**
-     * Return the source position of the entity, or null if
-     * no position is available.
-     */
-    @Override
-    public SourcePosition position() {
-        if (sym.enclClass().sourcefile == null) return null;
-        return SourcePositionImpl.make(sym.enclClass().sourcefile,
-                                       (tree==null) ? 0 : tree.pos,
-                                       lineMap);
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocClassFinder.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import java.util.EnumSet;
-import javax.tools.JavaFileObject;
-
-import com.sun.tools.javac.code.Symbol.PackageSymbol;
-import com.sun.tools.javac.code.ClassFinder;
-import com.sun.tools.javac.util.Context;
-
-/** Javadoc uses an extended class finder that records package.html entries
- *
- *  <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>
- *
- *  @author Neal Gafter
- */
-public class JavadocClassFinder extends ClassFinder {
-
-    public static JavadocClassFinder instance(Context context) {
-        ClassFinder instance = context.get(classFinderKey);
-        if (instance == null)
-            instance = new JavadocClassFinder(context);
-        return (JavadocClassFinder)instance;
-    }
-
-    public static void preRegister(Context context) {
-        context.put(classFinderKey, new Context.Factory<ClassFinder>() {
-            public ClassFinder make(Context c) {
-                return new JavadocClassFinder(c);
-            }
-        });
-    }
-
-    private DocEnv docenv;
-    private EnumSet<JavaFileObject.Kind> all = EnumSet.of(JavaFileObject.Kind.CLASS,
-                                                          JavaFileObject.Kind.SOURCE,
-                                                          JavaFileObject.Kind.HTML);
-    private EnumSet<JavaFileObject.Kind> noSource = EnumSet.of(JavaFileObject.Kind.CLASS,
-                                                               JavaFileObject.Kind.HTML);
-
-    public JavadocClassFinder(Context context) {
-        super(context);
-        docenv = DocEnv.instance(context);
-        preferSource = true;
-    }
-
-    /**
-     * Override getPackageFileKinds to include search for package.html
-     */
-    @Override
-    protected EnumSet<JavaFileObject.Kind> getPackageFileKinds() {
-        return docenv.docClasses ? noSource : all;
-    }
-
-    /**
-     * Override extraFileActions to check for package documentation
-     */
-    @Override
-    protected void extraFileActions(PackageSymbol pack, JavaFileObject fo) {
-        if (fo.isNameCompatible("package", JavaFileObject.Kind.HTML))
-            docenv.getPackageDoc(pack).setDocPath(fo);
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocEnter.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import javax.tools.JavaFileObject;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.comp.Enter;
-import com.sun.tools.javac.tree.JCTree.*;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
-import com.sun.tools.javac.util.List;
-
-import static com.sun.tools.javac.code.Kinds.Kind.*;
-
-/**
- *  Javadoc's own enter phase does a few things above and beyond that
- *  done by javac.
- *
- *  <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>
- *
- *  @author Neal Gafter
- */
-public class JavadocEnter extends Enter {
-    public static JavadocEnter instance(Context context) {
-        Enter instance = context.get(enterKey);
-        if (instance == null)
-            instance = new JavadocEnter(context);
-        return (JavadocEnter)instance;
-    }
-
-    public static void preRegister(Context context) {
-        context.put(enterKey, new Context.Factory<Enter>() {
-               public Enter make(Context c) {
-                   return new JavadocEnter(c);
-               }
-        });
-    }
-
-    protected JavadocEnter(Context context) {
-        super(context);
-        messager = Messager.instance0(context);
-        docenv = DocEnv.instance(context);
-    }
-
-    final Messager messager;
-    final DocEnv docenv;
-
-    @Override
-    public void main(List<JCCompilationUnit> trees) {
-        // count all Enter errors as warnings.
-        int nerrors = messager.nerrors;
-        super.main(trees);
-        messager.nwarnings += (messager.nerrors - nerrors);
-        messager.nerrors = nerrors;
-    }
-
-    @Override
-    public void visitTopLevel(JCCompilationUnit tree) {
-        super.visitTopLevel(tree);
-        if (tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE)) {
-            JCPackageDecl pd = tree.getPackage();
-            TreePath tp = pd == null ? docenv.getTreePath(tree) : docenv.getTreePath(tree, pd);
-            docenv.makePackageDoc(tree.packge, tp);
-        }
-    }
-
-    @Override
-    public void visitClassDef(JCClassDecl tree) {
-        super.visitClassDef(tree);
-        if (tree.sym == null) return;
-        if (tree.sym.kind == TYP || tree.sym.kind == ERR) {
-            ClassSymbol c = tree.sym;
-            docenv.makeClassDoc(c, docenv.getTreePath(env.toplevel, tree));
-        }
-    }
-
-    /** Don't complain about a duplicate class. */
-    @Override
-    protected void duplicateClass(DiagnosticPosition pos, ClassSymbol c) {}
-
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.comp.MemberEnter;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.*;
-import com.sun.tools.javac.util.Context;
-
-import static com.sun.tools.javac.code.Flags.*;
-import static com.sun.tools.javac.code.Kinds.Kind.*;
-
-/**
- *  Javadoc's own memberEnter phase does a few things above and beyond that
- *  done by javac.
- *
- *  <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>
- *
- *  @author Neal Gafter
- */
-public class JavadocMemberEnter extends MemberEnter {
-    public static JavadocMemberEnter instance0(Context context) {
-        MemberEnter instance = context.get(memberEnterKey);
-        if (instance == null)
-            instance = new JavadocMemberEnter(context);
-        return (JavadocMemberEnter)instance;
-    }
-
-    public static void preRegister(Context context) {
-        context.put(memberEnterKey, new Context.Factory<MemberEnter>() {
-               public MemberEnter make(Context c) {
-                   return new JavadocMemberEnter(c);
-               }
-        });
-    }
-
-    final DocEnv docenv;
-
-    protected JavadocMemberEnter(Context context) {
-        super(context);
-        docenv = DocEnv.instance(context);
-    }
-
-    @Override
-    public void visitMethodDef(JCMethodDecl tree) {
-        super.visitMethodDef(tree);
-        MethodSymbol meth = tree.sym;
-        if (meth == null || meth.kind != MTH) return;
-        TreePath treePath = docenv.getTreePath(env.toplevel, env.enclClass, tree);
-        if (meth.isConstructor())
-            docenv.makeConstructorDoc(meth, treePath);
-        else if (isAnnotationTypeElement(meth))
-            docenv.makeAnnotationTypeElementDoc(meth, treePath);
-        else
-            docenv.makeMethodDoc(meth, treePath);
-
-        // release resources
-        tree.body = null;
-    }
-
-    @Override
-    public void visitVarDef(JCVariableDecl tree) {
-        if (tree.init != null) {
-            boolean isFinal = (tree.mods.flags & FINAL) != 0
-                    || (env.enclClass.mods.flags & INTERFACE) != 0;
-            if (!isFinal || containsNonConstantExpression(tree.init)) {
-                // Avoid unnecessary analysis and release resources.
-                // In particular, remove non-constant expressions
-                // which may trigger Attr.attribClass, since
-                // method bodies are also removed, in visitMethodDef.
-                tree.init = null;
-            }
-        }
-        super.visitVarDef(tree);
-        if (tree.sym != null &&
-                tree.sym.kind == VAR &&
-                !isParameter(tree.sym)) {
-            docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, env.enclClass, tree));
-        }
-    }
-
-    private static boolean isAnnotationTypeElement(MethodSymbol meth) {
-        return ClassDocImpl.isAnnotationType(meth.enclClass());
-    }
-
-    private static boolean isParameter(VarSymbol var) {
-        return (var.flags() & Flags.PARAMETER) != 0;
-    }
-
-    /**
-     * Simple analysis of an expression tree to see if it contains tree nodes
-     * for any non-constant expression. This does not include checking references
-     * to other fields which may or may not be constant.
-     */
-    private static boolean containsNonConstantExpression(JCExpression tree) {
-        return new MaybeConstantExpressionScanner().containsNonConstantExpression(tree);
-    }
-
-    /**
-     * See JLS 15.18, Constant Expression
-     */
-    private static class MaybeConstantExpressionScanner extends JCTree.Visitor {
-        boolean maybeConstantExpr = true;
-
-        public boolean containsNonConstantExpression(JCExpression tree) {
-            scan(tree);
-            return !maybeConstantExpr;
-        }
-
-        public void scan(JCTree tree) {
-            // short circuit scan when end result is definitely false
-            if (maybeConstantExpr && tree != null)
-                tree.accept(this);
-        }
-
-        @Override
-        /** default for any non-overridden visit method. */
-        public void visitTree(JCTree tree) {
-            maybeConstantExpr = false;
-        }
-
-        @Override
-        public void visitBinary(JCBinary tree) {
-            switch (tree.getTag()) {
-                case MUL: case DIV: case MOD:
-                case PLUS: case MINUS:
-                case SL: case SR: case USR:
-                case LT: case LE: case GT: case GE:
-                case EQ: case NE:
-                case BITAND: case BITXOR: case BITOR:
-                case AND: case OR:
-                    break;
-                default:
-                    maybeConstantExpr = false;
-            }
-        }
-
-        @Override
-        public void visitConditional(JCConditional tree) {
-            scan(tree.cond);
-            scan(tree.truepart);
-            scan(tree.falsepart);
-        }
-
-        @Override
-        public void visitIdent(JCIdent tree) { }
-
-        @Override
-        public void visitLiteral(JCLiteral tree) { }
-
-        @Override
-        public void visitParens(JCParens tree) {
-            scan(tree.expr);
-        }
-
-        @Override
-        public void visitSelect(JCTree.JCFieldAccess tree) {
-            scan(tree.selected);
-        }
-
-        @Override
-        public void visitTypeCast(JCTypeCast tree) {
-            scan(tree.clazz);
-            scan(tree.expr);
-        }
-
-        @Override
-        public void visitTypeIdent(JCPrimitiveTypeTree tree) { }
-
-        @Override
-        public void visitUnary(JCUnary tree) {
-            switch (tree.getTag()) {
-                case POS: case NEG: case COMPL: case NOT:
-                    break;
-                default:
-                    maybeConstantExpr = false;
-            }
-        }
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocTodo.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2003, 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.tools.javadoc;
-
-import com.sun.tools.javac.comp.*;
-import com.sun.tools.javac.util.*;
-
-/**
- *  Javadoc's own todo queue doesn't queue its inputs, as javadoc
- *  doesn't perform attribution of method bodies or semantic checking.
- *
- *  <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>
- *
- *  @author Neal Gafter
- */
-public class JavadocTodo extends Todo {
-    public static void preRegister(Context context) {
-        context.put(todoKey, new Context.Factory<Todo>() {
-               public Todo make(Context c) {
-                   return new JavadocTodo(c);
-               }
-        });
-    }
-
-    protected JavadocTodo(Context context) {
-        super(context);
-    }
-
-    @Override
-    public void append(Env<AttrContext> e) {
-        // do nothing; Javadoc doesn't perform attribution.
-    }
-
-    @Override
-    public boolean offer(Env<AttrContext> e) {
-        return false;
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocTool.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,430 +0,0 @@
-/*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javadoc;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.EnumSet;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileManager.Location;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-
-import com.sun.tools.javac.code.ClassFinder;
-import com.sun.tools.javac.code.Symbol.Completer;
-import com.sun.tools.javac.code.Symbol.ModuleSymbol;
-import com.sun.tools.javac.comp.Enter;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCClassDecl;
-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
-import com.sun.tools.javac.util.Abort;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-
-
-/**
- *  This class could be the main entry point for Javadoc when Javadoc is used as a
- *  component in a larger software system. It provides operations to
- *  construct a new javadoc processor, and to run it on a set of source
- *  files.
- *
- *  <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>
- *
- *  @author Neal Gafter
- */
-public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler {
-    DocEnv docenv;
-
-    final Messager messager;
-    final ClassFinder javadocFinder;
-    final Enter javadocEnter;
-    final Set<JavaFileObject> uniquefiles;
-
-    /**
-     * Construct a new JavaCompiler processor, using appropriately
-     * extended phases of the underlying compiler.
-     */
-    protected JavadocTool(Context context) {
-        super(context);
-        messager = Messager.instance0(context);
-        javadocFinder = JavadocClassFinder.instance(context);
-        javadocEnter = JavadocEnter.instance(context);
-        uniquefiles = new HashSet<>();
-    }
-
-    /**
-     * For javadoc, the parser needs to keep comments. Overrides method from JavaCompiler.
-     */
-    @Override
-    protected boolean keepComments() {
-        return true;
-    }
-
-    /**
-     *  Construct a new javadoc tool.
-     */
-    public static JavadocTool make0(Context context) {
-        // force the use of Javadoc's class finder
-        JavadocClassFinder.preRegister(context);
-
-        // force the use of Javadoc's own enter phase
-        JavadocEnter.preRegister(context);
-
-        // force the use of Javadoc's own member enter phase
-        JavadocMemberEnter.preRegister(context);
-
-        // force the use of Javadoc's own todo phase
-        JavadocTodo.preRegister(context);
-
-        // force the use of Messager as a Log
-        Messager.instance0(context);
-
-        return new JavadocTool(context);
-    }
-
-    public RootDocImpl getRootDocImpl(String doclocale,
-                                      String encoding,
-                                      ModifierFilter filter,
-                                      List<String> args,
-                                      List<String[]> options,
-                                      Iterable<? extends JavaFileObject> fileObjects,
-                                      boolean breakiterator,
-                                      List<String> subPackages,
-                                      List<String> excludedPackages,
-                                      boolean docClasses,
-                                      boolean legacyDoclet,
-                      boolean quiet) throws IOException {
-        docenv = DocEnv.instance(context);
-        docenv.showAccess = filter;
-        docenv.quiet = quiet;
-        docenv.breakiterator = breakiterator;
-        docenv.setLocale(doclocale);
-        docenv.setEncoding(encoding);
-        docenv.docClasses = docClasses;
-        docenv.legacyDoclet = legacyDoclet;
-
-        javadocFinder.sourceCompleter = docClasses ? Completer.NULL_COMPLETER : sourceCompleter;
-
-        if (docClasses) {
-            // If -Xclasses is set, the args should be a series of class names
-            for (String arg: args) {
-                if (!isValidPackageName(arg)) // checks
-                    docenv.error(null, "main.illegal_class_name", arg);
-            }
-            if (messager.nerrors() != 0) {
-                return null;
-            }
-            return new RootDocImpl(docenv, args, options);
-        }
-
-        ListBuffer<JCCompilationUnit> classTrees = new ListBuffer<>();
-        Set<String> includedPackages = new LinkedHashSet<>();
-
-        try {
-            StandardJavaFileManager fm = docenv.fileManager instanceof StandardJavaFileManager
-                    ? (StandardJavaFileManager) docenv.fileManager : null;
-            Set<String> packageNames = new LinkedHashSet<>();
-            // Normally, the args should be a series of package names or file names.
-            // Parse the files and collect the package names.
-            for (String arg: args) {
-                if (fm != null && arg.endsWith(".java") && new File(arg).exists()) {
-                    if (new File(arg).getName().equals("module-info.java")) {
-                        docenv.warning(null, "main.file_ignored", arg);
-                    } else {
-                        parse(fm.getJavaFileObjects(arg), classTrees, true);
-                    }
-                } else if (isValidPackageName(arg)) {
-                    packageNames.add(arg);
-                } else if (arg.endsWith(".java")) {
-                    if (fm == null)
-                        throw new IllegalArgumentException();
-                    else
-                        docenv.error(null, "main.file_not_found", arg);
-                } else {
-                    docenv.error(null, "main.illegal_package_name", arg);
-                }
-            }
-
-            // Parse file objects provide via the DocumentationTool API
-            parse(fileObjects, classTrees, true);
-            modules.enter(classTrees.toList(), null);
-
-            syms.unnamedModule.complete(); // TEMP to force reading all named modules
-
-            // Build up the complete list of any packages to be documented
-            Location location =
-                    modules.multiModuleMode && !modules.noModules ? StandardLocation.MODULE_SOURCE_PATH
-                    : docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH) ? StandardLocation.SOURCE_PATH
-                    : StandardLocation.CLASS_PATH;
-
-            PackageTable t = new PackageTable(docenv.fileManager, location)
-                    .packages(packageNames)
-                    .subpackages(subPackages, excludedPackages);
-
-            includedPackages = t.getIncludedPackages();
-
-            // Parse the files in the packages to be documented
-            ListBuffer<JCCompilationUnit> packageTrees = new ListBuffer<>();
-            for (String packageName: includedPackages) {
-                List<JavaFileObject> files = t.getFiles(packageName);
-                docenv.notice("main.Loading_source_files_for_package", packageName);
-
-                if (files.isEmpty())
-                    messager.warning(Messager.NOPOS, "main.no_source_files_for_package", packageName);
-                parse(files, packageTrees, false);
-            }
-            modules.enter(packageTrees.toList(), null);
-
-            if (messager.nerrors() != 0) {
-                return null;
-            }
-
-            // Enter symbols for all files
-            docenv.notice("main.Building_tree");
-            javadocEnter.main(classTrees.toList().appendList(packageTrees.toList()));
-            enterDone = true;
-        } catch (Abort ex) {}
-
-        if (messager.nerrors() != 0)
-            return null;
-
-        return new RootDocImpl(docenv, listClasses(classTrees.toList()), List.from(includedPackages), options);
-    }
-
-    /** Is the given string a valid package name? */
-    boolean isValidPackageName(String s) {
-        int index;
-        while ((index = s.indexOf('.')) != -1) {
-            if (!isValidClassName(s.substring(0, index))) return false;
-            s = s.substring(index+1);
-        }
-        return isValidClassName(s);
-    }
-
-    private void parse(Iterable<? extends JavaFileObject> files, ListBuffer<JCCompilationUnit> trees,
-                       boolean trace) {
-        for (JavaFileObject fo: files) {
-            if (uniquefiles.add(fo)) { // ignore duplicates
-                if (trace)
-                    docenv.notice("main.Loading_source_file", fo.getName());
-                trees.append(parse(fo));
-            }
-        }
-    }
-
-    /** Are surrogates supported?
-     */
-    final static boolean surrogatesSupported = surrogatesSupported();
-    private static boolean surrogatesSupported() {
-        try {
-            boolean b = Character.isHighSurrogate('a');
-            return true;
-        } catch (NoSuchMethodError ex) {
-            return false;
-        }
-    }
-
-    /**
-     * Return true if given file name is a valid class name
-     * (including "package-info").
-     * @param s the name of the class to check.
-     * @return true if given class name is a valid class name
-     * and false otherwise.
-     */
-    public static boolean isValidClassName(String s) {
-        if (s.length() < 1) return false;
-        if (s.equals("package-info")) return true;
-        if (surrogatesSupported) {
-            int cp = s.codePointAt(0);
-            if (!Character.isJavaIdentifierStart(cp))
-                return false;
-            for (int j=Character.charCount(cp); j<s.length(); j+=Character.charCount(cp)) {
-                cp = s.codePointAt(j);
-                if (!Character.isJavaIdentifierPart(cp))
-                    return false;
-            }
-        } else {
-            if (!Character.isJavaIdentifierStart(s.charAt(0)))
-                return false;
-            for (int j=1; j<s.length(); j++)
-                if (!Character.isJavaIdentifierPart(s.charAt(j)))
-                    return false;
-        }
-        return true;
-    }
-
-    /**
-     * 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<>();
-        for (JCCompilationUnit t : trees) {
-            for (JCTree def : t.defs) {
-                if (def.hasTag(JCTree.Tag.CLASSDEF))
-                    result.append((JCClassDecl)def);
-            }
-        }
-        return result.toList();
-    }
-
-    /**
-     * A table to manage included and excluded packages.
-     */
-    class PackageTable {
-        private final Map<String, Entry> entries = new LinkedHashMap<>();
-        private final Set<String> includedPackages = new LinkedHashSet<>();
-        private final JavaFileManager fm;
-        private final Location location;
-        private final Set<JavaFileObject.Kind> sourceKinds = EnumSet.of(JavaFileObject.Kind.SOURCE);
-
-        /**
-         * Creates a table to manage included and excluded packages.
-         * @param fm The file manager used to locate source files
-         * @param locn the location used to locate source files
-         */
-        PackageTable(JavaFileManager fm, Location locn) {
-            this.fm = fm;
-            this.location = locn;
-            getEntry("").excluded = false;
-        }
-
-        PackageTable packages(Collection<String> packageNames) {
-            includedPackages.addAll(packageNames);
-            return this;
-        }
-
-        PackageTable subpackages(Collection<String> packageNames, Collection<String> excludePackageNames)
-                throws IOException {
-            for (String p: excludePackageNames) {
-                getEntry(p).excluded = true;
-            }
-
-            for (String packageName: packageNames) {
-                Location packageLocn = getLocation(packageName);
-                for (JavaFileObject fo: fm.list(packageLocn, packageName, sourceKinds, true)) {
-                    String binaryName = fm.inferBinaryName(packageLocn, fo);
-                    String pn = getPackageName(binaryName);
-                    String simpleName = getSimpleName(binaryName);
-                    Entry e = getEntry(pn);
-                    if (!e.isExcluded() && isValidClassName(simpleName)) {
-                        includedPackages.add(pn);
-                        e.files = (e.files == null ? List.of(fo) : e.files.prepend(fo));
-                    }
-                }
-            }
-            return this;
-        }
-
-        /**
-         * Returns the aggregate set of included packages.
-         * @return the aggregate set of included packages
-         */
-        Set<String> getIncludedPackages() {
-            return includedPackages;
-        }
-
-        /**
-         * Returns the set of source files for a package.
-         * @param packageName the specified package
-         * @return the set of file objects for the specified package
-         * @throws IOException if an error occurs while accessing the files
-         */
-        List<JavaFileObject> getFiles(String packageName) throws IOException {
-            Entry e = getEntry(packageName);
-            // The files may have been found as a side effect of searching for subpackages
-            if (e.files != null)
-                return e.files;
-
-            ListBuffer<JavaFileObject> lb = new ListBuffer<>();
-            Location packageLocn = getLocation(packageName);
-            for (JavaFileObject fo: fm.list(packageLocn, packageName, sourceKinds, false)) {
-                String binaryName = fm.inferBinaryName(packageLocn, fo);
-                String simpleName = getSimpleName(binaryName);
-                if (isValidClassName(simpleName)) {
-                    lb.append(fo);
-                }
-            }
-
-            return lb.toList();
-        }
-
-        private Location getLocation(String packageName) throws IOException {
-            if (location == StandardLocation.MODULE_SOURCE_PATH) {
-                // TODO: handle invalid results
-                ModuleSymbol msym = syms.inferModule(names.fromString(packageName));
-                return fm.getModuleLocation(location, msym.name.toString());
-            } else {
-                return location;
-            }
-        }
-
-        private Entry getEntry(String name) {
-            Entry e = entries.get(name);
-            if (e == null)
-                entries.put(name, e = new Entry(name));
-            return e;
-        }
-
-        private String getPackageName(String name) {
-            int lastDot = name.lastIndexOf(".");
-            return (lastDot == -1 ? "" : name.substring(0, lastDot));
-        }
-
-        private String getSimpleName(String name) {
-            int lastDot = name.lastIndexOf(".");
-            return (lastDot == -1 ? name : name.substring(lastDot + 1));
-        }
-
-        class Entry {
-            final String name;
-            Boolean excluded;
-            List<JavaFileObject> files;
-
-            Entry(String name) {
-                this.name = name;
-            }
-
-            boolean isExcluded() {
-                if (excluded == null)
-                    excluded = getEntry(getPackageName(name)).isExcluded();
-                return excluded;
-            }
-        }
-    }
-
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java	Tue May 17 05:38:15 2016 -0700
@@ -27,6 +27,8 @@
 
 import java.io.PrintWriter;
 
+import com.sun.tools.javadoc.main.Start;
+
 /**
  * Provides external entry points (tool and programmatic)
  * for the javadoc program.
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/MemberDocImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 1997, 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.tools.javadoc;
-
-import com.sun.javadoc.*;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Symbol;
-
-/**
- * Represents a member of a java class: field, constructor, or method.
- * This is an abstract class dealing with information common to
- * method, constructor and field members. Class members of a class
- * (nested classes) are represented instead by ClassDocImpl.
- *
- *  <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>
- *
- * @see MethodDocImpl
- * @see FieldDocImpl
- * @see ClassDocImpl
- *
- * @author Robert Field
- * @author Neal Gafter
- */
-
-public abstract class MemberDocImpl
-    extends ProgramElementDocImpl
-    implements MemberDoc {
-
-    /**
-     * constructor.
-     */
-    public MemberDocImpl(DocEnv env, Symbol sym, TreePath treePath) {
-        super(env, sym, treePath);
-    }
-
-    /**
-     * Returns true if this field was synthesized by the compiler.
-     */
-    public abstract boolean isSynthetic();
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Messager.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,323 +0,0 @@
-/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.javadoc;
-
-import java.io.PrintWriter;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.JCDiagnostic;
-import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
-import com.sun.tools.javac.util.JavacMessages;
-import com.sun.tools.javac.util.Log;
-
-/**
- * Utility for integrating with javadoc tools and for localization.
- * Handle Resources. Access to error and warning counts.
- * Message formatting.
- * <br>
- * Also provides implementation for DocErrorReporter.
- *
- *  <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>
- *
- * @see java.util.ResourceBundle
- * @see java.text.MessageFormat
- * @author Neal Gafter (rewrite)
- */
-public class Messager extends Log implements DocErrorReporter {
-    public static final SourcePosition NOPOS = null;
-
-    /** Get the current messager, which is also the compiler log. */
-    public static Messager instance0(Context context) {
-        Log instance = context.get(logKey);
-        if (instance == null || !(instance instanceof Messager))
-            throw new InternalError("no messager instance!");
-        return (Messager)instance;
-    }
-
-    public static void preRegister(Context context,
-                                   final String programName) {
-        context.put(logKey, new Context.Factory<Log>() {
-            public Log make(Context c) {
-                return new Messager(c,
-                                    programName);
-            }
-        });
-    }
-    public static void preRegister(Context context,
-                                   final String programName,
-                                   final PrintWriter errWriter,
-                                   final PrintWriter warnWriter,
-                                   final PrintWriter noticeWriter) {
-        context.put(logKey, new Context.Factory<Log>() {
-            public Log make(Context c) {
-                return new Messager(c,
-                                    programName,
-                                    errWriter,
-                                    warnWriter,
-                                    noticeWriter);
-            }
-        });
-    }
-
-    public class ExitJavadoc extends Error {
-        private static final long serialVersionUID = 0;
-    }
-
-    final String programName;
-
-    private Locale locale;
-    private final JavacMessages messages;
-    private final JCDiagnostic.Factory javadocDiags;
-
-    /** The default writer for diagnostics
-     */
-    static final PrintWriter defaultErrWriter = new PrintWriter(System.err);
-    static final PrintWriter defaultWarnWriter = new PrintWriter(System.err);
-    static final PrintWriter defaultNoticeWriter = new PrintWriter(System.out);
-
-    /**
-     * Constructor
-     * @param programName  Name of the program (for error messages).
-     */
-    protected Messager(Context context, String programName) {
-        this(context, programName, defaultErrWriter, defaultWarnWriter, defaultNoticeWriter);
-    }
-
-    /**
-     * Constructor
-     * @param programName  Name of the program (for error messages).
-     * @param errWriter    Stream for error messages
-     * @param warnWriter   Stream for warnings
-     * @param noticeWriter Stream for other messages
-     */
-    @SuppressWarnings("deprecation")
-    protected Messager(Context context,
-                       String programName,
-                       PrintWriter errWriter,
-                       PrintWriter warnWriter,
-                       PrintWriter noticeWriter) {
-        super(context, errWriter, warnWriter, noticeWriter);
-        messages = JavacMessages.instance(context);
-        messages.add(locale -> ResourceBundle.getBundle("com.sun.tools.javadoc.resources.javadoc",
-                                                         locale));
-        javadocDiags = new JCDiagnostic.Factory(messages, "javadoc");
-        this.programName = programName;
-
-    }
-
-    public void setLocale(Locale locale) {
-        this.locale = locale;
-    }
-
-    /**
-     * get and format message string from resource
-     *
-     * @param key selects message from resource
-     * @param args arguments for the message
-     */
-    String getText(String key, Object... args) {
-        return messages.getLocalizedString(locale, key, args);
-    }
-
-    /**
-     * Print error message, increment error count.
-     * Part of DocErrorReporter.
-     *
-     * @param msg message to print
-     */
-    public void printError(String msg) {
-        printError(null, msg);
-    }
-
-    /**
-     * Print error message, increment error count.
-     * Part of DocErrorReporter.
-     *
-     * @param pos the position where the error occurs
-     * @param msg message to print
-     */
-    public void printError(SourcePosition pos, String msg) {
-        if (diagListener != null) {
-            report(DiagnosticType.ERROR, pos, msg);
-            return;
-        }
-
-        if (nerrors < MaxErrors) {
-            String prefix = (pos == null) ? programName : pos.toString();
-            errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg);
-            errWriter.flush();
-            prompt();
-            nerrors++;
-        }
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     * Part of DocErrorReporter.
-     *
-     * @param msg message to print
-     */
-    public void printWarning(String msg) {
-        printWarning(null, msg);
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     * Part of DocErrorReporter.
-     *
-     * @param pos the position where the error occurs
-     * @param msg message to print
-     */
-    public void printWarning(SourcePosition pos, String msg) {
-        if (diagListener != null) {
-            report(DiagnosticType.WARNING, pos, msg);
-            return;
-        }
-
-        if (nwarnings < MaxWarnings) {
-            String prefix = (pos == null) ? programName : pos.toString();
-            warnWriter.println(prefix +  ": " + getText("javadoc.warning") +" - " + msg);
-            warnWriter.flush();
-            nwarnings++;
-        }
-    }
-
-    /**
-     * Print a message.
-     * Part of DocErrorReporter.
-     *
-     * @param msg message to print
-     */
-    public void printNotice(String msg) {
-        printNotice(null, msg);
-    }
-
-    /**
-     * Print a message.
-     * Part of DocErrorReporter.
-     *
-     * @param pos the position where the error occurs
-     * @param msg message to print
-     */
-    public void printNotice(SourcePosition pos, String msg) {
-        if (diagListener != null) {
-            report(DiagnosticType.NOTE, pos, msg);
-            return;
-        }
-
-        if (pos == null)
-            noticeWriter.println(msg);
-        else
-            noticeWriter.println(pos + ": " + msg);
-        noticeWriter.flush();
-    }
-
-    /**
-     * Print error message, increment error count.
-     *
-     * @param key selects message from resource
-     */
-    public void error(SourcePosition pos, String key, Object... args) {
-        printError(pos, getText(key, args));
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param key selects message from resource
-     */
-    public void warning(SourcePosition pos, String key, Object... args) {
-        printWarning(pos, getText(key, args));
-    }
-
-    /**
-     * Print a message.
-     *
-     * @param key selects message from resource
-     */
-    public void notice(String key, Object... args) {
-        printNotice(getText(key, args));
-    }
-
-    /**
-     * Return total number of errors, including those recorded
-     * in the compilation log.
-     */
-    public int nerrors() { return nerrors; }
-
-    /**
-     * Return total number of warnings, including those recorded
-     * in the compilation log.
-     */
-    public int nwarnings() { return nwarnings; }
-
-    /**
-     * Print exit message.
-     */
-    public void exitNotice() {
-        if (nerrors > 0) {
-            notice((nerrors > 1) ? "main.errors" : "main.error",
-                   "" + nerrors);
-        }
-        if (nwarnings > 0) {
-            notice((nwarnings > 1) ?  "main.warnings" : "main.warning",
-                   "" + nwarnings);
-        }
-    }
-
-    /**
-     * Force program exit, e.g., from a fatal error.
-     * <p>
-     * TODO: This method does not really belong here.
-     */
-    public void exit() {
-        throw new ExitJavadoc();
-    }
-
-    private void report(DiagnosticType type, SourcePosition pos, String msg) {
-        switch (type) {
-            case ERROR:
-            case WARNING:
-                Object prefix = (pos == null) ? programName : pos;
-                report(javadocDiags.create(type, null, null, "msg", prefix, msg));
-                break;
-
-            case NOTE:
-                String key = (pos == null) ? "msg" : "pos.msg";
-                report(javadocDiags.create(type, null, null, key, pos, msg));
-                break;
-
-            default:
-                throw new IllegalArgumentException(type.toString());
-        }
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/MethodDocImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,246 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import java.lang.reflect.Modifier;
-
-import com.sun.javadoc.*;
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.Type;
-import static com.sun.tools.javac.code.TypeTag.CLASS;
-
-/**
- * Represents a method of a java class.
- *
- *  <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>
- *
- * @since 1.2
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- */
-
-public class MethodDocImpl
-        extends ExecutableMemberDocImpl implements MethodDoc {
-
-    /**
-     * constructor.
-     */
-    public MethodDocImpl(DocEnv env, MethodSymbol sym) {
-        super(env, sym);
-    }
-
-    /**
-     * constructor.
-     */
-    public MethodDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) {
-        super(env, sym, treePath);
-    }
-
-    /**
-     * Return true if it is a method, which it is.
-     * Note: constructors are not methods.
-     * This method is overridden by AnnotationTypeElementDocImpl.
-     *
-     * @return true
-     */
-    public boolean isMethod() {
-        return true;
-    }
-
-    /**
-     * Return true if this method is default
-     */
-    public boolean isDefault() {
-        return (sym.flags() & Flags.DEFAULT) != 0;
-    }
-
-    /**
-     * Return true if this method is abstract
-     */
-    public boolean isAbstract() {
-        return (Modifier.isAbstract(getModifiers()) && !isDefault());
-    }
-
-    /**
-     * Get return type.
-     *
-     * @return the return type of this method, null if it
-     * is a constructor.
-     */
-    public com.sun.javadoc.Type returnType() {
-        return TypeMaker.getType(env, sym.type.getReturnType(), false);
-    }
-
-    /**
-     * Return the class that originally defined the method that
-     * is overridden by the current definition, or null if no
-     * such class exists.
-     *
-     * @return a ClassDocImpl representing the superclass that
-     * originally defined this method, null if this method does
-     * not override a definition in a superclass.
-     */
-    public ClassDoc overriddenClass() {
-        com.sun.javadoc.Type t = overriddenType();
-        return (t != null) ? t.asClassDoc() : null;
-    }
-
-    /**
-     * Return the type containing the method that this method overrides.
-     * It may be a <code>ClassDoc</code> or a <code>ParameterizedType</code>.
-     */
-    public com.sun.javadoc.Type overriddenType() {
-
-        if ((sym.flags() & Flags.STATIC) != 0) {
-            return null;
-        }
-
-        ClassSymbol origin = (ClassSymbol)sym.owner;
-        for (Type t = env.types.supertype(origin.type);
-             t.hasTag(CLASS);
-             t = env.types.supertype(t)) {
-            ClassSymbol c = (ClassSymbol)t.tsym;
-            for (Symbol sym2 : membersOf(c).getSymbolsByName(sym.name)) {
-                if (sym.overrides(sym2, origin, env.types, true)) {
-                    return TypeMaker.getType(env, t);
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Return the method that this method overrides.
-     *
-     * @return a MethodDoc representing a method definition
-     * in a superclass this method overrides, null if
-     * this method does not override.
-     */
-    public MethodDoc overriddenMethod() {
-
-        // Real overriding only.  Static members are simply hidden.
-        // Likewise for constructors, but the MethodSymbol.overrides
-        // method takes this into account.
-        if ((sym.flags() & Flags.STATIC) != 0) {
-            return null;
-        }
-
-        // Derived from  com.sun.tools.javac.comp.Check.checkOverride .
-
-        ClassSymbol origin = (ClassSymbol)sym.owner;
-        for (Type t = env.types.supertype(origin.type);
-             t.hasTag(CLASS);
-             t = env.types.supertype(t)) {
-            ClassSymbol c = (ClassSymbol)t.tsym;
-            for (Symbol sym2 : membersOf(c).getSymbolsByName(sym.name)) {
-                if (sym.overrides(sym2, origin, env.types, true)) {
-                    return env.getMethodDoc((MethodSymbol)sym2);
-                }
-            }
-        }
-        return null;
-    }
-
-    /**Retrieve members of c, ignoring any CompletionFailures that occur. */
-    private Scope membersOf(ClassSymbol c) {
-        try {
-            return c.members();
-        } catch (CompletionFailure cf) {
-            /* Quietly ignore completion failures and try again - the type
-             * for which the CompletionFailure was thrown shouldn't be completed
-             * again by the completer that threw the CompletionFailure.
-             */
-            return membersOf(c);
-        }
-    }
-
-    /**
-     * Tests whether this method overrides another.
-     * The overridden method may be one declared in a superclass or
-     * a superinterface (unlike {@link #overriddenMethod()}).
-     *
-     * <p> When a non-abstract method overrides an abstract one, it is
-     * also said to <i>implement</i> the other.
-     *
-     * @param meth  the other method to examine
-     * @return <tt>true</tt> if this method overrides the other
-     */
-    public boolean overrides(MethodDoc meth) {
-        MethodSymbol overridee = ((MethodDocImpl) meth).sym;
-        ClassSymbol origin = (ClassSymbol) sym.owner;
-
-        return sym.name == overridee.name &&
-
-               // not reflexive as per JLS
-               sym != overridee &&
-
-               // we don't care if overridee is static, though that wouldn't
-               // compile
-               !sym.isStatic() &&
-
-               // sym, whose declaring type is the origin, must be
-               // in a subtype of overridee's type
-               env.types.asSuper(origin.type, overridee.owner) != null &&
-
-               // check access and signatures; don't check return types
-               sym.overrides(overridee, origin, env.types, false);
-    }
-
-
-    public String name() {
-        if (name == null) {
-            name = sym.name.toString();
-        }
-        return name;
-    }
-
-    private String name;
-
-    public String qualifiedName() {
-        if (qualifiedName == null) {
-            qualifiedName =  sym.enclClass().getQualifiedName() + "." + sym.name;
-        }
-        return qualifiedName;
-    }
-
-    private String qualifiedName;
-
-    /**
-     * Returns a string representation of this method.  Includes the
-     * qualified signature, the qualified method name, and any type
-     * parameters.  Type parameters follow the class name, as they do
-     * in the syntax for invoking methods with explicit type parameters.
-     */
-    public String toString() {
-        return sym.enclClass().getQualifiedName() +
-                "." + typeParametersString() + name() + signature();
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ModifierFilter.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +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.tools.javadoc;
-
-import static com.sun.tools.javac.code.Flags.*;
-
-/**
- *   A class whose instances are filters over Modifier bits.
- *   Filtering is done by returning boolean values.
- *   Classes, methods and fields can be filtered, or filtering
- *   can be done directly on modifier bits.
- *
- *  <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>
- *
- *   @see com.sun.tools.javac.code.Flags
- *   @author Robert Field
- */
-
-public class ModifierFilter {
-
-    /**
-    * Package private access.
-    * A "pseudo-" modifier bit that can be used in the
-    * constructors of this class to specify package private
-    * access. This is needed since there is no Modifier.PACKAGE.
-    */
-    public static final long PACKAGE = 0x8000000000000000L;
-
-    /**
-    * All access modifiers.
-    * A short-hand set of modifier bits that can be used in the
-    * constructors of this class to specify all access modifiers,
-    * Same as PRIVATE | PROTECTED | PUBLIC | PACKAGE.
-    */
-    public static final long ALL_ACCESS =
-                PRIVATE | PROTECTED | PUBLIC | PACKAGE;
-
-    private long oneOf;
-    private long must;
-    private long cannot;
-
-    private static final int ACCESS_BITS = PRIVATE | PROTECTED | PUBLIC;
-
-    /**
-     * Constructor - Specify a filter.
-     *
-     * @param   oneOf   If zero, everything passes the filter.
-     *                  If non-zero, at least one of the specified
-     *                  bits must be on in the modifier bits to
-     *                  pass the filter.
-     */
-    public ModifierFilter(long oneOf) {
-        this(oneOf, 0, 0);
-    }
-
-    /**
-     * Constructor - Specify a filter.
-     * For example, the filter below  will only pass synchronized
-     * methods that are private or package private access and are
-     * not native or static.
-     * <pre>
-     * ModifierFilter(  Modifier.PRIVATE | ModifierFilter.PACKAGE,
-     *                  Modifier.SYNCHRONIZED,
-     *                  Modifier.NATIVE | Modifier.STATIC)
-     * </pre><p>
-     * Each of the three arguments must either be
-     * zero or the or'ed combination of the bits specified in the
-     * class Modifier or this class. During filtering, these values
-     * are compared against the modifier bits as follows:
-     *
-     * @param   oneOf   If zero, ignore this argument.
-     *                  If non-zero, at least one of the bits must be on.
-     * @param   must    All bits specified must be on.
-     * @param   cannot  None of the bits specified can be on.
-     */
-    public ModifierFilter(long oneOf, long must, long cannot) {
-        this.oneOf = oneOf;
-        this.must = must;
-        this.cannot = cannot;
-    }
-
-    /**
-     * Filter on modifier bits.
-     *
-     * @param   modifierBits    Bits as specified in the Modifier class
-     *
-     * @return                  Whether the modifierBits pass this filter.
-     */
-    public boolean checkModifier(int modifierBits) {
-        // Add in the "pseudo-" modifier bit PACKAGE, if needed
-        long fmod = ((modifierBits & ACCESS_BITS) == 0) ?
-                        modifierBits | PACKAGE :
-                        modifierBits;
-        return ((oneOf == 0) || ((oneOf & fmod) != 0)) &&
-                ((must & fmod) == must) &&
-                ((cannot & fmod) == 0);
-    }
-
-} // end ModifierFilter
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/PackageDocImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,389 +0,0 @@
-/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.javadoc;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.tools.FileObject;
-
-import com.sun.javadoc.*;
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.PackageSymbol;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Position;
-
-import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
-
-/**
- * Represents a java package.  Provides access to information
- * about the package, the package's comment and tags, and the
- * classes in the package.
- *
- *  <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>
- *
- * @since 1.2
- * @author Kaiyang Liu (original)
- * @author Robert Field (rewrite)
- * @author Neal Gafter (rewrite)
- * @author Scott Seligman (package-info.java)
- */
-
-public class PackageDocImpl extends DocImpl implements PackageDoc {
-
-    public final PackageSymbol sym;
-    private JCCompilationUnit tree = null;    // for source position
-
-    public FileObject docPath = null;
-    private boolean foundDoc;   // found a doc comment in either
-                                // package.html or package-info.java
-
-    boolean isIncluded = false;  // Set in RootDocImpl.
-    public boolean setDocPath = false;  //Flag to avoid setting doc path multiple times.
-
-    /**
-     * Constructor
-     */
-    public PackageDocImpl(DocEnv env, PackageSymbol sym) {
-        this(env, sym, null);
-    }
-
-    /**
-     * Constructor
-     */
-    public PackageDocImpl(DocEnv env, PackageSymbol sym, TreePath treePath) {
-        super(env, treePath);
-        this.sym = sym;
-        this.tree = (treePath == null) ? null : (JCCompilationUnit) treePath.getCompilationUnit();
-        foundDoc = (documentation != null);
-    }
-
-    void setTree(JCTree tree) {
-        this.tree = (JCCompilationUnit) tree;
-    }
-
-    public void setTreePath(TreePath treePath) {
-        super.setTreePath(treePath);
-        checkDoc();
-    }
-
-    /**
-     * Do lazy initialization of "documentation" string.
-     */
-    protected String documentation() {
-        if (documentation != null)
-            return documentation;
-        if (docPath != null) {
-            // read from file
-            try {
-                InputStream s = docPath.openInputStream();
-                documentation = readHTMLDocumentation(s, docPath);
-            } catch (IOException exc) {
-                documentation = "";
-                env.error(null, "javadoc.File_Read_Error", docPath.getName());
-            }
-        } else {
-            // no doc file to be had
-            documentation = "";
-        }
-        return documentation;
-    }
-
-    /**
-     * Cache of all classes contained in this package, including
-     * member classes of those classes, and their member classes, etc.
-     * Includes only those classes at the specified protection level
-     * and weaker.
-     */
-    private List<ClassDocImpl> allClassesFiltered = null;
-
-    /**
-     * Cache of all classes contained in this package, including
-     * member classes of those classes, and their member classes, etc.
-     */
-    private List<ClassDocImpl> allClasses = null;
-
-    /**
-     * Return a list of all classes contained in this package, including
-     * member classes of those classes, and their member classes, etc.
-     */
-    private List<ClassDocImpl> getClasses(boolean filtered) {
-        if (allClasses != null && !filtered) {
-            return allClasses;
-        }
-        if (allClassesFiltered != null && filtered) {
-            return allClassesFiltered;
-        }
-        ListBuffer<ClassDocImpl> classes = new ListBuffer<>();
-        for (Symbol enumerated : sym.members().getSymbols(NON_RECURSIVE)) {
-            if (enumerated != null) {
-                ClassSymbol s = (ClassSymbol)enumerated;
-                ClassDocImpl c = env.getClassDoc(s);
-                if (c != null && !c.isSynthetic())
-                    c.addAllClasses(classes, filtered);
-            }
-        }
-        if (filtered)
-            return allClassesFiltered = classes.toList();
-        else
-            return allClasses = classes.toList();
-    }
-
-    /**
-     * Add all included classes (including Exceptions and Errors)
-     * and interfaces.
-     */
-    public void addAllClassesTo(ListBuffer<ClassDocImpl> list) {
-        list.appendList(getClasses(true));
-    }
-
-    /**
-     * Get all classes (including Exceptions and Errors)
-     * and interfaces.
-     * @since J2SE1.4.
-     *
-     * @return all classes and interfaces in this package, filtered to include
-     * only the included classes if filter==true.
-     */
-    public ClassDoc[] allClasses(boolean filter) {
-        List<ClassDocImpl> classes = getClasses(filter);
-        return classes.toArray(new ClassDocImpl[classes.length()]);
-    }
-
-    /**
-     * Get all included classes (including Exceptions and Errors)
-     * and interfaces.  Same as allClasses(true).
-     *
-     * @return all included classes and interfaces in this package.
-     */
-    public ClassDoc[] allClasses() {
-        return allClasses(true);
-    }
-
-    /**
-     * Get ordinary classes (that is, exclude exceptions, errors,
-     * enums, interfaces, and annotation types) in this package.
-     *
-     * @return included ordinary classes in this package.
-     */
-    public ClassDoc[] ordinaryClasses() {
-        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
-        for (ClassDocImpl c : getClasses(true)) {
-            if (c.isOrdinaryClass()) {
-                ret.append(c);
-            }
-        }
-        return ret.toArray(new ClassDocImpl[ret.length()]);
-    }
-
-    /**
-     * Get Exception classes in this package.
-     *
-     * @return included Exceptions in this package.
-     */
-    public ClassDoc[] exceptions() {
-        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
-        for (ClassDocImpl c : getClasses(true)) {
-            if (c.isException()) {
-                ret.append(c);
-            }
-        }
-        return ret.toArray(new ClassDocImpl[ret.length()]);
-    }
-
-    /**
-     * Get Error classes in this package.
-     *
-     * @return included Errors in this package.
-     */
-    public ClassDoc[] errors() {
-        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
-        for (ClassDocImpl c : getClasses(true)) {
-            if (c.isError()) {
-                ret.append(c);
-            }
-        }
-        return ret.toArray(new ClassDocImpl[ret.length()]);
-    }
-
-    /**
-     * Get included enum types in this package.
-     *
-     * @return included enum types in this package.
-     */
-    public ClassDoc[] enums() {
-        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
-        for (ClassDocImpl c : getClasses(true)) {
-            if (c.isEnum()) {
-                ret.append(c);
-            }
-        }
-        return ret.toArray(new ClassDocImpl[ret.length()]);
-    }
-
-    /**
-     * Get included interfaces in this package, omitting annotation types.
-     *
-     * @return included interfaces in this package.
-     */
-    public ClassDoc[] interfaces() {
-        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
-        for (ClassDocImpl c : getClasses(true)) {
-            if (c.isInterface()) {
-                ret.append(c);
-            }
-        }
-        return ret.toArray(new ClassDocImpl[ret.length()]);
-    }
-
-    /**
-     * Get included annotation types in this package.
-     *
-     * @return included annotation types in this package.
-     */
-    public AnnotationTypeDoc[] annotationTypes() {
-        ListBuffer<AnnotationTypeDocImpl> ret = new ListBuffer<>();
-        for (ClassDocImpl c : getClasses(true)) {
-            if (c.isAnnotationType()) {
-                ret.append((AnnotationTypeDocImpl)c);
-            }
-        }
-        return ret.toArray(new AnnotationTypeDocImpl[ret.length()]);
-    }
-
-    /**
-     * Get the annotations of this package.
-     * Return an empty array if there are none.
-     */
-    public AnnotationDesc[] annotations() {
-        AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()];
-        int i = 0;
-        for (Attribute.Compound a : sym.getRawAttributes()) {
-            res[i++] = new AnnotationDescImpl(env, a);
-        }
-        return res;
-    }
-
-
-    /**
-     * Lookup for a class within this package.
-     *
-     * @return ClassDocImpl of found class, or null if not found.
-     */
-    public ClassDoc findClass(String className) {
-        final boolean filtered = true;
-        for (ClassDocImpl c : getClasses(filtered)) {
-            if (c.name().equals(className)) {
-                return c;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Return true if this package is included in the active set.
-     */
-    public boolean isIncluded() {
-        return isIncluded;
-    }
-
-    /**
-     * Get package name.
-     *
-     * Note that we do not provide a means of obtaining the simple
-     * name of a package -- package names are always returned in their
-     * uniquely qualified form.
-     */
-    public String name() {
-        return qualifiedName();
-    }
-
-    /**
-     * Get package name.
-     */
-    public String qualifiedName() {
-        if (qualifiedName == null) {
-            Name fullname = sym.getQualifiedName();
-            // Some bogus tests depend on the interned "" being returned.
-            // See 6457276.
-            qualifiedName = fullname.isEmpty() ? "" : fullname.toString();
-        }
-        return qualifiedName;
-    }
-
-    private String qualifiedName;
-
-    /**
-     * set doc path for an unzipped directory
-     */
-    public void setDocPath(FileObject path) {
-        setDocPath = true;
-        if (path == null)
-            return;
-        if (!path.equals(docPath)) {
-            docPath = path;
-            checkDoc();
-        }
-    }
-
-    // Has checkDoc() sounded off yet?
-    private boolean checkDocWarningEmitted = false;
-
-    /**
-     * Invoked when a source of package doc comments is located.
-     * Emits a diagnostic if this is the second one.
-     */
-    private void checkDoc() {
-        if (foundDoc) {
-            if (!checkDocWarningEmitted) {
-                env.warning(null, "javadoc.Multiple_package_comments", name());
-                checkDocWarningEmitted = true;
-            }
-        } else {
-            foundDoc = true;
-        }
-    }
-
-    /**
-     * Return the source position of the entity, or null if
-     * no position is available.
-     */
-    public SourcePosition position() {
-        return (tree != null)
-                ? SourcePositionImpl.make(tree.sourcefile, tree.pos, tree.lineMap)
-                : SourcePositionImpl.make(docPath, Position.NOPOS, null);
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ParamTagImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 1997, 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.tools.javadoc;
-
-import java.util.regex.*;
-
-import com.sun.javadoc.*;
-
-/**
- * Represents an @param documentation tag.
- * Parses and stores the name and comment parts of the parameter tag.
- *
- *  <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>
- *
- * @author Robert Field
- *
- */
-class ParamTagImpl extends TagImpl implements ParamTag {
-
-    private static final Pattern typeParamRE = Pattern.compile("<([^<>]+)>");
-
-    private final String parameterName;
-    private final String parameterComment;
-    private final boolean isTypeParameter;
-
-    /**
-     * Cached inline tags.
-     */
-    private Tag[] inlineTags;
-
-    ParamTagImpl(DocImpl holder, String name, String text) {
-        super(holder, name, text);
-        String[] sa = divideAtWhite();
-
-        Matcher m = typeParamRE.matcher(sa[0]);
-        isTypeParameter = m.matches();
-        parameterName = isTypeParameter ? m.group(1) : sa[0];
-        parameterComment = sa[1];
-    }
-
-    /**
-     * Return the parameter name.
-     */
-    public String parameterName() {
-        return parameterName;
-    }
-
-    /**
-     * Return the parameter comment.
-     */
-    public String parameterComment() {
-        return parameterComment;
-    }
-
-    /**
-     * Return the kind of this tag.
-     */
-    @Override
-    public String kind() {
-        return "@param";
-    }
-
-    /**
-     * Return true if this ParamTag corresponds to a type parameter.
-     */
-    public boolean isTypeParameter() {
-        return isTypeParameter;
-    }
-
-    /**
-     * convert this object to a string.
-     */
-    @Override
-    public String toString() {
-        return name + ":" + text;
-    }
-
-    /**
-     * For the parameter comment with embedded @link tags return the array of
-     * TagImpls consisting of SeeTagImpl(s) and text containing TagImpl(s).
-     *
-     * @return TagImpl[] Array of tags with inline SeeTagImpls.
-     * @see TagImpl#inlineTags()
-     * @see ThrowsTagImpl#inlineTags()
-     */
-    @Override
-    public Tag[] inlineTags() {
-        if (inlineTags == null) {
-            inlineTags = Comment.getInlineTags(holder, parameterComment);
-        }
-        return inlineTags;
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ParameterImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 1997, 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.tools.javadoc;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-
-/**
- * ParameterImpl information.
- * This includes a parameter type and parameter name.
- *
- *  <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>
- *
- * @author Kaiyang Liu (original)
- * @author Robert Field (rewrite)
- * @author Scott Seligman (generics, annotations)
- */
-class ParameterImpl implements Parameter {
-
-    private final DocEnv env;
-    private final VarSymbol sym;
-    private final com.sun.javadoc.Type type;
-
-    /**
-     * Constructor of parameter info class.
-     */
-    ParameterImpl(DocEnv env, VarSymbol sym) {
-        this.env = env;
-        this.sym = sym;
-        this.type = TypeMaker.getType(env, sym.type, false);
-    }
-
-    /**
-     * Get the type of this parameter.
-     */
-    public com.sun.javadoc.Type type() {
-        return type;
-    }
-
-    /**
-     * Get local name of this parameter.
-     * For example if parameter is the short 'index', returns "index".
-     */
-    public String name() {
-        return sym.toString();
-    }
-
-    /**
-     * Get type name of this parameter.
-     * For example if parameter is the short 'index', returns "short".
-     */
-    public String typeName() {
-        return (type instanceof ClassDoc || type instanceof TypeVariable)
-                ? type.typeName()       // omit formal type params or bounds
-                : type.toString();
-    }
-
-    /**
-     * Returns a string representation of the parameter.
-     * <p>
-     * For example if parameter is the short 'index', returns "short index".
-     *
-     * @return type name and parameter name of this parameter.
-     */
-    public String toString() {
-        return typeName() + " " + sym;
-    }
-
-    /**
-     * Get the annotations of this parameter.
-     * Return an empty array if there are none.
-     */
-    public AnnotationDesc[] annotations() {
-        AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()];
-        int i = 0;
-        for (Attribute.Compound a : sym.getRawAttributes()) {
-            res[i++] = new AnnotationDescImpl(env, a);
-        }
-        return res;
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ParameterizedTypeImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2003, 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.tools.javadoc;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.ClassType;
-
-import static com.sun.tools.javac.code.TypeTag.CLASS;
-
-
-/**
- * Implementation of <code>ParameterizedType</code>, which
- * represents an invocation of a generic class or interface.
- *
- *  <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>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-public class ParameterizedTypeImpl
-        extends AbstractTypeImpl implements ParameterizedType {
-
-    ParameterizedTypeImpl(DocEnv env, Type type) {
-        super(env, type);
-    }
-
-    /**
-     * Return the generic class or interface that declared this type.
-     */
-    @Override
-    public ClassDoc asClassDoc() {
-        return env.getClassDoc((ClassSymbol)type.tsym);
-    }
-
-    /**
-     * Return the actual type arguments of this type.
-     */
-    public com.sun.javadoc.Type[] typeArguments() {
-        return TypeMaker.getTypes(env, type.getTypeArguments());
-    }
-
-    /**
-     * Return the class type that is a direct supertype of this one.
-     * Return null if this is an interface type.
-     */
-    public com.sun.javadoc.Type superclassType() {
-        if (asClassDoc().isInterface()) {
-            return null;
-        }
-        Type sup = env.types.supertype(type);
-        return TypeMaker.getType(env,
-                                 (sup != type) ? sup : env.syms.objectType);
-    }
-
-    /**
-     * Return the interface types directly implemented by or extended by this
-     * parameterized type.
-     * Return an empty array if there are no interfaces.
-     */
-    public com.sun.javadoc.Type[] interfaceTypes() {
-        return TypeMaker.getTypes(env, env.types.interfaces(type));
-    }
-
-    /**
-     * Return the type that contains this type as a member.
-     * Return null is this is a top-level type.
-     */
-    public com.sun.javadoc.Type containingType() {
-        if (type.getEnclosingType().hasTag(CLASS)) {
-            // This is the type of an inner class.
-            return TypeMaker.getType(env, type.getEnclosingType());
-        }
-        ClassSymbol enclosing = type.tsym.owner.enclClass();
-        if (enclosing != null) {
-            // Nested but not inner.  Return the ClassDoc of the enclosing
-            // class or interface.
-            // See java.lang.reflect.ParameterizedType.getOwnerType().
-            return env.getClassDoc(enclosing);
-        }
-        return null;
-    }
-
-
-    // Asking for the "name" of a parameterized type doesn't exactly make
-    // sense.  It's a type expression.  Return the name of its generic
-    // type.
-    @Override
-    public String typeName() {
-        return TypeMaker.getTypeName(type, false);
-    }
-
-    @Override
-    public ParameterizedType asParameterizedType() {
-        return this;
-    }
-
-    @Override
-    public String toString() {
-        return parameterizedTypeToString(env, (ClassType)type, true);
-    }
-
-    static String parameterizedTypeToString(DocEnv env, ClassType cl,
-                                            boolean full) {
-        if (env.legacyDoclet) {
-            return TypeMaker.getTypeName(cl, full);
-        }
-        StringBuilder s = new StringBuilder();
-        if (!(cl.getEnclosingType().hasTag(CLASS))) {               // if not an inner class...
-            s.append(TypeMaker.getTypeName(cl, full));
-        } else {
-            ClassType encl = (ClassType)cl.getEnclosingType();
-            s.append(parameterizedTypeToString(env, encl, full))
-             .append('.')
-             .append(cl.tsym.name.toString());
-        }
-        s.append(TypeMaker.typeArgumentsString(env, cl, full));
-        return s.toString();
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/PrimitiveType.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import com.sun.javadoc.*;
-
-/**
- *  <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>
- */
-class PrimitiveType implements com.sun.javadoc.Type {
-
-    private final String name;
-
-    static final PrimitiveType voidType = new PrimitiveType("void");
-    static final PrimitiveType booleanType = new PrimitiveType("boolean");
-    static final PrimitiveType byteType = new PrimitiveType("byte");
-    static final PrimitiveType charType = new PrimitiveType("char");
-    static final PrimitiveType shortType = new PrimitiveType("short");
-    static final PrimitiveType intType = new PrimitiveType("int");
-    static final PrimitiveType longType = new PrimitiveType("long");
-    static final PrimitiveType floatType = new PrimitiveType("float");
-    static final PrimitiveType doubleType = new PrimitiveType("double");
-
-    // error type, should never actually be used
-    static final PrimitiveType errorType = new PrimitiveType("");
-
-    PrimitiveType(String name) {
-        this.name = name;
-    }
-
-    /**
-     * Return unqualified name of type excluding any dimension information.
-     * <p>
-     * For example, a two dimensional array of String returns 'String'.
-     */
-    public String typeName() {
-        return name;
-    }
-
-    public com.sun.javadoc.Type getElementType() {
-        return null;
-    }
-
-    /**
-     * Return qualified name of type excluding any dimension information.
-     *<p>
-     * For example, a two dimensional array of String
-     * returns 'java.lang.String'.
-     */
-    public String qualifiedTypeName() {
-        return name;
-    }
-
-    /**
-     * Return the simple name of this type.
-     */
-    public String simpleTypeName() {
-        return name;
-    }
-
-    /**
-     * Return the type's dimension information, as a string.
-     * <p>
-     * For example, a two dimensional array of String returns '[][]'.
-     */
-    public String dimension() {
-        return "";
-    }
-
-    /**
-     * Return this type as a class.  Array dimensions are ignored.
-     *
-     * @return a ClassDocImpl if the type is a Class.
-     * Return null if it is a primitive type..
-     */
-    public ClassDoc asClassDoc() {
-        return null;
-    }
-
-    /**
-     * Return null, as this is not an annotation type.
-     */
-    public AnnotationTypeDoc asAnnotationTypeDoc() {
-        return null;
-    }
-
-    /**
-     * Return null, as this is not an instantiation.
-     */
-    public ParameterizedType asParameterizedType() {
-        return null;
-    }
-
-    /**
-     * Return null, as this is not a type variable.
-     */
-    public TypeVariable asTypeVariable() {
-        return null;
-    }
-
-    /**
-     * Return null, as this is not a wildcard type.
-     */
-    public WildcardType asWildcardType() {
-        return null;
-    }
-
-    /**
-     * Return null, as this is not an annotated type.
-     */
-    public AnnotatedType asAnnotatedType() {
-        return null;
-    }
-
-    /**
-     * Returns a string representation of the type.
-     *
-     * Return name of type including any dimension information.
-     * <p>
-     * For example, a two dimensional array of String returns
-     * <code>String[][]</code>.
-     *
-     * @return name of type including any dimension information.
-     */
-    public String toString() {
-        return qualifiedTypeName();
-    }
-
-    /**
-     * Return true if this is a primitive type.
-     */
-    public boolean isPrimitive() {
-        return true;
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ProgramElementDocImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,231 +0,0 @@
-/*
- * Copyright (c) 1997, 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.tools.javadoc;
-
-import java.lang.reflect.Modifier;
-import java.text.CollationKey;
-
-import com.sun.javadoc.*;
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
-import com.sun.tools.javac.util.Position;
-
-/**
- * Represents a java program element: class, interface, field,
- * constructor, or method.
- * This is an abstract class dealing with information common to
- * these elements.
- *
- *  <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>
- *
- * @see MemberDocImpl
- * @see ClassDocImpl
- *
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- * @author Scott Seligman (generics, enums, annotations)
- */
-public abstract class ProgramElementDocImpl
-        extends DocImpl implements ProgramElementDoc {
-
-    private final Symbol sym;
-
-    // For source position information.
-    JCTree tree = null;
-    Position.LineMap lineMap = null;
-
-
-    // Cache for getModifiers().
-    private int modifiers = -1;
-
-    protected ProgramElementDocImpl(DocEnv env, Symbol sym, TreePath treePath) {
-        super(env, treePath);
-        this.sym = sym;
-        if (treePath != null) {
-            tree = (JCTree) treePath.getLeaf();
-            lineMap = ((JCCompilationUnit) treePath.getCompilationUnit()).lineMap;
-        }
-    }
-
-    @Override
-    void setTreePath(TreePath treePath) {
-        super.setTreePath(treePath);
-        this.tree = (JCTree) treePath.getLeaf();
-        this.lineMap = ((JCCompilationUnit) treePath.getCompilationUnit()).lineMap;
-    }
-
-    /**
-     * Subclasses override to identify the containing class
-     */
-    protected abstract ClassSymbol getContainingClass();
-
-    /**
-     * Returns the flags in terms of javac's flags
-     */
-    abstract protected long getFlags();
-
-    /**
-     * Returns the modifier flags in terms of java.lang.reflect.Modifier.
-     */
-    protected int getModifiers() {
-        if (modifiers == -1) {
-            modifiers = DocEnv.translateModifiers(getFlags());
-        }
-        return modifiers;
-    }
-
-    /**
-     * Get the containing class of this program element.
-     *
-     * @return a ClassDocImpl for this element's containing class.
-     * If this is a class with no outer class, return null.
-     */
-    public ClassDoc containingClass() {
-        if (getContainingClass() == null) {
-            return null;
-        }
-        return env.getClassDoc(getContainingClass());
-    }
-
-    /**
-     * Return the package that this member is contained in.
-     * Return "" if in unnamed package.
-     */
-    public PackageDoc containingPackage() {
-        return env.getPackageDoc(getContainingClass().packge());
-    }
-
-    /**
-     * Get the modifier specifier integer.
-     *
-     * @see java.lang.reflect.Modifier
-     */
-    public int modifierSpecifier() {
-        int modifiers = getModifiers();
-        if (isMethod() && containingClass().isInterface())
-            // Remove the implicit abstract modifier.
-            return modifiers & ~Modifier.ABSTRACT;
-        return modifiers;
-    }
-
-    /**
-     * Get modifiers string.
-     * <pre>
-     * Example, for:
-     *   public abstract int foo() { ... }
-     * modifiers() would return:
-     *   'public abstract'
-     * </pre>
-     * Annotations are not included.
-     */
-    public String modifiers() {
-        int modifiers = getModifiers();
-        if (isAnnotationTypeElement() ||
-                (isMethod() && containingClass().isInterface())) {
-            // Remove the implicit abstract modifier.
-            return Modifier.toString(modifiers & ~Modifier.ABSTRACT);
-        } else {
-            return Modifier.toString(modifiers);
-        }
-    }
-
-    /**
-     * Get the annotations of this program element.
-     * Return an empty array if there are none.
-     */
-    public AnnotationDesc[] annotations() {
-        AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()];
-        int i = 0;
-        for (Attribute.Compound a : sym.getRawAttributes()) {
-            res[i++] = new AnnotationDescImpl(env, a);
-        }
-        return res;
-    }
-
-    /**
-     * Return true if this program element is public
-     */
-    public boolean isPublic() {
-        int modifiers = getModifiers();
-        return Modifier.isPublic(modifiers);
-    }
-
-    /**
-     * Return true if this program element is protected
-     */
-    public boolean isProtected() {
-        int modifiers = getModifiers();
-        return Modifier.isProtected(modifiers);
-    }
-
-    /**
-     * Return true if this program element is private
-     */
-    public boolean isPrivate() {
-        int modifiers = getModifiers();
-        return Modifier.isPrivate(modifiers);
-    }
-
-    /**
-     * Return true if this program element is package private
-     */
-    public boolean isPackagePrivate() {
-        return !(isPublic() || isPrivate() || isProtected());
-    }
-
-    /**
-     * Return true if this program element is static
-     */
-    public boolean isStatic() {
-        int modifiers = getModifiers();
-        return Modifier.isStatic(modifiers);
-    }
-
-    /**
-     * Return true if this program element is final
-     */
-    public boolean isFinal() {
-        int modifiers = getModifiers();
-        return Modifier.isFinal(modifiers);
-    }
-
-    /**
-     * Generate a key for sorting.
-     */
-    CollationKey generateKey() {
-        String k = name();
-        // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
-        return env.doclocale.collator.getCollationKey(k);
-    }
-
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/RootDocImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,394 +0,0 @@
-/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.javadoc;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Locale;
-
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.tree.JCTree.JCClassDecl;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Position;
-
-/**
- * This class holds the information from one run of javadoc.
- * Particularly the packages, classes and options specified
- * by the user.
- *
- *  <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>
- *
- * @since 1.2
- * @author Robert Field
- * @author Atul M Dambalkar
- * @author Neal Gafter (rewrite)
- */
-public class RootDocImpl extends DocImpl implements RootDoc {
-
-    /**
-     * list of classes specified on the command line.
-     */
-    private List<ClassDocImpl> cmdLineClasses;
-
-    /**
-     * list of packages specified on the command line.
-     */
-    private List<PackageDocImpl> cmdLinePackages;
-
-    /**
-     * a collection of all options.
-     */
-    private List<String[]> options;
-
-    /**
-     * Constructor used when reading source files.
-     *
-     * @param env the documentation environment, state for this javadoc run
-     * @param classes list of classes specified on the commandline
-     * @param packages list of package names specified on the commandline
-     * @param options list of options
-     */
-    public RootDocImpl(DocEnv env, List<JCClassDecl> classes, List<String> packages, List<String[]> options) {
-        super(env, null);
-        this.options = options;
-        setPackages(env, packages);
-        setClasses(env, classes);
-    }
-
-    /**
-     * Constructor used when reading class files.
-     *
-     * @param env the documentation environment, state for this javadoc run
-     * @param classes list of class names specified on the commandline
-     * @param options list of options
-     */
-    public RootDocImpl(DocEnv env, List<String> classes, List<String[]> options) {
-        super(env, null);
-        this.options = options;
-        cmdLinePackages = List.nil();
-        ListBuffer<ClassDocImpl> classList = new ListBuffer<>();
-        for (String className : classes) {
-            ClassDocImpl c = env.loadClass(className);
-            if (c == null)
-                env.error(null, "javadoc.class_not_found", className);
-            else
-                classList = classList.append(c);
-        }
-        cmdLineClasses = classList.toList();
-    }
-
-    /**
-     * Initialize classes information. Those classes are input from
-     * command line.
-     *
-     * @param env the compilation environment
-     * @param classes a list of ClassDeclaration
-     */
-    private void setClasses(DocEnv env, List<JCClassDecl> classes) {
-        ListBuffer<ClassDocImpl> result = new ListBuffer<>();
-        for (JCClassDecl def : classes) {
-            //### Do we want modifier check here?
-            if (env.shouldDocument(def.sym)) {
-                ClassDocImpl cd = env.getClassDoc(def.sym);
-                if (cd != null) {
-                    cd.isIncluded = true;
-                    result.append(cd);
-                } //else System.out.println(" (classdoc is null)");//DEBUG
-            } //else System.out.println(" (env.shouldDocument() returned false)");//DEBUG
-        }
-        cmdLineClasses = result.toList();
-    }
-
-    /**
-     * Initialize packages information.
-     *
-     * @param env the compilation environment
-     * @param packages a list of package names (String)
-     */
-    private void setPackages(DocEnv env, List<String> packages) {
-        ListBuffer<PackageDocImpl> packlist = new ListBuffer<>();
-        for (String name : packages) {
-            PackageDocImpl pkg = env.lookupPackage(name);
-            if (pkg != null) {
-                pkg.isIncluded = true;
-                packlist.append(pkg);
-            } else {
-                env.warning(null, "main.no_source_files_for_package", name);
-            }
-        }
-        cmdLinePackages = packlist.toList();
-    }
-
-    /**
-     * Command line options.
-     *
-     * <pre>
-     * For example, given:
-     *     javadoc -foo this that -bar other ...
-     *
-     * This method will return:
-     *      options()[0][0] = "-foo"
-     *      options()[0][1] = "this"
-     *      options()[0][2] = "that"
-     *      options()[1][0] = "-bar"
-     *      options()[1][1] = "other"
-     * </pre>
-     *
-     * @return an array of arrays of String.
-     */
-    public String[][] options() {
-        return options.toArray(new String[options.length()][]);
-    }
-
-    /**
-     * Packages specified on the command line.
-     */
-    public PackageDoc[] specifiedPackages() {
-        return (PackageDoc[])cmdLinePackages
-            .toArray(new PackageDocImpl[cmdLinePackages.length()]);
-    }
-
-    /**
-     * Classes and interfaces specified on the command line.
-     */
-    public ClassDoc[] specifiedClasses() {
-        ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<>();
-        for (ClassDocImpl cd : cmdLineClasses) {
-            cd.addAllClasses(classesToDocument, true);
-        }
-        return (ClassDoc[])classesToDocument.toArray(new ClassDocImpl[classesToDocument.length()]);
-    }
-
-    /**
-     * Return all classes and interfaces (including those inside
-     * packages) to be documented.
-     */
-    public ClassDoc[] classes() {
-        ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<>();
-        for (ClassDocImpl cd : cmdLineClasses) {
-            cd.addAllClasses(classesToDocument, true);
-        }
-        for (PackageDocImpl pd : cmdLinePackages) {
-            pd.addAllClassesTo(classesToDocument);
-        }
-        return classesToDocument.toArray(new ClassDocImpl[classesToDocument.length()]);
-    }
-
-    /**
-     * Return a ClassDoc for the specified class/interface name
-     *
-     * @param qualifiedName qualified class name
-     *                        (i.e. includes package name).
-     *
-     * @return a ClassDocImpl holding the specified class, null if
-     * this class is not referenced.
-     */
-    public ClassDoc classNamed(String qualifiedName) {
-        return env.lookupClass(qualifiedName);
-    }
-
-    /**
-     * Return a PackageDoc for the specified package name
-     *
-     * @param name package name
-     *
-     * @return a PackageDoc holding the specified package, null if
-     * this package is not referenced.
-     */
-    public PackageDoc packageNamed(String name) {
-        return env.lookupPackage(name);
-    }
-
-    /**
-     * Return the name of this Doc item.
-     *
-     * @return the string <code>"*RootDocImpl*"</code>.
-     */
-    public String name() {
-        return "*RootDocImpl*";
-    }
-
-    /**
-     * Return the name of this Doc item.
-     *
-     * @return the string <code>"*RootDocImpl*"</code>.
-     */
-    public String qualifiedName() {
-        return "*RootDocImpl*";
-    }
-
-    /**
-     * Return true if this Doc is include in the active set.
-     * RootDocImpl isn't even a program entity so it is always false.
-     */
-    public boolean isIncluded() {
-        return false;
-    }
-
-    /**
-     * Print error message, increment error count.
-     *
-     * @param msg message to print
-     */
-    public void printError(String msg) {
-        env.printError(msg);
-    }
-
-    /**
-     * Print error message, increment error count.
-     *
-     * @param msg message to print
-     */
-    public void printError(SourcePosition pos, String msg) {
-        env.printError(pos, msg);
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param msg message to print
-     */
-    public void printWarning(String msg) {
-        env.printWarning(msg);
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param msg message to print
-     */
-    public void printWarning(SourcePosition pos, String msg) {
-        env.printWarning(pos, msg);
-    }
-
-    /**
-     * Print a message.
-     *
-     * @param msg message to print
-     */
-    public void printNotice(String msg) {
-        env.printNotice(msg);
-    }
-
-    /**
-     * Print a message.
-     *
-     * @param msg message to print
-     */
-    public void printNotice(SourcePosition pos, String msg) {
-        env.printNotice(pos, msg);
-    }
-
-    /**
-     * Return the path of the overview file and null if it does not exist.
-     * @return the path of the overview file and null if it does not exist.
-     */
-    private JavaFileObject getOverviewPath() {
-        for (String[] opt : options) {
-            if (opt[0].equals("-overview")) {
-                if (env.fileManager instanceof StandardJavaFileManager) {
-                    StandardJavaFileManager fm = (StandardJavaFileManager) env.fileManager;
-                    return fm.getJavaFileObjects(opt[1]).iterator().next();
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Do lazy initialization of "documentation" string.
-     */
-    @Override
-    protected String documentation() {
-        if (documentation == null) {
-            JavaFileObject overviewPath = getOverviewPath();
-            if (overviewPath == null) {
-                // no doc file to be had
-                documentation = "";
-            } else {
-                // read from file
-                try {
-                    documentation = readHTMLDocumentation(
-                        overviewPath.openInputStream(),
-                        overviewPath);
-                } catch (IOException exc) {
-                    documentation = "";
-                    env.error(null, "javadoc.File_Read_Error", overviewPath.getName());
-                }
-            }
-        }
-        return documentation;
-    }
-
-    /**
-     * Return the source position of the entity, or null if
-     * no position is available.
-     */
-    @Override
-    public SourcePosition position() {
-        JavaFileObject path;
-        return ((path = getOverviewPath()) == null) ?
-            null :
-            SourcePositionImpl.make(path, Position.NOPOS, null);
-    }
-
-    /**
-     * Return the locale provided by the user or the default locale value.
-     */
-    public Locale getLocale() {
-        return env.doclocale.locale;
-    }
-
-    /**
-     * Return the current file manager.
-     */
-    public JavaFileManager getFileManager() {
-        return env.fileManager;
-    }
-
-    public void initDocLint(Collection<String> opts, Collection<String> customTagNames,
-            String htmlVersion) {
-        env.initDoclint(opts, customTagNames, htmlVersion);
-    }
-
-    public boolean isFunctionalInterface(AnnotationDesc annotationDesc) {
-        return env.source.allowLambda()
-            && annotationDesc.annotationType().qualifiedName().equals(
-                env.syms.functionalInterfaceType.toString());
-    }
-
-    public boolean showTagMessages() {
-        return env.showTagMessages();
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/SeeTagImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,542 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import java.io.File;
-import java.util.Locale;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.code.Printer;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Type.CapturedType;
-import com.sun.tools.javac.util.*;
-
-import static com.sun.tools.javac.code.Kinds.Kind.*;
-
-/**
- * Represents a see also documentation tag.
- * The @see tag can be plain text, or reference a class or member.
- *
- *  <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>
- *
- * @author Kaiyang Liu (original)
- * @author Robert Field (rewrite)
- * @author Atul M Dambalkar
- *
- */
-class SeeTagImpl extends TagImpl implements SeeTag, LayoutCharacters {
-
-    //### TODO: Searching for classes, fields, and methods
-    //### should follow the normal rules applied by the compiler.
-
-    /**
-     * where of  where#what - i.e. the class name (may be empty)
-     */
-    private String where;
-
-    /**
-     * what of  where#what - i.e. the member (may be null)
-     */
-    private String what;
-
-    private PackageDoc referencedPackage;
-    private ClassDoc referencedClass;
-    private MemberDoc referencedMember;
-
-    String label = "";
-
-    SeeTagImpl(DocImpl holder, String name, String text) {
-        super(holder, name, text);
-        parseSeeString();
-        if (where != null) {
-            ClassDocImpl container = null;
-            if (holder instanceof MemberDoc) {
-                container =
-                  (ClassDocImpl)((ProgramElementDoc)holder).containingClass();
-            } else if (holder instanceof ClassDoc) {
-                container = (ClassDocImpl)holder;
-            }
-            findReferenced(container);
-            if (showRef) showRef();
-        }
-    }
-
-    private static final boolean showRef = false;
-
-    private void showRef() {
-        Symbol sym;
-        if (referencedMember != null) {
-            if (referencedMember instanceof MethodDocImpl)
-                sym = ((MethodDocImpl) referencedMember).sym;
-            else if (referencedMember instanceof FieldDocImpl)
-                sym = ((FieldDocImpl) referencedMember).sym;
-            else
-                sym = ((ConstructorDocImpl) referencedMember).sym;
-        } else if (referencedClass != null) {
-            sym = ((ClassDocImpl) referencedClass).tsym;
-        } else if (referencedPackage != null) {
-            sym = ((PackageDocImpl) referencedPackage).sym;
-        } else
-            return;
-
-        final JavacMessages messages = JavacMessages.instance(docenv().context);
-        Locale locale = Locale.getDefault();
-        Printer printer = new Printer() {
-            int count;
-            @Override
-            protected String localize(Locale locale, String key, Object... args) {
-                return messages.getLocalizedString(locale, key, args);
-            }
-            @Override
-            protected String capturedVarId(CapturedType t, Locale locale) {
-                return "CAP#" + (++count);
-            }
-        };
-
-        String s = text.replaceAll("\\s+", " ");  // normalize white space
-        int sp = s.indexOf(" ");
-        int lparen = s.indexOf("(");
-        int rparen = s.indexOf(")");
-        String seetext = (sp == -1) ? s
-                : (lparen == -1 || sp < lparen) ? s.substring(0, sp)
-                : s.substring(0, rparen + 1);
-
-        File file = new File(holder.position().file().getAbsoluteFile().toURI().normalize());
-
-        StringBuilder sb = new StringBuilder();
-        sb.append("+++ ").append(file).append(": ")
-                .append(name()).append(" ").append(seetext).append(": ");
-        sb.append(sym.getKind()).append(" ");
-        if (sym.kind == MTH || sym.kind == VAR)
-            sb.append(printer.visit(sym.owner, locale)).append(".");
-        sb.append(printer.visit(sym, locale));
-
-        System.err.println(sb);
-    }
-
-    /**
-     * get the class name part of @see, For instance,
-     * if the comment is @see String#startsWith(java.lang.String) .
-     *      This function returns String.
-     * Returns null if format was not that of java reference.
-     * Return empty string if class name was not specified..
-     */
-    public String referencedClassName() {
-        return where;
-    }
-
-    /**
-     * get the package referenced by  @see. For instance,
-     * if the comment is @see java.lang
-     *      This function returns a PackageDocImpl for java.lang
-     * Returns null if no known package found.
-     */
-    public PackageDoc referencedPackage() {
-        return referencedPackage;
-    }
-
-    /**
-     * get the class referenced by the class name part of @see, For instance,
-     * if the comment is @see String#startsWith(java.lang.String) .
-     *      This function returns a ClassDocImpl for java.lang.String.
-     * Returns null if class is not a class specified on the javadoc command line..
-     */
-    public ClassDoc referencedClass() {
-        return referencedClass;
-    }
-
-    /**
-     * get the name of the member referenced by the prototype part of @see,
-     * For instance,
-     * if the comment is @see String#startsWith(java.lang.String) .
-     *      This function returns "startsWith(java.lang.String)"
-     * Returns null if format was not that of java reference.
-     * Return empty string if member name was not specified..
-     */
-    public String referencedMemberName() {
-        return what;
-    }
-
-    /**
-     * get the member referenced by the prototype part of @see,
-     * For instance,
-     * if the comment is @see String#startsWith(java.lang.String) .
-     *      This function returns a MethodDocImpl for startsWith.
-     * Returns null if member could not be determined.
-     */
-    public MemberDoc referencedMember() {
-        return referencedMember;
-    }
-
-
-    /**
-     * parse @see part of comment. Determine 'where' and 'what'
-     */
-    private void parseSeeString() {
-        int len = text.length();
-        if (len == 0) {
-            return;
-        }
-        switch (text.charAt(0)) {
-            case '<':
-                if (text.charAt(len-1) != '>') {
-                    docenv().warning(holder,
-                                     "tag.see.no_close_bracket_on_url",
-                                     name, text);
-                }
-                return;
-            case '"':
-                if (len == 1 || text.charAt(len-1) != '"') {
-                    docenv().warning(holder,
-                                     "tag.see.no_close_quote",
-                                     name, text);
-                } else {
-//                    text = text.substring(1,len-1); // strip quotes
-                }
-                return;
-        }
-
-        // check that the text is one word, with possible parentheses
-        // this part of code doesn't allow
-        // @see <a href=.....>asfd</a>
-        // comment it.
-
-        // the code assumes that there is no initial white space.
-        int parens = 0;
-        int commentstart = 0;
-        int start = 0;
-        int cp;
-        for (int i = start; i < len ; i += Character.charCount(cp)) {
-            cp = text.codePointAt(i);
-            switch (cp) {
-                case '(': parens++; break;
-                case ')': parens--; break;
-                case '[': case ']': case '.': case '#': break;
-                case ',':
-                    if (parens <= 0) {
-                        docenv().warning(holder,
-                                         "tag.see.malformed_see_tag",
-                                         name, text);
-                        return;
-                    }
-                    break;
-                case ' ': case '\t': case '\n': case CR:
-                    if (parens == 0) { //here onwards the comment starts.
-                        commentstart = i;
-                        i = len;
-                    }
-                    break;
-                default:
-                    if (!Character.isJavaIdentifierPart(cp)) {
-                        docenv().warning(holder,
-                                         "tag.see.illegal_character",
-                                         name, ""+cp, text);
-                    }
-                    break;
-            }
-        }
-        if (parens != 0) {
-            docenv().warning(holder,
-                             "tag.see.malformed_see_tag",
-                             name, text);
-            return;
-        }
-
-        String seetext = "";
-        String labeltext = "";
-
-        if (commentstart > 0) {
-            seetext = text.substring(start, commentstart);
-            labeltext = text.substring(commentstart + 1);
-            // strip off the white space which can be between seetext and the
-            // actual label.
-            for (int i = 0; i < labeltext.length(); i++) {
-                char ch2 = labeltext.charAt(i);
-                if (!(ch2 == ' ' || ch2 == '\t' || ch2 == '\n')) {
-                    label = labeltext.substring(i);
-                    break;
-                }
-            }
-        } else {
-            seetext = text;
-            label = "";
-        }
-
-        int sharp = seetext.indexOf('#');
-        if (sharp >= 0) {
-            // class#member
-            where = seetext.substring(0, sharp);
-            what = seetext.substring(sharp + 1);
-        } else {
-            if (seetext.indexOf('(') >= 0) {
-                docenv().warning(holder,
-                                 "tag.see.missing_sharp",
-                                 name, text);
-                where = "";
-                what = seetext;
-            }
-            else {
-                // no member specified, text names class
-                where = seetext;
-                what = null;
-            }
-        }
-    }
-
-    /**
-     * Find what is referenced by the see also.  If possible, sets
-     * referencedClass and referencedMember.
-     *
-     * @param containingClass the class containing the comment containing
-     * the tag. May be null, if, for example, it is a package comment.
-     */
-    private void findReferenced(ClassDocImpl containingClass) {
-        if (where.length() > 0) {
-            if (containingClass != null) {
-                referencedClass = containingClass.findClass(where);
-            } else {
-                referencedClass = docenv().lookupClass(where);
-            }
-            if (referencedClass == null && holder() instanceof ProgramElementDoc) {
-                referencedClass = docenv().lookupClass(
-                    ((ProgramElementDoc) holder()).containingPackage().name() + "." + where);
-            }
-
-            if (referencedClass == null) { /* may just not be in this run */
-                // check if it's a package name
-                referencedPackage = docenv().lookupPackage(where);
-                return;
-            }
-        } else {
-            if (containingClass == null) {
-                docenv().warning(holder,
-                                 "tag.see.class_not_specified",
-                                 name, text);
-                return;
-            } else {
-                referencedClass = containingClass;
-            }
-        }
-        where = referencedClass.qualifiedName();
-
-        if (what == null) {
-            return;
-        } else {
-            int paren = what.indexOf('(');
-            String memName = (paren >= 0 ? what.substring(0, paren) : what);
-            String[] paramarr;
-            if (paren > 0) {
-                // has parameter list -- should be method or constructor
-                paramarr = new ParameterParseMachine(what.
-                        substring(paren, what.length())).parseParameters();
-                if (paramarr != null) {
-                    referencedMember = findExecutableMember(memName, paramarr,
-                                                            referencedClass);
-                } else {
-                    referencedMember = null;
-                }
-            } else {
-                // no parameter list -- should be field
-                referencedMember = findExecutableMember(memName, null,
-                                                        referencedClass);
-                FieldDoc fd = ((ClassDocImpl)referencedClass).
-                                                            findField(memName);
-                // when no args given, prefer fields over methods
-                if (referencedMember == null ||
-                    (fd != null &&
-                     fd.containingClass()
-                         .subclassOf(referencedMember.containingClass()))) {
-                    referencedMember = fd;
-                }
-            }
-            if (referencedMember == null) {
-                docenv().warning(holder,
-                                 "tag.see.can_not_find_member",
-                                 name, what, where);
-            }
-        }
-    }
-
-    private MemberDoc findReferencedMethod(String memName, String[] paramarr,
-                                           ClassDoc referencedClass) {
-        MemberDoc meth = findExecutableMember(memName, paramarr, referencedClass);
-        if (meth == null) {
-            for (ClassDoc nestedClass : referencedClass.innerClasses()) {
-                meth = findReferencedMethod(memName, paramarr, nestedClass);
-                if (meth != null) {
-                    return meth;
-                }
-            }
-        }
-        return null;
-    }
-
-    private MemberDoc findExecutableMember(String memName, String[] paramarr,
-                                           ClassDoc referencedClass) {
-        String className = referencedClass.name();
-        if (memName.equals(className.substring(className.lastIndexOf(".") + 1))) {
-            return ((ClassDocImpl)referencedClass).findConstructor(memName,
-                                                                   paramarr);
-        } else {   // it's a method.
-            return ((ClassDocImpl)referencedClass).findMethod(memName,
-                                                              paramarr);
-        }
-    }
-
-    // separate "int, String" from "(int, String)"
-    // (int i, String s) ==> [0] = "int",  [1] = String
-    // (int[][], String[]) ==> [0] = "int[][]" // [1] = "String[]"
-    class ParameterParseMachine {
-        static final int START = 0;
-        static final int TYPE = 1;
-        static final int NAME = 2;
-        static final int TNSPACE = 3;  // space between type and name
-        static final int ARRAYDECORATION = 4;
-        static final int ARRAYSPACE = 5;
-
-        String parameters;
-
-        StringBuilder typeId;
-
-        ListBuffer<String> paramList;
-
-        ParameterParseMachine(String parameters) {
-            this.parameters = parameters;
-            this.paramList = new ListBuffer<>();
-            typeId = new StringBuilder();
-        }
-
-        public String[] parseParameters() {
-            if (parameters.equals("()")) {
-                return new String[0];
-            }   // now strip off '(' and ')'
-            int state = START;
-            int prevstate = START;
-            parameters = parameters.substring(1, parameters.length() - 1);
-            int cp;
-            for (int index = 0; index < parameters.length(); index += Character.charCount(cp)) {
-                cp = parameters.codePointAt(index);
-                switch (state) {
-                    case START:
-                        if (Character.isJavaIdentifierStart(cp)) {
-                            typeId.append(Character.toChars(cp));
-                            state = TYPE;
-                        }
-                        prevstate = START;
-                        break;
-                    case TYPE:
-                        if (Character.isJavaIdentifierPart(cp) || cp == '.') {
-                            typeId.append(Character.toChars(cp));
-                        } else if (cp == '[') {
-                            typeId.append('[');
-                            state = ARRAYDECORATION;
-                        } else if (Character.isWhitespace(cp)) {
-                            state = TNSPACE;
-                        } else if (cp == ',') {  // no name, just type
-                            addTypeToParamList();
-                            state = START;
-                        }
-                        prevstate = TYPE;
-                        break;
-                    case TNSPACE:
-                        if (Character.isJavaIdentifierStart(cp)) { // name
-                            if (prevstate == ARRAYDECORATION) {
-                                docenv().warning(holder,
-                                                 "tag.missing_comma_space",
-                                                 name,
-                                                 "(" + parameters + ")");
-                                return (String[])null;
-                            }
-                            addTypeToParamList();
-                            state = NAME;
-                        } else if (cp == '[') {
-                            typeId.append('[');
-                            state = ARRAYDECORATION;
-                        } else if (cp == ',') {   // just the type
-                            addTypeToParamList();
-                            state = START;
-                        } // consume rest all
-                        prevstate = TNSPACE;
-                        break;
-                    case ARRAYDECORATION:
-                        if (cp == ']') {
-                            typeId.append(']');
-                            state = TNSPACE;
-                        } else if (!Character.isWhitespace(cp)) {
-                            docenv().warning(holder,
-                                             "tag.illegal_char_in_arr_dim",
-                                             name,
-                                             "(" + parameters + ")");
-                            return (String[])null;
-                        }
-                        prevstate = ARRAYDECORATION;
-                        break;
-                    case NAME:
-                        if (cp == ',') {  // just consume everything till ','
-                            state = START;
-                        }
-                        prevstate = NAME;
-                        break;
-                }
-            }
-            if (state == ARRAYDECORATION ||
-                (state == START && prevstate == TNSPACE)) {
-                docenv().warning(holder,
-                                 "tag.illegal_see_tag",
-                                 "(" + parameters + ")");
-            }
-            if (typeId.length() > 0) {
-                paramList.append(typeId.toString());
-            }
-            return paramList.toArray(new String[paramList.length()]);
-        }
-
-        void addTypeToParamList() {
-            if (typeId.length() > 0) {
-                paramList.append(typeId.toString());
-                typeId.setLength(0);
-            }
-        }
-    }
-
-    /**
-     * Return the kind of this tag.
-     */
-    @Override
-    public String kind() {
-        return "@see";
-    }
-
-    /**
-     * Return the label of the see tag.
-     */
-    public String label() {
-        return label;
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/SerialFieldTagImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,267 +0,0 @@
-/*
- * Copyright (c) 1998, 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.tools.javadoc;
-
-import com.sun.javadoc.*;
-
-/**
- * Documents a Serializable field defined by an ObjectStreamField.
- * <pre>
- * The class parses and stores the three serialField tag parameters:
- *
- * - field name
- * - field type name
- *      (fully-qualified or visible from the current import context)
- * - description of the valid values for the field
-
- * </pre>
- * This tag is only allowed in the javadoc for the special member
- * serialPersistentFields.
- *
- *  <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>
- *
- * @author Joe Fialli
- * @author Neal Gafter
- *
- * @see java.io.ObjectStreamField
- */
-class SerialFieldTagImpl
-    extends TagImpl
-    implements SerialFieldTag, Comparable<Object>
-{
-    //### These could be final, except that the constructor
-    //### does not set them directly.
-
-    private String fieldName;    // Required Argument 1 of serialField
-    private String fieldType;    // Required Argument 2 of serialField
-    private String description;  // Optional Remaining Arguments of serialField
-
-    private ClassDoc containingClass;   // Class containing serialPersistentField member
-    private ClassDoc fieldTypeDoc;      // ClassDocImpl of fieldType
-    private FieldDocImpl matchingField; // FieldDocImpl with same name as fieldName
-
-   /* Constructor. */
-   SerialFieldTagImpl(DocImpl holder, String name, String text) {
-        super(holder, name, text);
-        parseSerialFieldString();
-        if (holder instanceof MemberDoc) {
-            containingClass = ((MemberDocImpl)holder).containingClass();
-        }
-    }
-
-    /*
-     * The serialField tag is composed of three entities.
-     *
-     *   serialField  serializableFieldName serisliableFieldType
-     *                 description of field.
-     *
-     * The fieldName and fieldType must be legal Java Identifiers.
-     */
-    private void parseSerialFieldString() {
-        int len = text.length();
-        if (len == 0) {
-            return;
-        }
-
-        // if no white space found
-        /* Skip white space. */
-        int inx = 0;
-        int cp;
-        for (; inx < len; inx += Character.charCount(cp)) {
-             cp = text.codePointAt(inx);
-             if (!Character.isWhitespace(cp)) {
-                 break;
-             }
-        }
-
-        /* find first word. */
-        int first = inx;
-        int last = inx;
-        cp = text.codePointAt(inx);
-        if (! Character.isJavaIdentifierStart(cp)) {
-            docenv().warning(holder,
-                             "tag.serialField.illegal_character",
-                             new String(Character.toChars(cp)), text);
-            return;
-        }
-
-        for (inx += Character.charCount(cp); inx < len; inx += Character.charCount(cp)) {
-             cp = text.codePointAt(inx);
-             if (!Character.isJavaIdentifierPart(cp)) {
-                 break;
-             }
-        }
-
-        if (inx < len && ! Character.isWhitespace(cp = text.codePointAt(inx))) {
-            docenv().warning(holder,
-                             "tag.serialField.illegal_character",
-                             new String(Character.toChars(cp)), text);
-            return;
-        }
-
-        last = inx;
-        fieldName = text.substring(first, last);
-
-        /* Skip white space. */
-        for (; inx < len; inx += Character.charCount(cp)) {
-             cp = text.codePointAt(inx);
-             if (!Character.isWhitespace(cp)) {
-                 break;
-             }
-        }
-
-        /* find second word. */
-        first = inx;
-        last = inx;
-
-        for (; inx < len; inx += Character.charCount(cp)) {
-             cp = text.codePointAt(inx);
-             if (Character.isWhitespace(cp)) {
-                 break;
-             }
-        }
-        if (inx < len && ! Character.isWhitespace(cp = text.codePointAt(inx))) {
-            docenv().warning(holder,
-                             "tag.serialField.illegal_character",
-                             new String(Character.toChars(cp)), text);
-            return;
-        }
-        last = inx;
-        fieldType = text.substring(first, last);
-
-        /* Skip leading white space. Rest of string is description for serialField.*/
-        for (; inx < len; inx += Character.charCount(cp)) {
-             cp = text.codePointAt(inx);
-             if (!Character.isWhitespace(cp)) {
-                 break;
-             }
-        }
-        description = text.substring(inx);
-    }
-
-    /**
-     * return a key for sorting.
-     */
-    String key() {
-        return fieldName;
-    }
-
-    /*
-     * Optional. Link this serialField tag to its corrsponding
-     * field in the class. Note: there is no requirement that
-     * there be a field in the class that matches serialField tag.
-     */
-    void mapToFieldDocImpl(FieldDocImpl fd) {
-        matchingField = fd;
-    }
-
-    /**
-     * Return the serialziable field name.
-     */
-    public String fieldName() {
-        return fieldName;
-    }
-
-    /**
-     * Return the field type string.
-     */
-    public String fieldType() {
-        return fieldType;
-    }
-
-    /**
-     * Return the ClassDocImpl for field type.
-     *
-     * @returns null if no ClassDocImpl for field type is visible from
-     *          containingClass context.
-     */
-    public ClassDoc fieldTypeDoc() {
-        if (fieldTypeDoc == null && containingClass != null) {
-            fieldTypeDoc = containingClass.findClass(fieldType);
-        }
-        return fieldTypeDoc;
-    }
-
-    /**
-     * Return the corresponding FieldDocImpl for this SerialFieldTagImpl.
-     *
-     * @returns null if no matching FieldDocImpl.
-     */
-    FieldDocImpl getMatchingField() {
-        return matchingField;
-    }
-
-    /**
-     * Return the field comment. If there is no serialField comment, return
-     * javadoc comment of corresponding FieldDocImpl.
-     */
-    public String description() {
-        if (description.length() == 0 && matchingField != null) {
-
-            //check for javadoc comment of corresponding field.
-            Comment comment = matchingField.comment();
-            if (comment != null) {
-                return comment.commentText();
-            }
-        }
-        return description;
-    }
-
-    /**
-     * Return the kind of this tag.
-     */
-    public String kind() {
-        return "@serialField";
-    }
-
-    /**
-     * Convert this object to a string.
-     */
-    public String toString() {
-        return name + ":" + text;
-    }
-
-    /**
-     * Compares this Object with the specified Object for order.  Returns a
-     * negative integer, zero, or a positive integer as this Object is less
-     * than, equal to, or greater than the given Object.
-     * <p>
-     * Included to make SerialFieldTagImpl items java.lang.Comparable.
-     *
-     * @param   obj the <code>Object</code> to be compared.
-     * @return  a negative integer, zero, or a positive integer as this Object
-     *          is less than, equal to, or greater than the given Object.
-     * @exception ClassCastException the specified Object's type prevents it
-     *            from being compared to this Object.
-     * @since 1.2
-     */
-    public int compareTo(Object obj) {
-        return key().compareTo(((SerialFieldTagImpl)obj).key());
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/SerializedForm.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,287 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.MethodSymbol;
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-import com.sun.tools.javac.util.*;
-
-import static com.sun.tools.javac.code.Kinds.Kind.*;
-import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
-
-/**
- * The serialized form is the specification of a class' serialization
- * state. <p>
- *
- * It consists of the following information:<p>
- *
- * <pre>
- * 1. Whether class is Serializable or Externalizable.
- * 2. Javadoc for serialization methods.
- *    a. For Serializable, the optional readObject, writeObject,
- *       readResolve and writeReplace.
- *       serialData tag describes, in prose, the sequence and type
- *       of optional data written by writeObject.
- *    b. For Externalizable, writeExternal and readExternal.
- *       serialData tag describes, in prose, the sequence and type
- *       of optional data written by writeExternal.
- * 3. Javadoc for serialization data layout.
- *    a. For Serializable, the name,type and description
- *       of each Serializable fields.
- *    b. For Externalizable, data layout is described by 2(b).
- * </pre>
- *
- *  <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>
- *
- * @since 1.2
- * @author Joe Fialli
- * @author Neal Gafter (rewrite but not too proud)
- */
-class SerializedForm {
-    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<>();
-
-    /* True if class specifies serializable fields explicitly.
-     * using special static member, serialPersistentFields.
-     */
-    private boolean definesSerializableFields = false;
-
-    // Specially treated field/method names defined by Serialization.
-    private static final String SERIALIZABLE_FIELDS = "serialPersistentFields";
-    private static final String READOBJECT  = "readObject";
-    private static final String WRITEOBJECT = "writeObject";
-    private static final String READRESOLVE  = "readResolve";
-    private static final String WRITEREPLACE = "writeReplace";
-    private static final String READOBJECTNODATA = "readObjectNoData";
-
-    /**
-     * Constructor.
-     *
-     * Catalog Serializable fields for Serializable class.
-     * Catalog serialization methods for Serializable and
-     * Externalizable classes.
-     */
-    SerializedForm(DocEnv env, ClassSymbol def, ClassDocImpl cd) {
-        if (cd.isExternalizable()) {
-            /* look up required public accessible methods,
-             *   writeExternal and readExternal.
-             */
-            String[] readExternalParamArr = { "java.io.ObjectInput" };
-            String[] writeExternalParamArr = { "java.io.ObjectOutput" };
-            MethodDoc md = cd.findMethod("readExternal", readExternalParamArr);
-            if (md != null) {
-                methods.append(md);
-            }
-            md = cd.findMethod("writeExternal", writeExternalParamArr);
-            if (md != null) {
-                methods.append(md);
-                Tag tag[] = md.tags("serialData");
-            }
-        // } else { // isSerializable() //### ???
-        } else if (cd.isSerializable()) {
-
-            VarSymbol dsf = getDefinedSerializableFields(def);
-            if (dsf != null) {
-
-                /* Define serializable fields with array of ObjectStreamField.
-                 * Each ObjectStreamField should be documented by a
-                 * serialField tag.
-                 */
-                definesSerializableFields = true;
-                //### No modifier filtering applied here.
-                FieldDocImpl dsfDoc = env.getFieldDoc(dsf);
-                fields.append(dsfDoc);
-                mapSerialFieldTagImplsToFieldDocImpls(dsfDoc, env, def);
-            } else {
-
-                /* Calculate default Serializable fields as all
-                 * non-transient, non-static fields.
-                 * Fields should be documented by serial tag.
-                 */
-                computeDefaultSerializableFields(env, def, cd);
-            }
-
-           /* Check for optional customized readObject, writeObject,
-            * readResolve and writeReplace, which can all contain
-            * the serialData tag.        */
-            addMethodIfExist(env, def, READOBJECT);
-            addMethodIfExist(env, def, WRITEOBJECT);
-            addMethodIfExist(env, def, READRESOLVE);
-            addMethodIfExist(env, def, WRITEREPLACE);
-            addMethodIfExist(env, def, READOBJECTNODATA);
-        }
-    }
-
-    /*
-     * Check for explicit Serializable fields.
-     * Check for a private static array of ObjectStreamField with
-     * name SERIALIZABLE_FIELDS.
-     */
-    private VarSymbol getDefinedSerializableFields(ClassSymbol def) {
-        Names names = def.name.table.names;
-
-        /* SERIALIZABLE_FIELDS can be private,
-         * so must lookup by ClassSymbol, not by ClassDocImpl.
-         */
-        for (Symbol sym : def.members().getSymbolsByName(names.fromString(SERIALIZABLE_FIELDS))) {
-            if (sym.kind == VAR) {
-                VarSymbol f = (VarSymbol)sym;
-                if ((f.flags() & Flags.STATIC) != 0 &&
-                    (f.flags() & Flags.PRIVATE) != 0) {
-                    return f;
-                }
-            }
-        }
-        return null;
-    }
-
-    /*
-     * Compute default Serializable fields from all members of ClassSymbol.
-     *
-     * Since the fields of ClassDocImpl might not contain private or
-     * package accessible fields, must walk over all members of ClassSymbol.
-     */
-    private void computeDefaultSerializableFields(DocEnv env,
-                                                  ClassSymbol def,
-                                                  ClassDocImpl cd) {
-        for (Symbol sym : def.members().getSymbols(NON_RECURSIVE)) {
-            if (sym != null && sym.kind == VAR) {
-                VarSymbol f = (VarSymbol)sym;
-                if ((f.flags() & Flags.STATIC) == 0 &&
-                    (f.flags() & Flags.TRANSIENT) == 0) {
-                    //### No modifier filtering applied here.
-                    FieldDocImpl fd = env.getFieldDoc(f);
-                    //### Add to beginning.
-                    //### Preserve order used by old 'javadoc'.
-                    fields.prepend(fd);
-                }
-            }
-        }
-    }
-
-    /*
-     * Catalog Serializable method if it exists in current ClassSymbol.
-     * Do not look for method in superclasses.
-     *
-     * Serialization requires these methods to be non-static.
-     *
-     * @param method should be an unqualified Serializable method
-     *               name either READOBJECT, WRITEOBJECT, READRESOLVE
-     *               or WRITEREPLACE.
-     * @param visibility the visibility flag for the given method.
-     */
-    private void addMethodIfExist(DocEnv env, ClassSymbol def, String methodName) {
-        Names names = def.name.table.names;
-
-        for (Symbol sym : def.members().getSymbolsByName(names.fromString(methodName))) {
-            if (sym.kind == MTH) {
-                MethodSymbol md = (MethodSymbol)sym;
-                if ((md.flags() & Flags.STATIC) == 0) {
-                    /*
-                     * WARNING: not robust if unqualifiedMethodName is overloaded
-                     *          method. Signature checking could make more robust.
-                     * READOBJECT takes a single parameter, java.io.ObjectInputStream.
-                     * WRITEOBJECT takes a single parameter, java.io.ObjectOutputStream.
-                     */
-                    methods.append(env.getMethodDoc(md));
-                }
-            }
-        }
-    }
-
-    /*
-     * Associate serialField tag fieldName with FieldDocImpl member.
-     * Note: A serialField tag does not have to map an existing field
-     *       of a class.
-     */
-    private void mapSerialFieldTagImplsToFieldDocImpls(FieldDocImpl spfDoc,
-                                                       DocEnv env,
-                                                       ClassSymbol def) {
-        Names names = def.name.table.names;
-        for (SerialFieldTag tag : spfDoc.serialFieldTags()) {
-            if (tag.fieldName() == null || tag.fieldType() == null) // ignore malformed @serialField tags
-                continue;
-
-            Name fieldName = names.fromString(tag.fieldName());
-
-            // Look for a FieldDocImpl that is documented by serialFieldTagImpl.
-            for (Symbol sym : def.members().getSymbolsByName(fieldName)) {
-                if (sym.kind == VAR) {
-                    VarSymbol f = (VarSymbol) sym;
-                    FieldDocImpl fdi = env.getFieldDoc(f);
-                    ((SerialFieldTagImpl) (tag)).mapToFieldDocImpl(fdi);
-                    break;
-                }
-            }
-        }
-    }
-
-    /**
-     * Return serializable fields in class. <p>
-     *
-     * Returns either a list of default fields documented by serial tag comment or
-     *         javadoc comment<p>
-     * Or Returns a single FieldDocImpl for serialPersistentField. There is a
-     *         serialField tag for each serializable field.<p>
-     *
-     * @return an array of FieldDocImpl for representing the visible
-     *         fields in this class.
-     */
-    FieldDoc[] fields() {
-        return (FieldDoc[])fields.toArray(new FieldDocImpl[fields.length()]);
-    }
-
-    /**
-     * Return serialization methods in class.
-     *
-     * @return an array of MethodDocImpl for serialization methods in this class.
-     */
-    MethodDoc[] methods() {
-        return methods.toArray(new MethodDoc[methods.length()]);
-    }
-
-    /**
-     * Returns true if Serializable fields are defined explicitly using
-     * member, serialPersistentFields.
-     *
-     * @see #fields()
-     */
-    boolean definesSerializableFields() {
-        return definesSerializableFields;
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/SourcePositionImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javadoc;
-
-import java.io.File;
-import javax.tools.FileObject;
-
-import com.sun.javadoc.SourcePosition;
-import com.sun.tools.javac.util.Position;
-
-/**
- * A source position: filename, line number, and column number.
- *
- *  <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>
- *
- * @since J2SE1.4
- * @author Neal M Gafter
- * @author Michael Van De Vanter (position representation changed to char offsets)
- */
-public class SourcePositionImpl implements SourcePosition {
-    FileObject filename;
-    int position;
-    Position.LineMap lineMap;
-
-    /** The source file. Returns null if no file information is
-     *  available. */
-    public File file() {
-        return (filename == null) ? null : new File(filename.getName());
-    }
-
-    /** The source file. Returns null if no file information is
-     *  available. */
-    public FileObject fileObject() {
-        return filename;
-    }
-
-    /** The line in the source file. The first line is numbered 1;
-     *  0 means no line number information is available. */
-    public int line() {
-        if (lineMap == null) {
-            return 0;
-        } else {
-            return lineMap.getLineNumber(position);
-        }
-    }
-
-    /** The column in the source file. The first column is
-     *  numbered 1; 0 means no column information is available.
-     *  Columns count characters in the input stream; a tab
-     *  advances the column number to the next 8-column tab stop.
-     */
-    public int column() {
-        if (lineMap == null) {
-            return 0;
-        }else {
-            return lineMap.getColumnNumber(position);
-        }
-    }
-
-    private SourcePositionImpl(FileObject file, int position,
-                               Position.LineMap lineMap) {
-        super();
-        this.filename = file;
-        this.position = position;
-        this.lineMap = lineMap;
-    }
-
-    public static SourcePosition make(FileObject file, int pos,
-                                      Position.LineMap lineMap) {
-        if (file == null) return null;
-        return new SourcePositionImpl(file, pos, lineMap);
-    }
-
-    public String toString() {
-        // Backwards compatibility hack. ZipFileObjects use the format
-        // zipfile(zipentry) but javadoc has been using zipfile/zipentry
-        String fn = filename.getName();
-        if (fn.endsWith(")")) {
-            int paren = fn.lastIndexOf("(");
-            if (paren != -1) {
-                int i = paren+1;
-                if (fn.charAt(i) == '/')
-                    i++;
-                fn = fn.substring(0, paren)
-                        + File.separatorChar
-                        + fn.substring(i, fn.length() - 1);
-            }
-        }
-
-        if (position == Position.NOPOS)
-            return fn;
-        else
-            return fn + ":" + line();
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Start.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,557 +0,0 @@
-/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javadoc;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Objects;
-
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.main.CommandLine;
-import com.sun.tools.javac.main.Option;
-import com.sun.tools.javac.file.BaseFileManager;
-import com.sun.tools.javac.platform.PlatformDescription;
-import com.sun.tools.javac.platform.PlatformUtils;
-import com.sun.tools.javac.util.ClientCodeException;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Options;
-
-import static com.sun.tools.javac.code.Flags.*;
-
-/**
- * Main program of Javadoc.
- * Previously named "Main".
- *
- *  <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>
- *
- * @since 1.2
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- */
-public class Start extends ToolOption.Helper {
-    /** Context for this invocation. */
-    private final Context context;
-
-    private final String defaultDocletClassName;
-    private final ClassLoader docletParentClassLoader;
-
-    private static final String javadocName = "javadoc";
-
-    private static final String standardDocletClassName =
-        "com.sun.tools.doclets.standard.Standard";
-
-    private final long defaultFilter = PUBLIC | PROTECTED;
-
-    private final Messager messager;
-
-    private DocletInvoker docletInvoker;
-
-    /**
-     * In API mode, exceptions thrown while calling the doclet are
-     * propagated using ClientCodeException.
-     */
-    private boolean apiMode;
-
-    private JavaFileManager fileManager;
-
-    Start(String programName,
-          PrintWriter errWriter,
-          PrintWriter warnWriter,
-          PrintWriter noticeWriter,
-          String defaultDocletClassName) {
-        this(programName, errWriter, warnWriter, noticeWriter, defaultDocletClassName, null);
-    }
-
-    public Start(PrintWriter pw) {
-        this(javadocName, pw, pw, pw, standardDocletClassName);
-    }
-
-    public Start(String programName,
-          PrintWriter errWriter,
-          PrintWriter warnWriter,
-          PrintWriter noticeWriter,
-          String defaultDocletClassName,
-          ClassLoader docletParentClassLoader) {
-        context = new Context();
-        messager = new Messager(context, programName, errWriter, warnWriter, noticeWriter);
-        this.defaultDocletClassName = defaultDocletClassName;
-        this.docletParentClassLoader = docletParentClassLoader;
-    }
-
-    Start(String programName, String defaultDocletClassName) {
-        this(programName, defaultDocletClassName, null);
-    }
-
-    Start(String programName, String defaultDocletClassName,
-          ClassLoader docletParentClassLoader) {
-        context = new Context();
-        messager = new Messager(context, programName);
-        this.defaultDocletClassName = defaultDocletClassName;
-        this.docletParentClassLoader = docletParentClassLoader;
-    }
-
-    Start(String programName, ClassLoader docletParentClassLoader) {
-        this(programName, standardDocletClassName, docletParentClassLoader);
-    }
-
-    Start(String programName) {
-        this(programName, standardDocletClassName);
-    }
-
-    Start(ClassLoader docletParentClassLoader) {
-        this(javadocName, docletParentClassLoader);
-    }
-
-    public Start() {
-        this(javadocName);
-    }
-
-    public Start(Context context) {
-        this.context = Objects.requireNonNull(context);
-        apiMode = true;
-        defaultDocletClassName = standardDocletClassName;
-        docletParentClassLoader = null;
-
-        Log log = context.get(Log.logKey);
-        if (log instanceof Messager)
-            messager = (Messager) log;
-        else {
-            PrintWriter out = context.get(Log.outKey);
-            messager = (out == null) ? new Messager(context, javadocName)
-                    : new Messager(context, javadocName, out, out, out);
-        }
-    }
-
-    /**
-     * Usage
-     */
-    @Override
-    void usage() {
-        usage(true);
-    }
-
-    void usage(boolean exit) {
-        usage("main.usage", "-help", null, exit);
-    }
-
-    @Override
-    void Xusage() {
-        Xusage(true);
-    }
-
-    void Xusage(boolean exit) {
-        usage("main.Xusage", "-X", "main.Xusage.foot", exit);
-    }
-
-    private void usage(String main, String doclet, String foot, boolean exit) {
-        // RFE: it would be better to replace the following with code to
-        // write a header, then help for each option, then a footer.
-        messager.notice(main);
-
-        // let doclet print usage information (does nothing on error)
-        if (docletInvoker != null) {
-            // RFE: this is a pretty bad way to get the doclet to show
-            // help info. Moreover, the output appears on stdout,
-            // and <i>not</i> on any of the standard streams passed
-            // to javadoc, and in particular, not to the noticeWriter
-            // But, to fix this, we need to fix the Doclet API.
-            docletInvoker.optionLength(doclet);
-        }
-
-        if (foot != null)
-            messager.notice(foot);
-
-        if (exit) exit();
-    }
-
-    /**
-     * Exit
-     */
-    private void exit() {
-        messager.exit();
-    }
-
-
-    /**
-     * Main program - external wrapper
-     */
-    public int begin(String... argv) {
-        boolean ok = begin(null, argv, Collections.<JavaFileObject> emptySet());
-        return ok ? 0 : 1;
-    }
-
-    public boolean begin(Class<?> docletClass, Iterable<String> options, Iterable<? extends JavaFileObject> fileObjects) {
-        Collection<String> opts = new ArrayList<>();
-        for (String opt: options) opts.add(opt);
-        return begin(docletClass, opts.toArray(new String[opts.size()]), fileObjects);
-    }
-
-    private boolean begin(Class<?> docletClass, String[] options, Iterable<? extends JavaFileObject> fileObjects) {
-        boolean failed = false;
-
-        try {
-            failed = !parseAndExecute(docletClass, options, fileObjects);
-        } catch (Messager.ExitJavadoc exc) {
-            // ignore, we just exit this way
-        } catch (OutOfMemoryError ee) {
-            messager.error(Messager.NOPOS, "main.out.of.memory");
-            failed = true;
-        } catch (ClientCodeException e) {
-            // simply rethrow these exceptions, to be caught and handled by JavadocTaskImpl
-            throw e;
-        } catch (Error ee) {
-            ee.printStackTrace(System.err);
-            messager.error(Messager.NOPOS, "main.fatal.error");
-            failed = true;
-        } catch (Exception ee) {
-            ee.printStackTrace(System.err);
-            messager.error(Messager.NOPOS, "main.fatal.exception");
-            failed = true;
-        } finally {
-            if (fileManager != null
-                    && fileManager instanceof BaseFileManager
-                    && ((BaseFileManager) fileManager).autoClose) {
-                try {
-                    fileManager.close();
-                } catch (IOException ignore) {
-                }
-            }
-            messager.exitNotice();
-            messager.flush();
-        }
-        failed |= messager.nerrors() > 0;
-        failed |= rejectWarnings && messager.nwarnings() > 0;
-        return !failed;
-    }
-
-    /**
-     * Main program - internal
-     */
-    private boolean parseAndExecute(
-            Class<?> docletClass,
-            String[] argv,
-            Iterable<? extends JavaFileObject> fileObjects) throws IOException {
-        long tm = System.currentTimeMillis();
-
-        ListBuffer<String> javaNames = new ListBuffer<>();
-
-        // Preprocess @file arguments
-        try {
-            argv = CommandLine.parse(argv);
-        } catch (FileNotFoundException e) {
-            messager.error(Messager.NOPOS, "main.cant.read", e.getMessage());
-            exit();
-        } catch (IOException e) {
-            e.printStackTrace(System.err);
-            exit();
-        }
-
-
-        fileManager = context.get(JavaFileManager.class);
-
-        setDocletInvoker(docletClass, fileManager, argv);
-
-        compOpts = Options.instance(context);
-        // Make sure no obsolete source/target messages are reported
-        compOpts.put("-Xlint:-options", "-Xlint:-options");
-
-        // Parse arguments
-        for (int i = 0 ; i < argv.length ; i++) {
-            String arg = argv[i];
-
-            ToolOption o = ToolOption.get(arg);
-            if (o != null) {
-                // hack: this restriction should be removed
-                if (o == ToolOption.LOCALE && i > 0)
-                    usageError("main.locale_first");
-
-                if (o.hasArg) {
-                    oneArg(argv, i++);
-                    o.process(this, argv[i]);
-                } else {
-                    setOption(arg);
-                    o.process(this);
-                }
-            } else if (arg.equals("-XDaccessInternalAPI")) {
-                // pass this hidden option down to the doclet, if it wants it
-                if (docletInvoker.optionLength("-XDaccessInternalAPI") == 1) {
-                    setOption(arg);
-                }
-            } else if (arg.startsWith("-XD")) {
-                // hidden javac options
-                String s = arg.substring("-XD".length());
-                int eq = s.indexOf('=');
-                String key = (eq < 0) ? s : s.substring(0, eq);
-                String value = (eq < 0) ? s : s.substring(eq+1);
-                compOpts.put(key, value);
-            }
-            // call doclet for its options
-            // other arg starts with - is invalid
-            else if (arg.startsWith("-")) {
-                int optionLength;
-                optionLength = docletInvoker.optionLength(arg);
-                if (optionLength < 0) {
-                    // error already displayed
-                    exit();
-                } else if (optionLength == 0) {
-                    // option not found
-                    usageError("main.invalid_flag", arg);
-                } else {
-                    // doclet added option
-                    if ((i + optionLength) > argv.length) {
-                        usageError("main.requires_argument", arg);
-                    }
-                    ListBuffer<String> args = new ListBuffer<>();
-                    for (int j = 0; j < optionLength-1; ++j) {
-                        args.append(argv[++i]);
-                    }
-                    setOption(arg, args.toList());
-                }
-            } else {
-                javaNames.append(arg);
-            }
-        }
-
-        if (fileManager == null) {
-            JavacFileManager.preRegister(context);
-            fileManager = context.get(JavaFileManager.class);
-            if (fileManager instanceof BaseFileManager) {
-                ((BaseFileManager) fileManager).autoClose = true;
-            }
-        }
-        if (fileManager instanceof BaseFileManager) {
-            ((BaseFileManager) fileManager).handleOptions(fileManagerOpts);
-        }
-
-        String platformString = compOpts.get("-release");
-
-        if (platformString != null) {
-            if (compOpts.isSet("-source")) {
-                usageError("main.release.bootclasspath.conflict", "-source");
-            }
-            if (fileManagerOpts.containsKey(Option.BOOTCLASSPATH)) {
-                usageError("main.release.bootclasspath.conflict", Option.BOOTCLASSPATH.getText());
-            }
-
-            PlatformDescription platformDescription =
-                    PlatformUtils.lookupPlatformDescription(platformString);
-
-            if (platformDescription == null) {
-                usageError("main.unsupported.release.version", platformString);
-            }
-
-            compOpts.put(Option.SOURCE, platformDescription.getSourceVersion());
-
-            context.put(PlatformDescription.class, platformDescription);
-
-            Collection<Path> platformCP = platformDescription.getPlatformPath();
-
-            if (platformCP != null) {
-                if (fileManager instanceof StandardJavaFileManager) {
-                    StandardJavaFileManager sfm = (StandardJavaFileManager) fileManager;
-
-                    sfm.setLocationFromPaths(StandardLocation.PLATFORM_CLASS_PATH, platformCP);
-                } else {
-                    usageError("main.release.not.standard.file.manager", platformString);
-                }
-            }
-        }
-
-        compOpts.notifyListeners();
-
-        if (javaNames.isEmpty() && subPackages.isEmpty() && isEmpty(fileObjects)) {
-            usageError("main.No_packages_or_classes_specified");
-        }
-
-        if (!docletInvoker.validOptions(options.toList())) {
-            // error message already displayed
-            exit();
-        }
-
-        JavadocTool comp = JavadocTool.make0(context);
-        if (comp == null) return false;
-
-        if (showAccess == null) {
-            setFilter(defaultFilter);
-        }
-
-        LanguageVersion languageVersion = docletInvoker.languageVersion();
-        RootDocImpl root = comp.getRootDocImpl(
-                docLocale,
-                encoding,
-                showAccess,
-                javaNames.toList(),
-                options.toList(),
-                fileObjects,
-                breakiterator,
-                subPackages.toList(),
-                excludedPackages.toList(),
-                docClasses,
-                // legacy?
-                languageVersion == null || languageVersion == LanguageVersion.JAVA_1_1,
-                quiet);
-
-        // release resources
-        comp = null;
-
-        // pass off control to the doclet
-        boolean ok = root != null;
-        if (ok) ok = docletInvoker.start(root);
-
-        // We're done.
-        if (compOpts.get("-verbose") != null) {
-            tm = System.currentTimeMillis() - tm;
-            messager.notice("main.done_in", Long.toString(tm));
-        }
-
-        return ok;
-    }
-
-    private <T> boolean isEmpty(Iterable<T> iter) {
-        return !iter.iterator().hasNext();
-    }
-
-    /**
-     * Init the doclet invoker.
-     * The doclet class may be given explicitly, or via the -doclet option in
-     * argv.
-     * If the doclet class is not given explicitly, it will be loaded from
-     * the file manager's DOCLET_PATH location, if available, or via the
-     * -doclet path option in argv.
-     * @param docletClass The doclet class. May be null.
-     * @param fileManager The file manager used to get the class loader to load
-     * the doclet class if required. May be null.
-     * @param argv Args containing -doclet and -docletpath, in case they are required.
-     */
-    private void setDocletInvoker(Class<?> docletClass, JavaFileManager fileManager, String[] argv) {
-        boolean exportInternalAPI = false;
-        String docletClassName = null;
-        String docletPath = null;
-
-        // Parse doclet specifying arguments
-        for (int i = 0 ; i < argv.length ; i++) {
-            String arg = argv[i];
-            if (arg.equals(ToolOption.DOCLET.opt)) {
-                oneArg(argv, i++);
-                if (docletClassName != null) {
-                    usageError("main.more_than_one_doclet_specified_0_and_1",
-                               docletClassName, argv[i]);
-                }
-                docletClassName = argv[i];
-            } else if (arg.equals(ToolOption.DOCLETPATH.opt)) {
-                oneArg(argv, i++);
-                if (docletPath == null) {
-                    docletPath = argv[i];
-                } else {
-                    docletPath += File.pathSeparator + argv[i];
-                }
-            } else if (arg.equals("-XDaccessInternalAPI")) {
-                exportInternalAPI = true;
-            }
-        }
-
-        if (docletClass != null) {
-            // TODO, check no -doclet, -docletpath
-            docletInvoker = new DocletInvoker(messager, docletClass, apiMode, exportInternalAPI);
-        } else {
-            if (docletClassName == null) {
-                docletClassName = defaultDocletClassName;
-            }
-
-            // attempt to find doclet
-            docletInvoker = new DocletInvoker(messager, fileManager,
-                    docletClassName, docletPath,
-                    docletParentClassLoader,
-                    apiMode,
-                    exportInternalAPI);
-        }
-    }
-
-    /**
-     * Set one arg option.
-     * Error and exit if one argument is not provided.
-     */
-    private void oneArg(String[] args, int index) {
-        if ((index + 1) < args.length) {
-            setOption(args[index], args[index+1]);
-        } else {
-            usageError("main.requires_argument", args[index]);
-        }
-    }
-
-    @Override
-    void usageError(String key, Object... args) {
-        messager.error(Messager.NOPOS, key, args);
-        usage(true);
-    }
-
-    /**
-     * indicate an option with no arguments was given.
-     */
-    private void setOption(String opt) {
-        String[] option = { opt };
-        options.append(option);
-    }
-
-    /**
-     * indicate an option with one argument was given.
-     */
-    private void setOption(String opt, String argument) {
-        String[] option = { opt, argument };
-        options.append(option);
-    }
-
-    /**
-     * indicate an option with the specified list of arguments was given.
-     */
-    private void setOption(String opt, List<String> arguments) {
-        String[] args = new String[arguments.length() + 1];
-        int k = 0;
-        args[k++] = opt;
-        for (List<String> i = arguments; i.nonEmpty(); i=i.tail) {
-            args[k++] = i.head;
-        }
-        options.append(args);
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/TagImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 1997, 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.tools.javadoc;
-
-import com.sun.javadoc.*;
-
-/**
- * Represents a documentation tag, e.g. @since, @author, @version.
- * Given a tag (e.g. "@since 1.2"), holds tag name (e.g. "@since")
- * and tag text (e.g. "1.2").  TagImpls with structure or which require
- * special processing are handled by subclasses (ParamTagImpl, SeeTagImpl,
- * and ThrowsTagImpl
- *
- *  <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>
- *
- * @author Robert Field
- * @author Atul M Dambalkar
- * @author Neal M Gafter
- * @see SeeTagImpl
- * @see ParamTagImpl
- * @see ThrowsTagImpl
- * @see Doc#tags()
- *
- */
-class TagImpl implements Tag {
-
-    protected final String text;
-    protected final String name;
-    protected final DocImpl holder;
-
-    /**
-     * Cached first sentence.
-     */
-    private Tag[] firstSentence;
-
-    /**
-     * Cached inline tags.
-     */
-    private Tag[] inlineTags;
-
-    /**
-     *  Constructor
-     */
-    TagImpl(DocImpl holder, String name, String text) {
-        this.holder = holder;
-        this.name = name;
-        this.text = text;
-    }
-
-    /**
-     * Return the name of this tag.
-     */
-    public String name() {
-        return name;
-    }
-
-    /**
-     * Return the containing {@link Doc} of this Tag element.
-     */
-    public Doc holder() {
-        return holder;
-    }
-
-    /**
-     * Return the kind of this tag.
-     */
-    public String kind() {
-        return name;
-    }
-
-    /**
-     * Return the text of this tag, that is, portion beyond tag name.
-     */
-    public String text() {
-        return text;
-    }
-
-    DocEnv docenv() {
-        return holder.env;
-    }
-
-    /**
-     * for use by subclasses which have two part tag text.
-     */
-    String[] divideAtWhite() {
-        String[] sa = new String[2];
-        int len = text.length();
-        // if no white space found
-        sa[0] = text;
-        sa[1] = "";
-        for (int inx = 0; inx < len; ++inx) {
-            char ch = text.charAt(inx);
-            if (Character.isWhitespace(ch)) {
-                sa[0] = text.substring(0, inx);
-                for (; inx < len; ++inx) {
-                    ch = text.charAt(inx);
-                    if (!Character.isWhitespace(ch)) {
-                        sa[1] = text.substring(inx, len);
-                        break;
-                    }
-                }
-                break;
-            }
-        }
-        return sa;
-    }
-
-    /**
-     * convert this object to a string.
-     */
-    public String toString() {
-        return name + ":" + text;
-    }
-
-    /**
-     * For documentation comment with embedded @link tags, return the array of
-     * TagImpls consisting of SeeTagImpl(s) and text containing TagImpl(s).
-     * Within a comment string "This is an example of inline tags for a
-     * documentation comment {@link Doc {@link Doc commentlabel}}",
-     * where inside the inner braces, the first "Doc" carries exctly the same
-     * syntax as a SeeTagImpl and the second "commentlabel" is label for the Html
-     * Link, will return an array of TagImpl(s) with first element as TagImpl with
-     * comment text "This is an example of inline tags for a documentation
-     * comment" and second element as SeeTagImpl with referenced class as "Doc"
-     * and the label for the Html Link as "commentlabel".
-     *
-     * @return TagImpl[] Array of tags with inline SeeTagImpls.
-     * @see ParamTagImpl
-     * @see ThrowsTagImpl
-     */
-    public Tag[] inlineTags() {
-        if (inlineTags == null) {
-            inlineTags = Comment.getInlineTags(holder, text);
-        }
-        return inlineTags;
-    }
-
-    /**
-     * Return array of tags for the first sentence in the doc comment text.
-     */
-    public Tag[] firstSentenceTags() {
-        if (firstSentence == null) {
-            //Parse all sentences first to avoid duplicate warnings.
-            inlineTags();
-            try {
-                docenv().setSilent(true);
-                firstSentence = Comment.firstSentenceTags(holder, text);
-            } finally {
-                docenv().setSilent(false);
-            }
-        }
-        return firstSentence;
-    }
-
-    /**
-     * Return the doc item to which this tag is attached.
-     * @return the doc item to which this tag is attached.
-     */
-    public SourcePosition position() {
-        return holder.position();
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ThrowsTagImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 1997, 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.tools.javadoc;
-
-import com.sun.javadoc.*;
-
-/**
- * Represents a @throws or @exception documentation tag.
- * Parses and holds the exception name and exception comment.
- * The exception name my be the name of a type variable.
- * Note: @exception is a backwards compatible synonymy for @throws.
- *
- *  <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>
- *
- * @author Robert Field
- * @author Atul M Dambalkar
- * @see ExecutableMemberDocImpl#throwsTags()
- *
- */
-class ThrowsTagImpl extends TagImpl implements ThrowsTag {
-
-    private final String exceptionName;
-    private final String exceptionComment;
-
-    /**
-     * Cached inline tags.
-     */
-    private Tag[] inlineTags;
-
-    ThrowsTagImpl(DocImpl holder, String name, String text) {
-        super(holder, name, text);
-        String[] sa = divideAtWhite();
-        exceptionName = sa[0];
-        exceptionComment = sa[1];
-    }
-
-    /**
-     * Return the exception name.
-     */
-    public String exceptionName() {
-        return exceptionName;
-    }
-
-    /**
-     * Return the exception comment.
-     */
-    public String exceptionComment() {
-        return exceptionComment;
-    }
-
-    /**
-     * Return the exception as a ClassDocImpl.
-     */
-    public ClassDoc exception() {
-        ClassDocImpl exceptionClass;
-        if (!(holder instanceof ExecutableMemberDoc)) {
-            exceptionClass = null;
-        } else {
-            ExecutableMemberDocImpl emd = (ExecutableMemberDocImpl)holder;
-            ClassDocImpl con = (ClassDocImpl)emd.containingClass();
-            exceptionClass = (ClassDocImpl)con.findClass(exceptionName);
-        }
-        return exceptionClass;
-    }
-
-    /**
-     * Return the type that represents the exception.
-     * This may be a <code>ClassDoc</code> or a <code>TypeVariable</code>.
-     */
-    public Type exceptionType() {
-        //###(gj) TypeVariable not yet supported.
-        return exception();
-    }
-
-
-    /**
-     * Return the kind of this tag.  Always "@throws" for instances
-     * of ThrowsTagImpl.
-     */
-    @Override
-    public String kind() {
-        return "@throws";
-    }
-
-    /**
-     * For the exception comment with embedded @link tags return the array of
-     * TagImpls consisting of SeeTagImpl(s) and text containing TagImpl(s).
-     *
-     * @return TagImpl[] Array of tags with inline SeeTagImpls.
-     * @see TagImpl#inlineTags()
-     * @see ParamTagImpl#inlineTags()
-     */
-    @Override
-    public Tag[] inlineTags() {
-        if (inlineTags == null) {
-            inlineTags = Comment.getInlineTags(holder, exceptionComment());
-        }
-        return inlineTags;
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ToolOption.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,392 +0,0 @@
-/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javadoc;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.main.Option;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Options;
-
-
-/**
- * javadoc tool options.
- *
- *  <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 enum ToolOption {
-    // ----- options for underlying compiler -----
-
-    BOOTCLASSPATH("-bootclasspath", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.BOOTCLASSPATH, arg);
-        }
-    },
-
-    CLASSPATH("-classpath", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.CLASSPATH, arg);
-        }
-    },
-
-    CP("-cp", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.CP, arg);
-        }
-    },
-
-    EXTDIRS("-extdirs", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.EXTDIRS, arg);
-        }
-    },
-
-    SOURCEPATH("-sourcepath", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.SOURCEPATH, arg);
-        }
-    },
-
-    SYSCLASSPATH("-sysclasspath", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.BOOTCLASSPATH, arg);
-        }
-    },
-
-    MODULESOURCEPATH("-modulesourcepath", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.MODULESOURCEPATH, arg);
-        }
-    },
-
-    UPGRADEMODULEPATH("-upgrademodulepath", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.UPGRADEMODULEPATH, arg);
-        }
-    },
-
-    SYSTEM("-system", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.SYSTEM, arg);
-        }
-    },
-
-    MODULEPATH("-modulepath", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.MODULEPATH, arg);
-        }
-    },
-
-    ADDMODS("-addmods", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setCompilerOpt(opt, arg);
-        }
-    },
-
-    LIMITMODS("-limitmods", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setCompilerOpt(opt, arg);
-        }
-    },
-
-    ENCODING("-encoding", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.encoding = arg;
-            helper.setCompilerOpt(opt, arg);
-        }
-    },
-
-    RELEASE("-release", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setCompilerOpt(opt, arg);
-        }
-    },
-
-    SOURCE("-source", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setCompilerOpt(opt, arg);
-        }
-    },
-
-    XMAXERRS("-Xmaxerrs", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setCompilerOpt(opt, arg);
-        }
-    },
-
-    XMAXWARNS("-Xmaxwarns", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setCompilerOpt(opt, arg);
-        }
-    },
-
-    // ----- doclet options -----
-
-    DOCLET("-doclet", true), // handled in setDocletInvoker
-
-    DOCLETPATH("-docletpath", true), // handled in setDocletInvoker
-
-    // ----- selection options -----
-
-    SUBPACKAGES("-subpackages", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.addToList(helper.subPackages, arg);
-        }
-    },
-
-    EXCLUDE("-exclude", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.addToList(helper.excludedPackages, arg);
-        }
-    },
-
-    // ----- filtering options -----
-
-    PACKAGE("-package") {
-        @Override
-        public void process(Helper helper) {
-            helper.setFilter(
-                    Flags.PUBLIC | Flags.PROTECTED | ModifierFilter.PACKAGE);
-        }
-    },
-
-    PRIVATE("-private") {
-        @Override
-        public void process(Helper helper) {
-            helper.setFilter(ModifierFilter.ALL_ACCESS);
-        }
-    },
-
-    PROTECTED("-protected") {
-        @Override
-        public void process(Helper helper) {
-            helper.setFilter(Flags.PUBLIC | Flags.PROTECTED);
-        }
-    },
-
-    PUBLIC("-public") {
-        @Override
-        public void process(Helper helper) {
-            helper.setFilter(Flags.PUBLIC);
-        }
-    },
-
-    // ----- output control options -----
-
-    PROMPT("-prompt") {
-        @Override
-        public void process(Helper helper) {
-            helper.compOpts.put("-prompt", "-prompt");
-            helper.promptOnError = true;
-        }
-    },
-
-    QUIET("-quiet") {
-        @Override
-        public void process(Helper helper) {
-            helper.quiet = true;
-        }
-    },
-
-    VERBOSE("-verbose") {
-        @Override
-        public void process(Helper helper) {
-            helper.compOpts.put("-verbose", "");
-        }
-    },
-
-    XWERROR("-Xwerror") {
-        @Override
-        public void process(Helper helper) {
-            helper.rejectWarnings = true;
-
-        }
-    },
-
-    // ----- other options -----
-
-    BREAKITERATOR("-breakiterator") {
-        @Override
-        public void process(Helper helper) {
-            helper.breakiterator = true;
-        }
-    },
-
-    LOCALE("-locale", true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.docLocale = arg;
-        }
-    },
-
-    OVERVIEW("-overview", true),
-
-    XCLASSES("-Xclasses") {
-        @Override
-        public void process(Helper helper) {
-            helper.docClasses = true;
-
-        }
-    },
-
-    // ----- help options -----
-
-    HELP("-help") {
-        @Override
-        public void process(Helper helper) {
-            helper.usage();
-        }
-    },
-
-    X("-X") {
-        @Override
-        public void process(Helper helper) {
-            helper.Xusage();
-        }
-    };
-
-    public final String opt;
-    public final boolean hasArg;
-
-    ToolOption(String opt) {
-        this(opt, false);
-    }
-
-    ToolOption(String opt, boolean hasArg) {
-        this.opt = opt;
-        this.hasArg = hasArg;
-    }
-
-    void process(Helper helper, String arg) { }
-
-    void process(Helper helper) { }
-
-    static ToolOption get(String name) {
-        for (ToolOption o: values()) {
-            if (name.equals(o.opt))
-                return o;
-        }
-        return null;
-    }
-
-    static abstract class Helper {
-        /** List of decoded options. */
-        final ListBuffer<String[]> options = new ListBuffer<>();
-
-        /** Selected packages, from -subpackages. */
-        final ListBuffer<String> subPackages = new ListBuffer<>();
-
-        /** Excluded packages, from -exclude. */
-        final ListBuffer<String> excludedPackages = new ListBuffer<>();
-
-        // File manager options
-        final Map<Option, String> fileManagerOpts = new LinkedHashMap<>();
-
-        /** javac options, set by various options. */
-        Options compOpts; // = Options.instance(context)
-
-        /* Encoding for javac, and files written? set by -encoding. */
-        String encoding = null;
-
-        /** Set by -breakiterator. */
-        boolean breakiterator = false;
-
-        /** Set by -quiet. */
-        boolean quiet = false;
-
-        /** Set by -Xclasses. */
-        boolean docClasses = false;
-
-        /** Set by -Xwerror. */
-        boolean rejectWarnings = false;
-
-        /** Set by -prompt. */
-        boolean promptOnError;
-
-        /** Set by -locale. */
-        String docLocale = "";
-
-        /** Set by -public, private, -protected, -package. */
-        ModifierFilter showAccess = null;
-
-        abstract void usage();
-        abstract void Xusage();
-
-        abstract void usageError(String msg, Object... args);
-
-        void addToList(ListBuffer<String> list, String str){
-            StringTokenizer st = new StringTokenizer(str, ":");
-            String current;
-            while(st.hasMoreTokens()){
-                current = st.nextToken();
-                list.append(current);
-            }
-        }
-
-        void setFilter(long filterBits) {
-            if (showAccess != null) {
-                usageError("main.incompatible.access.flags");
-            }
-            showAccess = new ModifierFilter(filterBits);
-        }
-
-        void setCompilerOpt(String opt, String arg) {
-            if (compOpts.get(opt) != null) {
-                usageError("main.option.already.seen", opt);
-            }
-            compOpts.put(opt, arg);
-        }
-
-        void setFileManagerOpt(Option opt, String arg) {
-            fileManagerOpts.put(opt, arg);
-        }
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/TypeMaker.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,350 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.CompletionFailure;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.ArrayType;
-import com.sun.tools.javac.code.Type.ClassType;
-import com.sun.tools.javac.code.Type.TypeVar;
-import com.sun.tools.javac.util.List;
-import static com.sun.tools.javac.code.TypeTag.ARRAY;
-
-/**
- *  <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 TypeMaker {
-
-    public static com.sun.javadoc.Type getType(DocEnv env, Type t) {
-        return getType(env, t, true);
-    }
-
-    /**
-     * @param errToClassDoc  if true, ERROR type results in a ClassDoc;
-     *          false preserves legacy behavior
-     */
-    public static com.sun.javadoc.Type getType(DocEnv env, Type t,
-            boolean errorToClassDoc) {
-        return getType(env, t, errorToClassDoc, true);
-    }
-
-    public static com.sun.javadoc.Type getType(DocEnv env, Type t,
-            boolean errToClassDoc, boolean considerAnnotations) {
-        try {
-            return getTypeImpl(env, t, errToClassDoc, considerAnnotations);
-        } catch (CompletionFailure cf) {
-            /* Quietly ignore completion failures and try again - the type
-             * for which the CompletionFailure was thrown shouldn't be completed
-             * again by the completer that threw the CompletionFailure.
-             */
-            return getType(env, t, errToClassDoc, considerAnnotations);
-        }
-    }
-
-    @SuppressWarnings("fallthrough")
-    private static com.sun.javadoc.Type getTypeImpl(DocEnv env, Type t,
-            boolean errToClassDoc, boolean considerAnnotations) {
-        if (env.legacyDoclet) {
-            t = env.types.erasure(t);
-        }
-
-        if (considerAnnotations && t.isAnnotated()) {
-            return new AnnotatedTypeImpl(env, t);
-        }
-
-        switch (t.getTag()) {
-        case CLASS:
-            if (ClassDocImpl.isGeneric((ClassSymbol)t.tsym)) {
-                return env.getParameterizedType((ClassType)t);
-            } else {
-                return env.getClassDoc((ClassSymbol)t.tsym);
-            }
-        case WILDCARD:
-            Type.WildcardType a = (Type.WildcardType)t;
-            return new WildcardTypeImpl(env, a);
-        case TYPEVAR: return new TypeVariableImpl(env, (TypeVar)t);
-        case ARRAY: return new ArrayTypeImpl(env, t);
-        case BYTE: return PrimitiveType.byteType;
-        case CHAR: return PrimitiveType.charType;
-        case SHORT: return PrimitiveType.shortType;
-        case INT: return PrimitiveType.intType;
-        case LONG: return PrimitiveType.longType;
-        case FLOAT: return PrimitiveType.floatType;
-        case DOUBLE: return PrimitiveType.doubleType;
-        case BOOLEAN: return PrimitiveType.booleanType;
-        case VOID: return PrimitiveType.voidType;
-        case ERROR:
-            if (errToClassDoc)
-                return env.getClassDoc((ClassSymbol)t.tsym);
-            // FALLTHRU
-        default:
-            return new PrimitiveType(t.tsym.getQualifiedName().toString());
-        }
-    }
-
-    /**
-     * Convert a list of javac types into an array of javadoc types.
-     */
-    public static com.sun.javadoc.Type[] getTypes(DocEnv env, List<Type> ts) {
-        return getTypes(env, ts, new com.sun.javadoc.Type[ts.length()]);
-    }
-
-    /**
-     * Like the above version, but use and return the array given.
-     */
-    public static com.sun.javadoc.Type[] getTypes(DocEnv env, List<Type> ts,
-                                                  com.sun.javadoc.Type res[]) {
-        int i = 0;
-        for (Type t : ts) {
-            res[i++] = getType(env, t);
-        }
-        return res;
-    }
-
-    public static String getTypeName(Type t, boolean full) {
-        switch (t.getTag()) {
-        case ARRAY:
-            StringBuilder s = new StringBuilder();
-            while (t.hasTag(ARRAY)) {
-                s.append("[]");
-                t = ((ArrayType)t).elemtype;
-            }
-            s.insert(0, getTypeName(t, full));
-            return s.toString();
-        case CLASS:
-            return ClassDocImpl.getClassName((ClassSymbol)t.tsym, full);
-        default:
-            return t.tsym.getQualifiedName().toString();
-        }
-    }
-
-    /**
-     * Return the string representation of a type use.  Bounds of type
-     * variables are not included; bounds of wildcard types are.
-     * Class names are qualified if "full" is true.
-     */
-    static String getTypeString(DocEnv env, Type t, boolean full) {
-        // TODO: should annotations be included here?
-        switch (t.getTag()) {
-        case ARRAY:
-            StringBuilder s = new StringBuilder();
-            while (t.hasTag(ARRAY)) {
-                s.append("[]");
-                t = env.types.elemtype(t);
-            }
-            s.insert(0, getTypeString(env, t, full));
-            return s.toString();
-        case CLASS:
-            return ParameterizedTypeImpl.
-                        parameterizedTypeToString(env, (ClassType)t, full);
-        case WILDCARD:
-            Type.WildcardType a = (Type.WildcardType)t;
-            return WildcardTypeImpl.wildcardTypeToString(env, a, full);
-        default:
-            return t.tsym.getQualifiedName().toString();
-        }
-    }
-
-    /**
-     * Return the formal type parameters of a class or method as an
-     * angle-bracketed string.  Each parameter is a type variable with
-     * optional bounds.  Class names are qualified if "full" is true.
-     * Return "" if there are no type parameters or we're hiding generics.
-     */
-    static String typeParametersString(DocEnv env, Symbol sym, boolean full) {
-        if (env.legacyDoclet || sym.type.getTypeArguments().isEmpty()) {
-            return "";
-        }
-        StringBuilder s = new StringBuilder();
-        for (Type t : sym.type.getTypeArguments()) {
-            s.append(s.length() == 0 ? "<" : ", ");
-            s.append(TypeVariableImpl.typeVarToString(env, (TypeVar)t, full));
-        }
-        s.append(">");
-        return s.toString();
-    }
-
-    /**
-     * Return the actual type arguments of a parameterized type as an
-     * angle-bracketed string.  Class name are qualified if "full" is true.
-     * Return "" if there are no type arguments or we're hiding generics.
-     */
-    static String typeArgumentsString(DocEnv env, ClassType cl, boolean full) {
-        if (env.legacyDoclet || cl.getTypeArguments().isEmpty()) {
-            return "";
-        }
-        StringBuilder s = new StringBuilder();
-        for (Type t : cl.getTypeArguments()) {
-            s.append(s.length() == 0 ? "<" : ", ");
-            s.append(getTypeString(env, t, full));
-        }
-        s.append(">");
-        return s.toString();
-    }
-
-
-    private static class ArrayTypeImpl implements com.sun.javadoc.Type {
-
-        Type arrayType;
-
-        DocEnv env;
-
-        ArrayTypeImpl(DocEnv env, Type arrayType) {
-            this.env = env;
-            this.arrayType = arrayType;
-        }
-
-        private com.sun.javadoc.Type skipArraysCache = null;
-
-        public com.sun.javadoc.Type getElementType() {
-            return TypeMaker.getType(env, env.types.elemtype(arrayType));
-        }
-
-        private com.sun.javadoc.Type skipArrays() {
-            if (skipArraysCache == null) {
-                Type t;
-                for (t = arrayType; t.hasTag(ARRAY); t = env.types.elemtype(t)) { }
-                skipArraysCache = TypeMaker.getType(env, t);
-            }
-            return skipArraysCache;
-        }
-
-        /**
-         * Return the type's dimension information, as a string.
-         * <p>
-         * For example, a two dimensional array of String returns '[][]'.
-         */
-        public String dimension() {
-            StringBuilder dimension = new StringBuilder();
-            for (Type t = arrayType; t.hasTag(ARRAY); t = env.types.elemtype(t)) {
-                dimension.append("[]");
-            }
-            return dimension.toString();
-        }
-
-        /**
-         * Return unqualified name of type excluding any dimension information.
-         * <p>
-         * For example, a two dimensional array of String returns 'String'.
-         */
-        public String typeName() {
-            return skipArrays().typeName();
-        }
-
-        /**
-         * Return qualified name of type excluding any dimension information.
-         *<p>
-         * For example, a two dimensional array of String
-         * returns 'java.lang.String'.
-         */
-        public String qualifiedTypeName() {
-            return skipArrays().qualifiedTypeName();
-        }
-
-        /**
-         * Return the simple name of this type excluding any dimension information.
-         */
-        public String simpleTypeName() {
-            return skipArrays().simpleTypeName();
-        }
-
-        /**
-         * Return this type as a class.  Array dimensions are ignored.
-         *
-         * @return a ClassDocImpl if the type is a Class.
-         * Return null if it is a primitive type..
-         */
-        public ClassDoc asClassDoc() {
-            return skipArrays().asClassDoc();
-        }
-
-        /**
-         * Return this type as a <code>ParameterizedType</code> if it
-         * represents a parameterized type.  Array dimensions are ignored.
-         */
-        public ParameterizedType asParameterizedType() {
-            return skipArrays().asParameterizedType();
-        }
-
-        /**
-         * Return this type as a <code>TypeVariable</code> if it represents
-         * a type variable.  Array dimensions are ignored.
-         */
-        public TypeVariable asTypeVariable() {
-            return skipArrays().asTypeVariable();
-        }
-
-        /**
-         * Return null, as there are no arrays of wildcard types.
-         */
-        public WildcardType asWildcardType() {
-            return null;
-        }
-
-        /**
-         * Return null, as there are no annotations of the type
-         */
-        public AnnotatedType asAnnotatedType() {
-            return null;
-        }
-
-        /**
-         * Return this type as an <code>AnnotationTypeDoc</code> if it
-         * represents an annotation type.  Array dimensions are ignored.
-         */
-        public AnnotationTypeDoc asAnnotationTypeDoc() {
-            return skipArrays().asAnnotationTypeDoc();
-        }
-
-        /**
-         * Return true if this is an array of a primitive type.
-         */
-        public boolean isPrimitive() {
-            return skipArrays().isPrimitive();
-        }
-
-        /**
-         * Return a string representation of the type.
-         *
-         * Return name of type including any dimension information.
-         * <p>
-         * For example, a two dimensional array of String returns
-         * <code>String[][]</code>.
-         *
-         * @return name of type including any dimension information.
-         */
-        @Override
-        public String toString() {
-            return qualifiedTypeName() + dimension();
-        }
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/*
- * 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
- * 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.javadoc;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Attribute.TypeCompound;
-import com.sun.tools.javac.code.Kinds;
-import com.sun.tools.javac.code.Kinds.KindSelector;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.MethodSymbol;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.TypeVar;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Names;
-
-/**
- * Implementation of <code>TypeVariable</code>, which
- * represents a type variable.
- *
- *  <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>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-public class TypeVariableImpl extends AbstractTypeImpl implements TypeVariable {
-
-    TypeVariableImpl(DocEnv env, TypeVar type) {
-        super(env, type);
-    }
-
-    /**
-     * Return the bounds of this type variable.
-     */
-    public com.sun.javadoc.Type[] bounds() {
-        return TypeMaker.getTypes(env, getBounds((TypeVar)type, env));
-    }
-
-    /**
-     * Return the class, interface, method, or constructor within
-     * which this type variable is declared.
-     */
-    public ProgramElementDoc owner() {
-        Symbol osym = type.tsym.owner;
-        if (osym.kind.matches(KindSelector.TYP)) {
-            return env.getClassDoc((ClassSymbol)osym);
-        }
-        Names names = osym.name.table.names;
-        if (osym.name == names.init) {
-            return env.getConstructorDoc((MethodSymbol)osym);
-        } else {
-            return env.getMethodDoc((MethodSymbol)osym);
-        }
-    }
-
-    /**
-     * Return the ClassDoc of the erasure of this type variable.
-     */
-    @Override
-    public ClassDoc asClassDoc() {
-        return env.getClassDoc((ClassSymbol)env.types.erasure(type).tsym);
-    }
-
-    @Override
-    public TypeVariable asTypeVariable() {
-        return this;
-    }
-
-    @Override
-    public String toString() {
-        return typeVarToString(env, (TypeVar)type, true);
-    }
-
-
-    /**
-     * Return the string form of a type variable along with any
-     * "extends" clause.  Class names are qualified if "full" is true.
-     */
-    static String typeVarToString(DocEnv env, TypeVar v, boolean full) {
-        StringBuilder s = new StringBuilder(v.toString());
-        List<Type> bounds = getBounds(v, env);
-        if (bounds.nonEmpty()) {
-            boolean first = true;
-            for (Type b : bounds) {
-                s.append(first ? " extends " : " & ");
-                s.append(TypeMaker.getTypeString(env, b, full));
-                first = false;
-            }
-        }
-        return s.toString();
-    }
-
-    /**
-     * Get the bounds of a type variable as listed in the "extends" clause.
-     */
-    private static List<Type> getBounds(TypeVar v, DocEnv env) {
-        final Type upperBound = v.getUpperBound();
-        Name boundname = upperBound.tsym.getQualifiedName();
-        if (boundname == boundname.table.names.java_lang_Object
-            && !upperBound.isAnnotated()) {
-            return List.nil();
-        } else {
-            return env.types.getBounds(v);
-        }
-    }
-
-    /**
-     * Get the annotations of this program element.
-     * Return an empty array if there are none.
-     */
-    public AnnotationDesc[] annotations() {
-        if (!type.isAnnotated()) {
-            return new AnnotationDesc[0];
-        }
-        List<? extends TypeCompound> tas = type.getAnnotationMirrors();
-        AnnotationDesc res[] = new AnnotationDesc[tas.length()];
-        int i = 0;
-        for (Attribute.Compound a : tas) {
-            res[i++] = new AnnotationDescImpl(env, a);
-        }
-        return res;
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/WildcardTypeImpl.java	Sat May 14 09:11:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2003, 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.tools.javadoc;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.util.List;
-
-
-/**
- * Implementation of <code>WildcardType</code>, which
- * represents a wildcard type.
- *
- *  <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>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-public class WildcardTypeImpl extends AbstractTypeImpl implements WildcardType {
-
-    WildcardTypeImpl(DocEnv env, Type.WildcardType type) {
-        super(env, type);
-    }
-
-    /**
-     * Return the upper bounds of this wildcard type argument
-     * as given by the <i>extends</i> clause.
-     * Return an empty array if no such bounds are explicitly given.
-     */
-    public com.sun.javadoc.Type[] extendsBounds() {
-        return TypeMaker.getTypes(env, getExtendsBounds((Type.WildcardType)type));
-    }
-
-    /**
-     * Return the lower bounds of this wildcard type argument
-     * as given by the <i>super</i> clause.
-     * Return an empty array if no such bounds are explicitly given.
-     */
-    public com.sun.javadoc.Type[] superBounds() {
-        return TypeMaker.getTypes(env, getSuperBounds((Type.WildcardType)type));
-    }
-
-    /**
-     * Return the ClassDoc of the erasure of this wildcard type.
-     */
-    @Override
-    public ClassDoc asClassDoc() {
-        return env.getClassDoc((ClassSymbol)env.types.erasure(type).tsym);
-    }
-
-    @Override
-    public WildcardType asWildcardType() {
-        return this;
-    }
-
-    @Override
-    public String typeName()            { return "?"; }
-    @Override
-    public String qualifiedTypeName()   { return "?"; }
-    @Override
-    public String simpleTypeName()      { return "?"; }
-
-    @Override
-    public String toString() {
-        return wildcardTypeToString(env, (Type.WildcardType)type, true);
-    }
-
-
-    /**
-     * Return the string form of a wildcard type ("?") along with any
-     * "extends" or "super" clause.  Delimiting brackets are not
-     * included.  Class names are qualified if "full" is true.
-     */
-    static String wildcardTypeToString(DocEnv env,
-                                       Type.WildcardType wildThing, boolean full) {
-        if (env.legacyDoclet) {
-            return TypeMaker.getTypeName(env.types.erasure(wildThing), full);
-        }
-        StringBuilder s = new StringBuilder("?");
-        List<Type> bounds = getExtendsBounds(wildThing);
-        if (bounds.nonEmpty()) {
-            s.append(" extends ");
-        } else {
-            bounds = getSuperBounds(wildThing);
-            if (bounds.nonEmpty()) {
-                s.append(" super ");
-            }
-        }
-        boolean first = true;   // currently only one bound is allowed
-        for (Type b : bounds) {
-            if (!first) {
-                s.append(" & ");
-            }
-            s.append(TypeMaker.getTypeString(env, b, full));
-            first = false;
-        }
-        return s.toString();
-    }
-
-    private static List<Type> getExtendsBounds(Type.WildcardType wild) {
-        return wild.isSuperBound()
-                ? List.<Type>nil()
-                : List.of(wild.type);
-    }
-
-    private static List<Type> getSuperBounds(Type.WildcardType wild) {
-        return wild.isExtendsBound()
-                ? List.<Type>nil()
-                : List.of(wild.type);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AbstractTypeImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,115 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import com.sun.javadoc.*;
+
+import com.sun.tools.javac.code.Type;
+
+
+/**
+ * Abstract implementation of <code>Type</code>, with useful
+ * defaults for the methods in <code>Type</code> (and a couple from
+ * <code>ProgramElementDoc</code>).
+ *
+ *  <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>
+ *
+ * @author Scott Seligman
+ * @since 1.5
+ */
+abstract class AbstractTypeImpl implements com.sun.javadoc.Type {
+
+    protected final DocEnv env;
+    protected final Type type;
+
+    protected AbstractTypeImpl(DocEnv env, Type type) {
+        this.env = env;
+        this.type = type;
+    }
+
+    public String typeName() {
+        return type.tsym.name.toString();
+    }
+
+    public String qualifiedTypeName() {
+        return type.tsym.getQualifiedName().toString();
+    }
+
+    public com.sun.javadoc.Type getElementType() {
+        return null;
+    }
+
+    public String simpleTypeName() {
+        return type.tsym.name.toString();
+    }
+
+    public String name() {
+        return typeName();
+    }
+
+    public String qualifiedName() {
+        return qualifiedTypeName();
+    }
+
+    public String toString() {
+        return qualifiedTypeName();
+    }
+
+    public String dimension() {
+        return "";
+    }
+
+    public boolean isPrimitive() {
+        return false;
+    }
+
+    public ClassDoc asClassDoc() {
+        return null;
+    }
+
+    public TypeVariable asTypeVariable() {
+        return null;
+    }
+
+    public WildcardType asWildcardType() {
+        return null;
+    }
+
+    public ParameterizedType asParameterizedType() {
+        return null;
+    }
+
+    public AnnotationTypeDoc asAnnotationTypeDoc() {
+        return null;
+    }
+
+    public AnnotatedType asAnnotatedType() {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotatedTypeImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,125 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.code.Attribute;
+import com.sun.tools.javac.code.Attribute.TypeCompound;
+import com.sun.tools.javac.util.List;
+
+/**
+ * Implementation of <code>AnnotatedType</code>, which
+ * represents an annotated type.
+ *
+ * @author Mahmood Ali
+ * @since 1.8
+ */
+public class AnnotatedTypeImpl
+        extends AbstractTypeImpl implements AnnotatedType {
+
+    AnnotatedTypeImpl(DocEnv env, com.sun.tools.javac.code.Type type) {
+        super(env, type);
+    }
+
+    /**
+     * Get the annotations of this program element.
+     * Return an empty array if there are none.
+     */
+    @Override
+    public AnnotationDesc[] annotations() {
+        List<? extends TypeCompound> tas = type.getAnnotationMirrors();
+        if (tas == null ||
+                tas.isEmpty()) {
+            return new AnnotationDesc[0];
+        }
+        AnnotationDesc res[] = new AnnotationDesc[tas.length()];
+        int i = 0;
+        for (Attribute.Compound a : tas) {
+            res[i++] = new AnnotationDescImpl(env, a);
+        }
+        return res;
+    }
+
+    @Override
+    public com.sun.javadoc.Type underlyingType() {
+        return TypeMaker.getType(env, type, true, false);
+    }
+
+    @Override
+    public AnnotatedType asAnnotatedType() {
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        return typeName();
+    }
+
+    @Override
+    public String typeName() {
+        return this.underlyingType().typeName();
+    }
+
+    @Override
+    public String qualifiedTypeName() {
+        return this.underlyingType().qualifiedTypeName();
+    }
+
+    @Override
+    public String simpleTypeName() {
+        return this.underlyingType().simpleTypeName();
+    }
+
+    @Override
+    public String dimension() {
+        return this.underlyingType().dimension();
+    }
+
+    @Override
+    public boolean isPrimitive() {
+        return this.underlyingType().isPrimitive();
+    }
+
+    @Override
+    public ClassDoc asClassDoc() {
+        return this.underlyingType().asClassDoc();
+    }
+
+    @Override
+    public TypeVariable asTypeVariable() {
+        return this.underlyingType().asTypeVariable();
+    }
+
+    @Override
+    public WildcardType asWildcardType() {
+        return this.underlyingType().asWildcardType();
+    }
+
+    @Override
+    public ParameterizedType asParameterizedType() {
+        return this.underlyingType().asParameterizedType();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,177 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import com.sun.javadoc.*;
+
+import com.sun.tools.javac.code.Attribute;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.Pair;
+
+
+/**
+ * Represents an annotation.
+ * An annotation associates a value with each element of an annotation type.
+ * Sure it ought to be called "Annotation", but that clashes with
+ * java.lang.annotation.Annotation.
+ *
+ *  <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>
+ *
+ * @author Scott Seligman
+ * @since 1.5
+ */
+
+public class AnnotationDescImpl implements AnnotationDesc {
+
+    private final DocEnv env;
+    private final Attribute.Compound annotation;
+
+
+    AnnotationDescImpl(DocEnv env, Attribute.Compound annotation) {
+        this.env = env;
+        this.annotation = annotation;
+    }
+
+    /**
+     * Returns the annotation type of this annotation.
+     */
+    public AnnotationTypeDoc annotationType() {
+        ClassSymbol atsym = (ClassSymbol)annotation.type.tsym;
+        if (annotation.type.isErroneous()) {
+            env.warning(null, "javadoc.class_not_found", annotation.type.toString());
+            return new AnnotationTypeDocImpl(env, atsym);
+        } else {
+            return (AnnotationTypeDoc)env.getClassDoc(atsym);
+        }
+    }
+
+    /**
+     * Returns this annotation's elements and their values.
+     * Only those explicitly present in the annotation are
+     * included, not those assuming their default values.
+     * Returns an empty array if there are none.
+     */
+    public ElementValuePair[] elementValues() {
+        List<Pair<MethodSymbol,Attribute>> vals = annotation.values;
+        ElementValuePair res[] = new ElementValuePair[vals.length()];
+        int i = 0;
+        for (Pair<MethodSymbol,Attribute> val : vals) {
+            res[i++] = new ElementValuePairImpl(env, val.fst, val.snd);
+        }
+        return res;
+    }
+
+    /**
+     * Check for the synthesized bit on the annotation.
+     *
+     * @return true if the annotation is synthesized.
+     */
+    public boolean isSynthesized() {
+        return annotation.isSynthesized();
+    }
+
+    /**
+     * Returns a string representation of this annotation.
+     * String is of one of the forms:
+     * <pre>
+     *     {@code @com.example.foo(name1=val1, name2=val2)}
+     *     {@code @com.example.foo(val)}
+     *     {@code @com.example.foo}
+     * </pre>
+     * Omit parens for marker annotations, and omit "value=" when allowed.
+     */
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("@");
+        sb.append(annotation.type.tsym);
+
+        ElementValuePair vals[] = elementValues();
+        if (vals.length > 0) {          // omit parens for marker annotation
+            sb.append('(');
+            boolean first = true;
+            for (ElementValuePair val : vals) {
+                if (!first) {
+                    sb.append(", ");
+                }
+                first = false;
+
+                String name = val.element().name();
+                if (vals.length == 1 && name.equals("value")) {
+                    sb.append(val.value());
+                } else {
+                    sb.append(val);
+                }
+            }
+            sb.append(')');
+        }
+        return sb.toString();
+    }
+
+
+    /**
+     * Represents an association between an annotation type element
+     * and one of its values.
+     */
+    public static class ElementValuePairImpl implements ElementValuePair {
+
+        private final DocEnv env;
+        private final MethodSymbol meth;
+        private final Attribute value;
+
+        ElementValuePairImpl(DocEnv env, MethodSymbol meth, Attribute value) {
+            this.env = env;
+            this.meth = meth;
+            this.value = value;
+        }
+
+        /**
+         * Returns the annotation type element.
+         */
+        public AnnotationTypeElementDoc element() {
+            return env.getAnnotationTypeElementDoc(meth);
+        }
+
+        /**
+         * Returns the value associated with the annotation type element.
+         */
+        public AnnotationValue value() {
+            return new AnnotationValueImpl(env, value);
+        }
+
+        /**
+         * Returns a string representation of this pair
+         * of the form "name=value".
+         */
+        @Override
+        public String toString() {
+            return meth.name + "=" + value();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeDocImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,106 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import com.sun.javadoc.*;
+
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.util.List;
+
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
+
+import static com.sun.tools.javac.code.Kinds.Kind.*;
+
+/**
+ * Represents an annotation type.
+ *
+ *  <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>
+ *
+ * @author Scott Seligman
+ * @since 1.5
+ */
+
+public class AnnotationTypeDocImpl
+        extends ClassDocImpl implements AnnotationTypeDoc {
+
+    public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym) {
+        this(env, sym, null);
+    }
+
+    public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym, TreePath treePath) {
+        super(env, sym, treePath);
+    }
+
+    /**
+     * Returns true, as this is an annotation type.
+     * (For legacy doclets, return false.)
+     */
+    public boolean isAnnotationType() {
+        return !isInterface();
+    }
+
+    /**
+     * Returns false.  Though technically an interface, an annotation
+     * type is not considered an interface for this purpose.
+     * (For legacy doclets, returns true.)
+     */
+    public boolean isInterface() {
+        return env.legacyDoclet;
+    }
+
+    /**
+     * Returns an empty array, as all methods are annotation type elements.
+     * (For legacy doclets, returns the elements.)
+     * @see #elements()
+     */
+    public MethodDoc[] methods(boolean filter) {
+        return env.legacyDoclet
+                ? (MethodDoc[])elements()
+                : new MethodDoc[0];
+    }
+
+    /**
+     * Returns the elements of this annotation type.
+     * Returns an empty array if there are none.
+     * Elements are always public, so no need to filter them.
+     */
+    public AnnotationTypeElementDoc[] elements() {
+        List<AnnotationTypeElementDoc> elements = List.nil();
+        for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
+            if (sym != null && sym.kind == MTH) {
+                MethodSymbol s = (MethodSymbol)sym;
+                elements = elements.prepend(env.getAnnotationTypeElementDoc(s));
+            }
+        }
+        return
+            elements.toArray(new AnnotationTypeElementDoc[elements.length()]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeElementDocImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,90 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import com.sun.javadoc.*;
+
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.code.Symbol.*;
+
+/**
+ * Represents an element of an annotation type.
+ *
+ *  <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>
+ *
+ * @author Scott Seligman
+ * @since 1.5
+ */
+
+public class AnnotationTypeElementDocImpl
+        extends MethodDocImpl implements AnnotationTypeElementDoc {
+
+    public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym) {
+        super(env, sym);
+    }
+
+    public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) {
+        super(env, sym, treePath);
+    }
+
+    /**
+     * Returns true, as this is an annotation type element.
+     * (For legacy doclets, return false.)
+     */
+    public boolean isAnnotationTypeElement() {
+        return !isMethod();
+    }
+
+    /**
+     * Returns false.  Although this is technically a method, we don't
+     * consider it one for this purpose.
+     * (For legacy doclets, return true.)
+     */
+    public boolean isMethod() {
+        return env.legacyDoclet;
+    }
+
+    /**
+     * Returns false, even though this is indeed abstract.  See
+     * MethodDocImpl.isAbstract() for the (il)logic behind this.
+     */
+    public boolean isAbstract() {
+        return false;
+    }
+
+    /**
+     * Returns the default value of this element.
+     * Returns null if this element has no default.
+     */
+    public AnnotationValue defaultValue() {
+        return (sym.defaultValue == null)
+               ? null
+               : new AnnotationValueImpl(env, sym.defaultValue);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationValueImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,176 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import com.sun.javadoc.*;
+
+import com.sun.tools.javac.code.Attribute;
+
+import static com.sun.tools.javac.code.TypeTag.BOOLEAN;
+
+/**
+ * Represents a value of an annotation type element.
+ *
+ *  <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>
+ *
+ * @author Scott Seligman
+ * @since 1.5
+ */
+
+public class AnnotationValueImpl implements AnnotationValue {
+
+    private final DocEnv env;
+    private final Attribute attr;
+
+
+    AnnotationValueImpl(DocEnv env, Attribute attr) {
+        this.env = env;
+        this.attr = attr;
+    }
+
+    /**
+     * Returns the value.
+     * The type of the returned object is one of the following:
+     * <ul><li> a wrapper class for a primitive type
+     *     <li> <code>String</code>
+     *     <li> <code>Type</code> (representing a class literal)
+     *     <li> <code>FieldDoc</code> (representing an enum constant)
+     *     <li> <code>AnnotationDesc</code>
+     *     <li> <code>AnnotationValue[]</code>
+     * </ul>
+     */
+    public Object value() {
+        ValueVisitor vv = new ValueVisitor();
+        attr.accept(vv);
+        return vv.value;
+    }
+
+    private class ValueVisitor implements Attribute.Visitor {
+        public Object value;
+
+        public void visitConstant(Attribute.Constant c) {
+            if (c.type.hasTag(BOOLEAN)) {
+                // javac represents false and true as integers 0 and 1
+                value = Boolean.valueOf(
+                                ((Integer)c.value).intValue() != 0);
+            } else {
+                value = c.value;
+            }
+        }
+
+        public void visitClass(Attribute.Class c) {
+            value = TypeMaker.getType(env,
+                                      env.types.erasure(c.classType));
+        }
+
+        public void visitEnum(Attribute.Enum e) {
+            value = env.getFieldDoc(e.value);
+        }
+
+        public void visitCompound(Attribute.Compound c) {
+            value = new AnnotationDescImpl(env, c);
+        }
+
+        public void visitArray(Attribute.Array a) {
+            AnnotationValue vals[] = new AnnotationValue[a.values.length];
+            for (int i = 0; i < vals.length; i++) {
+                vals[i] = new AnnotationValueImpl(env, a.values[i]);
+            }
+            value = vals;
+        }
+
+        public void visitError(Attribute.Error e) {
+            value = "<error>";
+        }
+    }
+
+    /**
+     * Returns a string representation of the value.
+     *
+     * @return the text of a Java language annotation value expression
+     *          whose value is the value of this annotation type element.
+     */
+    @Override
+    public String toString() {
+        ToStringVisitor tv = new ToStringVisitor();
+        attr.accept(tv);
+        return tv.toString();
+    }
+
+    private class ToStringVisitor implements Attribute.Visitor {
+        private final StringBuilder sb = new StringBuilder();
+
+        @Override
+        public String toString() {
+            return sb.toString();
+        }
+
+        public void visitConstant(Attribute.Constant c) {
+            if (c.type.hasTag(BOOLEAN)) {
+                // javac represents false and true as integers 0 and 1
+                sb.append(((Integer)c.value).intValue() != 0);
+            } else {
+                sb.append(FieldDocImpl.constantValueExpression(c.value));
+            }
+        }
+
+        public void visitClass(Attribute.Class c) {
+            sb.append(c);
+        }
+
+        public void visitEnum(Attribute.Enum e) {
+            sb.append(e);
+        }
+
+        public void visitCompound(Attribute.Compound c) {
+            sb.append(new AnnotationDescImpl(env, c));
+        }
+
+        public void visitArray(Attribute.Array a) {
+            // Omit braces from singleton.
+            if (a.values.length != 1) sb.append('{');
+
+            boolean first = true;
+            for (Attribute elem : a.values) {
+                if (first) {
+                    first = false;
+                } else {
+                    sb.append(", ");
+                }
+                elem.accept(this);
+            }
+            // Omit braces from singleton.
+            if (a.values.length != 1) sb.append('}');
+        }
+
+        public void visitError(Attribute.Error e) {
+            sb.append("<error>");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,1329 @@
+/*
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.javadoc.main;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Modifier;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.tools.FileObject;
+import javax.tools.JavaFileManager.Location;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+
+import com.sun.javadoc.*;
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Kinds;
+import com.sun.tools.javac.code.Kinds.KindSelector;
+import com.sun.tools.javac.code.Scope;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.ClassType;
+import com.sun.tools.javac.code.TypeTag;
+import com.sun.tools.javac.comp.AttrContext;
+import com.sun.tools.javac.comp.Env;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
+import com.sun.tools.javac.tree.JCTree.JCImport;
+import com.sun.tools.javac.tree.TreeInfo;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Names;
+import com.sun.tools.javac.util.Position;
+import static com.sun.tools.javac.code.Kinds.Kind.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
+import static com.sun.tools.javac.code.TypeTag.CLASS;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
+
+/**
+ * Represents a java class and provides access to information
+ * about the class, the class' comment and tags, and the
+ * members of the class.  A ClassDocImpl only exists if it was
+ * processed in this run of javadoc.  References to classes
+ * which may or may not have been processed in this run are
+ * referred to using Type (which can be converted to ClassDocImpl,
+ * if possible).
+ *
+ *  <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>
+ *
+ * @see Type
+ *
+ * @since 1.2
+ * @author Robert Field
+ * @author Neal Gafter (rewrite)
+ * @author Scott Seligman (generics, enums, annotations)
+ */
+
+public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
+
+    public final ClassType type;        // protected->public for debugging
+    public final ClassSymbol tsym;
+
+    boolean isIncluded = false;         // Set in RootDocImpl
+
+    private SerializedForm serializedForm;
+
+    /**
+     * Constructor
+     */
+    public ClassDocImpl(DocEnv env, ClassSymbol sym) {
+        this(env, sym, null);
+    }
+
+    /**
+     * Constructor
+     */
+    public ClassDocImpl(DocEnv env, ClassSymbol sym, TreePath treePath) {
+        super(env, sym, treePath);
+        this.type = (ClassType)sym.type;
+        this.tsym = sym;
+    }
+
+    public com.sun.javadoc.Type getElementType() {
+        return null;
+    }
+
+    /**
+     * Returns the flags in terms of javac's flags
+     */
+    protected long getFlags() {
+        return getFlags(tsym);
+    }
+
+    /**
+     * Returns the flags of a ClassSymbol in terms of javac's flags
+     */
+    static long getFlags(ClassSymbol clazz) {
+        try {
+            return clazz.flags();
+        } catch (CompletionFailure ex) {
+            /* Quietly ignore completion failures and try again - the type
+             * for which the CompletionFailure was thrown shouldn't be completed
+             * again by the completer that threw the CompletionFailure.
+             */
+            return getFlags(clazz);
+        }
+    }
+
+    /**
+     * Is a ClassSymbol an annotation type?
+     */
+    static boolean isAnnotationType(ClassSymbol clazz) {
+        return (getFlags(clazz) & Flags.ANNOTATION) != 0;
+    }
+
+    /**
+     * Identify the containing class
+     */
+    protected ClassSymbol getContainingClass() {
+        return tsym.owner.enclClass();
+    }
+
+    /**
+     * Return true if this is a class, not an interface.
+     */
+    @Override
+    public boolean isClass() {
+        return !Modifier.isInterface(getModifiers());
+    }
+
+    /**
+     * Return true if this is a ordinary class,
+     * not an enumeration, exception, an error, or an interface.
+     */
+    @Override
+    public boolean isOrdinaryClass() {
+        if (isEnum() || isInterface() || isAnnotationType()) {
+            return false;
+        }
+        for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
+            if (t.tsym == env.syms.errorType.tsym ||
+                t.tsym == env.syms.exceptionType.tsym) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Return true if this is an enumeration.
+     * (For legacy doclets, return false.)
+     */
+    @Override
+    public boolean isEnum() {
+        return (getFlags() & Flags.ENUM) != 0
+               &&
+               !env.legacyDoclet;
+    }
+
+    /**
+     * Return true if this is an interface, but not an annotation type.
+     * Overridden by AnnotationTypeDocImpl.
+     */
+    @Override
+    public boolean isInterface() {
+        return Modifier.isInterface(getModifiers());
+    }
+
+    /**
+     * Return true if this is an exception class
+     */
+    @Override
+    public boolean isException() {
+        if (isEnum() || isInterface() || isAnnotationType()) {
+            return false;
+        }
+        for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
+            if (t.tsym == env.syms.exceptionType.tsym) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Return true if this is an error class
+     */
+    @Override
+    public boolean isError() {
+        if (isEnum() || isInterface() || isAnnotationType()) {
+            return false;
+        }
+        for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
+            if (t.tsym == env.syms.errorType.tsym) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Return true if this is a throwable class
+     */
+    public boolean isThrowable() {
+        if (isEnum() || isInterface() || isAnnotationType()) {
+            return false;
+        }
+        for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
+            if (t.tsym == env.syms.throwableType.tsym) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Return true if this class is abstract
+     */
+    public boolean isAbstract() {
+        return Modifier.isAbstract(getModifiers());
+    }
+
+    /**
+     * Returns true if this class was synthesized by the compiler.
+     */
+    public boolean isSynthetic() {
+        return (getFlags() & Flags.SYNTHETIC) != 0;
+    }
+
+    /**
+     * Return true if this class is included in the active set.
+     * A ClassDoc is included iff either it is specified on the
+     * commandline, or if it's containing package is specified
+     * on the command line, or if it is a member class of an
+     * included class.
+     */
+
+    public boolean isIncluded() {
+        if (isIncluded) {
+            return true;
+        }
+        if (env.shouldDocument(tsym)) {
+            // Class is nameable from top-level and
+            // the class and all enclosing classes
+            // pass the modifier filter.
+            if (containingPackage().isIncluded()) {
+                return isIncluded=true;
+            }
+            ClassDoc outer = containingClass();
+            if (outer != null && outer.isIncluded()) {
+                return isIncluded=true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Return the package that this class is contained in.
+     */
+    @Override
+    public PackageDoc containingPackage() {
+        PackageDocImpl p = env.getPackageDoc(tsym.packge());
+        if (p.setDocPath == false) {
+            FileObject docPath;
+            try {
+                Location location = env.fileManager.hasLocation(StandardLocation.SOURCE_PATH)
+                    ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
+
+                docPath = env.fileManager.getFileForInput(
+                        location, p.qualifiedName(), "package.html");
+            } catch (IOException e) {
+                docPath = null;
+            }
+
+            if (docPath == null) {
+                // fall back on older semantics of looking in same directory as
+                // source file for this class
+                SourcePosition po = position();
+                if (env.fileManager instanceof StandardJavaFileManager &&
+                        po instanceof SourcePositionImpl) {
+                    URI uri = ((SourcePositionImpl) po).filename.toUri();
+                    if ("file".equals(uri.getScheme())) {
+                        File f = new File(uri);
+                        File dir = f.getParentFile();
+                        if (dir != null) {
+                            File pf = new File(dir, "package.html");
+                            if (pf.exists()) {
+                                StandardJavaFileManager sfm = (StandardJavaFileManager) env.fileManager;
+                                docPath = sfm.getJavaFileObjects(pf).iterator().next();
+                            }
+                        }
+
+                    }
+                }
+            }
+
+            p.setDocPath(docPath);
+        }
+        return p;
+    }
+
+    /**
+     * Return the class name without package qualifier - but with
+     * enclosing class qualifier - as a String.
+     * <pre>
+     * Examples:
+     *  for java.util.Hashtable
+     *  return Hashtable
+     *  for java.util.Map.Entry
+     *  return Map.Entry
+     * </pre>
+     */
+    public String name() {
+        if (name == null) {
+            name = getClassName(tsym, false);
+        }
+        return name;
+    }
+
+    private String name;
+
+    /**
+     * Return the qualified class name as a String.
+     * <pre>
+     * Example:
+     *  for java.util.Hashtable
+     *  return java.util.Hashtable
+     *  if no qualifier, just return flat name
+     * </pre>
+     */
+    public String qualifiedName() {
+        if (qualifiedName == null) {
+            qualifiedName = getClassName(tsym, true);
+        }
+        return qualifiedName;
+    }
+
+    private String qualifiedName;
+
+    /**
+     * Return unqualified name of type excluding any dimension information.
+     * <p>
+     * For example, a two dimensional array of String returns 'String'.
+     */
+    public String typeName() {
+        return name();
+    }
+
+    /**
+     * Return qualified name of type excluding any dimension information.
+     *<p>
+     * For example, a two dimensional array of String
+     * returns 'java.lang.String'.
+     */
+    public String qualifiedTypeName() {
+        return qualifiedName();
+    }
+
+    /**
+     * Return the simple name of this type.
+     */
+    public String simpleTypeName() {
+        if (simpleTypeName == null) {
+            simpleTypeName = tsym.name.toString();
+        }
+        return simpleTypeName;
+    }
+
+    private String simpleTypeName;
+
+    /**
+     * Return the qualified name and any type parameters.
+     * Each parameter is a type variable with optional bounds.
+     */
+    @Override
+    public String toString() {
+        return classToString(env, tsym, true);
+    }
+
+    /**
+     * Return the class name as a string.  If "full" is true the name is
+     * qualified, otherwise it is qualified by its enclosing class(es) only.
+     */
+    static String getClassName(ClassSymbol c, boolean full) {
+        if (full) {
+            return c.getQualifiedName().toString();
+        } else {
+            String n = "";
+            for ( ; c != null; c = c.owner.enclClass()) {
+                n = c.name + (n.equals("") ? "" : ".") + n;
+            }
+            return n;
+        }
+    }
+
+    /**
+     * Return the class name with any type parameters as a string.
+     * Each parameter is a type variable with optional bounds.
+     * If "full" is true all names are qualified, otherwise they are
+     * qualified by their enclosing class(es) only.
+     */
+    static String classToString(DocEnv env, ClassSymbol c, boolean full) {
+        StringBuilder s = new StringBuilder();
+        if (!c.isInner()) {             // if c is not an inner class
+            s.append(getClassName(c, full));
+        } else {
+            // c is an inner class, so include type params of outer.
+            ClassSymbol encl = c.owner.enclClass();
+            s.append(classToString(env, encl, full))
+             .append('.')
+             .append(c.name);
+        }
+        s.append(TypeMaker.typeParametersString(env, c, full));
+        return s.toString();
+    }
+
+    /**
+     * Is this class (or any enclosing class) generic?  That is, does
+     * it have type parameters?
+     */
+    static boolean isGeneric(ClassSymbol c) {
+        return c.type.allparams().nonEmpty();
+    }
+
+    /**
+     * Return the formal type parameters of this class or interface.
+     * Return an empty array if there are none.
+     */
+    public TypeVariable[] typeParameters() {
+        if (env.legacyDoclet) {
+            return new TypeVariable[0];
+        }
+        TypeVariable res[] = new TypeVariable[type.getTypeArguments().length()];
+        TypeMaker.getTypes(env, type.getTypeArguments(), res);
+        return res;
+    }
+
+    /**
+     * Return the type parameter tags of this class or interface.
+     */
+    public ParamTag[] typeParamTags() {
+        return (env.legacyDoclet)
+            ? new ParamTag[0]
+            : comment().typeParamTags();
+    }
+
+    /**
+     * Return the modifier string for this class. If it's an interface
+     * exclude 'abstract' keyword from the modifier string
+     */
+    @Override
+    public String modifiers() {
+        return Modifier.toString(modifierSpecifier());
+    }
+
+    @Override
+    public int modifierSpecifier() {
+        int modifiers = getModifiers();
+        return (isInterface() || isAnnotationType())
+                ? modifiers & ~Modifier.ABSTRACT
+                : modifiers;
+    }
+
+    /**
+     * Return the superclass of this class
+     *
+     * @return the ClassDocImpl for the superclass of this class, null
+     * if there is no superclass.
+     */
+    public ClassDoc superclass() {
+        if (isInterface() || isAnnotationType()) return null;
+        if (tsym == env.syms.objectType.tsym) return null;
+        ClassSymbol c = (ClassSymbol)env.types.supertype(type).tsym;
+        if (c == null || c == tsym) c = (ClassSymbol)env.syms.objectType.tsym;
+        return env.getClassDoc(c);
+    }
+
+    /**
+     * Return the superclass of this class.  Return null if this is an
+     * interface.  A superclass is represented by either a
+     * <code>ClassDoc</code> or a <code>ParameterizedType</code>.
+     */
+    public com.sun.javadoc.Type superclassType() {
+        if (isInterface() || isAnnotationType() ||
+                (tsym == env.syms.objectType.tsym))
+            return null;
+        Type sup = env.types.supertype(type);
+        return TypeMaker.getType(env,
+                                 (sup.hasTag(TypeTag.NONE)) ? env.syms.objectType : sup);
+    }
+
+    /**
+     * Test whether this class is a subclass of the specified class.
+     *
+     * @param cd the candidate superclass.
+     * @return true if cd is a superclass of this class.
+     */
+    public boolean subclassOf(ClassDoc cd) {
+        return tsym.isSubClass(((ClassDocImpl)cd).tsym, env.types);
+    }
+
+    /**
+     * Return interfaces implemented by this class or interfaces
+     * extended by this interface.
+     *
+     * @return An array of ClassDocImpl representing the interfaces.
+     * Return an empty array if there are no interfaces.
+     */
+    public ClassDoc[] interfaces() {
+        ListBuffer<ClassDocImpl> ta = new ListBuffer<>();
+        for (Type t : env.types.interfaces(type)) {
+            ta.append(env.getClassDoc((ClassSymbol)t.tsym));
+        }
+        //### Cache ta here?
+        return ta.toArray(new ClassDocImpl[ta.length()]);
+    }
+
+    /**
+     * Return interfaces implemented by this class or interfaces extended
+     * by this interface. Includes only directly-declared interfaces, not
+     * inherited interfaces.
+     * Return an empty array if there are no interfaces.
+     */
+    public com.sun.javadoc.Type[] interfaceTypes() {
+        //### Cache result here?
+        return TypeMaker.getTypes(env, env.types.interfaces(type));
+    }
+
+    /**
+     * Return fields in class.
+     * @param filter include only the included fields if filter==true
+     */
+    public FieldDoc[] fields(boolean filter) {
+        return fields(filter, false);
+    }
+
+    /**
+     * Return included fields in class.
+     */
+    public FieldDoc[] fields() {
+        return fields(true, false);
+    }
+
+    /**
+     * Return the enum constants if this is an enum type.
+     */
+    public FieldDoc[] enumConstants() {
+        return fields(false, true);
+    }
+
+    /**
+     * Return fields in class.
+     * @param filter  if true, return only the included fields
+     * @param enumConstants  if true, return the enum constants instead
+     */
+    private FieldDoc[] fields(boolean filter, boolean enumConstants) {
+        List<FieldDocImpl> fields = List.nil();
+        for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
+            if (sym != null && sym.kind == VAR) {
+                VarSymbol s = (VarSymbol)sym;
+                boolean isEnum = ((s.flags() & Flags.ENUM) != 0) &&
+                                 !env.legacyDoclet;
+                if (isEnum == enumConstants &&
+                        (!filter || env.shouldDocument(s))) {
+                    fields = fields.prepend(env.getFieldDoc(s));
+                }
+            }
+        }
+        return fields.toArray(new FieldDocImpl[fields.length()]);
+    }
+
+    /**
+     * Return methods in class.
+     * This method is overridden by AnnotationTypeDocImpl.
+     *
+     * @param filter include only the included methods if filter==true
+     * @return an array of MethodDocImpl for representing the visible
+     * methods in this class.  Does not include constructors.
+     */
+    public MethodDoc[] methods(boolean filter) {
+        Names names = tsym.name.table.names;
+        List<MethodDocImpl> methods = List.nil();
+        for (Symbol sym :tsym.members().getSymbols(NON_RECURSIVE)) {
+            if (sym != null
+                && sym.kind == MTH
+                && sym.name != names.init
+                && sym.name != names.clinit) {
+                MethodSymbol s = (MethodSymbol)sym;
+                if (!filter || env.shouldDocument(s)) {
+                    methods = methods.prepend(env.getMethodDoc(s));
+                }
+            }
+        }
+        //### Cache methods here?
+        return methods.toArray(new MethodDocImpl[methods.length()]);
+    }
+
+    /**
+     * Return included methods in class.
+     *
+     * @return an array of MethodDocImpl for representing the visible
+     * methods in this class.  Does not include constructors.
+     */
+    public MethodDoc[] methods() {
+        return methods(true);
+    }
+
+    /**
+     * Return constructors in class.
+     *
+     * @param filter include only the included constructors if filter==true
+     * @return an array of ConstructorDocImpl for representing the visible
+     * constructors in this class.
+     */
+    public ConstructorDoc[] constructors(boolean filter) {
+        Names names = tsym.name.table.names;
+        List<ConstructorDocImpl> constructors = List.nil();
+        for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
+            if (sym != null &&
+                sym.kind == MTH && sym.name == names.init) {
+                MethodSymbol s = (MethodSymbol)sym;
+                if (!filter || env.shouldDocument(s)) {
+                    constructors = constructors.prepend(env.getConstructorDoc(s));
+                }
+            }
+        }
+        //### Cache constructors here?
+        return constructors.toArray(new ConstructorDocImpl[constructors.length()]);
+    }
+
+    /**
+     * Return included constructors in class.
+     *
+     * @return an array of ConstructorDocImpl for representing the visible
+     * constructors in this class.
+     */
+    public ConstructorDoc[] constructors() {
+        return constructors(true);
+    }
+
+    /**
+     * Adds all inner classes of this class, and their
+     * inner classes recursively, to the list l.
+     */
+    void addAllClasses(ListBuffer<ClassDocImpl> l, boolean filtered) {
+        try {
+            if (isSynthetic()) return;
+            // sometimes synthetic classes are not marked synthetic
+            if (!JavadocTool.isValidClassName(tsym.name.toString())) return;
+            if (filtered && !env.shouldDocument(tsym)) return;
+            if (l.contains(this)) return;
+            l.append(this);
+            List<ClassDocImpl> more = List.nil();
+            for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
+                if (sym != null && sym.kind == TYP) {
+                    ClassSymbol s = (ClassSymbol)sym;
+                    ClassDocImpl c = env.getClassDoc(s);
+                    if (c.isSynthetic()) continue;
+                    if (c != null) more = more.prepend(c);
+                }
+            }
+            // this extra step preserves the ordering from oldjavadoc
+            for (; more.nonEmpty(); more=more.tail) {
+                more.head.addAllClasses(l, filtered);
+            }
+        } catch (CompletionFailure e) {
+            // quietly ignore completion failures
+        }
+    }
+
+    /**
+     * Return inner classes within this class.
+     *
+     * @param filter include only the included inner classes if filter==true.
+     * @return an array of ClassDocImpl for representing the visible
+     * classes defined in this class. Anonymous and local classes
+     * are not included.
+     */
+    public ClassDoc[] innerClasses(boolean filter) {
+        ListBuffer<ClassDocImpl> innerClasses = new ListBuffer<>();
+        for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
+            if (sym != null && sym.kind == TYP) {
+                ClassSymbol s = (ClassSymbol)sym;
+                if ((s.flags_field & Flags.SYNTHETIC) != 0) continue;
+                if (!filter || env.isVisible(s)) {
+                    innerClasses.prepend(env.getClassDoc(s));
+                }
+            }
+        }
+        //### Cache classes here?
+        return innerClasses.toArray(new ClassDocImpl[innerClasses.length()]);
+    }
+
+    /**
+     * Return included inner classes within this class.
+     *
+     * @return an array of ClassDocImpl for representing the visible
+     * classes defined in this class. Anonymous and local classes
+     * are not included.
+     */
+    public ClassDoc[] innerClasses() {
+        return innerClasses(true);
+    }
+
+    /**
+     * Find a class within the context of this class.
+     * Search order: qualified name, in this class (inner),
+     * in this package, in the class imports, in the package
+     * imports.
+     * Return the ClassDocImpl if found, null if not found.
+     */
+    //### The specified search order is not the normal rule the
+    //### compiler would use.  Leave as specified or change it?
+    public ClassDoc findClass(String className) {
+        ClassDoc searchResult = searchClass(className);
+        if (searchResult == null) {
+            ClassDocImpl enclosingClass = (ClassDocImpl)containingClass();
+            //Expand search space to include enclosing class.
+            while (enclosingClass != null && enclosingClass.containingClass() != null) {
+                enclosingClass = (ClassDocImpl)enclosingClass.containingClass();
+            }
+            searchResult = enclosingClass == null ?
+                null : enclosingClass.searchClass(className);
+        }
+        return searchResult;
+    }
+
+    private ClassDoc searchClass(String className) {
+        Names names = tsym.name.table.names;
+
+        // search by qualified name first
+        ClassDoc cd = env.lookupClass(className);
+        if (cd != null) {
+            return cd;
+        }
+
+        // search inner classes
+        //### Add private entry point to avoid creating array?
+        //### Replicate code in innerClasses here to avoid consing?
+        for (ClassDoc icd : innerClasses()) {
+            if (icd.name().equals(className) ||
+                    //### This is from original javadoc but it looks suspicious to me...
+                    //### I believe it is attempting to compensate for the confused
+                    //### convention of including the nested class qualifiers in the
+                    //### 'name' of the inner class, rather than the true simple name.
+                    icd.name().endsWith("." + className)) {
+                return icd;
+            } else {
+                ClassDoc innercd = ((ClassDocImpl) icd).searchClass(className);
+                if (innercd != null) {
+                    return innercd;
+                }
+            }
+        }
+
+        // check in this package
+        cd = containingPackage().findClass(className);
+        if (cd != null) {
+            return cd;
+        }
+
+        // make sure that this symbol has been completed
+        tsym.complete();
+
+        // search imports
+
+        if (tsym.sourcefile != null) {
+
+            //### This information is available only for source classes.
+
+            Env<AttrContext> compenv = env.enter.getEnv(tsym);
+            if (compenv == null) return null;
+
+            Scope s = compenv.toplevel.namedImportScope;
+            for (Symbol sym : s.getSymbolsByName(names.fromString(className))) {
+                if (sym.kind == TYP) {
+                    ClassDoc c = env.getClassDoc((ClassSymbol)sym);
+                    return c;
+                }
+            }
+
+            s = compenv.toplevel.starImportScope;
+            for (Symbol sym : s.getSymbolsByName(names.fromString(className))) {
+                if (sym.kind == TYP) {
+                    ClassDoc c = env.getClassDoc((ClassSymbol)sym);
+                    return c;
+                }
+            }
+        }
+
+        return null; // not found
+    }
+
+
+    private boolean hasParameterTypes(MethodSymbol method, String[] argTypes) {
+
+        if (argTypes == null) {
+            // wildcard
+            return true;
+        }
+
+        int i = 0;
+        List<Type> types = method.type.getParameterTypes();
+
+        if (argTypes.length != types.length()) {
+            return false;
+        }
+
+        for (Type t : types) {
+            String argType = argTypes[i++];
+            // For vararg method, "T..." matches type T[].
+            if (i == argTypes.length) {
+                argType = argType.replace("...", "[]");
+            }
+            if (!hasTypeName(env.types.erasure(t), argType)) {  //###(gj)
+                return false;
+            }
+        }
+        return true;
+    }
+    // where
+    private boolean hasTypeName(Type t, String name) {
+        return
+            name.equals(TypeMaker.getTypeName(t, true))
+            ||
+            name.equals(TypeMaker.getTypeName(t, false))
+            ||
+            (qualifiedName() + "." + name).equals(TypeMaker.getTypeName(t, true));
+    }
+
+
+
+    /**
+     * Find a method in this class scope.
+     * Search order: this class, interfaces, superclasses, outerclasses.
+     * Note that this is not necessarily what the compiler would do!
+     *
+     * @param methodName the unqualified name to search for.
+     * @param paramTypes the array of Strings for method parameter types.
+     * @return the first MethodDocImpl which matches, null if not found.
+     */
+    public MethodDocImpl findMethod(String methodName, String[] paramTypes) {
+        // Use hash table 'searched' to avoid searching same class twice.
+        //### It is not clear how this could happen.
+        return searchMethod(methodName, paramTypes, new HashSet<ClassDocImpl>());
+    }
+
+    private MethodDocImpl searchMethod(String methodName,
+                                       String[] paramTypes, Set<ClassDocImpl> searched) {
+        //### Note that this search is not necessarily what the compiler would do!
+
+        Names names = tsym.name.table.names;
+        // do not match constructors
+        if (names.init.contentEquals(methodName)) {
+            return null;
+        }
+
+        ClassDocImpl cdi;
+        MethodDocImpl mdi;
+
+        if (searched.contains(this)) {
+            return null;
+        }
+        searched.add(this);
+
+        //DEBUG
+        /*---------------------------------*
+         System.out.print("searching " + this + " for " + methodName);
+         if (paramTypes == null) {
+         System.out.println("()");
+         } else {
+         System.out.print("(");
+         for (int k=0; k < paramTypes.length; k++) {
+         System.out.print(paramTypes[k]);
+         if ((k + 1) < paramTypes.length) {
+         System.out.print(", ");
+         }
+         }
+         System.out.println(")");
+         }
+         *---------------------------------*/
+
+        // search current class
+
+        //### Using modifier filter here isn't really correct,
+        //### but emulates the old behavior.  Instead, we should
+        //### apply the normal rules of visibility and inheritance.
+
+        if (paramTypes == null) {
+            // If no parameters specified, we are allowed to return
+            // any method with a matching name.  In practice, the old
+            // code returned the first method, which is now the last!
+            // In order to provide textually identical results, we
+            // attempt to emulate the old behavior.
+            MethodSymbol lastFound = null;
+            for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(methodName))) {
+                if (sym.kind == MTH) {
+                    //### Should intern methodName as Name.
+                    if (sym.name.toString().equals(methodName)) {
+                        lastFound = (MethodSymbol)sym;
+                    }
+                }
+            }
+            if (lastFound != null) {
+                return env.getMethodDoc(lastFound);
+            }
+        } else {
+            for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(methodName))) {
+                if (sym != null &&
+                    sym.kind == MTH) {
+                    //### Should intern methodName as Name.
+                    if (hasParameterTypes((MethodSymbol)sym, paramTypes)) {
+                        return env.getMethodDoc((MethodSymbol)sym);
+                    }
+                }
+            }
+        }
+
+        //### If we found a MethodDoc above, but which did not pass
+        //### the modifier filter, we should return failure here!
+
+        // search superclass
+        cdi = (ClassDocImpl)superclass();
+        if (cdi != null) {
+            mdi = cdi.searchMethod(methodName, paramTypes, searched);
+            if (mdi != null) {
+                return mdi;
+            }
+        }
+
+        // search interfaces
+        for (ClassDoc intf : interfaces()) {
+            cdi = (ClassDocImpl) intf;
+            mdi = cdi.searchMethod(methodName, paramTypes, searched);
+            if (mdi != null) {
+                return mdi;
+            }
+        }
+
+        // search enclosing class
+        cdi = (ClassDocImpl)containingClass();
+        if (cdi != null) {
+            mdi = cdi.searchMethod(methodName, paramTypes, searched);
+            if (mdi != null) {
+                return mdi;
+            }
+        }
+
+        //###(gj) As a temporary measure until type variables are better
+        //### handled, try again without the parameter types.
+        //### This should most often find the right method, and occassionally
+        //### find the wrong one.
+        //if (paramTypes != null) {
+        //    return findMethod(methodName, null);
+        //}
+
+        return null;
+    }
+
+    /**
+     * Find constructor in this class.
+     *
+     * @param constrName the unqualified name to search for.
+     * @param paramTypes the array of Strings for constructor parameters.
+     * @return the first ConstructorDocImpl which matches, null if not found.
+     */
+    public ConstructorDoc findConstructor(String constrName,
+                                          String[] paramTypes) {
+        Names names = tsym.name.table.names;
+        for (Symbol sym : tsym.members().getSymbolsByName(names.fromString("<init>"))) {
+            if (sym.kind == MTH) {
+                if (hasParameterTypes((MethodSymbol)sym, paramTypes)) {
+                    return env.getConstructorDoc((MethodSymbol)sym);
+                }
+            }
+        }
+
+        //###(gj) As a temporary measure until type variables are better
+        //### handled, try again without the parameter types.
+        //### This will often find the right constructor, and occassionally
+        //### find the wrong one.
+        //if (paramTypes != null) {
+        //    return findConstructor(constrName, null);
+        //}
+
+        return null;
+    }
+
+    /**
+     * Find a field in this class scope.
+     * Search order: this class, outerclasses, interfaces,
+     * superclasses. IMP: If see tag is defined in an inner class,
+     * which extends a super class and if outerclass and the super
+     * class have a visible field in common then Java compiler cribs
+     * about the ambiguity, but the following code will search in the
+     * above given search order.
+     *
+     * @param fieldName the unqualified name to search for.
+     * @return the first FieldDocImpl which matches, null if not found.
+     */
+    public FieldDoc findField(String fieldName) {
+        return searchField(fieldName, new HashSet<ClassDocImpl>());
+    }
+
+    private FieldDocImpl searchField(String fieldName, Set<ClassDocImpl> searched) {
+        Names names = tsym.name.table.names;
+        if (searched.contains(this)) {
+            return null;
+        }
+        searched.add(this);
+
+        for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(fieldName))) {
+            if (sym.kind == VAR) {
+                //### Should intern fieldName as Name.
+                return env.getFieldDoc((VarSymbol)sym);
+            }
+        }
+
+        //### If we found a FieldDoc above, but which did not pass
+        //### the modifier filter, we should return failure here!
+
+        ClassDocImpl cdi = (ClassDocImpl)containingClass();
+        if (cdi != null) {
+            FieldDocImpl fdi = cdi.searchField(fieldName, searched);
+            if (fdi != null) {
+                return fdi;
+            }
+        }
+
+        // search superclass
+        cdi = (ClassDocImpl)superclass();
+        if (cdi != null) {
+            FieldDocImpl fdi = cdi.searchField(fieldName, searched);
+            if (fdi != null) {
+                return fdi;
+            }
+        }
+
+        // search interfaces
+        for (ClassDoc intf : interfaces()) {
+            cdi = (ClassDocImpl) intf;
+            FieldDocImpl fdi = cdi.searchField(fieldName, searched);
+            if (fdi != null) {
+                return fdi;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Get the list of classes declared as imported.
+     * These are called "single-type-import declarations" in the JLS.
+     * This method is deprecated in the ClassDoc interface.
+     *
+     * @return an array of ClassDocImpl representing the imported classes.
+     *
+     * @deprecated  Import declarations are implementation details that
+     *          should not be exposed here.  In addition, not all imported
+     *          classes are imported through single-type-import declarations.
+     */
+    @Deprecated
+    public ClassDoc[] importedClasses() {
+        // information is not available for binary classfiles
+        if (tsym.sourcefile == null) return new ClassDoc[0];
+
+        ListBuffer<ClassDocImpl> importedClasses = new ListBuffer<>();
+
+        Env<AttrContext> compenv = env.enter.getEnv(tsym);
+        if (compenv == null) return new ClassDocImpl[0];
+
+        Name asterisk = tsym.name.table.names.asterisk;
+        for (JCTree t : compenv.toplevel.defs) {
+            if (t.hasTag(IMPORT)) {
+                JCTree imp = ((JCImport) t).qualid;
+                if ((TreeInfo.name(imp) != asterisk) &&
+                    imp.type.tsym.kind.matches(KindSelector.TYP)) {
+                    importedClasses.append(
+                            env.getClassDoc((ClassSymbol)imp.type.tsym));
+                }
+            }
+        }
+
+        return importedClasses.toArray(new ClassDocImpl[importedClasses.length()]);
+    }
+
+    /**
+     * Get the list of packages declared as imported.
+     * These are called "type-import-on-demand declarations" in the JLS.
+     * This method is deprecated in the ClassDoc interface.
+     *
+     * @return an array of PackageDocImpl representing the imported packages.
+     *
+     * ###NOTE: the syntax supports importing all inner classes from a class as well.
+     * @deprecated  Import declarations are implementation details that
+     *          should not be exposed here.  In addition, this method's
+     *          return type does not allow for all type-import-on-demand
+     *          declarations to be returned.
+     */
+    @Deprecated
+    public PackageDoc[] importedPackages() {
+        // information is not available for binary classfiles
+        if (tsym.sourcefile == null) return new PackageDoc[0];
+
+        ListBuffer<PackageDocImpl> importedPackages = new ListBuffer<>();
+
+        //### Add the implicit "import java.lang.*" to the result
+        Names names = tsym.name.table.names;
+        importedPackages.append(env.getPackageDoc(env.syms.enterPackage(env.syms.java_base, names.java_lang)));
+
+        Env<AttrContext> compenv = env.enter.getEnv(tsym);
+        if (compenv == null) return new PackageDocImpl[0];
+
+        for (JCTree t : compenv.toplevel.defs) {
+            if (t.hasTag(IMPORT)) {
+                JCTree imp = ((JCImport) t).qualid;
+                if (TreeInfo.name(imp) == names.asterisk) {
+                    JCFieldAccess sel = (JCFieldAccess)imp;
+                    Symbol s = sel.selected.type.tsym;
+                    PackageDocImpl pdoc = env.getPackageDoc(s.packge());
+                    if (!importedPackages.contains(pdoc))
+                        importedPackages.append(pdoc);
+                }
+            }
+        }
+
+        return importedPackages.toArray(new PackageDocImpl[importedPackages.length()]);
+    }
+
+    /**
+     * Return the type's dimension information.
+     * Always return "", as this is not an array type.
+     */
+    public String dimension() {
+        return "";
+    }
+
+    /**
+     * Return this type as a class, which it already is.
+     */
+    public ClassDoc asClassDoc() {
+        return this;
+    }
+
+    /**
+     * Return null (unless overridden), as this is not an annotation type.
+     */
+    public AnnotationTypeDoc asAnnotationTypeDoc() {
+        return null;
+    }
+
+    /**
+     * Return null, as this is not a class instantiation.
+     */
+    public ParameterizedType asParameterizedType() {
+        return null;
+    }
+
+    /**
+     * Return null, as this is not a type variable.
+     */
+    public TypeVariable asTypeVariable() {
+        return null;
+    }
+
+    /**
+     * Return null, as this is not a wildcard type.
+     */
+    public WildcardType asWildcardType() {
+        return null;
+    }
+
+    /**
+     * Returns null, as this is not an annotated type.
+     */
+    public AnnotatedType asAnnotatedType() {
+        return null;
+    }
+
+    /**
+     * Return false, as this is not a primitive type.
+     */
+    public boolean isPrimitive() {
+        return false;
+    }
+
+    //--- Serialization ---
+
+    //### These methods ignore modifier filter.
+
+    /**
+     * Return true if this class implements <code>java.io.Serializable</code>.
+     *
+     * Since <code>java.io.Externalizable</code> extends
+     * <code>java.io.Serializable</code>,
+     * Externalizable objects are also Serializable.
+     */
+    public boolean isSerializable() {
+        try {
+            return env.types.isSubtype(type, env.syms.serializableType);
+        } catch (CompletionFailure ex) {
+            // quietly ignore completion failures
+            return false;
+        }
+    }
+
+    /**
+     * Return true if this class implements
+     * <code>java.io.Externalizable</code>.
+     */
+    public boolean isExternalizable() {
+        try {
+            return env.types.isSubtype(type, env.externalizableSym.type);
+        } catch (CompletionFailure ex) {
+            // quietly ignore completion failures
+            return false;
+        }
+    }
+
+    /**
+     * Return the serialization methods for this class.
+     *
+     * @return an array of <code>MethodDocImpl</code> that represents
+     * the serialization methods for this class.
+     */
+    public MethodDoc[] serializationMethods() {
+        if (serializedForm == null) {
+            serializedForm = new SerializedForm(env, tsym, this);
+        }
+        //### Clone this?
+        return serializedForm.methods();
+    }
+
+    /**
+     * Return the Serializable fields of class.<p>
+     *
+     * Return either a list of default fields documented by
+     * <code>serial</code> tag<br>
+     * or return a single <code>FieldDoc</code> for
+     * <code>serialPersistentField</code> member.
+     * There should be a <code>serialField</code> tag for
+     * each Serializable field defined by an <code>ObjectStreamField</code>
+     * array component of <code>serialPersistentField</code>.
+     *
+     * @return an array of {@code FieldDoc} for the Serializable fields
+     *         of this class.
+     *
+     * @see #definesSerializableFields()
+     * @see SerialFieldTagImpl
+     */
+    public FieldDoc[] serializableFields() {
+        if (serializedForm == null) {
+            serializedForm = new SerializedForm(env, tsym, this);
+        }
+        //### Clone this?
+        return serializedForm.fields();
+    }
+
+    /**
+     * Return true if Serializable fields are explicitly defined with
+     * the special class member <code>serialPersistentFields</code>.
+     *
+     * @see #serializableFields()
+     * @see SerialFieldTagImpl
+     */
+    public boolean definesSerializableFields() {
+        if (!isSerializable() || isExternalizable()) {
+            return false;
+        } else {
+            if (serializedForm == null) {
+                serializedForm = new SerializedForm(env, tsym, this);
+            }
+            //### Clone this?
+            return serializedForm.definesSerializableFields();
+        }
+    }
+
+    /**
+     * Determine if a class is a RuntimeException.
+     * <p>
+     * Used only by ThrowsTagImpl.
+     */
+    boolean isRuntimeException() {
+        return tsym.isSubClass(env.syms.runtimeExceptionType.tsym, env.types);
+    }
+
+    /**
+     * Return the source position of the entity, or null if
+     * no position is available.
+     */
+    @Override
+    public SourcePosition position() {
+        if (tsym.sourcefile == null) return null;
+        return SourcePositionImpl.make(tsym.sourcefile,
+                                       (tree==null) ? Position.NOPOS : tree.pos,
+                                       lineMap);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,460 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import com.sun.javadoc.*;
+import com.sun.tools.javac.util.ListBuffer;
+
+/**
+ * Comment contains all information in comment part.
+ *      It allows users to get first sentence of this comment, get
+ *      comment for different tags...
+ *
+ *  <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>
+ *
+ * @author Kaiyang Liu (original)
+ * @author Robert Field (rewrite)
+ * @author Atul M Dambalkar
+ * @author Neal Gafter (rewrite)
+ */
+class Comment {
+
+    /**
+     * sorted comments with different tags.
+     */
+    private final ListBuffer<Tag> tagList = new ListBuffer<>();
+
+    /**
+     * text minus any tags.
+     */
+    private String text;
+
+    /**
+     * Doc environment
+     */
+    private final DocEnv docenv;
+
+    /**
+     * constructor of Comment.
+     */
+    Comment(final DocImpl holder, final String commentString) {
+        this.docenv = holder.env;
+
+        /**
+         * Separate the comment into the text part and zero to N tags.
+         * Simple state machine is in one of three states:
+         * <pre>
+         * IN_TEXT: parsing the comment text or tag text.
+         * TAG_NAME: parsing the name of a tag.
+         * TAG_GAP: skipping through the gap between the tag name and
+         * the tag text.
+         * </pre>
+         */
+        @SuppressWarnings("fallthrough")
+        class CommentStringParser {
+            /**
+             * The entry point to the comment string parser
+             */
+            void parseCommentStateMachine() {
+                final int IN_TEXT = 1;
+                final int TAG_GAP = 2;
+                final int TAG_NAME = 3;
+                int state = TAG_GAP;
+                boolean newLine = true;
+                String tagName = null;
+                int tagStart = 0;
+                int textStart = 0;
+                int lastNonWhite = -1;
+                int len = commentString.length();
+                for (int inx = 0; inx < len; ++inx) {
+                    char ch = commentString.charAt(inx);
+                    boolean isWhite = Character.isWhitespace(ch);
+                    switch (state)  {
+                        case TAG_NAME:
+                            if (isWhite) {
+                                tagName = commentString.substring(tagStart, inx);
+                                state = TAG_GAP;
+                            }
+                            break;
+                        case TAG_GAP:
+                            if (isWhite) {
+                                break;
+                            }
+                            textStart = inx;
+                            state = IN_TEXT;
+                            /* fall thru */
+                        case IN_TEXT:
+                            if (newLine && ch == '@') {
+                                parseCommentComponent(tagName, textStart,
+                                                      lastNonWhite+1);
+                                tagStart = inx;
+                                state = TAG_NAME;
+                            }
+                            break;
+                    }
+                    if (ch == '\n') {
+                        newLine = true;
+                    } else if (!isWhite) {
+                        lastNonWhite = inx;
+                        newLine = false;
+                    }
+                }
+                // Finish what's currently being processed
+                switch (state)  {
+                    case TAG_NAME:
+                        tagName = commentString.substring(tagStart, len);
+                        /* fall thru */
+                    case TAG_GAP:
+                        textStart = len;
+                        /* fall thru */
+                    case IN_TEXT:
+                        parseCommentComponent(tagName, textStart, lastNonWhite+1);
+                        break;
+                }
+            }
+
+            /**
+             * Save away the last parsed item.
+             */
+            void parseCommentComponent(String tagName,
+                                       int from, int upto) {
+                String tx = upto <= from ? "" : commentString.substring(from, upto);
+                if (tagName == null) {
+                    text = tx;
+                } else {
+                    TagImpl tag;
+                    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);
+                }
+            }
+
+            void warnIfEmpty(String tagName, String tx) {
+                if (tx.length() == 0) {
+                    docenv.warning(holder, "tag.tag_has_no_arguments", tagName);
+                }
+            }
+
+        }
+
+        new CommentStringParser().parseCommentStateMachine();
+    }
+
+    /**
+     * Return the text of the comment.
+     */
+    String commentText() {
+        return text;
+    }
+
+    /**
+     * Return all tags in this comment.
+     */
+    Tag[] tags() {
+        return tagList.toArray(new Tag[tagList.length()]);
+    }
+
+    /**
+     * Return tags of the specified kind in this comment.
+     */
+    Tag[] tags(String tagname) {
+        ListBuffer<Tag> found = new ListBuffer<>();
+        String target = tagname;
+        if (target.charAt(0) != '@') {
+            target = "@" + target;
+        }
+        for (Tag tag : tagList) {
+            if (tag.kind().equals(target)) {
+                found.append(tag);
+            }
+        }
+        return found.toArray(new Tag[found.length()]);
+    }
+
+    /**
+     * Return throws tags in this comment.
+     */
+    ThrowsTag[] throwsTags() {
+        ListBuffer<ThrowsTag> found = new ListBuffer<>();
+        for (Tag next : tagList) {
+            if (next instanceof ThrowsTag) {
+                found.append((ThrowsTag)next);
+            }
+        }
+        return found.toArray(new ThrowsTag[found.length()]);
+    }
+
+    /**
+     * Return param tags (excluding type param tags) in this comment.
+     */
+    ParamTag[] paramTags() {
+        return paramTags(false);
+    }
+
+    /**
+     * Return type param tags in this comment.
+     */
+    ParamTag[] typeParamTags() {
+        return paramTags(true);
+    }
+
+    /**
+     * Return param tags in this comment.  If typeParams is true
+     * include only type param tags, otherwise include only ordinary
+     * param tags.
+     */
+    private ParamTag[] paramTags(boolean typeParams) {
+        ListBuffer<ParamTag> found = new ListBuffer<>();
+        for (Tag next : tagList) {
+            if (next instanceof ParamTag) {
+                ParamTag p = (ParamTag)next;
+                if (typeParams == p.isTypeParameter()) {
+                    found.append(p);
+                }
+            }
+        }
+        return found.toArray(new ParamTag[found.length()]);
+    }
+
+    /**
+     * Return see also tags in this comment.
+     */
+    SeeTag[] seeTags() {
+        ListBuffer<SeeTag> found = new ListBuffer<>();
+        for (Tag next : tagList) {
+            if (next instanceof SeeTag) {
+                found.append((SeeTag)next);
+            }
+        }
+        return found.toArray(new SeeTag[found.length()]);
+    }
+
+    /**
+     * Return serialField tags in this comment.
+     */
+    SerialFieldTag[] serialFieldTags() {
+        ListBuffer<SerialFieldTag> found = new ListBuffer<>();
+        for (Tag next : tagList) {
+            if (next instanceof SerialFieldTag) {
+                found.append((SerialFieldTag)next);
+            }
+        }
+        return found.toArray(new SerialFieldTag[found.length()]);
+    }
+
+    /**
+     * 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<>();
+        int delimend = 0, textstart = 0, len = inlinetext.length();
+        boolean inPre = false;
+        DocEnv docenv = holder.env;
+
+        if (len == 0) {
+            return taglist.toArray(new Tag[taglist.length()]);
+        }
+        while (true) {
+            int linkstart;
+            if ((linkstart = inlineTagFound(holder, inlinetext,
+                                            textstart)) == -1) {
+                taglist.append(new TagImpl(holder, "Text",
+                                           inlinetext.substring(textstart)));
+                break;
+            } else {
+                inPre = scanForPre(inlinetext, textstart, linkstart, inPre);
+                int seetextstart = linkstart;
+                for (int i = linkstart; i < inlinetext.length(); i++) {
+                    char c = inlinetext.charAt(i);
+                    if (Character.isWhitespace(c) ||
+                        c == '}') {
+                        seetextstart = i;
+                        break;
+                     }
+                }
+                String linkName = inlinetext.substring(linkstart+2, seetextstart);
+                if (!(inPre && (linkName.equals("code") || linkName.equals("literal")))) {
+                    //Move past the white space after the inline tag name.
+                    while (Character.isWhitespace(inlinetext.
+                                                      charAt(seetextstart))) {
+                        if (inlinetext.length() <= seetextstart) {
+                            taglist.append(new TagImpl(holder, "Text",
+                                                       inlinetext.substring(textstart, seetextstart)));
+                            docenv.warning(holder,
+                                           "tag.Improper_Use_Of_Link_Tag",
+                                           inlinetext);
+                            return taglist.toArray(new Tag[taglist.length()]);
+                        } else {
+                            seetextstart++;
+                        }
+                    }
+                }
+                taglist.append(new TagImpl(holder, "Text",
+                                           inlinetext.substring(textstart, linkstart)));
+                textstart = seetextstart;   // this text is actually seetag
+                if ((delimend = findInlineTagDelim(inlinetext, textstart)) == -1) {
+                    //Missing closing '}' character.
+                    // store the text as it is with the {@link.
+                    taglist.append(new TagImpl(holder, "Text",
+                                               inlinetext.substring(textstart)));
+                    docenv.warning(holder,
+                                   "tag.End_delimiter_missing_for_possible_SeeTag",
+                                   inlinetext);
+                    return taglist.toArray(new Tag[taglist.length()]);
+                } else {
+                    //Found closing '}' character.
+                    if (linkName.equals("see")
+                           || linkName.equals("link")
+                           || linkName.equals("linkplain")) {
+                        taglist.append( new SeeTagImpl(holder, "@" + linkName,
+                              inlinetext.substring(textstart, delimend)));
+                    } else {
+                        taglist.append( new TagImpl(holder, "@" + linkName,
+                              inlinetext.substring(textstart, delimend)));
+                    }
+                    textstart = delimend + 1;
+                }
+            }
+            if (textstart == inlinetext.length()) {
+                break;
+            }
+        }
+        return taglist.toArray(new Tag[taglist.length()]);
+    }
+
+    /** regex for case-insensitive match for {@literal <pre> } and  {@literal </pre> }. */
+    private static final Pattern prePat = Pattern.compile("(?i)<(/?)pre>");
+
+    private static boolean scanForPre(String inlinetext, int start, int end, boolean inPre) {
+        Matcher m = prePat.matcher(inlinetext).region(start, end);
+        while (m.find()) {
+            inPre = m.group(1).isEmpty();
+        }
+        return inPre;
+    }
+
+    /**
+     * Recursively find the index of the closing '}' character for an inline tag
+     * and return it.  If it can't be found, return -1.
+     * @param inlineText the text to search in.
+     * @param searchStart the index of the place to start searching at.
+     * @return the index of the closing '}' character for an inline tag.
+     * If it can't be found, return -1.
+     */
+    private static int findInlineTagDelim(String inlineText, int searchStart) {
+        int delimEnd, nestedOpenBrace;
+        if ((delimEnd = inlineText.indexOf("}", searchStart)) == -1) {
+            return -1;
+        } else if (((nestedOpenBrace = inlineText.indexOf("{", searchStart)) != -1) &&
+            nestedOpenBrace < delimEnd){
+            //Found a nested open brace.
+            int nestedCloseBrace = findInlineTagDelim(inlineText, nestedOpenBrace + 1);
+            return (nestedCloseBrace != -1) ?
+                findInlineTagDelim(inlineText, nestedCloseBrace + 1) :
+                -1;
+        } else {
+            return delimEnd;
+        }
+    }
+
+    /**
+     * Recursively search for the characters '{', '@', followed by
+     * name of inline tag and white space,
+     * if found
+     *    return the index of the text following the white space.
+     * else
+     *    return -1.
+     */
+    private static int inlineTagFound(DocImpl holder, String inlinetext, int start) {
+        DocEnv docenv = holder.env;
+        int linkstart = inlinetext.indexOf("{@", start);
+        if (start == inlinetext.length() || linkstart == -1) {
+            return -1;
+        } else if (inlinetext.indexOf('}', linkstart) == -1) {
+            //Missing '}'.
+            docenv.warning(holder, "tag.Improper_Use_Of_Link_Tag",
+                    inlinetext.substring(linkstart, inlinetext.length()));
+            return -1;
+        } else {
+            return linkstart;
+        }
+    }
+
+
+    /**
+     * Return array of tags for the locale specific first sentence in the text.
+     */
+    static Tag[] firstSentenceTags(DocImpl holder, String text) {
+        DocLocale doclocale = holder.env.doclocale;
+        return getInlineTags(holder,
+                             doclocale.localeSpecificFirstSentence(holder, text));
+    }
+
+    /**
+     * Return text for this Doc comment.
+     */
+    @Override
+    public String toString() {
+        return text;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ConstructorDocImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,103 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import com.sun.javadoc.*;
+
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.MethodSymbol;
+
+/**
+ * Represents a constructor of a java class.
+ *
+ *  <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>
+ *
+ * @since 1.2
+ * @author Robert Field
+ * @author Neal Gafter (rewrite)
+ */
+
+public class ConstructorDocImpl
+        extends ExecutableMemberDocImpl implements ConstructorDoc {
+
+    /**
+     * constructor.
+     */
+    public ConstructorDocImpl(DocEnv env, MethodSymbol sym) {
+        super(env, sym);
+    }
+
+    /**
+     * constructor.
+     */
+    public ConstructorDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) {
+        super(env, sym, treePath);
+    }
+
+    /**
+     * Return true if it is a constructor, which it is.
+     *
+     * @return true
+     */
+    public boolean isConstructor() {
+        return true;
+    }
+
+    /**
+     * Get the name.
+     *
+     * @return the name of the member.
+     */
+    public String name() {
+        ClassSymbol c = sym.enclClass();
+        return c.name.toString();
+    }
+
+    /**
+     * Get the name.
+     *
+     * @return the qualified name of the member.
+     */
+    public String qualifiedName() {
+        return sym.enclClass().getQualifiedName().toString();
+    }
+
+    /**
+     * Returns a string representation of this constructor.  Includes the
+     * qualified signature and any type parameters.
+     * Type parameters precede the class name, as they do in the syntax
+     * for invoking constructors with explicit type parameters using "new".
+     * (This is unlike the syntax for invoking methods with explicit type
+     * parameters.)
+     */
+    public String toString() {
+        return typeParametersString() + qualifiedName() + signature();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,869 @@
+/*
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.javadoc.main;
+
+import java.lang.reflect.Modifier;
+import java.util.*;
+
+import javax.tools.JavaFileManager;
+
+import com.sun.javadoc.*;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreePath;
+import com.sun.tools.doclint.DocLint;
+import com.sun.tools.javac.api.BasicJavacTask;
+import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.CompletionFailure;
+import com.sun.tools.javac.code.Symbol.MethodSymbol;
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
+import com.sun.tools.javac.code.Symbol.VarSymbol;
+import com.sun.tools.javac.code.Type.ClassType;
+import com.sun.tools.javac.comp.Check;
+import com.sun.tools.javac.comp.Enter;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCClassDecl;
+import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
+import com.sun.tools.javac.tree.JCTree.JCPackageDecl;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Convert;
+import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Names;
+
+/**
+ * Holds the environment for a run of javadoc.
+ * Holds only the information needed throughout the
+ * run and not the compiler info that could be GC'ed
+ * or ported.
+ *
+ *  <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>
+ *
+ * @since 1.4
+ * @author Robert Field
+ * @author Neal Gafter (rewrite)
+ * @author Scott Seligman (generics)
+ */
+public class DocEnv {
+    protected static final Context.Key<DocEnv> docEnvKey = new Context.Key<>();
+
+    public static DocEnv instance(Context context) {
+        DocEnv instance = context.get(docEnvKey);
+        if (instance == null)
+            instance = new DocEnv(context);
+        return instance;
+    }
+
+    DocLocale doclocale;
+
+    private final Messager messager;
+
+    /** Predefined symbols known to the compiler. */
+    final Symtab syms;
+
+    /** Referenced directly in RootDocImpl. */
+    private final ClassFinder finder;
+
+    /** Javadoc's own version of the compiler's enter phase. */
+    final Enter enter;
+
+    /** The name table. */
+    private Names names;
+
+    /** The encoding name. */
+    private String encoding;
+
+    final Symbol externalizableSym;
+
+    /** Access filter (public, protected, ...).  */
+    protected ModifierFilter showAccess;
+
+    /** True if we are using a sentence BreakIterator. */
+    boolean breakiterator;
+
+    /**
+     * True if we do not want to print any notifications at all.
+     */
+    boolean quiet = false;
+
+    Check chk;
+    Types types;
+    JavaFileManager fileManager;
+    Context context;
+    DocLint doclint;
+
+    WeakHashMap<JCTree, TreePath> treePaths = new WeakHashMap<>();
+
+    /** Allow documenting from class files? */
+    boolean docClasses = false;
+
+    /** Does the doclet only expect pre-1.5 doclet API? */
+    protected boolean legacyDoclet = true;
+
+    /**
+     * Set this to true if you would like to not emit any errors, warnings and
+     * notices.
+     */
+    private boolean silent = false;
+
+    /**
+     * The source language version.
+     */
+    protected Source source;
+
+    /**
+     * Constructor
+     *
+     * @param context      Context for this javadoc instance.
+     */
+    protected DocEnv(Context context) {
+        context.put(docEnvKey, this);
+        this.context = context;
+
+        messager = Messager.instance0(context);
+        syms = Symtab.instance(context);
+        finder = JavadocClassFinder.instance(context);
+        enter = JavadocEnter.instance(context);
+        names = Names.instance(context);
+        externalizableSym = syms.enterClass(syms.java_base, names.fromString("java.io.Externalizable"));
+        chk = Check.instance(context);
+        types = Types.instance(context);
+        fileManager = context.get(JavaFileManager.class);
+        if (fileManager instanceof JavacFileManager) {
+            ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
+        }
+
+        // Default.  Should normally be reset with setLocale.
+        this.doclocale = new DocLocale(this, "", breakiterator);
+        source = Source.instance(context);
+    }
+
+    public void setSilent(boolean silent) {
+        this.silent = silent;
+    }
+
+    /**
+     * Look up ClassDoc by qualified name.
+     */
+    public ClassDocImpl lookupClass(String name) {
+        ClassSymbol c = getClassSymbol(name);
+        if (c != null) {
+            return getClassDoc(c);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Load ClassDoc by qualified name.
+     */
+    public ClassDocImpl loadClass(String name) {
+        try {
+            Name nameImpl = names.fromString(name);
+            ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl));
+            ClassSymbol c = finder.loadClass(mod != null ? mod : syms.errModule, nameImpl);
+            return getClassDoc(c);
+        } catch (CompletionFailure ex) {
+            chk.completionError(null, ex);
+            return null;
+        }
+    }
+
+    /**
+     * Look up PackageDoc by qualified name.
+     */
+    public PackageDocImpl lookupPackage(String name) {
+        //### Jing alleges that class check is needed
+        //### to avoid a compiler bug.  Most likely
+        //### instead a dummy created for error recovery.
+        //### Should investigate this.
+        Name nameImpl = names.fromString(name);
+        ModuleSymbol mod = syms.inferModule(nameImpl);
+        PackageSymbol p = mod != null ? syms.getPackage(mod, nameImpl) : null;
+        ClassSymbol c = getClassSymbol(name);
+        if (p != null && c == null) {
+            return getPackageDoc(p);
+        } else {
+            return null;
+        }
+    }
+        // where
+        /** Retrieve class symbol by fully-qualified name.
+         */
+        ClassSymbol getClassSymbol(String name) {
+            // Name may contain nested class qualification.
+            // Generate candidate flatnames with successively shorter
+            // package qualifiers and longer nested class qualifiers.
+            int nameLen = name.length();
+            char[] nameChars = name.toCharArray();
+            int idx = name.length();
+            for (;;) {
+                Name nameImpl = names.fromChars(nameChars, 0, nameLen);
+                ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl));
+                ClassSymbol s = mod != null ? syms.getClass(mod, nameImpl) : null;
+                if (s != null)
+                    return s; // found it!
+                idx = name.substring(0, idx).lastIndexOf('.');
+                if (idx < 0) break;
+                nameChars[idx] = '$';
+            }
+            return null;
+        }
+
+    /**
+     * Set the locale.
+     */
+    public void setLocale(String localeName) {
+        // create locale specifics
+        doclocale = new DocLocale(this, localeName, breakiterator);
+        // update Messager if locale has changed.
+        messager.setLocale(doclocale.locale);
+    }
+
+    /** Check whether this member should be documented. */
+    public boolean shouldDocument(VarSymbol sym) {
+        long mod = sym.flags();
+
+        if ((mod & Flags.SYNTHETIC) != 0) {
+            return false;
+        }
+
+        return showAccess.checkModifier(translateModifiers(mod));
+    }
+
+    /** Check whether this member should be documented. */
+    public boolean shouldDocument(MethodSymbol sym) {
+        long mod = sym.flags();
+
+        if ((mod & Flags.SYNTHETIC) != 0) {
+            return false;
+        }
+
+        return showAccess.checkModifier(translateModifiers(mod));
+    }
+
+    /** check whether this class should be documented. */
+    public boolean shouldDocument(ClassSymbol sym) {
+        return
+            (sym.flags_field&Flags.SYNTHETIC) == 0 && // no synthetics
+            (docClasses || getClassDoc(sym).tree != null) &&
+            isVisible(sym);
+    }
+
+    //### Comment below is inaccurate wrt modifier filter testing
+    /**
+     * Check the visibility if this is an nested class.
+     * if this is not a nested class, return true.
+     * if this is an static visible nested class,
+     *    return true.
+     * if this is an visible nested class
+     *    if the outer class is visible return true.
+     *    else return false.
+     * IMPORTANT: This also allows, static nested classes
+     * to be defined inside an nested class, which is not
+     * allowed by the compiler. So such an test case will
+     * not reach upto this method itself, but if compiler
+     * allows it, then that will go through.
+     */
+    protected boolean isVisible(ClassSymbol sym) {
+        long mod = sym.flags_field;
+        if (!showAccess.checkModifier(translateModifiers(mod))) {
+            return false;
+        }
+        ClassSymbol encl = sym.owner.enclClass();
+        return (encl == null || (mod & Flags.STATIC) != 0 || isVisible(encl));
+    }
+
+    //---------------- print forwarders ----------------//
+
+    /**
+     * Print error message, increment error count.
+     *
+     * @param msg message to print.
+     */
+    public void printError(String msg) {
+        if (silent)
+            return;
+        messager.printError(msg);
+    }
+
+    /**
+     * Print error message, increment error count.
+     *
+     * @param key selects message from resource
+     */
+    public void error(DocImpl doc, String key) {
+        if (silent)
+            return;
+        messager.error(doc==null ? null : doc.position(), key);
+    }
+
+    /**
+     * Print error message, increment error count.
+     *
+     * @param key selects message from resource
+     */
+    public void error(SourcePosition pos, String key) {
+        if (silent)
+            return;
+        messager.error(pos, key);
+    }
+
+    /**
+     * Print error message, increment error count.
+     *
+     * @param msg message to print.
+     */
+    public void printError(SourcePosition pos, String msg) {
+        if (silent)
+            return;
+        messager.printError(pos, msg);
+    }
+
+    /**
+     * Print error message, increment error count.
+     *
+     * @param key selects message from resource
+     * @param a1 first argument
+     */
+    public void error(DocImpl doc, String key, String a1) {
+        if (silent)
+            return;
+        messager.error(doc==null ? null : doc.position(), key, a1);
+    }
+
+    /**
+     * Print error message, increment error count.
+     *
+     * @param key selects message from resource
+     * @param a1 first argument
+     * @param a2 second argument
+     */
+    public void error(DocImpl doc, String key, String a1, String a2) {
+        if (silent)
+            return;
+        messager.error(doc==null ? null : doc.position(), key, a1, a2);
+    }
+
+    /**
+     * Print error message, increment error count.
+     *
+     * @param key selects message from resource
+     * @param a1 first argument
+     * @param a2 second argument
+     * @param a3 third argument
+     */
+    public void error(DocImpl doc, String key, String a1, String a2, String a3) {
+        if (silent)
+            return;
+        messager.error(doc==null ? null : doc.position(), key, a1, a2, a3);
+    }
+
+    /**
+     * Print warning message, increment warning count.
+     *
+     * @param msg message to print.
+     */
+    public void printWarning(String msg) {
+        if (silent)
+            return;
+        messager.printWarning(msg);
+    }
+
+    /**
+     * Print warning message, increment warning count.
+     *
+     * @param key selects message from resource
+     */
+    public void warning(DocImpl doc, String key) {
+        if (silent)
+            return;
+        messager.warning(doc==null ? null : doc.position(), key);
+    }
+
+    /**
+     * Print warning message, increment warning count.
+     *
+     * @param msg message to print.
+     */
+    public void printWarning(SourcePosition pos, String msg) {
+        if (silent)
+            return;
+        messager.printWarning(pos, msg);
+    }
+
+    /**
+     * Print warning message, increment warning count.
+     *
+     * @param key selects message from resource
+     * @param a1 first argument
+     */
+    public void warning(DocImpl doc, String key, String a1) {
+        if (silent)
+            return;
+        // suppress messages that have (probably) been covered by doclint
+        if (doclint != null && doc != null && key.startsWith("tag"))
+            return;
+        messager.warning(doc==null ? null : doc.position(), key, a1);
+    }
+
+    /**
+     * Print warning message, increment warning count.
+     *
+     * @param key selects message from resource
+     * @param a1 first argument
+     * @param a2 second argument
+     */
+    public void warning(DocImpl doc, String key, String a1, String a2) {
+        if (silent)
+            return;
+        messager.warning(doc==null ? null : doc.position(), key, a1, a2);
+    }
+
+    /**
+     * Print warning message, increment warning count.
+     *
+     * @param key selects message from resource
+     * @param a1 first argument
+     * @param a2 second argument
+     * @param a3 third argument
+     */
+    public void warning(DocImpl doc, String key, String a1, String a2, String a3) {
+        if (silent)
+            return;
+        messager.warning(doc==null ? null : doc.position(), key, a1, a2, a3);
+    }
+
+    /**
+     * Print warning message, increment warning count.
+     *
+     * @param key selects message from resource
+     * @param a1 first argument
+     * @param a2 second argument
+     * @param a3 third argument
+     */
+    public void warning(DocImpl doc, String key, String a1, String a2, String a3,
+                        String a4) {
+        if (silent)
+            return;
+        messager.warning(doc==null ? null : doc.position(), key, a1, a2, a3, a4);
+    }
+
+    /**
+     * Print a message.
+     *
+     * @param msg message to print.
+     */
+    public void printNotice(String msg) {
+        if (silent || quiet)
+            return;
+        messager.printNotice(msg);
+    }
+
+
+    /**
+     * Print a message.
+     *
+     * @param key selects message from resource
+     */
+    public void notice(String key) {
+        if (silent || quiet)
+            return;
+        messager.notice(key);
+    }
+
+    /**
+     * Print a message.
+     *
+     * @param msg message to print.
+     */
+    public void printNotice(SourcePosition pos, String msg) {
+        if (silent || quiet)
+            return;
+        messager.printNotice(pos, msg);
+    }
+
+    /**
+     * Print a message.
+     *
+     * @param key selects message from resource
+     * @param a1 first argument
+     */
+    public void notice(String key, String a1) {
+        if (silent || quiet)
+            return;
+        messager.notice(key, a1);
+    }
+
+    /**
+     * Print a message.
+     *
+     * @param key selects message from resource
+     * @param a1 first argument
+     * @param a2 second argument
+     */
+    public void notice(String key, String a1, String a2) {
+        if (silent || quiet)
+            return;
+        messager.notice(key, a1, a2);
+    }
+
+    /**
+     * Print a message.
+     *
+     * @param key selects message from resource
+     * @param a1 first argument
+     * @param a2 second argument
+     * @param a3 third argument
+     */
+    public void notice(String key, String a1, String a2, String a3) {
+        if (silent || quiet)
+            return;
+        messager.notice(key, a1, a2, a3);
+    }
+
+    /**
+     * Exit, reporting errors and warnings.
+     */
+    public void exit() {
+        // Messager should be replaced by a more general
+        // compilation environment.  This can probably
+        // subsume DocEnv as well.
+        messager.exit();
+    }
+
+    protected Map<PackageSymbol, PackageDocImpl> packageMap = new HashMap<>();
+    /**
+     * Return the PackageDoc of this package symbol.
+     */
+    public PackageDocImpl getPackageDoc(PackageSymbol pack) {
+        PackageDocImpl result = packageMap.get(pack);
+        if (result != null) return result;
+        result = new PackageDocImpl(this, pack);
+        packageMap.put(pack, result);
+        return result;
+    }
+
+    /**
+     * Create the PackageDoc (or a subtype) for a package symbol.
+     */
+    void makePackageDoc(PackageSymbol pack, TreePath treePath) {
+        PackageDocImpl result = packageMap.get(pack);
+        if (result != null) {
+            if (treePath != null) result.setTreePath(treePath);
+        } else {
+            result = new PackageDocImpl(this, pack, treePath);
+            packageMap.put(pack, result);
+        }
+    }
+
+
+    protected Map<ClassSymbol, ClassDocImpl> classMap = new HashMap<>();
+    /**
+     * Return the ClassDoc (or a subtype) of this class symbol.
+     */
+    public ClassDocImpl getClassDoc(ClassSymbol clazz) {
+        ClassDocImpl result = classMap.get(clazz);
+        if (result != null) return result;
+        if (isAnnotationType(clazz)) {
+            result = new AnnotationTypeDocImpl(this, clazz);
+        } else {
+            result = new ClassDocImpl(this, clazz);
+        }
+        classMap.put(clazz, result);
+        return result;
+    }
+
+    /**
+     * Create the ClassDoc (or a subtype) for a class symbol.
+     */
+    protected void makeClassDoc(ClassSymbol clazz, TreePath treePath) {
+        ClassDocImpl result = classMap.get(clazz);
+        if (result != null) {
+            if (treePath != null) result.setTreePath(treePath);
+            return;
+        }
+        if (isAnnotationType((JCClassDecl) treePath.getLeaf())) {   // flags of clazz may not yet be set
+            result = new AnnotationTypeDocImpl(this, clazz, treePath);
+        } else {
+            result = new ClassDocImpl(this, clazz, treePath);
+        }
+        classMap.put(clazz, result);
+    }
+
+    protected static boolean isAnnotationType(ClassSymbol clazz) {
+        return ClassDocImpl.isAnnotationType(clazz);
+    }
+
+    protected static boolean isAnnotationType(JCClassDecl tree) {
+        return (tree.mods.flags & Flags.ANNOTATION) != 0;
+    }
+
+    protected Map<VarSymbol, FieldDocImpl> fieldMap = new HashMap<>();
+    /**
+     * Return the FieldDoc of this var symbol.
+     */
+    public FieldDocImpl getFieldDoc(VarSymbol var) {
+        FieldDocImpl result = fieldMap.get(var);
+        if (result != null) return result;
+        result = new FieldDocImpl(this, var);
+        fieldMap.put(var, result);
+        return result;
+    }
+    /**
+     * Create a FieldDoc for a var symbol.
+     */
+    protected void makeFieldDoc(VarSymbol var, TreePath treePath) {
+        FieldDocImpl result = fieldMap.get(var);
+        if (result != null) {
+            if (treePath != null) result.setTreePath(treePath);
+        } else {
+            result = new FieldDocImpl(this, var, treePath);
+            fieldMap.put(var, result);
+        }
+    }
+
+    protected Map<MethodSymbol, ExecutableMemberDocImpl> methodMap = new HashMap<>();
+    /**
+     * Create a MethodDoc for this MethodSymbol.
+     * Should be called only on symbols representing methods.
+     */
+    protected void makeMethodDoc(MethodSymbol meth, TreePath treePath) {
+        MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
+        if (result != null) {
+            if (treePath != null) result.setTreePath(treePath);
+        } else {
+            result = new MethodDocImpl(this, meth, treePath);
+            methodMap.put(meth, result);
+        }
+    }
+
+    /**
+     * Return the MethodDoc for a MethodSymbol.
+     * Should be called only on symbols representing methods.
+     */
+    public MethodDocImpl getMethodDoc(MethodSymbol meth) {
+        assert !meth.isConstructor() : "not expecting a constructor symbol";
+        MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
+        if (result != null) return result;
+        result = new MethodDocImpl(this, meth);
+        methodMap.put(meth, result);
+        return result;
+    }
+
+    /**
+     * Create the ConstructorDoc for a MethodSymbol.
+     * Should be called only on symbols representing constructors.
+     */
+    protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) {
+        ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
+        if (result != null) {
+            if (treePath != null) result.setTreePath(treePath);
+        } else {
+            result = new ConstructorDocImpl(this, meth, treePath);
+            methodMap.put(meth, result);
+        }
+    }
+
+    /**
+     * Return the ConstructorDoc for a MethodSymbol.
+     * Should be called only on symbols representing constructors.
+     */
+    public ConstructorDocImpl getConstructorDoc(MethodSymbol meth) {
+        assert meth.isConstructor() : "expecting a constructor symbol";
+        ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
+        if (result != null) return result;
+        result = new ConstructorDocImpl(this, meth);
+        methodMap.put(meth, result);
+        return result;
+    }
+
+    /**
+     * Create the AnnotationTypeElementDoc for a MethodSymbol.
+     * Should be called only on symbols representing annotation type elements.
+     */
+    protected void makeAnnotationTypeElementDoc(MethodSymbol meth, TreePath treePath) {
+        AnnotationTypeElementDocImpl result =
+            (AnnotationTypeElementDocImpl)methodMap.get(meth);
+        if (result != null) {
+            if (treePath != null) result.setTreePath(treePath);
+        } else {
+            result =
+                new AnnotationTypeElementDocImpl(this, meth, treePath);
+            methodMap.put(meth, result);
+        }
+    }
+
+    /**
+     * Return the AnnotationTypeElementDoc for a MethodSymbol.
+     * Should be called only on symbols representing annotation type elements.
+     */
+    public AnnotationTypeElementDocImpl getAnnotationTypeElementDoc(
+            MethodSymbol meth) {
+
+        AnnotationTypeElementDocImpl result =
+            (AnnotationTypeElementDocImpl)methodMap.get(meth);
+        if (result != null) return result;
+        result = new AnnotationTypeElementDocImpl(this, meth);
+        methodMap.put(meth, result);
+        return result;
+    }
+
+//  private Map<ClassType, ParameterizedTypeImpl> parameterizedTypeMap =
+//          new HashMap<ClassType, ParameterizedTypeImpl>();
+    /**
+     * Return the ParameterizedType of this instantiation.
+//   * ### Could use Type.sameTypeAs() instead of equality matching in hashmap
+//   * ### to avoid some duplication.
+     */
+    ParameterizedTypeImpl getParameterizedType(ClassType t) {
+        return new ParameterizedTypeImpl(this, t);
+//      ParameterizedTypeImpl result = parameterizedTypeMap.get(t);
+//      if (result != null) return result;
+//      result = new ParameterizedTypeImpl(this, t);
+//      parameterizedTypeMap.put(t, result);
+//      return result;
+    }
+
+    TreePath getTreePath(JCCompilationUnit tree) {
+        TreePath p = treePaths.get(tree);
+        if (p == null)
+            treePaths.put(tree, p = new TreePath(tree));
+        return p;
+    }
+
+    TreePath getTreePath(JCCompilationUnit toplevel, JCPackageDecl tree) {
+        TreePath p = treePaths.get(tree);
+        if (p == null)
+            treePaths.put(tree, p = new TreePath(getTreePath(toplevel), tree));
+        return p;
+    }
+
+    TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl tree) {
+        TreePath p = treePaths.get(tree);
+        if (p == null)
+            treePaths.put(tree, p = new TreePath(getTreePath(toplevel), tree));
+        return p;
+    }
+
+    TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl cdecl, JCTree tree) {
+        return new TreePath(getTreePath(toplevel, cdecl), tree);
+    }
+
+    /**
+     * Set the encoding.
+     */
+    public void setEncoding(String encoding) {
+        this.encoding = encoding;
+    }
+
+    /**
+     * Get the encoding.
+     */
+    public String getEncoding() {
+        return encoding;
+    }
+
+    /**
+     * Convert modifier bits from private coding used by
+     * the compiler to that of java.lang.reflect.Modifier.
+     */
+    static int translateModifiers(long flags) {
+        int result = 0;
+        if ((flags & Flags.ABSTRACT) != 0)
+            result |= Modifier.ABSTRACT;
+        if ((flags & Flags.FINAL) != 0)
+            result |= Modifier.FINAL;
+        if ((flags & Flags.INTERFACE) != 0)
+            result |= Modifier.INTERFACE;
+        if ((flags & Flags.NATIVE) != 0)
+            result |= Modifier.NATIVE;
+        if ((flags & Flags.PRIVATE) != 0)
+            result |= Modifier.PRIVATE;
+        if ((flags & Flags.PROTECTED) != 0)
+            result |= Modifier.PROTECTED;
+        if ((flags & Flags.PUBLIC) != 0)
+            result |= Modifier.PUBLIC;
+        if ((flags & Flags.STATIC) != 0)
+            result |= Modifier.STATIC;
+        if ((flags & Flags.SYNCHRONIZED) != 0)
+            result |= Modifier.SYNCHRONIZED;
+        if ((flags & Flags.TRANSIENT) != 0)
+            result |= Modifier.TRANSIENT;
+        if ((flags & Flags.VOLATILE) != 0)
+            result |= Modifier.VOLATILE;
+        return result;
+    }
+
+    void initDoclint(Collection<String> opts, Collection<String> customTagNames, String htmlVersion) {
+        ArrayList<String> doclintOpts = new ArrayList<>();
+        boolean msgOptionSeen = false;
+
+        for (String opt : opts) {
+            if (opt.startsWith(DocLint.XMSGS_OPTION)) {
+                if (opt.equals(DocLint.XMSGS_CUSTOM_PREFIX + "none"))
+                    return;
+                msgOptionSeen = true;
+            }
+            doclintOpts.add(opt);
+        }
+
+        if (!msgOptionSeen) {
+            doclintOpts.add(DocLint.XMSGS_OPTION);
+        }
+
+        String sep = "";
+        StringBuilder customTags = new StringBuilder();
+        for (String customTag : customTagNames) {
+            customTags.append(sep);
+            customTags.append(customTag);
+            sep = DocLint.SEPARATOR;
+        }
+        doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());
+        doclintOpts.add(DocLint.XHTML_VERSION_PREFIX + htmlVersion);
+
+        JavacTask t = BasicJavacTask.instance(context);
+        doclint = new DocLint();
+        // standard doclet normally generates H1, H2
+        doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
+        doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
+    }
+
+    boolean showTagMessages() {
+        return (doclint == null);
+    }
+
+    Map<CompilationUnitTree, Boolean> shouldCheck = new HashMap<>();
+
+    boolean shouldCheck(CompilationUnitTree unit) {
+        return shouldCheck.computeIfAbsent(unit, doclint :: shouldCheck);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,444 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.CollationKey;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.tools.FileObject;
+
+import com.sun.javadoc.*;
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
+import com.sun.tools.javac.util.Position;
+
+/**
+ * abstract base class of all Doc classes.  Doc item's are representations
+ * of java language constructs (class, package, method,...) which have
+ * comments and have been processed by this run of javadoc.  All Doc items
+ * are unique, that is, they are == comparable.
+ *
+ *  <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>
+ *
+ * @since 1.2
+ * @author Robert Field
+ * @author Atul M Dambalkar
+ * @author Neal Gafter (rewrite)
+ */
+public abstract class DocImpl implements Doc, Comparable<Object> {
+
+    /**
+     * Doc environment
+     */
+    protected final DocEnv env;   //### Rename this everywhere to 'docenv' ?
+
+    /**
+     * Back pointer to the tree node for this doc item.
+     * May be null if there is no associated tree.
+     */
+    protected TreePath treePath;
+
+    /**
+     *  The complex comment object, lazily initialized.
+     */
+    private Comment comment;
+
+    /**
+     * The cached sort key, to take care of Natural Language Text sorting.
+     */
+    private CollationKey collationkey = null;
+
+    /**
+     *  Raw documentation string.
+     */
+    protected String documentation;  // Accessed in PackageDocImpl, RootDocImpl
+
+    /**
+     * Cached first sentence.
+     */
+    private Tag[] firstSentence;
+
+    /**
+     * Cached inline tags.
+     */
+    private Tag[] inlineTags;
+
+    /**
+     * Constructor.
+     */
+    DocImpl(DocEnv env, TreePath treePath) {
+        this.treePath = treePath;
+        this.documentation = getCommentText(treePath);
+        this.env = env;
+    }
+
+    private static String getCommentText(TreePath p) {
+        if (p == null)
+            return null;
+
+        JCCompilationUnit topLevel = (JCCompilationUnit) p.getCompilationUnit();
+        JCTree tree = (JCTree) p.getLeaf();
+        return topLevel.docComments.getCommentText(tree);
+    }
+
+    /**
+     * So subclasses have the option to do lazy initialization of
+     * "documentation" string.
+     */
+    protected String documentation() {
+        if (documentation == null) documentation = "";
+        return documentation;
+    }
+
+    /**
+     * For lazy initialization of comment.
+     */
+    Comment comment() {
+        if (comment == null) {
+            String d = documentation();
+            if (env.doclint != null
+                    && treePath != null
+                    && env.shouldCheck(treePath.getCompilationUnit())
+                    && d.equals(getCommentText(treePath))) {
+                env.doclint.scan(treePath);
+            }
+            comment = new Comment(this, d);
+        }
+        return comment;
+    }
+
+    /**
+     * Return the text of the comment for this doc item.
+     * TagImpls have been removed.
+     */
+    public String commentText() {
+        return comment().commentText();
+    }
+
+    /**
+     * Return all tags in this Doc item.
+     *
+     * @return an array of TagImpl containing all tags on this Doc item.
+     */
+    public Tag[] tags() {
+        return comment().tags();
+    }
+
+    /**
+     * Return tags of the specified kind in this Doc item.
+     *
+     * @param tagname name of the tag kind to search for.
+     * @return an array of TagImpl containing all tags whose 'kind()'
+     * matches 'tagname'.
+     */
+    public Tag[] tags(String tagname) {
+        return comment().tags(tagname);
+    }
+
+    /**
+     * Return the see also tags in this Doc item.
+     *
+     * @return an array of SeeTag containing all &#64;see tags.
+     */
+    public SeeTag[] seeTags() {
+        return comment().seeTags();
+    }
+
+    public Tag[] inlineTags() {
+        if (inlineTags == null) {
+            inlineTags = Comment.getInlineTags(this, commentText());
+        }
+        return inlineTags;
+    }
+
+    public Tag[] firstSentenceTags() {
+        if (firstSentence == null) {
+            //Parse all sentences first to avoid duplicate warnings.
+            inlineTags();
+            try {
+                env.setSilent(true);
+                firstSentence = Comment.firstSentenceTags(this, commentText());
+            } finally {
+                env.setSilent(false);
+            }
+        }
+        return firstSentence;
+    }
+
+    /**
+     * Utility for subclasses which read HTML documentation files.
+     */
+    String readHTMLDocumentation(InputStream input, FileObject filename) throws IOException {
+        byte[] filecontents = new byte[input.available()];
+        try {
+            DataInputStream dataIn = new DataInputStream(input);
+            dataIn.readFully(filecontents);
+        } finally {
+            input.close();
+        }
+        String encoding = env.getEncoding();
+        String rawDoc = (encoding!=null)
+            ? new String(filecontents, encoding)
+            : new String(filecontents);
+        Pattern bodyPat = Pattern.compile("(?is).*<body\\b[^>]*>(.*)</body\\b.*");
+        Matcher m = bodyPat.matcher(rawDoc);
+        if (m.matches()) {
+            return m.group(1);
+        } else {
+            String key = rawDoc.matches("(?is).*<body\\b.*")
+                    ? "javadoc.End_body_missing_from_html_file"
+                    : "javadoc.Body_missing_from_html_file";
+            env.error(SourcePositionImpl.make(filename, Position.NOPOS, null), key);
+            return "";
+        }
+    }
+
+    /**
+     * Return the full unprocessed text of the comment.  Tags
+     * are included as text.  Used mainly for store and retrieve
+     * operations like internalization.
+     */
+    public String getRawCommentText() {
+        return documentation();
+    }
+
+    /**
+     * Set the full unprocessed text of the comment.  Tags
+     * are included as text.  Used mainly for store and retrieve
+     * operations like internalization.
+     */
+    public void setRawCommentText(String rawDocumentation) {
+        treePath = null;
+        documentation = rawDocumentation;
+        comment = null;
+    }
+
+    /**
+     * Set the full unprocessed text of the comment and tree path.
+     */
+    void setTreePath(TreePath treePath) {
+        this.treePath = treePath;
+        documentation = getCommentText(treePath);
+        comment = null;
+    }
+
+    /**
+     * return a key for sorting.
+     */
+    CollationKey key() {
+        if (collationkey == null) {
+            collationkey = generateKey();
+        }
+        return collationkey;
+    }
+
+    /**
+     * Generate a key for sorting.
+     * <p>
+     * Default is name().
+     */
+    CollationKey generateKey() {
+        String k = name();
+        // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
+        return env.doclocale.collator.getCollationKey(k);
+    }
+
+    /**
+     * Returns a string representation of this Doc item.
+     */
+    @Override
+    public String toString() {
+        return qualifiedName();
+    }
+
+    /**
+     * Returns the name of this Doc item.
+     *
+     * @return  the name
+     */
+    public abstract String name();
+
+    /**
+     * Returns the qualified name of this Doc item.
+     *
+     * @return  the name
+     */
+    public abstract String qualifiedName();
+
+    /**
+     * Compares this Object with the specified Object for order.  Returns a
+     * negative integer, zero, or a positive integer as this Object is less
+     * than, equal to, or greater than the given Object.
+     * <p>
+     * Included so that Doc item are java.lang.Comparable.
+     *
+     * @param   obj the {@code Object} to be compared.
+     * @return  a negative integer, zero, or a positive integer as this Object
+     *          is less than, equal to, or greater than the given Object.
+     * @exception ClassCastException the specified Object's type prevents it
+     *            from being compared to this Object.
+     */
+    public int compareTo(Object obj) {
+        // System.out.println("COMPARE \"" + this + "\" to \"" + obj + "\" = " + key().compareTo(((DocImpl)obj).key()));
+        return key().compareTo(((DocImpl)obj).key());
+    }
+
+    /**
+     * Is this Doc item a field?  False until overridden.
+     *
+     * @return true if it represents a field
+     */
+    public boolean isField() {
+        return false;
+    }
+
+    /**
+     * Is this Doc item an enum constant?  False until overridden.
+     *
+     * @return true if it represents an enum constant
+     */
+    public boolean isEnumConstant() {
+        return false;
+    }
+
+    /**
+     * Is this Doc item a constructor?  False until overridden.
+     *
+     * @return true if it represents a constructor
+     */
+    public boolean isConstructor() {
+        return false;
+    }
+
+    /**
+     * Is this Doc item a method (but not a constructor or annotation
+     * type element)?
+     * False until overridden.
+     *
+     * @return true if it represents a method
+     */
+    public boolean isMethod() {
+        return false;
+    }
+
+    /**
+     * Is this Doc item an annotation type element?
+     * False until overridden.
+     *
+     * @return true if it represents an annotation type element
+     */
+    public boolean isAnnotationTypeElement() {
+        return false;
+    }
+
+    /**
+     * Is this Doc item a interface (but not an annotation type)?
+     * False until overridden.
+     *
+     * @return true if it represents a interface
+     */
+    public boolean isInterface() {
+        return false;
+    }
+
+    /**
+     * Is this Doc item a exception class?  False until overridden.
+     *
+     * @return true if it represents a exception
+     */
+    public boolean isException() {
+        return false;
+    }
+
+    /**
+     * Is this Doc item a error class?  False until overridden.
+     *
+     * @return true if it represents a error
+     */
+    public boolean isError() {
+        return false;
+    }
+
+    /**
+     * Is this Doc item an enum type?  False until overridden.
+     *
+     * @return true if it represents an enum type
+     */
+    public boolean isEnum() {
+        return false;
+    }
+
+    /**
+     * Is this Doc item an annotation type?  False until overridden.
+     *
+     * @return true if it represents an annotation type
+     */
+    public boolean isAnnotationType() {
+        return false;
+    }
+
+    /**
+     * Is this Doc item an ordinary class (i.e. not an interface,
+     * annotation type, enumeration, exception, or error)?
+     * False until overridden.
+     *
+     * @return true if it represents an ordinary class
+     */
+    public boolean isOrdinaryClass() {
+        return false;
+    }
+
+    /**
+     * Is this Doc item a class
+     * (and not an interface or annotation type)?
+     * This includes ordinary classes, enums, errors and exceptions.
+     * False until overridden.
+     *
+     * @return true if it represents a class
+     */
+    public boolean isClass() {
+        return false;
+    }
+
+    /**
+     * return true if this Doc is include in the active set.
+     */
+    public abstract boolean isIncluded();
+
+    /**
+     * Return the source position of the entity, or null if
+     * no position is available.
+     */
+    public SourcePosition position() { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocLocale.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,241 @@
+/*
+ * 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.tools.javadoc.main;
+
+import java.text.BreakIterator;
+import java.text.Collator;
+import java.util.Locale;
+
+/**
+ * This class holds the information about locales.
+ *
+ *  <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>
+ *
+ * @since 1.4
+ * @author Robert Field
+ */
+class DocLocale {
+
+    /**
+     * The locale name will be set by Main, if option is provided on the
+     * command line.
+     */
+    final String localeName;
+
+    /**
+     * The locale to be used. If user doesn't provide this,
+     * then set it to default locale value.
+     */
+    final Locale locale;
+
+    /**
+     * The collator for this application. This is to take care of Locale
+     * Specific or Natural Language Text sorting.
+     */
+    final Collator collator;
+
+    /**
+     * Enclosing DocEnv
+     */
+    private final DocEnv docenv;
+
+    /**
+     * Sentence instance from the BreakIterator.
+     */
+    private final BreakIterator sentenceBreaker;
+
+    /**
+     * True is we should use <code>BreakIterator</code>
+     * to compute first sentence.
+     */
+    private boolean useBreakIterator = false;
+
+    /**
+     * The HTML sentence terminators.
+     */
+    static final String[] sentenceTerminators =
+                    {
+                        "<p>", "</p>", "<h1>", "<h2>",
+                        "<h3>", "<h4>", "<h5>", "<h6>",
+                        "</h1>", "</h2>", "</h3>", "</h4>", "</h5>",
+                        "</h6>", "<hr>", "<pre>", "</pre>"
+                    };
+
+    /**
+     * Constructor
+     */
+    DocLocale(DocEnv docenv, String localeName, boolean useBreakIterator) {
+        this.docenv = docenv;
+        this.localeName = localeName;
+        this.useBreakIterator = useBreakIterator;
+        locale = getLocale();
+        if (locale == null) {
+            docenv.exit();
+        } else {
+            Locale.setDefault(locale); // NOTE: updating global state
+        }
+        collator = Collator.getInstance(locale);
+        sentenceBreaker = BreakIterator.getSentenceInstance(locale);
+    }
+
+    /**
+     * Get the locale if specified on the command line
+     * else return null and if locale option is not used
+     * then return default locale.
+     */
+    private Locale getLocale() {
+        Locale userlocale = null;
+        if (localeName.length() > 0) {
+            int firstuscore = localeName.indexOf('_');
+            int seconduscore = -1;
+            String language = null;
+            String country = null;
+            String variant = null;
+            if (firstuscore == 2) {
+                language = localeName.substring(0, firstuscore);
+                seconduscore = localeName.indexOf('_', firstuscore + 1);
+                if (seconduscore > 0) {
+                    if (seconduscore != firstuscore + 3 ||
+                           localeName.length() <= seconduscore + 1) {
+                        docenv.error(null, "main.malformed_locale_name", localeName);
+                        return null;
+                    }
+                    country = localeName.substring(firstuscore + 1,
+                                                   seconduscore);
+                    variant = localeName.substring(seconduscore + 1);
+                } else if (localeName.length() == firstuscore + 3) {
+                    country = localeName.substring(firstuscore + 1);
+                } else {
+                    docenv.error(null, "main.malformed_locale_name", localeName);
+                    return null;
+                }
+            } else if (firstuscore == -1 && localeName.length() == 2) {
+                language = localeName;
+            } else {
+                docenv.error(null, "main.malformed_locale_name", localeName);
+                return null;
+            }
+            userlocale = searchLocale(language, country, variant);
+            if (userlocale == null) {
+                docenv.error(null, "main.illegal_locale_name", localeName);
+                return null;
+            } else {
+                return userlocale;
+            }
+        } else {
+            return Locale.getDefault();
+        }
+    }
+
+    /**
+     * Search the locale for specified language, specified country and
+     * specified variant.
+     */
+    private Locale searchLocale(String language, String country,
+                                String variant) {
+        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;
+    }
+
+    String localeSpecificFirstSentence(DocImpl doc, String s) {
+        if (s == null || s.length() == 0) {
+            return "";
+        }
+        int index = s.indexOf("-->");
+        if(s.trim().startsWith("<!--") && index != -1) {
+            return localeSpecificFirstSentence(doc, s.substring(index + 3, s.length()));
+        }
+        if (useBreakIterator || !locale.getLanguage().equals("en")) {
+            sentenceBreaker.setText(s.replace('\n', ' '));
+            int start = sentenceBreaker.first();
+            int end = sentenceBreaker.next();
+            return s.substring(start, end).trim();
+        } else {
+            return englishLanguageFirstSentence(s).trim();
+        }
+    }
+
+    /**
+     * Return the first sentence of a string, where a sentence ends
+     * with a period followed be white space.
+     */
+    private String englishLanguageFirstSentence(String s) {
+        if (s == null) {
+            return null;
+        }
+        int len = s.length();
+        boolean period = false;
+        for (int i = 0 ; i < len ; i++) {
+            switch (s.charAt(i)) {
+                case '.':
+                    period = true;
+                    break;
+                case ' ':
+                case '\t':
+                case '\n':
+            case '\r':
+            case '\f':
+                    if (period) {
+                        return s.substring(0, i);
+                    }
+                    break;
+            case '<':
+                    if (i > 0) {
+                        if (htmlSentenceTerminatorFound(s, i)) {
+                            return s.substring(0, i);
+                        }
+                    }
+                    break;
+                default:
+                    period = false;
+            }
+        }
+        return s;
+    }
+
+    /**
+     * Find out if there is any HTML tag in the given string. If found
+     * return true else return false.
+     */
+    private boolean htmlSentenceTerminatorFound(String str, int index) {
+        for (String terminator : sentenceTerminators) {
+            if (str.regionMatches(true, index, terminator,
+                                  0, terminator.length())) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,439 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javadoc.main;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.regex.Pattern;
+
+import javax.tools.DocumentationTool;
+import javax.tools.JavaFileManager;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.util.ClientCodeException;
+import com.sun.tools.javac.util.List;
+
+import static com.sun.javadoc.LanguageVersion.*;
+
+
+/**
+ * Class creates, controls and invokes doclets.
+ *
+ *  <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>
+ *
+ * @author Neal Gafter (rewrite)
+ */
+public class DocletInvoker {
+
+    private final Class<?> docletClass;
+
+    private final String docletClassName;
+
+    private final ClassLoader appClassLoader;
+
+    private final Messager messager;
+
+    /**
+     * In API mode, exceptions thrown while calling the doclet are
+     * propagated using ClientCodeException.
+     */
+    private final boolean apiMode;
+
+    /**
+     * Whether javadoc internal API should be exported to doclets
+     * and (indirectly) to taglets
+     */
+    private final boolean exportInternalAPI;
+
+    private static class DocletInvokeException extends Exception {
+        private static final long serialVersionUID = 0;
+    }
+
+    private String appendPath(String path1, String path2) {
+        if (path1 == null || path1.length() == 0) {
+            return path2 == null ? "." : path2;
+        } else if (path2 == null || path2.length() == 0) {
+            return path1;
+        } else {
+            return path1  + File.pathSeparator + path2;
+        }
+    }
+
+    public DocletInvoker(Messager messager, Class<?> docletClass, boolean apiMode, boolean exportInternalAPI) {
+        this.messager = messager;
+        this.docletClass = docletClass;
+        docletClassName = docletClass.getName();
+        appClassLoader = null;
+        this.apiMode = apiMode;
+        this.exportInternalAPI = exportInternalAPI; // for backdoor use by standard doclet for taglets
+
+        // this may not be soon enough if the class has already been loaded
+        if (exportInternalAPI) {
+            exportInternalAPI(docletClass.getClassLoader());
+        }
+    }
+
+    public DocletInvoker(Messager messager, JavaFileManager fileManager,
+                         String docletClassName, String docletPath,
+                         ClassLoader docletParentClassLoader,
+                         boolean apiMode,
+                         boolean exportInternalAPI) {
+        this.messager = messager;
+        this.docletClassName = docletClassName;
+        this.apiMode = apiMode;
+        this.exportInternalAPI = exportInternalAPI; // for backdoor use by standard doclet for taglets
+
+        if (fileManager != null && fileManager.hasLocation(DocumentationTool.Location.DOCLET_PATH)) {
+            appClassLoader = fileManager.getClassLoader(DocumentationTool.Location.DOCLET_PATH);
+        } else {
+            // construct class loader
+            String cpString = null;   // make sure env.class.path defaults to dot
+
+            // do prepends to get correct ordering
+            cpString = appendPath(System.getProperty("env.class.path"), cpString);
+            cpString = appendPath(System.getProperty("java.class.path"), cpString);
+            cpString = appendPath(docletPath, cpString);
+            URL[] urls = pathToURLs(cpString);
+            if (docletParentClassLoader == null)
+                appClassLoader = new URLClassLoader(urls, getDelegationClassLoader(docletClassName));
+            else
+                appClassLoader = new URLClassLoader(urls, docletParentClassLoader);
+        }
+
+        if (exportInternalAPI) {
+            exportInternalAPI(appClassLoader);
+        }
+
+        // attempt to find doclet
+        Class<?> dc = null;
+        try {
+            dc = appClassLoader.loadClass(docletClassName);
+        } catch (ClassNotFoundException exc) {
+            messager.error(Messager.NOPOS, "main.doclet_class_not_found", docletClassName);
+            messager.exit();
+        }
+        docletClass = dc;
+    }
+
+    /*
+     * Returns the delegation class loader to use when creating
+     * appClassLoader (used to load the doclet).  The context class
+     * loader is the best choice, but legacy behavior was to use the
+     * default delegation class loader (aka system class loader).
+     *
+     * Here we favor using the context class loader.  To ensure
+     * compatibility with existing apps, we revert to legacy
+     * behavior if either or both of the following conditions hold:
+     *
+     * 1) the doclet is loadable from the system class loader but not
+     *    from the context class loader,
+     *
+     * 2) this.getClass() is loadable from the system class loader but not
+     *    from the context class loader.
+     */
+    private ClassLoader getDelegationClassLoader(String docletClassName) {
+        ClassLoader ctxCL = Thread.currentThread().getContextClassLoader();
+        ClassLoader sysCL = ClassLoader.getSystemClassLoader();
+        if (sysCL == null)
+            return ctxCL;
+        if (ctxCL == null)
+            return sysCL;
+
+        // Condition 1.
+        try {
+            sysCL.loadClass(docletClassName);
+            try {
+                ctxCL.loadClass(docletClassName);
+            } catch (ClassNotFoundException e) {
+                return sysCL;
+            }
+        } catch (ClassNotFoundException e) {
+        }
+
+        // Condition 2.
+        try {
+            if (getClass() == sysCL.loadClass(getClass().getName())) {
+                try {
+                    if (getClass() != ctxCL.loadClass(getClass().getName()))
+                        return sysCL;
+                } catch (ClassNotFoundException e) {
+                    return sysCL;
+                }
+            }
+        } catch (ClassNotFoundException e) {
+        }
+
+        return ctxCL;
+    }
+
+    /**
+     * Generate documentation here.  Return true on success.
+     */
+    public boolean start(RootDoc root) {
+        Object retVal;
+        String methodName = "start";
+        Class<?>[] paramTypes = { RootDoc.class };
+        Object[] params = { root };
+        try {
+            retVal = invoke(methodName, null, paramTypes, params);
+        } catch (DocletInvokeException exc) {
+            return false;
+        }
+        if (retVal instanceof Boolean) {
+            return ((Boolean)retVal);
+        } else {
+            messager.error(Messager.NOPOS, "main.must_return_boolean",
+                           docletClassName, methodName);
+            return false;
+        }
+    }
+
+    /**
+     * Check for doclet added options here. Zero return means
+     * option not known.  Positive value indicates number of
+     * arguments to option.  Negative value means error occurred.
+     */
+    public int optionLength(String option) {
+        Object retVal;
+        String methodName = "optionLength";
+        Class<?>[] paramTypes = { String.class };
+        Object[] params = { option };
+        try {
+            retVal = invoke(methodName, 0, paramTypes, params);
+        } catch (DocletInvokeException exc) {
+            return -1;
+        }
+        if (retVal instanceof Integer) {
+            return ((Integer)retVal);
+        } else {
+            messager.error(Messager.NOPOS, "main.must_return_int",
+                           docletClassName, methodName);
+            return -1;
+        }
+    }
+
+    /**
+     * Let doclet check that all options are OK. Returning true means
+     * options are OK.  If method does not exist, assume true.
+     */
+    public boolean validOptions(List<String[]> optlist) {
+        Object retVal;
+        String options[][] = optlist.toArray(new String[optlist.length()][]);
+        String methodName = "validOptions";
+        DocErrorReporter reporter = messager;
+        Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
+        Object[] params = { options, reporter };
+        try {
+            retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
+        } catch (DocletInvokeException exc) {
+            return false;
+        }
+        if (retVal instanceof Boolean) {
+            return ((Boolean)retVal);
+        } else {
+            messager.error(Messager.NOPOS, "main.must_return_boolean",
+                           docletClassName, methodName);
+            return false;
+        }
+    }
+
+    /**
+     * Return the language version supported by this doclet.
+     * If the method does not exist in the doclet, assume version 1.1.
+     */
+    public LanguageVersion languageVersion() {
+        try {
+            Object retVal;
+            String methodName = "languageVersion";
+            Class<?>[] paramTypes = new Class<?>[0];
+            Object[] params = new Object[0];
+            try {
+                retVal = invoke(methodName, JAVA_1_1, paramTypes, params);
+            } catch (DocletInvokeException exc) {
+                return JAVA_1_1;
+            }
+            if (retVal instanceof LanguageVersion) {
+                return (LanguageVersion)retVal;
+            } else {
+                messager.error(Messager.NOPOS, "main.must_return_languageversion",
+                               docletClassName, methodName);
+                return JAVA_1_1;
+            }
+        } catch (NoClassDefFoundError ex) { // for boostrapping, no Enum class.
+            return null;
+        }
+    }
+
+    /**
+     * Utility method for calling doclet functionality
+     */
+    private Object invoke(String methodName, Object returnValueIfNonExistent,
+                          Class<?>[] paramTypes, Object[] params)
+        throws DocletInvokeException {
+            Method meth;
+            try {
+                meth = docletClass.getMethod(methodName, paramTypes);
+            } catch (NoSuchMethodException exc) {
+                if (returnValueIfNonExistent == null) {
+                    messager.error(Messager.NOPOS, "main.doclet_method_not_found",
+                                   docletClassName, methodName);
+                    throw new DocletInvokeException();
+                } else {
+                    return returnValueIfNonExistent;
+                }
+            } catch (SecurityException exc) {
+                messager.error(Messager.NOPOS, "main.doclet_method_not_accessible",
+                               docletClassName, methodName);
+                throw new DocletInvokeException();
+            }
+            if (!Modifier.isStatic(meth.getModifiers())) {
+                messager.error(Messager.NOPOS, "main.doclet_method_must_be_static",
+                               docletClassName, methodName);
+                throw new DocletInvokeException();
+            }
+            ClassLoader savedCCL =
+                Thread.currentThread().getContextClassLoader();
+            try {
+                if (appClassLoader != null) // will be null if doclet class provided via API
+                    Thread.currentThread().setContextClassLoader(appClassLoader);
+                return meth.invoke(null , params);
+            } catch (IllegalArgumentException | NullPointerException exc) {
+                messager.error(Messager.NOPOS, "main.internal_error_exception_thrown",
+                               docletClassName, methodName, exc.toString());
+                throw new DocletInvokeException();
+            } catch (IllegalAccessException exc) {
+                messager.error(Messager.NOPOS, "main.doclet_method_not_accessible",
+                               docletClassName, methodName);
+                throw new DocletInvokeException();
+            }
+            catch (InvocationTargetException exc) {
+                Throwable err = exc.getTargetException();
+                if (apiMode)
+                    throw new ClientCodeException(err);
+                if (err instanceof java.lang.OutOfMemoryError) {
+                    messager.error(Messager.NOPOS, "main.out.of.memory");
+                } else {
+                    messager.error(Messager.NOPOS, "main.exception_thrown",
+                               docletClassName, methodName, exc.toString());
+                    exc.getTargetException().printStackTrace(System.err);
+                }
+                throw new DocletInvokeException();
+            } finally {
+                Thread.currentThread().setContextClassLoader(savedCCL);
+            }
+    }
+
+    /**
+     * Export javadoc internal API to the unnamed module for a classloader.
+     * This is to support continued use of existing non-standard doclets that
+     * use the internal toolkit API and related classes.
+     * @param cl the classloader
+     */
+    private void exportInternalAPI(ClassLoader cl) {
+        String[] packages = {
+            "com.sun.tools.doclets",
+            "com.sun.tools.doclets.standard",
+            "com.sun.tools.doclets.internal.toolkit",
+            "com.sun.tools.doclets.internal.toolkit.taglets",
+            "com.sun.tools.doclets.internal.toolkit.builders",
+            "com.sun.tools.doclets.internal.toolkit.util",
+            "com.sun.tools.doclets.internal.toolkit.util.links",
+            "com.sun.tools.doclets.formats.html",
+            "com.sun.tools.doclets.formats.html.markup"
+        };
+
+        try {
+            Method getModuleMethod = Class.class.getDeclaredMethod("getModule");
+            Object thisModule = getModuleMethod.invoke(getClass());
+
+            Class<?> moduleClass = Class.forName("java.lang.reflect.Module");
+            Method addExportsMethod = moduleClass.getDeclaredMethod("addExports", String.class, moduleClass);
+
+            Method getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule");
+            Object target = getUnnamedModuleMethod.invoke(cl);
+
+            for (String pack : packages) {
+                addExportsMethod.invoke(thisModule, pack, target);
+            }
+        } catch (Exception e) {
+            // do nothing
+        }
+    }
+
+    /**
+     * Utility method for converting a search path string to an array of directory and JAR file
+     * URLs.
+     *
+     * Note that this method is called by the DocletInvoker.
+     *
+     * @param path the search path string
+     * @return the resulting array of directory and JAR file URLs
+     */
+    private static URL[] pathToURLs(String path) {
+        java.util.List<URL> urls = new ArrayList<>();
+        for (String s: path.split(Pattern.quote(File.pathSeparator))) {
+            if (!s.isEmpty()) {
+                URL url = fileToURL(Paths.get(s));
+                if (url != null) {
+                    urls.add(url);
+                }
+            }
+        }
+        return urls.toArray(new URL[urls.size()]);
+    }
+
+    /**
+     * Returns the directory or JAR file URL corresponding to the specified local file name.
+     *
+     * @param file the Path object
+     * @return the resulting directory or JAR file URL, or null if unknown
+     */
+    private static URL fileToURL(Path file) {
+        Path p;
+        try {
+            p = file.toRealPath();
+        } catch (IOException e) {
+            p = file.toAbsolutePath();
+        }
+        try {
+            return p.normalize().toUri().toURL();
+        } catch (MalformedURLException e) {
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ExecutableMemberDocImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,288 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import java.lang.reflect.Modifier;
+import java.text.CollationKey;
+
+import com.sun.javadoc.*;
+
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+
+/**
+ * Represents a method or constructor of a java class.
+ *
+ *  <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>
+ *
+ * @since 1.2
+ * @author Robert Field
+ * @author Neal Gafter (rewrite)
+ * @author Scott Seligman (generics, annotations)
+ */
+
+public abstract class ExecutableMemberDocImpl
+        extends MemberDocImpl implements ExecutableMemberDoc {
+
+    protected final MethodSymbol sym;
+
+    /**
+     * Constructor.
+     */
+    public ExecutableMemberDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) {
+        super(env, sym, treePath);
+        this.sym = sym;
+    }
+
+    /**
+     * Constructor.
+     */
+    public ExecutableMemberDocImpl(DocEnv env, MethodSymbol sym) {
+        this(env, sym, null);
+    }
+
+    /**
+     * Returns the flags in terms of javac's flags
+     */
+    protected long getFlags() {
+        return sym.flags();
+    }
+
+    /**
+     * Identify the containing class
+     */
+    protected ClassSymbol getContainingClass() {
+        return sym.enclClass();
+    }
+
+    /**
+     * Return true if this method is native
+     */
+    public boolean isNative() {
+        return Modifier.isNative(getModifiers());
+    }
+
+    /**
+     * Return true if this method is synchronized
+     */
+    public boolean isSynchronized() {
+        return Modifier.isSynchronized(getModifiers());
+    }
+
+    /**
+     * Return true if this method was declared to take a variable number
+     * of arguments.
+     */
+    public boolean isVarArgs() {
+        return ((sym.flags() & Flags.VARARGS) != 0
+                && !env.legacyDoclet);
+    }
+
+    /**
+     * Returns true if this field was synthesized by the compiler.
+     */
+    public boolean isSynthetic() {
+        return ((sym.flags() & Flags.SYNTHETIC) != 0);
+    }
+
+    public boolean isIncluded() {
+        return containingClass().isIncluded() && env.shouldDocument(sym);
+    }
+
+    /**
+     * Return the throws tags in this method.
+     *
+     * @return an array of ThrowTagImpl containing all {@code @exception}
+     * and {@code @throws} tags.
+     */
+    public ThrowsTag[] throwsTags() {
+        return comment().throwsTags();
+    }
+
+    /**
+     * Return the param tags in this method, excluding the type
+     * parameter tags.
+     *
+     * @return an array of ParamTagImpl containing all {@code @param} tags.
+     */
+    public ParamTag[] paramTags() {
+        return comment().paramTags();
+    }
+
+    /**
+     * Return the type parameter tags in this method.
+     */
+    public ParamTag[] typeParamTags() {
+        return env.legacyDoclet
+            ? new ParamTag[0]
+            : comment().typeParamTags();
+    }
+
+    /**
+     * Return exceptions this method or constructor throws.
+     *
+     * @return an array of ClassDoc[] representing the exceptions
+     * thrown by this method.
+     */
+    public ClassDoc[] thrownExceptions() {
+        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
+            //### errors in the documented code?
+            ClassDocImpl cdi = env.getClassDoc((ClassSymbol)ex.tsym);
+            if (cdi != null) l.append(cdi);
+        }
+        return l.toArray(new ClassDocImpl[l.length()]);
+    }
+
+    /**
+     * Return exceptions this method or constructor throws.
+     * Each array element is either a <code>ClassDoc</code> or a
+     * <code>TypeVariable</code>.
+     */
+    public com.sun.javadoc.Type[] thrownExceptionTypes() {
+        return TypeMaker.getTypes(env, sym.type.getThrownTypes());
+    }
+
+    /**
+     * Get argument information.
+     *
+     * @see ParameterImpl
+     *
+     * @return an array of ParameterImpl, one element per argument
+     * in the order the arguments are present.
+     */
+    public Parameter[] parameters() {
+        // generate the parameters on the fly:  they're not cached
+        List<VarSymbol> params = sym.params();
+        Parameter result[] = new Parameter[params.length()];
+
+        int i = 0;
+        for (VarSymbol param : params) {
+            result[i++] = new ParameterImpl(env, param);
+        }
+        return result;
+    }
+
+    /**
+     * Get the receiver type of this executable element.
+     *
+     * @return the receiver type of this executable element.
+     * @since 1.8
+     */
+    public com.sun.javadoc.Type receiverType() {
+        Type recvtype = sym.type.asMethodType().recvtype;
+        return (recvtype != null) ? TypeMaker.getType(env, recvtype, false, true) : null;
+    }
+
+    /**
+     * Return the formal type parameters of this method or constructor.
+     * Return an empty array if there are none.
+     */
+    public TypeVariable[] typeParameters() {
+        if (env.legacyDoclet) {
+            return new TypeVariable[0];
+        }
+        TypeVariable res[] = new TypeVariable[sym.type.getTypeArguments().length()];
+        TypeMaker.getTypes(env, sym.type.getTypeArguments(), res);
+        return res;
+    }
+
+    /**
+     * Get the signature. It is the parameter list, type is qualified.
+     * For instance, for a method <code>mymethod(String x, int y)</code>,
+     * it will return <code>(java.lang.String,int)</code>.
+     */
+    public String signature() {
+        return makeSignature(true);
+    }
+
+    /**
+     * Get flat signature.  All types are not qualified.
+     * Return a String, which is the flat signiture of this member.
+     * It is the parameter list, type is not qualified.
+     * For instance, for a method <code>mymethod(String x, int y)</code>,
+     * it will return <code>(String, int)</code>.
+     */
+    public String flatSignature() {
+        return makeSignature(false);
+    }
+
+    private String makeSignature(boolean full) {
+        StringBuilder result = new StringBuilder();
+        result.append("(");
+        for (List<Type> types = sym.type.getParameterTypes(); types.nonEmpty(); ) {
+            Type t = types.head;
+            result.append(TypeMaker.getTypeString(env, t, full));
+            types = types.tail;
+            if (types.nonEmpty()) {
+                result.append(", ");
+            }
+        }
+        if (isVarArgs()) {
+            int len = result.length();
+            result.replace(len - 2, len, "...");
+        }
+        result.append(")");
+        return result.toString();
+    }
+
+    protected String typeParametersString() {
+        return TypeMaker.typeParametersString(env, sym, true);
+    }
+
+    /**
+     * Generate a key for sorting.
+     */
+    @Override
+    CollationKey generateKey() {
+        String k = name() + flatSignature() + typeParametersString();
+        // ',' and '&' are between '$' and 'a':  normalize to spaces.
+        k = k.replace(',', ' ').replace('&', ' ');
+        // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
+        return env.doclocale.collator.getCollationKey(k);
+    }
+
+    /**
+     * Return the source position of the entity, or null if
+     * no position is available.
+     */
+    @Override
+    public SourcePosition position() {
+        if (sym.enclClass().sourcefile == null) return null;
+        return SourcePositionImpl.make(sym.enclClass().sourcefile,
+                                       (tree==null) ? 0 : tree.pos,
+                                       lineMap);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/FieldDocImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,279 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import com.sun.source.util.TreePath;
+import java.lang.reflect.Modifier;
+
+import com.sun.javadoc.*;
+
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.VarSymbol;
+
+import static com.sun.tools.javac.code.TypeTag.BOOLEAN;
+
+/**
+ * Represents a field in a java class.
+ *
+ *  <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>
+ *
+ * @see MemberDocImpl
+ *
+ * @since 1.2
+ * @author Robert Field
+ * @author Neal Gafter (rewrite)
+ * @author Scott Seligman (generics, enums, annotations)
+ */
+public class FieldDocImpl extends MemberDocImpl implements FieldDoc {
+
+    protected final VarSymbol sym;
+
+    /**
+     * Constructor.
+     */
+    public FieldDocImpl(DocEnv env, VarSymbol sym, TreePath treePath) {
+        super(env, sym, treePath);
+        this.sym = sym;
+    }
+
+    /**
+     * Constructor.
+     */
+    public FieldDocImpl(DocEnv env, VarSymbol sym) {
+        this(env, sym, null);
+    }
+
+    /**
+     * Returns the flags in terms of javac's flags
+     */
+    protected long getFlags() {
+        return sym.flags();
+    }
+
+    /**
+     * Identify the containing class
+     */
+    protected ClassSymbol getContainingClass() {
+        return sym.enclClass();
+    }
+
+    /**
+     * Get type of this field.
+     */
+    public com.sun.javadoc.Type type() {
+        return TypeMaker.getType(env, sym.type, false);
+    }
+
+    /**
+     * Get the value of a constant field.
+     *
+     * @return the value of a constant field. The value is
+     * automatically wrapped in an object if it has a primitive type.
+     * If the field is not constant, returns null.
+     */
+    public Object constantValue() {
+        Object result = sym.getConstValue();
+        if (result != null && sym.type.hasTag(BOOLEAN))
+            // javac represents false and true as Integers 0 and 1
+            result = Boolean.valueOf(((Integer)result).intValue() != 0);
+        return result;
+    }
+
+    /**
+     * Get the value of a constant field.
+     *
+     * @return the text of a Java language expression whose value
+     * is the value of the constant. The expression uses no identifiers
+     * other than primitive literals. If the field is
+     * not constant, returns null.
+     */
+    public String constantValueExpression() {
+        return constantValueExpression(constantValue());
+    }
+
+    /**
+     * A static version of the above.
+     */
+    static String constantValueExpression(Object cb) {
+        if (cb == null) return null;
+        if (cb instanceof Character) return sourceForm(((Character)cb).charValue());
+        if (cb instanceof Byte) return sourceForm(((Byte)cb).byteValue());
+        if (cb instanceof String) return sourceForm((String)cb);
+        if (cb instanceof Double) return sourceForm(((Double)cb).doubleValue(), 'd');
+        if (cb instanceof Float) return sourceForm(((Float)cb).doubleValue(), 'f');
+        if (cb instanceof Long) return cb + "L";
+        return cb.toString(); // covers int, short
+    }
+        // where
+        private static String sourceForm(double v, char suffix) {
+            if (Double.isNaN(v))
+                return "0" + suffix + "/0" + suffix;
+            if (v == Double.POSITIVE_INFINITY)
+                return "1" + suffix + "/0" + suffix;
+            if (v == Double.NEGATIVE_INFINITY)
+                return "-1" + suffix + "/0" + suffix;
+            return v + (suffix == 'f' || suffix == 'F' ? "" + suffix : "");
+        }
+        private static String sourceForm(char c) {
+            StringBuilder buf = new StringBuilder(8);
+            buf.append('\'');
+            sourceChar(c, buf);
+            buf.append('\'');
+            return buf.toString();
+        }
+        private static String sourceForm(byte c) {
+            return "0x" + Integer.toString(c & 0xff, 16);
+        }
+        private static String sourceForm(String s) {
+            StringBuilder buf = new StringBuilder(s.length() + 5);
+            buf.append('\"');
+            for (int i=0; i<s.length(); i++) {
+                char c = s.charAt(i);
+                sourceChar(c, buf);
+            }
+            buf.append('\"');
+            return buf.toString();
+        }
+        private static void sourceChar(char c, StringBuilder buf) {
+            switch (c) {
+            case '\b': buf.append("\\b"); return;
+            case '\t': buf.append("\\t"); return;
+            case '\n': buf.append("\\n"); return;
+            case '\f': buf.append("\\f"); return;
+            case '\r': buf.append("\\r"); return;
+            case '\"': buf.append("\\\""); return;
+            case '\'': buf.append("\\\'"); return;
+            case '\\': buf.append("\\\\"); return;
+            default:
+                if (isPrintableAscii(c)) {
+                    buf.append(c); return;
+                }
+                unicodeEscape(c, buf);
+                return;
+            }
+        }
+        private static void unicodeEscape(char c, StringBuilder buf) {
+            final String chars = "0123456789abcdef";
+            buf.append("\\u");
+            buf.append(chars.charAt(15 & (c>>12)));
+            buf.append(chars.charAt(15 & (c>>8)));
+            buf.append(chars.charAt(15 & (c>>4)));
+            buf.append(chars.charAt(15 & (c>>0)));
+        }
+        private static boolean isPrintableAscii(char c) {
+            return c >= ' ' && c <= '~';
+        }
+
+    /**
+     * Return true if this field is included in the active set.
+     */
+    public boolean isIncluded() {
+        return containingClass().isIncluded() && env.shouldDocument(sym);
+    }
+
+    /**
+     * Is this Doc item a field (but not an enum constant?
+     */
+    @Override
+    public boolean isField() {
+        return !isEnumConstant();
+    }
+
+    /**
+     * Is this Doc item an enum constant?
+     * (For legacy doclets, return false.)
+     */
+    @Override
+    public boolean isEnumConstant() {
+        return (getFlags() & Flags.ENUM) != 0 &&
+               !env.legacyDoclet;
+    }
+
+    /**
+     * Return true if this field is transient
+     */
+    public boolean isTransient() {
+        return Modifier.isTransient(getModifiers());
+    }
+
+    /**
+     * Return true if this field is volatile
+     */
+    public boolean isVolatile() {
+        return Modifier.isVolatile(getModifiers());
+    }
+
+    /**
+     * Returns true if this field was synthesized by the compiler.
+     */
+    public boolean isSynthetic() {
+        return (getFlags() & Flags.SYNTHETIC) != 0;
+    }
+
+    /**
+     * Return the serialField tags in this FieldDocImpl item.
+     *
+     * @return an array of <tt>SerialFieldTagImpl</tt> containing all
+     *         <code>&#64;serialField</code> tags.
+     */
+    public SerialFieldTag[] serialFieldTags() {
+        return comment().serialFieldTags();
+    }
+
+    public String name() {
+        if (name == null) {
+            name = sym.name.toString();
+        }
+        return name;
+    }
+
+    private String name;
+
+    public String qualifiedName() {
+        if (qualifiedName == null) {
+            qualifiedName = sym.enclClass().getQualifiedName() + "." + name();
+        }
+        return qualifiedName;
+    }
+
+    private String qualifiedName;
+
+    /**
+     * Return the source position of the entity, or null if
+     * no position is available.
+     */
+    @Override
+    public SourcePosition position() {
+        if (sym.enclClass().sourcefile == null) return null;
+        return SourcePositionImpl.make(sym.enclClass().sourcefile,
+                                       (tree==null) ? 0 : tree.pos,
+                                       lineMap);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocClassFinder.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,90 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import java.util.EnumSet;
+import javax.tools.JavaFileObject;
+
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
+import com.sun.tools.javac.code.ClassFinder;
+import com.sun.tools.javac.util.Context;
+
+/** Javadoc uses an extended class finder that records package.html entries
+ *
+ *  <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>
+ *
+ *  @author Neal Gafter
+ */
+public class JavadocClassFinder extends ClassFinder {
+
+    public static JavadocClassFinder instance(Context context) {
+        ClassFinder instance = context.get(classFinderKey);
+        if (instance == null)
+            instance = new JavadocClassFinder(context);
+        return (JavadocClassFinder)instance;
+    }
+
+    public static void preRegister(Context context) {
+        context.put(classFinderKey, new Context.Factory<ClassFinder>() {
+            public ClassFinder make(Context c) {
+                return new JavadocClassFinder(c);
+            }
+        });
+    }
+
+    private DocEnv docenv;
+    private EnumSet<JavaFileObject.Kind> all = EnumSet.of(JavaFileObject.Kind.CLASS,
+                                                          JavaFileObject.Kind.SOURCE,
+                                                          JavaFileObject.Kind.HTML);
+    private EnumSet<JavaFileObject.Kind> noSource = EnumSet.of(JavaFileObject.Kind.CLASS,
+                                                               JavaFileObject.Kind.HTML);
+
+    public JavadocClassFinder(Context context) {
+        super(context);
+        docenv = DocEnv.instance(context);
+        preferSource = true;
+    }
+
+    /**
+     * Override getPackageFileKinds to include search for package.html
+     */
+    @Override
+    protected EnumSet<JavaFileObject.Kind> getPackageFileKinds() {
+        return docenv.docClasses ? noSource : all;
+    }
+
+    /**
+     * Override extraFileActions to check for package documentation
+     */
+    @Override
+    protected void extraFileActions(PackageSymbol pack, JavaFileObject fo) {
+        if (fo.isNameCompatible("package", JavaFileObject.Kind.HTML))
+            docenv.getPackageDoc(pack).setDocPath(fo);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocEnter.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,109 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import javax.tools.JavaFileObject;
+
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.comp.Enter;
+import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
+import com.sun.tools.javac.util.List;
+
+import static com.sun.tools.javac.code.Kinds.Kind.*;
+
+/**
+ *  Javadoc's own enter phase does a few things above and beyond that
+ *  done by javac.
+ *
+ *  <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>
+ *
+ *  @author Neal Gafter
+ */
+public class JavadocEnter extends Enter {
+    public static JavadocEnter instance(Context context) {
+        Enter instance = context.get(enterKey);
+        if (instance == null)
+            instance = new JavadocEnter(context);
+        return (JavadocEnter)instance;
+    }
+
+    public static void preRegister(Context context) {
+        context.put(enterKey, new Context.Factory<Enter>() {
+               public Enter make(Context c) {
+                   return new JavadocEnter(c);
+               }
+        });
+    }
+
+    protected JavadocEnter(Context context) {
+        super(context);
+        messager = Messager.instance0(context);
+        docenv = DocEnv.instance(context);
+    }
+
+    final Messager messager;
+    final DocEnv docenv;
+
+    @Override
+    public void main(List<JCCompilationUnit> trees) {
+        // count all Enter errors as warnings.
+        int nerrors = messager.nerrors;
+        super.main(trees);
+        messager.nwarnings += (messager.nerrors - nerrors);
+        messager.nerrors = nerrors;
+    }
+
+    @Override
+    public void visitTopLevel(JCCompilationUnit tree) {
+        super.visitTopLevel(tree);
+        if (tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE)) {
+            JCPackageDecl pd = tree.getPackage();
+            TreePath tp = pd == null ? docenv.getTreePath(tree) : docenv.getTreePath(tree, pd);
+            docenv.makePackageDoc(tree.packge, tp);
+        }
+    }
+
+    @Override
+    public void visitClassDef(JCClassDecl tree) {
+        super.visitClassDef(tree);
+        if (tree.sym == null) return;
+        if (tree.sym.kind == TYP || tree.sym.kind == ERR) {
+            ClassSymbol c = tree.sym;
+            docenv.makeClassDoc(c, docenv.getTreePath(env.toplevel, tree));
+        }
+    }
+
+    /** Don't complain about a duplicate class. */
+    @Override
+    protected void duplicateClass(DiagnosticPosition pos, ClassSymbol c) {}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocMemberEnter.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,209 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.comp.MemberEnter;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.util.Context;
+
+import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.code.Kinds.Kind.*;
+
+/**
+ *  Javadoc's own memberEnter phase does a few things above and beyond that
+ *  done by javac.
+ *
+ *  <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>
+ *
+ *  @author Neal Gafter
+ */
+public class JavadocMemberEnter extends MemberEnter {
+    public static JavadocMemberEnter instance0(Context context) {
+        MemberEnter instance = context.get(memberEnterKey);
+        if (instance == null)
+            instance = new JavadocMemberEnter(context);
+        return (JavadocMemberEnter)instance;
+    }
+
+    public static void preRegister(Context context) {
+        context.put(memberEnterKey, new Context.Factory<MemberEnter>() {
+               public MemberEnter make(Context c) {
+                   return new JavadocMemberEnter(c);
+               }
+        });
+    }
+
+    final DocEnv docenv;
+
+    protected JavadocMemberEnter(Context context) {
+        super(context);
+        docenv = DocEnv.instance(context);
+    }
+
+    @Override
+    public void visitMethodDef(JCMethodDecl tree) {
+        super.visitMethodDef(tree);
+        MethodSymbol meth = tree.sym;
+        if (meth == null || meth.kind != MTH) return;
+        TreePath treePath = docenv.getTreePath(env.toplevel, env.enclClass, tree);
+        if (meth.isConstructor())
+            docenv.makeConstructorDoc(meth, treePath);
+        else if (isAnnotationTypeElement(meth))
+            docenv.makeAnnotationTypeElementDoc(meth, treePath);
+        else
+            docenv.makeMethodDoc(meth, treePath);
+
+        // release resources
+        tree.body = null;
+    }
+
+    @Override
+    public void visitVarDef(JCVariableDecl tree) {
+        if (tree.init != null) {
+            boolean isFinal = (tree.mods.flags & FINAL) != 0
+                    || (env.enclClass.mods.flags & INTERFACE) != 0;
+            if (!isFinal || containsNonConstantExpression(tree.init)) {
+                // Avoid unnecessary analysis and release resources.
+                // In particular, remove non-constant expressions
+                // which may trigger Attr.attribClass, since
+                // method bodies are also removed, in visitMethodDef.
+                tree.init = null;
+            }
+        }
+        super.visitVarDef(tree);
+        if (tree.sym != null &&
+                tree.sym.kind == VAR &&
+                !isParameter(tree.sym)) {
+            docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, env.enclClass, tree));
+        }
+    }
+
+    private static boolean isAnnotationTypeElement(MethodSymbol meth) {
+        return ClassDocImpl.isAnnotationType(meth.enclClass());
+    }
+
+    private static boolean isParameter(VarSymbol var) {
+        return (var.flags() & Flags.PARAMETER) != 0;
+    }
+
+    /**
+     * Simple analysis of an expression tree to see if it contains tree nodes
+     * for any non-constant expression. This does not include checking references
+     * to other fields which may or may not be constant.
+     */
+    private static boolean containsNonConstantExpression(JCExpression tree) {
+        return new MaybeConstantExpressionScanner().containsNonConstantExpression(tree);
+    }
+
+    /**
+     * See JLS 15.18, Constant Expression
+     */
+    private static class MaybeConstantExpressionScanner extends JCTree.Visitor {
+        boolean maybeConstantExpr = true;
+
+        public boolean containsNonConstantExpression(JCExpression tree) {
+            scan(tree);
+            return !maybeConstantExpr;
+        }
+
+        public void scan(JCTree tree) {
+            // short circuit scan when end result is definitely false
+            if (maybeConstantExpr && tree != null)
+                tree.accept(this);
+        }
+
+        @Override
+        /** default for any non-overridden visit method. */
+        public void visitTree(JCTree tree) {
+            maybeConstantExpr = false;
+        }
+
+        @Override
+        public void visitBinary(JCBinary tree) {
+            switch (tree.getTag()) {
+                case MUL: case DIV: case MOD:
+                case PLUS: case MINUS:
+                case SL: case SR: case USR:
+                case LT: case LE: case GT: case GE:
+                case EQ: case NE:
+                case BITAND: case BITXOR: case BITOR:
+                case AND: case OR:
+                    break;
+                default:
+                    maybeConstantExpr = false;
+            }
+        }
+
+        @Override
+        public void visitConditional(JCConditional tree) {
+            scan(tree.cond);
+            scan(tree.truepart);
+            scan(tree.falsepart);
+        }
+
+        @Override
+        public void visitIdent(JCIdent tree) { }
+
+        @Override
+        public void visitLiteral(JCLiteral tree) { }
+
+        @Override
+        public void visitParens(JCParens tree) {
+            scan(tree.expr);
+        }
+
+        @Override
+        public void visitSelect(JCTree.JCFieldAccess tree) {
+            scan(tree.selected);
+        }
+
+        @Override
+        public void visitTypeCast(JCTypeCast tree) {
+            scan(tree.clazz);
+            scan(tree.expr);
+        }
+
+        @Override
+        public void visitTypeIdent(JCPrimitiveTypeTree tree) { }
+
+        @Override
+        public void visitUnary(JCUnary tree) {
+            switch (tree.getTag()) {
+                case POS: case NEG: case COMPL: case NOT:
+                    break;
+                default:
+                    maybeConstantExpr = false;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocTodo.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2003, 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.tools.javadoc.main;
+
+import com.sun.tools.javac.comp.*;
+import com.sun.tools.javac.util.*;
+
+/**
+ *  Javadoc's own todo queue doesn't queue its inputs, as javadoc
+ *  doesn't perform attribution of method bodies or semantic checking.
+ *
+ *  <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>
+ *
+ *  @author Neal Gafter
+ */
+public class JavadocTodo extends Todo {
+    public static void preRegister(Context context) {
+        context.put(todoKey, new Context.Factory<Todo>() {
+               public Todo make(Context c) {
+                   return new JavadocTodo(c);
+               }
+        });
+    }
+
+    protected JavadocTodo(Context context) {
+        super(context);
+    }
+
+    @Override
+    public void append(Env<AttrContext> e) {
+        // do nothing; Javadoc doesn't perform attribution.
+    }
+
+    @Override
+    public boolean offer(Env<AttrContext> e) {
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocTool.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,430 @@
+/*
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javadoc.main;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileManager.Location;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+
+import com.sun.tools.javac.code.ClassFinder;
+import com.sun.tools.javac.code.Symbol.Completer;
+import com.sun.tools.javac.code.Symbol.ModuleSymbol;
+import com.sun.tools.javac.comp.Enter;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCClassDecl;
+import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
+import com.sun.tools.javac.util.Abort;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+
+
+/**
+ *  This class could be the main entry point for Javadoc when Javadoc is used as a
+ *  component in a larger software system. It provides operations to
+ *  construct a new javadoc processor, and to run it on a set of source
+ *  files.
+ *
+ *  <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>
+ *
+ *  @author Neal Gafter
+ */
+public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler {
+    DocEnv docenv;
+
+    final Messager messager;
+    final ClassFinder javadocFinder;
+    final Enter javadocEnter;
+    final Set<JavaFileObject> uniquefiles;
+
+    /**
+     * Construct a new JavaCompiler processor, using appropriately
+     * extended phases of the underlying compiler.
+     */
+    protected JavadocTool(Context context) {
+        super(context);
+        messager = Messager.instance0(context);
+        javadocFinder = JavadocClassFinder.instance(context);
+        javadocEnter = JavadocEnter.instance(context);
+        uniquefiles = new HashSet<>();
+    }
+
+    /**
+     * For javadoc, the parser needs to keep comments. Overrides method from JavaCompiler.
+     */
+    @Override
+    protected boolean keepComments() {
+        return true;
+    }
+
+    /**
+     *  Construct a new javadoc tool.
+     */
+    public static JavadocTool make0(Context context) {
+        // force the use of Javadoc's class finder
+        JavadocClassFinder.preRegister(context);
+
+        // force the use of Javadoc's own enter phase
+        JavadocEnter.preRegister(context);
+
+        // force the use of Javadoc's own member enter phase
+        JavadocMemberEnter.preRegister(context);
+
+        // force the use of Javadoc's own todo phase
+        JavadocTodo.preRegister(context);
+
+        // force the use of Messager as a Log
+        Messager.instance0(context);
+
+        return new JavadocTool(context);
+    }
+
+    public RootDocImpl getRootDocImpl(String doclocale,
+                                      String encoding,
+                                      ModifierFilter filter,
+                                      List<String> args,
+                                      List<String[]> options,
+                                      Iterable<? extends JavaFileObject> fileObjects,
+                                      boolean breakiterator,
+                                      List<String> subPackages,
+                                      List<String> excludedPackages,
+                                      boolean docClasses,
+                                      boolean legacyDoclet,
+                      boolean quiet) throws IOException {
+        docenv = DocEnv.instance(context);
+        docenv.showAccess = filter;
+        docenv.quiet = quiet;
+        docenv.breakiterator = breakiterator;
+        docenv.setLocale(doclocale);
+        docenv.setEncoding(encoding);
+        docenv.docClasses = docClasses;
+        docenv.legacyDoclet = legacyDoclet;
+
+        javadocFinder.sourceCompleter = docClasses ? Completer.NULL_COMPLETER : sourceCompleter;
+
+        if (docClasses) {
+            // If -Xclasses is set, the args should be a series of class names
+            for (String arg: args) {
+                if (!isValidPackageName(arg)) // checks
+                    docenv.error(null, "main.illegal_class_name", arg);
+            }
+            if (messager.nerrors() != 0) {
+                return null;
+            }
+            return new RootDocImpl(docenv, args, options);
+        }
+
+        ListBuffer<JCCompilationUnit> classTrees = new ListBuffer<>();
+        Set<String> includedPackages = new LinkedHashSet<>();
+
+        try {
+            StandardJavaFileManager fm = docenv.fileManager instanceof StandardJavaFileManager
+                    ? (StandardJavaFileManager) docenv.fileManager : null;
+            Set<String> packageNames = new LinkedHashSet<>();
+            // Normally, the args should be a series of package names or file names.
+            // Parse the files and collect the package names.
+            for (String arg: args) {
+                if (fm != null && arg.endsWith(".java") && new File(arg).exists()) {
+                    if (new File(arg).getName().equals("module-info.java")) {
+                        docenv.warning(null, "main.file_ignored", arg);
+                    } else {
+                        parse(fm.getJavaFileObjects(arg), classTrees, true);
+                    }
+                } else if (isValidPackageName(arg)) {
+                    packageNames.add(arg);
+                } else if (arg.endsWith(".java")) {
+                    if (fm == null)
+                        throw new IllegalArgumentException();
+                    else
+                        docenv.error(null, "main.file_not_found", arg);
+                } else {
+                    docenv.error(null, "main.illegal_package_name", arg);
+                }
+            }
+
+            // Parse file objects provide via the DocumentationTool API
+            parse(fileObjects, classTrees, true);
+            modules.enter(classTrees.toList(), null);
+
+            syms.unnamedModule.complete(); // TEMP to force reading all named modules
+
+            // Build up the complete list of any packages to be documented
+            Location location =
+                    modules.multiModuleMode && !modules.noModules ? StandardLocation.MODULE_SOURCE_PATH
+                    : docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH) ? StandardLocation.SOURCE_PATH
+                    : StandardLocation.CLASS_PATH;
+
+            PackageTable t = new PackageTable(docenv.fileManager, location)
+                    .packages(packageNames)
+                    .subpackages(subPackages, excludedPackages);
+
+            includedPackages = t.getIncludedPackages();
+
+            // Parse the files in the packages to be documented
+            ListBuffer<JCCompilationUnit> packageTrees = new ListBuffer<>();
+            for (String packageName: includedPackages) {
+                List<JavaFileObject> files = t.getFiles(packageName);
+                docenv.notice("main.Loading_source_files_for_package", packageName);
+
+                if (files.isEmpty())
+                    messager.warning(Messager.NOPOS, "main.no_source_files_for_package", packageName);
+                parse(files, packageTrees, false);
+            }
+            modules.enter(packageTrees.toList(), null);
+
+            if (messager.nerrors() != 0) {
+                return null;
+            }
+
+            // Enter symbols for all files
+            docenv.notice("main.Building_tree");
+            javadocEnter.main(classTrees.toList().appendList(packageTrees.toList()));
+            enterDone = true;
+        } catch (Abort ex) {}
+
+        if (messager.nerrors() != 0)
+            return null;
+
+        return new RootDocImpl(docenv, listClasses(classTrees.toList()), List.from(includedPackages), options);
+    }
+
+    /** Is the given string a valid package name? */
+    boolean isValidPackageName(String s) {
+        int index;
+        while ((index = s.indexOf('.')) != -1) {
+            if (!isValidClassName(s.substring(0, index))) return false;
+            s = s.substring(index+1);
+        }
+        return isValidClassName(s);
+    }
+
+    private void parse(Iterable<? extends JavaFileObject> files, ListBuffer<JCCompilationUnit> trees,
+                       boolean trace) {
+        for (JavaFileObject fo: files) {
+            if (uniquefiles.add(fo)) { // ignore duplicates
+                if (trace)
+                    docenv.notice("main.Loading_source_file", fo.getName());
+                trees.append(parse(fo));
+            }
+        }
+    }
+
+    /** Are surrogates supported?
+     */
+    final static boolean surrogatesSupported = surrogatesSupported();
+    private static boolean surrogatesSupported() {
+        try {
+            boolean b = Character.isHighSurrogate('a');
+            return true;
+        } catch (NoSuchMethodError ex) {
+            return false;
+        }
+    }
+
+    /**
+     * Return true if given file name is a valid class name
+     * (including "package-info").
+     * @param s the name of the class to check.
+     * @return true if given class name is a valid class name
+     * and false otherwise.
+     */
+    public static boolean isValidClassName(String s) {
+        if (s.length() < 1) return false;
+        if (s.equals("package-info")) return true;
+        if (surrogatesSupported) {
+            int cp = s.codePointAt(0);
+            if (!Character.isJavaIdentifierStart(cp))
+                return false;
+            for (int j=Character.charCount(cp); j<s.length(); j+=Character.charCount(cp)) {
+                cp = s.codePointAt(j);
+                if (!Character.isJavaIdentifierPart(cp))
+                    return false;
+            }
+        } else {
+            if (!Character.isJavaIdentifierStart(s.charAt(0)))
+                return false;
+            for (int j=1; j<s.length(); j++)
+                if (!Character.isJavaIdentifierPart(s.charAt(j)))
+                    return false;
+        }
+        return true;
+    }
+
+    /**
+     * 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<>();
+        for (JCCompilationUnit t : trees) {
+            for (JCTree def : t.defs) {
+                if (def.hasTag(JCTree.Tag.CLASSDEF))
+                    result.append((JCClassDecl)def);
+            }
+        }
+        return result.toList();
+    }
+
+    /**
+     * A table to manage included and excluded packages.
+     */
+    class PackageTable {
+        private final Map<String, Entry> entries = new LinkedHashMap<>();
+        private final Set<String> includedPackages = new LinkedHashSet<>();
+        private final JavaFileManager fm;
+        private final Location location;
+        private final Set<JavaFileObject.Kind> sourceKinds = EnumSet.of(JavaFileObject.Kind.SOURCE);
+
+        /**
+         * Creates a table to manage included and excluded packages.
+         * @param fm The file manager used to locate source files
+         * @param locn the location used to locate source files
+         */
+        PackageTable(JavaFileManager fm, Location locn) {
+            this.fm = fm;
+            this.location = locn;
+            getEntry("").excluded = false;
+        }
+
+        PackageTable packages(Collection<String> packageNames) {
+            includedPackages.addAll(packageNames);
+            return this;
+        }
+
+        PackageTable subpackages(Collection<String> packageNames, Collection<String> excludePackageNames)
+                throws IOException {
+            for (String p: excludePackageNames) {
+                getEntry(p).excluded = true;
+            }
+
+            for (String packageName: packageNames) {
+                Location packageLocn = getLocation(packageName);
+                for (JavaFileObject fo: fm.list(packageLocn, packageName, sourceKinds, true)) {
+                    String binaryName = fm.inferBinaryName(packageLocn, fo);
+                    String pn = getPackageName(binaryName);
+                    String simpleName = getSimpleName(binaryName);
+                    Entry e = getEntry(pn);
+                    if (!e.isExcluded() && isValidClassName(simpleName)) {
+                        includedPackages.add(pn);
+                        e.files = (e.files == null ? List.of(fo) : e.files.prepend(fo));
+                    }
+                }
+            }
+            return this;
+        }
+
+        /**
+         * Returns the aggregate set of included packages.
+         * @return the aggregate set of included packages
+         */
+        Set<String> getIncludedPackages() {
+            return includedPackages;
+        }
+
+        /**
+         * Returns the set of source files for a package.
+         * @param packageName the specified package
+         * @return the set of file objects for the specified package
+         * @throws IOException if an error occurs while accessing the files
+         */
+        List<JavaFileObject> getFiles(String packageName) throws IOException {
+            Entry e = getEntry(packageName);
+            // The files may have been found as a side effect of searching for subpackages
+            if (e.files != null)
+                return e.files;
+
+            ListBuffer<JavaFileObject> lb = new ListBuffer<>();
+            Location packageLocn = getLocation(packageName);
+            for (JavaFileObject fo: fm.list(packageLocn, packageName, sourceKinds, false)) {
+                String binaryName = fm.inferBinaryName(packageLocn, fo);
+                String simpleName = getSimpleName(binaryName);
+                if (isValidClassName(simpleName)) {
+                    lb.append(fo);
+                }
+            }
+
+            return lb.toList();
+        }
+
+        private Location getLocation(String packageName) throws IOException {
+            if (location == StandardLocation.MODULE_SOURCE_PATH) {
+                // TODO: handle invalid results
+                ModuleSymbol msym = syms.inferModule(names.fromString(packageName));
+                return fm.getModuleLocation(location, msym.name.toString());
+            } else {
+                return location;
+            }
+        }
+
+        private Entry getEntry(String name) {
+            Entry e = entries.get(name);
+            if (e == null)
+                entries.put(name, e = new Entry(name));
+            return e;
+        }
+
+        private String getPackageName(String name) {
+            int lastDot = name.lastIndexOf(".");
+            return (lastDot == -1 ? "" : name.substring(0, lastDot));
+        }
+
+        private String getSimpleName(String name) {
+            int lastDot = name.lastIndexOf(".");
+            return (lastDot == -1 ? name : name.substring(lastDot + 1));
+        }
+
+        class Entry {
+            final String name;
+            Boolean excluded;
+            List<JavaFileObject> files;
+
+            Entry(String name) {
+                this.name = name;
+            }
+
+            boolean isExcluded() {
+                if (excluded == null)
+                    excluded = getEntry(getPackageName(name)).isExcluded();
+                return excluded;
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/MemberDocImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 1997, 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.tools.javadoc.main;
+
+import com.sun.javadoc.*;
+
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.code.Symbol;
+
+/**
+ * Represents a member of a java class: field, constructor, or method.
+ * This is an abstract class dealing with information common to
+ * method, constructor and field members. Class members of a class
+ * (nested classes) are represented instead by ClassDocImpl.
+ *
+ *  <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>
+ *
+ * @see MethodDocImpl
+ * @see FieldDocImpl
+ * @see ClassDocImpl
+ *
+ * @author Robert Field
+ * @author Neal Gafter
+ */
+
+public abstract class MemberDocImpl
+    extends ProgramElementDocImpl
+    implements MemberDoc {
+
+    /**
+     * constructor.
+     */
+    public MemberDocImpl(DocEnv env, Symbol sym, TreePath treePath) {
+        super(env, sym, treePath);
+    }
+
+    /**
+     * Returns true if this field was synthesized by the compiler.
+     */
+    public abstract boolean isSynthetic();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,323 @@
+/*
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.javadoc.main;
+
+import java.io.PrintWriter;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.JCDiagnostic;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
+import com.sun.tools.javac.util.JavacMessages;
+import com.sun.tools.javac.util.Log;
+
+/**
+ * Utility for integrating with javadoc tools and for localization.
+ * Handle Resources. Access to error and warning counts.
+ * Message formatting.
+ * <br>
+ * Also provides implementation for DocErrorReporter.
+ *
+ *  <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>
+ *
+ * @see java.util.ResourceBundle
+ * @see java.text.MessageFormat
+ * @author Neal Gafter (rewrite)
+ */
+public class Messager extends Log implements DocErrorReporter {
+    public static final SourcePosition NOPOS = null;
+
+    /** Get the current messager, which is also the compiler log. */
+    public static Messager instance0(Context context) {
+        Log instance = context.get(logKey);
+        if (instance == null || !(instance instanceof Messager))
+            throw new InternalError("no messager instance!");
+        return (Messager)instance;
+    }
+
+    public static void preRegister(Context context,
+                                   final String programName) {
+        context.put(logKey, new Context.Factory<Log>() {
+            public Log make(Context c) {
+                return new Messager(c,
+                                    programName);
+            }
+        });
+    }
+    public static void preRegister(Context context,
+                                   final String programName,
+                                   final PrintWriter errWriter,
+                                   final PrintWriter warnWriter,
+                                   final PrintWriter noticeWriter) {
+        context.put(logKey, new Context.Factory<Log>() {
+            public Log make(Context c) {
+                return new Messager(c,
+                                    programName,
+                                    errWriter,
+                                    warnWriter,
+                                    noticeWriter);
+            }
+        });
+    }
+
+    public class ExitJavadoc extends Error {
+        private static final long serialVersionUID = 0;
+    }
+
+    final String programName;
+
+    private Locale locale;
+    private final JavacMessages messages;
+    private final JCDiagnostic.Factory javadocDiags;
+
+    /** The default writer for diagnostics
+     */
+    static final PrintWriter defaultErrWriter = new PrintWriter(System.err);
+    static final PrintWriter defaultWarnWriter = new PrintWriter(System.err);
+    static final PrintWriter defaultNoticeWriter = new PrintWriter(System.out);
+
+    /**
+     * Constructor
+     * @param programName  Name of the program (for error messages).
+     */
+    protected Messager(Context context, String programName) {
+        this(context, programName, defaultErrWriter, defaultWarnWriter, defaultNoticeWriter);
+    }
+
+    /**
+     * Constructor
+     * @param programName  Name of the program (for error messages).
+     * @param errWriter    Stream for error messages
+     * @param warnWriter   Stream for warnings
+     * @param noticeWriter Stream for other messages
+     */
+    @SuppressWarnings("deprecation")
+    protected Messager(Context context,
+                       String programName,
+                       PrintWriter errWriter,
+                       PrintWriter warnWriter,
+                       PrintWriter noticeWriter) {
+        super(context, errWriter, warnWriter, noticeWriter);
+        messages = JavacMessages.instance(context);
+        messages.add(locale -> ResourceBundle.getBundle("com.sun.tools.javadoc.resources.javadoc",
+                                                         locale));
+        javadocDiags = new JCDiagnostic.Factory(messages, "javadoc");
+        this.programName = programName;
+
+    }
+
+    public void setLocale(Locale locale) {
+        this.locale = locale;
+    }
+
+    /**
+     * get and format message string from resource
+     *
+     * @param key selects message from resource
+     * @param args arguments for the message
+     */
+    String getText(String key, Object... args) {
+        return messages.getLocalizedString(locale, key, args);
+    }
+
+    /**
+     * Print error message, increment error count.
+     * Part of DocErrorReporter.
+     *
+     * @param msg message to print
+     */
+    public void printError(String msg) {
+        printError(null, msg);
+    }
+
+    /**
+     * Print error message, increment error count.
+     * Part of DocErrorReporter.
+     *
+     * @param pos the position where the error occurs
+     * @param msg message to print
+     */
+    public void printError(SourcePosition pos, String msg) {
+        if (diagListener != null) {
+            report(DiagnosticType.ERROR, pos, msg);
+            return;
+        }
+
+        if (nerrors < MaxErrors) {
+            String prefix = (pos == null) ? programName : pos.toString();
+            errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg);
+            errWriter.flush();
+            prompt();
+            nerrors++;
+        }
+    }
+
+    /**
+     * Print warning message, increment warning count.
+     * Part of DocErrorReporter.
+     *
+     * @param msg message to print
+     */
+    public void printWarning(String msg) {
+        printWarning(null, msg);
+    }
+
+    /**
+     * Print warning message, increment warning count.
+     * Part of DocErrorReporter.
+     *
+     * @param pos the position where the error occurs
+     * @param msg message to print
+     */
+    public void printWarning(SourcePosition pos, String msg) {
+        if (diagListener != null) {
+            report(DiagnosticType.WARNING, pos, msg);
+            return;
+        }
+
+        if (nwarnings < MaxWarnings) {
+            String prefix = (pos == null) ? programName : pos.toString();
+            warnWriter.println(prefix +  ": " + getText("javadoc.warning") +" - " + msg);
+            warnWriter.flush();
+            nwarnings++;
+        }
+    }
+
+    /**
+     * Print a message.
+     * Part of DocErrorReporter.
+     *
+     * @param msg message to print
+     */
+    public void printNotice(String msg) {
+        printNotice(null, msg);
+    }
+
+    /**
+     * Print a message.
+     * Part of DocErrorReporter.
+     *
+     * @param pos the position where the error occurs
+     * @param msg message to print
+     */
+    public void printNotice(SourcePosition pos, String msg) {
+        if (diagListener != null) {
+            report(DiagnosticType.NOTE, pos, msg);
+            return;
+        }
+
+        if (pos == null)
+            noticeWriter.println(msg);
+        else
+            noticeWriter.println(pos + ": " + msg);
+        noticeWriter.flush();
+    }
+
+    /**
+     * Print error message, increment error count.
+     *
+     * @param key selects message from resource
+     */
+    public void error(SourcePosition pos, String key, Object... args) {
+        printError(pos, getText(key, args));
+    }
+
+    /**
+     * Print warning message, increment warning count.
+     *
+     * @param key selects message from resource
+     */
+    public void warning(SourcePosition pos, String key, Object... args) {
+        printWarning(pos, getText(key, args));
+    }
+
+    /**
+     * Print a message.
+     *
+     * @param key selects message from resource
+     */
+    public void notice(String key, Object... args) {
+        printNotice(getText(key, args));
+    }
+
+    /**
+     * Return total number of errors, including those recorded
+     * in the compilation log.
+     */
+    public int nerrors() { return nerrors; }
+
+    /**
+     * Return total number of warnings, including those recorded
+     * in the compilation log.
+     */
+    public int nwarnings() { return nwarnings; }
+
+    /**
+     * Print exit message.
+     */
+    public void exitNotice() {
+        if (nerrors > 0) {
+            notice((nerrors > 1) ? "main.errors" : "main.error",
+                   "" + nerrors);
+        }
+        if (nwarnings > 0) {
+            notice((nwarnings > 1) ?  "main.warnings" : "main.warning",
+                   "" + nwarnings);
+        }
+    }
+
+    /**
+     * Force program exit, e.g., from a fatal error.
+     * <p>
+     * TODO: This method does not really belong here.
+     */
+    public void exit() {
+        throw new ExitJavadoc();
+    }
+
+    private void report(DiagnosticType type, SourcePosition pos, String msg) {
+        switch (type) {
+            case ERROR:
+            case WARNING:
+                Object prefix = (pos == null) ? programName : pos;
+                report(javadocDiags.create(type, null, null, "msg", prefix, msg));
+                break;
+
+            case NOTE:
+                String key = (pos == null) ? "msg" : "pos.msg";
+                report(javadocDiags.create(type, null, null, key, pos, msg));
+                break;
+
+            default:
+                throw new IllegalArgumentException(type.toString());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/MethodDocImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,246 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import java.lang.reflect.Modifier;
+
+import com.sun.javadoc.*;
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.Type;
+import static com.sun.tools.javac.code.TypeTag.CLASS;
+
+/**
+ * Represents a method of a java class.
+ *
+ *  <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>
+ *
+ * @since 1.2
+ * @author Robert Field
+ * @author Neal Gafter (rewrite)
+ */
+
+public class MethodDocImpl
+        extends ExecutableMemberDocImpl implements MethodDoc {
+
+    /**
+     * constructor.
+     */
+    public MethodDocImpl(DocEnv env, MethodSymbol sym) {
+        super(env, sym);
+    }
+
+    /**
+     * constructor.
+     */
+    public MethodDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) {
+        super(env, sym, treePath);
+    }
+
+    /**
+     * Return true if it is a method, which it is.
+     * Note: constructors are not methods.
+     * This method is overridden by AnnotationTypeElementDocImpl.
+     *
+     * @return true
+     */
+    public boolean isMethod() {
+        return true;
+    }
+
+    /**
+     * Return true if this method is default
+     */
+    public boolean isDefault() {
+        return (sym.flags() & Flags.DEFAULT) != 0;
+    }
+
+    /**
+     * Return true if this method is abstract
+     */
+    public boolean isAbstract() {
+        return (Modifier.isAbstract(getModifiers()) && !isDefault());
+    }
+
+    /**
+     * Get return type.
+     *
+     * @return the return type of this method, null if it
+     * is a constructor.
+     */
+    public com.sun.javadoc.Type returnType() {
+        return TypeMaker.getType(env, sym.type.getReturnType(), false);
+    }
+
+    /**
+     * Return the class that originally defined the method that
+     * is overridden by the current definition, or null if no
+     * such class exists.
+     *
+     * @return a ClassDocImpl representing the superclass that
+     * originally defined this method, null if this method does
+     * not override a definition in a superclass.
+     */
+    public ClassDoc overriddenClass() {
+        com.sun.javadoc.Type t = overriddenType();
+        return (t != null) ? t.asClassDoc() : null;
+    }
+
+    /**
+     * Return the type containing the method that this method overrides.
+     * It may be a <code>ClassDoc</code> or a <code>ParameterizedType</code>.
+     */
+    public com.sun.javadoc.Type overriddenType() {
+
+        if ((sym.flags() & Flags.STATIC) != 0) {
+            return null;
+        }
+
+        ClassSymbol origin = (ClassSymbol)sym.owner;
+        for (Type t = env.types.supertype(origin.type);
+             t.hasTag(CLASS);
+             t = env.types.supertype(t)) {
+            ClassSymbol c = (ClassSymbol)t.tsym;
+            for (Symbol sym2 : membersOf(c).getSymbolsByName(sym.name)) {
+                if (sym.overrides(sym2, origin, env.types, true)) {
+                    return TypeMaker.getType(env, t);
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Return the method that this method overrides.
+     *
+     * @return a MethodDoc representing a method definition
+     * in a superclass this method overrides, null if
+     * this method does not override.
+     */
+    public MethodDoc overriddenMethod() {
+
+        // Real overriding only.  Static members are simply hidden.
+        // Likewise for constructors, but the MethodSymbol.overrides
+        // method takes this into account.
+        if ((sym.flags() & Flags.STATIC) != 0) {
+            return null;
+        }
+
+        // Derived from  com.sun.tools.javac.comp.Check.checkOverride .
+
+        ClassSymbol origin = (ClassSymbol)sym.owner;
+        for (Type t = env.types.supertype(origin.type);
+             t.hasTag(CLASS);
+             t = env.types.supertype(t)) {
+            ClassSymbol c = (ClassSymbol)t.tsym;
+            for (Symbol sym2 : membersOf(c).getSymbolsByName(sym.name)) {
+                if (sym.overrides(sym2, origin, env.types, true)) {
+                    return env.getMethodDoc((MethodSymbol)sym2);
+                }
+            }
+        }
+        return null;
+    }
+
+    /**Retrieve members of c, ignoring any CompletionFailures that occur. */
+    private Scope membersOf(ClassSymbol c) {
+        try {
+            return c.members();
+        } catch (CompletionFailure cf) {
+            /* Quietly ignore completion failures and try again - the type
+             * for which the CompletionFailure was thrown shouldn't be completed
+             * again by the completer that threw the CompletionFailure.
+             */
+            return membersOf(c);
+        }
+    }
+
+    /**
+     * Tests whether this method overrides another.
+     * The overridden method may be one declared in a superclass or
+     * a superinterface (unlike {@link #overriddenMethod()}).
+     *
+     * <p> When a non-abstract method overrides an abstract one, it is
+     * also said to <i>implement</i> the other.
+     *
+     * @param meth  the other method to examine
+     * @return <tt>true</tt> if this method overrides the other
+     */
+    public boolean overrides(MethodDoc meth) {
+        MethodSymbol overridee = ((MethodDocImpl) meth).sym;
+        ClassSymbol origin = (ClassSymbol) sym.owner;
+
+        return sym.name == overridee.name &&
+
+               // not reflexive as per JLS
+               sym != overridee &&
+
+               // we don't care if overridee is static, though that wouldn't
+               // compile
+               !sym.isStatic() &&
+
+               // sym, whose declaring type is the origin, must be
+               // in a subtype of overridee's type
+               env.types.asSuper(origin.type, overridee.owner) != null &&
+
+               // check access and signatures; don't check return types
+               sym.overrides(overridee, origin, env.types, false);
+    }
+
+
+    public String name() {
+        if (name == null) {
+            name = sym.name.toString();
+        }
+        return name;
+    }
+
+    private String name;
+
+    public String qualifiedName() {
+        if (qualifiedName == null) {
+            qualifiedName =  sym.enclClass().getQualifiedName() + "." + sym.name;
+        }
+        return qualifiedName;
+    }
+
+    private String qualifiedName;
+
+    /**
+     * Returns a string representation of this method.  Includes the
+     * qualified signature, the qualified method name, and any type
+     * parameters.  Type parameters follow the class name, as they do
+     * in the syntax for invoking methods with explicit type parameters.
+     */
+    public String toString() {
+        return sym.enclClass().getQualifiedName() +
+                "." + typeParametersString() + name() + signature();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ModifierFilter.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,125 @@
+/*
+ * 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.tools.javadoc.main;
+
+import static com.sun.tools.javac.code.Flags.*;
+
+/**
+ *   A class whose instances are filters over Modifier bits.
+ *   Filtering is done by returning boolean values.
+ *   Classes, methods and fields can be filtered, or filtering
+ *   can be done directly on modifier bits.
+ *
+ *  <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>
+ *
+ *   @see com.sun.tools.javac.code.Flags
+ *   @author Robert Field
+ */
+
+public class ModifierFilter {
+
+    /**
+    * Package private access.
+    * A "pseudo-" modifier bit that can be used in the
+    * constructors of this class to specify package private
+    * access. This is needed since there is no Modifier.PACKAGE.
+    */
+    public static final long PACKAGE = 0x8000000000000000L;
+
+    /**
+    * All access modifiers.
+    * A short-hand set of modifier bits that can be used in the
+    * constructors of this class to specify all access modifiers,
+    * Same as PRIVATE | PROTECTED | PUBLIC | PACKAGE.
+    */
+    public static final long ALL_ACCESS =
+                PRIVATE | PROTECTED | PUBLIC | PACKAGE;
+
+    private long oneOf;
+    private long must;
+    private long cannot;
+
+    private static final int ACCESS_BITS = PRIVATE | PROTECTED | PUBLIC;
+
+    /**
+     * Constructor - Specify a filter.
+     *
+     * @param   oneOf   If zero, everything passes the filter.
+     *                  If non-zero, at least one of the specified
+     *                  bits must be on in the modifier bits to
+     *                  pass the filter.
+     */
+    public ModifierFilter(long oneOf) {
+        this(oneOf, 0, 0);
+    }
+
+    /**
+     * Constructor - Specify a filter.
+     * For example, the filter below  will only pass synchronized
+     * methods that are private or package private access and are
+     * not native or static.
+     * <pre>
+     * ModifierFilter(  Modifier.PRIVATE | ModifierFilter.PACKAGE,
+     *                  Modifier.SYNCHRONIZED,
+     *                  Modifier.NATIVE | Modifier.STATIC)
+     * </pre><p>
+     * Each of the three arguments must either be
+     * zero or the or'ed combination of the bits specified in the
+     * class Modifier or this class. During filtering, these values
+     * are compared against the modifier bits as follows:
+     *
+     * @param   oneOf   If zero, ignore this argument.
+     *                  If non-zero, at least one of the bits must be on.
+     * @param   must    All bits specified must be on.
+     * @param   cannot  None of the bits specified can be on.
+     */
+    public ModifierFilter(long oneOf, long must, long cannot) {
+        this.oneOf = oneOf;
+        this.must = must;
+        this.cannot = cannot;
+    }
+
+    /**
+     * Filter on modifier bits.
+     *
+     * @param   modifierBits    Bits as specified in the Modifier class
+     *
+     * @return                  Whether the modifierBits pass this filter.
+     */
+    public boolean checkModifier(int modifierBits) {
+        // Add in the "pseudo-" modifier bit PACKAGE, if needed
+        long fmod = ((modifierBits & ACCESS_BITS) == 0) ?
+                        modifierBits | PACKAGE :
+                        modifierBits;
+        return ((oneOf == 0) || ((oneOf & fmod) != 0)) &&
+                ((must & fmod) == must) &&
+                ((cannot & fmod) == 0);
+    }
+
+} // end ModifierFilter
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,389 @@
+/*
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.javadoc.main;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.tools.FileObject;
+
+import com.sun.javadoc.*;
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.code.Attribute;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Position;
+
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
+
+/**
+ * Represents a java package.  Provides access to information
+ * about the package, the package's comment and tags, and the
+ * classes in the package.
+ *
+ *  <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>
+ *
+ * @since 1.2
+ * @author Kaiyang Liu (original)
+ * @author Robert Field (rewrite)
+ * @author Neal Gafter (rewrite)
+ * @author Scott Seligman (package-info.java)
+ */
+
+public class PackageDocImpl extends DocImpl implements PackageDoc {
+
+    public final PackageSymbol sym;
+    private JCCompilationUnit tree = null;    // for source position
+
+    public FileObject docPath = null;
+    private boolean foundDoc;   // found a doc comment in either
+                                // package.html or package-info.java
+
+    boolean isIncluded = false;  // Set in RootDocImpl.
+    public boolean setDocPath = false;  //Flag to avoid setting doc path multiple times.
+
+    /**
+     * Constructor
+     */
+    public PackageDocImpl(DocEnv env, PackageSymbol sym) {
+        this(env, sym, null);
+    }
+
+    /**
+     * Constructor
+     */
+    public PackageDocImpl(DocEnv env, PackageSymbol sym, TreePath treePath) {
+        super(env, treePath);
+        this.sym = sym;
+        this.tree = (treePath == null) ? null : (JCCompilationUnit) treePath.getCompilationUnit();
+        foundDoc = (documentation != null);
+    }
+
+    void setTree(JCTree tree) {
+        this.tree = (JCCompilationUnit) tree;
+    }
+
+    public void setTreePath(TreePath treePath) {
+        super.setTreePath(treePath);
+        checkDoc();
+    }
+
+    /**
+     * Do lazy initialization of "documentation" string.
+     */
+    protected String documentation() {
+        if (documentation != null)
+            return documentation;
+        if (docPath != null) {
+            // read from file
+            try {
+                InputStream s = docPath.openInputStream();
+                documentation = readHTMLDocumentation(s, docPath);
+            } catch (IOException exc) {
+                documentation = "";
+                env.error(null, "javadoc.File_Read_Error", docPath.getName());
+            }
+        } else {
+            // no doc file to be had
+            documentation = "";
+        }
+        return documentation;
+    }
+
+    /**
+     * Cache of all classes contained in this package, including
+     * member classes of those classes, and their member classes, etc.
+     * Includes only those classes at the specified protection level
+     * and weaker.
+     */
+    private List<ClassDocImpl> allClassesFiltered = null;
+
+    /**
+     * Cache of all classes contained in this package, including
+     * member classes of those classes, and their member classes, etc.
+     */
+    private List<ClassDocImpl> allClasses = null;
+
+    /**
+     * Return a list of all classes contained in this package, including
+     * member classes of those classes, and their member classes, etc.
+     */
+    private List<ClassDocImpl> getClasses(boolean filtered) {
+        if (allClasses != null && !filtered) {
+            return allClasses;
+        }
+        if (allClassesFiltered != null && filtered) {
+            return allClassesFiltered;
+        }
+        ListBuffer<ClassDocImpl> classes = new ListBuffer<>();
+        for (Symbol enumerated : sym.members().getSymbols(NON_RECURSIVE)) {
+            if (enumerated != null) {
+                ClassSymbol s = (ClassSymbol)enumerated;
+                ClassDocImpl c = env.getClassDoc(s);
+                if (c != null && !c.isSynthetic())
+                    c.addAllClasses(classes, filtered);
+            }
+        }
+        if (filtered)
+            return allClassesFiltered = classes.toList();
+        else
+            return allClasses = classes.toList();
+    }
+
+    /**
+     * Add all included classes (including Exceptions and Errors)
+     * and interfaces.
+     */
+    public void addAllClassesTo(ListBuffer<ClassDocImpl> list) {
+        list.appendList(getClasses(true));
+    }
+
+    /**
+     * Get all classes (including Exceptions and Errors)
+     * and interfaces.
+     * @since J2SE1.4.
+     *
+     * @return all classes and interfaces in this package, filtered to include
+     * only the included classes if filter==true.
+     */
+    public ClassDoc[] allClasses(boolean filter) {
+        List<ClassDocImpl> classes = getClasses(filter);
+        return classes.toArray(new ClassDocImpl[classes.length()]);
+    }
+
+    /**
+     * Get all included classes (including Exceptions and Errors)
+     * and interfaces.  Same as allClasses(true).
+     *
+     * @return all included classes and interfaces in this package.
+     */
+    public ClassDoc[] allClasses() {
+        return allClasses(true);
+    }
+
+    /**
+     * Get ordinary classes (that is, exclude exceptions, errors,
+     * enums, interfaces, and annotation types) in this package.
+     *
+     * @return included ordinary classes in this package.
+     */
+    public ClassDoc[] ordinaryClasses() {
+        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
+        for (ClassDocImpl c : getClasses(true)) {
+            if (c.isOrdinaryClass()) {
+                ret.append(c);
+            }
+        }
+        return ret.toArray(new ClassDocImpl[ret.length()]);
+    }
+
+    /**
+     * Get Exception classes in this package.
+     *
+     * @return included Exceptions in this package.
+     */
+    public ClassDoc[] exceptions() {
+        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
+        for (ClassDocImpl c : getClasses(true)) {
+            if (c.isException()) {
+                ret.append(c);
+            }
+        }
+        return ret.toArray(new ClassDocImpl[ret.length()]);
+    }
+
+    /**
+     * Get Error classes in this package.
+     *
+     * @return included Errors in this package.
+     */
+    public ClassDoc[] errors() {
+        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
+        for (ClassDocImpl c : getClasses(true)) {
+            if (c.isError()) {
+                ret.append(c);
+            }
+        }
+        return ret.toArray(new ClassDocImpl[ret.length()]);
+    }
+
+    /**
+     * Get included enum types in this package.
+     *
+     * @return included enum types in this package.
+     */
+    public ClassDoc[] enums() {
+        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
+        for (ClassDocImpl c : getClasses(true)) {
+            if (c.isEnum()) {
+                ret.append(c);
+            }
+        }
+        return ret.toArray(new ClassDocImpl[ret.length()]);
+    }
+
+    /**
+     * Get included interfaces in this package, omitting annotation types.
+     *
+     * @return included interfaces in this package.
+     */
+    public ClassDoc[] interfaces() {
+        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
+        for (ClassDocImpl c : getClasses(true)) {
+            if (c.isInterface()) {
+                ret.append(c);
+            }
+        }
+        return ret.toArray(new ClassDocImpl[ret.length()]);
+    }
+
+    /**
+     * Get included annotation types in this package.
+     *
+     * @return included annotation types in this package.
+     */
+    public AnnotationTypeDoc[] annotationTypes() {
+        ListBuffer<AnnotationTypeDocImpl> ret = new ListBuffer<>();
+        for (ClassDocImpl c : getClasses(true)) {
+            if (c.isAnnotationType()) {
+                ret.append((AnnotationTypeDocImpl)c);
+            }
+        }
+        return ret.toArray(new AnnotationTypeDocImpl[ret.length()]);
+    }
+
+    /**
+     * Get the annotations of this package.
+     * Return an empty array if there are none.
+     */
+    public AnnotationDesc[] annotations() {
+        AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()];
+        int i = 0;
+        for (Attribute.Compound a : sym.getRawAttributes()) {
+            res[i++] = new AnnotationDescImpl(env, a);
+        }
+        return res;
+    }
+
+
+    /**
+     * Lookup for a class within this package.
+     *
+     * @return ClassDocImpl of found class, or null if not found.
+     */
+    public ClassDoc findClass(String className) {
+        final boolean filtered = true;
+        for (ClassDocImpl c : getClasses(filtered)) {
+            if (c.name().equals(className)) {
+                return c;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Return true if this package is included in the active set.
+     */
+    public boolean isIncluded() {
+        return isIncluded;
+    }
+
+    /**
+     * Get package name.
+     *
+     * Note that we do not provide a means of obtaining the simple
+     * name of a package -- package names are always returned in their
+     * uniquely qualified form.
+     */
+    public String name() {
+        return qualifiedName();
+    }
+
+    /**
+     * Get package name.
+     */
+    public String qualifiedName() {
+        if (qualifiedName == null) {
+            Name fullname = sym.getQualifiedName();
+            // Some bogus tests depend on the interned "" being returned.
+            // See 6457276.
+            qualifiedName = fullname.isEmpty() ? "" : fullname.toString();
+        }
+        return qualifiedName;
+    }
+
+    private String qualifiedName;
+
+    /**
+     * set doc path for an unzipped directory
+     */
+    public void setDocPath(FileObject path) {
+        setDocPath = true;
+        if (path == null)
+            return;
+        if (!path.equals(docPath)) {
+            docPath = path;
+            checkDoc();
+        }
+    }
+
+    // Has checkDoc() sounded off yet?
+    private boolean checkDocWarningEmitted = false;
+
+    /**
+     * Invoked when a source of package doc comments is located.
+     * Emits a diagnostic if this is the second one.
+     */
+    private void checkDoc() {
+        if (foundDoc) {
+            if (!checkDocWarningEmitted) {
+                env.warning(null, "javadoc.Multiple_package_comments", name());
+                checkDocWarningEmitted = true;
+            }
+        } else {
+            foundDoc = true;
+        }
+    }
+
+    /**
+     * Return the source position of the entity, or null if
+     * no position is available.
+     */
+    public SourcePosition position() {
+        return (tree != null)
+                ? SourcePositionImpl.make(tree.sourcefile, tree.pos, tree.lineMap)
+                : SourcePositionImpl.make(docPath, Position.NOPOS, null);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParamTagImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 1997, 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.tools.javadoc.main;
+
+import java.util.regex.*;
+
+import com.sun.javadoc.*;
+
+/**
+ * Represents an @param documentation tag.
+ * Parses and stores the name and comment parts of the parameter tag.
+ *
+ *  <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>
+ *
+ * @author Robert Field
+ *
+ */
+class ParamTagImpl extends TagImpl implements ParamTag {
+
+    private static final Pattern typeParamRE = Pattern.compile("<([^<>]+)>");
+
+    private final String parameterName;
+    private final String parameterComment;
+    private final boolean isTypeParameter;
+
+    /**
+     * Cached inline tags.
+     */
+    private Tag[] inlineTags;
+
+    ParamTagImpl(DocImpl holder, String name, String text) {
+        super(holder, name, text);
+        String[] sa = divideAtWhite();
+
+        Matcher m = typeParamRE.matcher(sa[0]);
+        isTypeParameter = m.matches();
+        parameterName = isTypeParameter ? m.group(1) : sa[0];
+        parameterComment = sa[1];
+    }
+
+    /**
+     * Return the parameter name.
+     */
+    public String parameterName() {
+        return parameterName;
+    }
+
+    /**
+     * Return the parameter comment.
+     */
+    public String parameterComment() {
+        return parameterComment;
+    }
+
+    /**
+     * Return the kind of this tag.
+     */
+    @Override
+    public String kind() {
+        return "@param";
+    }
+
+    /**
+     * Return true if this ParamTag corresponds to a type parameter.
+     */
+    public boolean isTypeParameter() {
+        return isTypeParameter;
+    }
+
+    /**
+     * convert this object to a string.
+     */
+    @Override
+    public String toString() {
+        return name + ":" + text;
+    }
+
+    /**
+     * For the parameter comment with embedded @link tags return the array of
+     * TagImpls consisting of SeeTagImpl(s) and text containing TagImpl(s).
+     *
+     * @return TagImpl[] Array of tags with inline SeeTagImpls.
+     * @see TagImpl#inlineTags()
+     * @see ThrowsTagImpl#inlineTags()
+     */
+    @Override
+    public Tag[] inlineTags() {
+        if (inlineTags == null) {
+            inlineTags = Comment.getInlineTags(holder, parameterComment);
+        }
+        return inlineTags;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 1997, 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.tools.javadoc.main;
+
+import com.sun.javadoc.*;
+
+import com.sun.tools.javac.code.Attribute;
+import com.sun.tools.javac.code.Symbol.VarSymbol;
+
+/**
+ * ParameterImpl information.
+ * This includes a parameter type and parameter name.
+ *
+ *  <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>
+ *
+ * @author Kaiyang Liu (original)
+ * @author Robert Field (rewrite)
+ * @author Scott Seligman (generics, annotations)
+ */
+class ParameterImpl implements Parameter {
+
+    private final DocEnv env;
+    private final VarSymbol sym;
+    private final com.sun.javadoc.Type type;
+
+    /**
+     * Constructor of parameter info class.
+     */
+    ParameterImpl(DocEnv env, VarSymbol sym) {
+        this.env = env;
+        this.sym = sym;
+        this.type = TypeMaker.getType(env, sym.type, false);
+    }
+
+    /**
+     * Get the type of this parameter.
+     */
+    public com.sun.javadoc.Type type() {
+        return type;
+    }
+
+    /**
+     * Get local name of this parameter.
+     * For example if parameter is the short 'index', returns "index".
+     */
+    public String name() {
+        return sym.toString();
+    }
+
+    /**
+     * Get type name of this parameter.
+     * For example if parameter is the short 'index', returns "short".
+     */
+    public String typeName() {
+        return (type instanceof ClassDoc || type instanceof TypeVariable)
+                ? type.typeName()       // omit formal type params or bounds
+                : type.toString();
+    }
+
+    /**
+     * Returns a string representation of the parameter.
+     * <p>
+     * For example if parameter is the short 'index', returns "short index".
+     *
+     * @return type name and parameter name of this parameter.
+     */
+    public String toString() {
+        return typeName() + " " + sym;
+    }
+
+    /**
+     * Get the annotations of this parameter.
+     * Return an empty array if there are none.
+     */
+    public AnnotationDesc[] annotations() {
+        AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()];
+        int i = 0;
+        for (Attribute.Compound a : sym.getRawAttributes()) {
+            res[i++] = new AnnotationDescImpl(env, a);
+        }
+        return res;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterizedTypeImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2003, 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.tools.javadoc.main;
+
+import com.sun.javadoc.*;
+
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.ClassType;
+
+import static com.sun.tools.javac.code.TypeTag.CLASS;
+
+
+/**
+ * Implementation of <code>ParameterizedType</code>, which
+ * represents an invocation of a generic class or interface.
+ *
+ *  <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>
+ *
+ * @author Scott Seligman
+ * @since 1.5
+ */
+public class ParameterizedTypeImpl
+        extends AbstractTypeImpl implements ParameterizedType {
+
+    ParameterizedTypeImpl(DocEnv env, Type type) {
+        super(env, type);
+    }
+
+    /**
+     * Return the generic class or interface that declared this type.
+     */
+    @Override
+    public ClassDoc asClassDoc() {
+        return env.getClassDoc((ClassSymbol)type.tsym);
+    }
+
+    /**
+     * Return the actual type arguments of this type.
+     */
+    public com.sun.javadoc.Type[] typeArguments() {
+        return TypeMaker.getTypes(env, type.getTypeArguments());
+    }
+
+    /**
+     * Return the class type that is a direct supertype of this one.
+     * Return null if this is an interface type.
+     */
+    public com.sun.javadoc.Type superclassType() {
+        if (asClassDoc().isInterface()) {
+            return null;
+        }
+        Type sup = env.types.supertype(type);
+        return TypeMaker.getType(env,
+                                 (sup != type) ? sup : env.syms.objectType);
+    }
+
+    /**
+     * Return the interface types directly implemented by or extended by this
+     * parameterized type.
+     * Return an empty array if there are no interfaces.
+     */
+    public com.sun.javadoc.Type[] interfaceTypes() {
+        return TypeMaker.getTypes(env, env.types.interfaces(type));
+    }
+
+    /**
+     * Return the type that contains this type as a member.
+     * Return null is this is a top-level type.
+     */
+    public com.sun.javadoc.Type containingType() {
+        if (type.getEnclosingType().hasTag(CLASS)) {
+            // This is the type of an inner class.
+            return TypeMaker.getType(env, type.getEnclosingType());
+        }
+        ClassSymbol enclosing = type.tsym.owner.enclClass();
+        if (enclosing != null) {
+            // Nested but not inner.  Return the ClassDoc of the enclosing
+            // class or interface.
+            // See java.lang.reflect.ParameterizedType.getOwnerType().
+            return env.getClassDoc(enclosing);
+        }
+        return null;
+    }
+
+
+    // Asking for the "name" of a parameterized type doesn't exactly make
+    // sense.  It's a type expression.  Return the name of its generic
+    // type.
+    @Override
+    public String typeName() {
+        return TypeMaker.getTypeName(type, false);
+    }
+
+    @Override
+    public ParameterizedType asParameterizedType() {
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        return parameterizedTypeToString(env, (ClassType)type, true);
+    }
+
+    static String parameterizedTypeToString(DocEnv env, ClassType cl,
+                                            boolean full) {
+        if (env.legacyDoclet) {
+            return TypeMaker.getTypeName(cl, full);
+        }
+        StringBuilder s = new StringBuilder();
+        if (!(cl.getEnclosingType().hasTag(CLASS))) {               // if not an inner class...
+            s.append(TypeMaker.getTypeName(cl, full));
+        } else {
+            ClassType encl = (ClassType)cl.getEnclosingType();
+            s.append(parameterizedTypeToString(env, encl, full))
+             .append('.')
+             .append(cl.tsym.name.toString());
+        }
+        s.append(TypeMaker.typeArgumentsString(env, cl, full));
+        return s.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PrimitiveType.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,161 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import com.sun.javadoc.*;
+
+/**
+ *  <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>
+ */
+class PrimitiveType implements com.sun.javadoc.Type {
+
+    private final String name;
+
+    static final PrimitiveType voidType = new PrimitiveType("void");
+    static final PrimitiveType booleanType = new PrimitiveType("boolean");
+    static final PrimitiveType byteType = new PrimitiveType("byte");
+    static final PrimitiveType charType = new PrimitiveType("char");
+    static final PrimitiveType shortType = new PrimitiveType("short");
+    static final PrimitiveType intType = new PrimitiveType("int");
+    static final PrimitiveType longType = new PrimitiveType("long");
+    static final PrimitiveType floatType = new PrimitiveType("float");
+    static final PrimitiveType doubleType = new PrimitiveType("double");
+
+    // error type, should never actually be used
+    static final PrimitiveType errorType = new PrimitiveType("");
+
+    PrimitiveType(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Return unqualified name of type excluding any dimension information.
+     * <p>
+     * For example, a two dimensional array of String returns 'String'.
+     */
+    public String typeName() {
+        return name;
+    }
+
+    public com.sun.javadoc.Type getElementType() {
+        return null;
+    }
+
+    /**
+     * Return qualified name of type excluding any dimension information.
+     *<p>
+     * For example, a two dimensional array of String
+     * returns 'java.lang.String'.
+     */
+    public String qualifiedTypeName() {
+        return name;
+    }
+
+    /**
+     * Return the simple name of this type.
+     */
+    public String simpleTypeName() {
+        return name;
+    }
+
+    /**
+     * Return the type's dimension information, as a string.
+     * <p>
+     * For example, a two dimensional array of String returns '[][]'.
+     */
+    public String dimension() {
+        return "";
+    }
+
+    /**
+     * Return this type as a class.  Array dimensions are ignored.
+     *
+     * @return a ClassDocImpl if the type is a Class.
+     * Return null if it is a primitive type..
+     */
+    public ClassDoc asClassDoc() {
+        return null;
+    }
+
+    /**
+     * Return null, as this is not an annotation type.
+     */
+    public AnnotationTypeDoc asAnnotationTypeDoc() {
+        return null;
+    }
+
+    /**
+     * Return null, as this is not an instantiation.
+     */
+    public ParameterizedType asParameterizedType() {
+        return null;
+    }
+
+    /**
+     * Return null, as this is not a type variable.
+     */
+    public TypeVariable asTypeVariable() {
+        return null;
+    }
+
+    /**
+     * Return null, as this is not a wildcard type.
+     */
+    public WildcardType asWildcardType() {
+        return null;
+    }
+
+    /**
+     * Return null, as this is not an annotated type.
+     */
+    public AnnotatedType asAnnotatedType() {
+        return null;
+    }
+
+    /**
+     * Returns a string representation of the type.
+     *
+     * Return name of type including any dimension information.
+     * <p>
+     * For example, a two dimensional array of String returns
+     * <code>String[][]</code>.
+     *
+     * @return name of type including any dimension information.
+     */
+    public String toString() {
+        return qualifiedTypeName();
+    }
+
+    /**
+     * Return true if this is a primitive type.
+     */
+    public boolean isPrimitive() {
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ProgramElementDocImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 1997, 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.tools.javadoc.main;
+
+import java.lang.reflect.Modifier;
+import java.text.CollationKey;
+
+import com.sun.javadoc.*;
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.code.Attribute;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
+import com.sun.tools.javac.util.Position;
+
+/**
+ * Represents a java program element: class, interface, field,
+ * constructor, or method.
+ * This is an abstract class dealing with information common to
+ * these elements.
+ *
+ *  <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>
+ *
+ * @see MemberDocImpl
+ * @see ClassDocImpl
+ *
+ * @author Robert Field
+ * @author Neal Gafter (rewrite)
+ * @author Scott Seligman (generics, enums, annotations)
+ */
+public abstract class ProgramElementDocImpl
+        extends DocImpl implements ProgramElementDoc {
+
+    private final Symbol sym;
+
+    // For source position information.
+    JCTree tree = null;
+    Position.LineMap lineMap = null;
+
+
+    // Cache for getModifiers().
+    private int modifiers = -1;
+
+    protected ProgramElementDocImpl(DocEnv env, Symbol sym, TreePath treePath) {
+        super(env, treePath);
+        this.sym = sym;
+        if (treePath != null) {
+            tree = (JCTree) treePath.getLeaf();
+            lineMap = ((JCCompilationUnit) treePath.getCompilationUnit()).lineMap;
+        }
+    }
+
+    @Override
+    void setTreePath(TreePath treePath) {
+        super.setTreePath(treePath);
+        this.tree = (JCTree) treePath.getLeaf();
+        this.lineMap = ((JCCompilationUnit) treePath.getCompilationUnit()).lineMap;
+    }
+
+    /**
+     * Subclasses override to identify the containing class
+     */
+    protected abstract ClassSymbol getContainingClass();
+
+    /**
+     * Returns the flags in terms of javac's flags
+     */
+    abstract protected long getFlags();
+
+    /**
+     * Returns the modifier flags in terms of java.lang.reflect.Modifier.
+     */
+    protected int getModifiers() {
+        if (modifiers == -1) {
+            modifiers = DocEnv.translateModifiers(getFlags());
+        }
+        return modifiers;
+    }
+
+    /**
+     * Get the containing class of this program element.
+     *
+     * @return a ClassDocImpl for this element's containing class.
+     * If this is a class with no outer class, return null.
+     */
+    public ClassDoc containingClass() {
+        if (getContainingClass() == null) {
+            return null;
+        }
+        return env.getClassDoc(getContainingClass());
+    }
+
+    /**
+     * Return the package that this member is contained in.
+     * Return "" if in unnamed package.
+     */
+    public PackageDoc containingPackage() {
+        return env.getPackageDoc(getContainingClass().packge());
+    }
+
+    /**
+     * Get the modifier specifier integer.
+     *
+     * @see java.lang.reflect.Modifier
+     */
+    public int modifierSpecifier() {
+        int modifiers = getModifiers();
+        if (isMethod() && containingClass().isInterface())
+            // Remove the implicit abstract modifier.
+            return modifiers & ~Modifier.ABSTRACT;
+        return modifiers;
+    }
+
+    /**
+     * Get modifiers string.
+     * <pre>
+     * Example, for:
+     *   public abstract int foo() { ... }
+     * modifiers() would return:
+     *   'public abstract'
+     * </pre>
+     * Annotations are not included.
+     */
+    public String modifiers() {
+        int modifiers = getModifiers();
+        if (isAnnotationTypeElement() ||
+                (isMethod() && containingClass().isInterface())) {
+            // Remove the implicit abstract modifier.
+            return Modifier.toString(modifiers & ~Modifier.ABSTRACT);
+        } else {
+            return Modifier.toString(modifiers);
+        }
+    }
+
+    /**
+     * Get the annotations of this program element.
+     * Return an empty array if there are none.
+     */
+    public AnnotationDesc[] annotations() {
+        AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()];
+        int i = 0;
+        for (Attribute.Compound a : sym.getRawAttributes()) {
+            res[i++] = new AnnotationDescImpl(env, a);
+        }
+        return res;
+    }
+
+    /**
+     * Return true if this program element is public
+     */
+    public boolean isPublic() {
+        int modifiers = getModifiers();
+        return Modifier.isPublic(modifiers);
+    }
+
+    /**
+     * Return true if this program element is protected
+     */
+    public boolean isProtected() {
+        int modifiers = getModifiers();
+        return Modifier.isProtected(modifiers);
+    }
+
+    /**
+     * Return true if this program element is private
+     */
+    public boolean isPrivate() {
+        int modifiers = getModifiers();
+        return Modifier.isPrivate(modifiers);
+    }
+
+    /**
+     * Return true if this program element is package private
+     */
+    public boolean isPackagePrivate() {
+        return !(isPublic() || isPrivate() || isProtected());
+    }
+
+    /**
+     * Return true if this program element is static
+     */
+    public boolean isStatic() {
+        int modifiers = getModifiers();
+        return Modifier.isStatic(modifiers);
+    }
+
+    /**
+     * Return true if this program element is final
+     */
+    public boolean isFinal() {
+        int modifiers = getModifiers();
+        return Modifier.isFinal(modifiers);
+    }
+
+    /**
+     * Generate a key for sorting.
+     */
+    CollationKey generateKey() {
+        String k = name();
+        // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
+        return env.doclocale.collator.getCollationKey(k);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/RootDocImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,394 @@
+/*
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.javadoc.main;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Locale;
+
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.tree.JCTree.JCClassDecl;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Position;
+
+/**
+ * This class holds the information from one run of javadoc.
+ * Particularly the packages, classes and options specified
+ * by the user.
+ *
+ *  <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>
+ *
+ * @since 1.2
+ * @author Robert Field
+ * @author Atul M Dambalkar
+ * @author Neal Gafter (rewrite)
+ */
+public class RootDocImpl extends DocImpl implements RootDoc {
+
+    /**
+     * list of classes specified on the command line.
+     */
+    private List<ClassDocImpl> cmdLineClasses;
+
+    /**
+     * list of packages specified on the command line.
+     */
+    private List<PackageDocImpl> cmdLinePackages;
+
+    /**
+     * a collection of all options.
+     */
+    private List<String[]> options;
+
+    /**
+     * Constructor used when reading source files.
+     *
+     * @param env the documentation environment, state for this javadoc run
+     * @param classes list of classes specified on the commandline
+     * @param packages list of package names specified on the commandline
+     * @param options list of options
+     */
+    public RootDocImpl(DocEnv env, List<JCClassDecl> classes, List<String> packages, List<String[]> options) {
+        super(env, null);
+        this.options = options;
+        setPackages(env, packages);
+        setClasses(env, classes);
+    }
+
+    /**
+     * Constructor used when reading class files.
+     *
+     * @param env the documentation environment, state for this javadoc run
+     * @param classes list of class names specified on the commandline
+     * @param options list of options
+     */
+    public RootDocImpl(DocEnv env, List<String> classes, List<String[]> options) {
+        super(env, null);
+        this.options = options;
+        cmdLinePackages = List.nil();
+        ListBuffer<ClassDocImpl> classList = new ListBuffer<>();
+        for (String className : classes) {
+            ClassDocImpl c = env.loadClass(className);
+            if (c == null)
+                env.error(null, "javadoc.class_not_found", className);
+            else
+                classList = classList.append(c);
+        }
+        cmdLineClasses = classList.toList();
+    }
+
+    /**
+     * Initialize classes information. Those classes are input from
+     * command line.
+     *
+     * @param env the compilation environment
+     * @param classes a list of ClassDeclaration
+     */
+    private void setClasses(DocEnv env, List<JCClassDecl> classes) {
+        ListBuffer<ClassDocImpl> result = new ListBuffer<>();
+        for (JCClassDecl def : classes) {
+            //### Do we want modifier check here?
+            if (env.shouldDocument(def.sym)) {
+                ClassDocImpl cd = env.getClassDoc(def.sym);
+                if (cd != null) {
+                    cd.isIncluded = true;
+                    result.append(cd);
+                } //else System.out.println(" (classdoc is null)");//DEBUG
+            } //else System.out.println(" (env.shouldDocument() returned false)");//DEBUG
+        }
+        cmdLineClasses = result.toList();
+    }
+
+    /**
+     * Initialize packages information.
+     *
+     * @param env the compilation environment
+     * @param packages a list of package names (String)
+     */
+    private void setPackages(DocEnv env, List<String> packages) {
+        ListBuffer<PackageDocImpl> packlist = new ListBuffer<>();
+        for (String name : packages) {
+            PackageDocImpl pkg = env.lookupPackage(name);
+            if (pkg != null) {
+                pkg.isIncluded = true;
+                packlist.append(pkg);
+            } else {
+                env.warning(null, "main.no_source_files_for_package", name);
+            }
+        }
+        cmdLinePackages = packlist.toList();
+    }
+
+    /**
+     * Command line options.
+     *
+     * <pre>
+     * For example, given:
+     *     javadoc -foo this that -bar other ...
+     *
+     * This method will return:
+     *      options()[0][0] = "-foo"
+     *      options()[0][1] = "this"
+     *      options()[0][2] = "that"
+     *      options()[1][0] = "-bar"
+     *      options()[1][1] = "other"
+     * </pre>
+     *
+     * @return an array of arrays of String.
+     */
+    public String[][] options() {
+        return options.toArray(new String[options.length()][]);
+    }
+
+    /**
+     * Packages specified on the command line.
+     */
+    public PackageDoc[] specifiedPackages() {
+        return (PackageDoc[])cmdLinePackages
+            .toArray(new PackageDocImpl[cmdLinePackages.length()]);
+    }
+
+    /**
+     * Classes and interfaces specified on the command line.
+     */
+    public ClassDoc[] specifiedClasses() {
+        ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<>();
+        for (ClassDocImpl cd : cmdLineClasses) {
+            cd.addAllClasses(classesToDocument, true);
+        }
+        return (ClassDoc[])classesToDocument.toArray(new ClassDocImpl[classesToDocument.length()]);
+    }
+
+    /**
+     * Return all classes and interfaces (including those inside
+     * packages) to be documented.
+     */
+    public ClassDoc[] classes() {
+        ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<>();
+        for (ClassDocImpl cd : cmdLineClasses) {
+            cd.addAllClasses(classesToDocument, true);
+        }
+        for (PackageDocImpl pd : cmdLinePackages) {
+            pd.addAllClassesTo(classesToDocument);
+        }
+        return classesToDocument.toArray(new ClassDocImpl[classesToDocument.length()]);
+    }
+
+    /**
+     * Return a ClassDoc for the specified class/interface name
+     *
+     * @param qualifiedName qualified class name
+     *                        (i.e. includes package name).
+     *
+     * @return a ClassDocImpl holding the specified class, null if
+     * this class is not referenced.
+     */
+    public ClassDoc classNamed(String qualifiedName) {
+        return env.lookupClass(qualifiedName);
+    }
+
+    /**
+     * Return a PackageDoc for the specified package name
+     *
+     * @param name package name
+     *
+     * @return a PackageDoc holding the specified package, null if
+     * this package is not referenced.
+     */
+    public PackageDoc packageNamed(String name) {
+        return env.lookupPackage(name);
+    }
+
+    /**
+     * Return the name of this Doc item.
+     *
+     * @return the string <code>"*RootDocImpl*"</code>.
+     */
+    public String name() {
+        return "*RootDocImpl*";
+    }
+
+    /**
+     * Return the name of this Doc item.
+     *
+     * @return the string <code>"*RootDocImpl*"</code>.
+     */
+    public String qualifiedName() {
+        return "*RootDocImpl*";
+    }
+
+    /**
+     * Return true if this Doc is include in the active set.
+     * RootDocImpl isn't even a program entity so it is always false.
+     */
+    public boolean isIncluded() {
+        return false;
+    }
+
+    /**
+     * Print error message, increment error count.
+     *
+     * @param msg message to print
+     */
+    public void printError(String msg) {
+        env.printError(msg);
+    }
+
+    /**
+     * Print error message, increment error count.
+     *
+     * @param msg message to print
+     */
+    public void printError(SourcePosition pos, String msg) {
+        env.printError(pos, msg);
+    }
+
+    /**
+     * Print warning message, increment warning count.
+     *
+     * @param msg message to print
+     */
+    public void printWarning(String msg) {
+        env.printWarning(msg);
+    }
+
+    /**
+     * Print warning message, increment warning count.
+     *
+     * @param msg message to print
+     */
+    public void printWarning(SourcePosition pos, String msg) {
+        env.printWarning(pos, msg);
+    }
+
+    /**
+     * Print a message.
+     *
+     * @param msg message to print
+     */
+    public void printNotice(String msg) {
+        env.printNotice(msg);
+    }
+
+    /**
+     * Print a message.
+     *
+     * @param msg message to print
+     */
+    public void printNotice(SourcePosition pos, String msg) {
+        env.printNotice(pos, msg);
+    }
+
+    /**
+     * Return the path of the overview file and null if it does not exist.
+     * @return the path of the overview file and null if it does not exist.
+     */
+    private JavaFileObject getOverviewPath() {
+        for (String[] opt : options) {
+            if (opt[0].equals("-overview")) {
+                if (env.fileManager instanceof StandardJavaFileManager) {
+                    StandardJavaFileManager fm = (StandardJavaFileManager) env.fileManager;
+                    return fm.getJavaFileObjects(opt[1]).iterator().next();
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Do lazy initialization of "documentation" string.
+     */
+    @Override
+    protected String documentation() {
+        if (documentation == null) {
+            JavaFileObject overviewPath = getOverviewPath();
+            if (overviewPath == null) {
+                // no doc file to be had
+                documentation = "";
+            } else {
+                // read from file
+                try {
+                    documentation = readHTMLDocumentation(
+                        overviewPath.openInputStream(),
+                        overviewPath);
+                } catch (IOException exc) {
+                    documentation = "";
+                    env.error(null, "javadoc.File_Read_Error", overviewPath.getName());
+                }
+            }
+        }
+        return documentation;
+    }
+
+    /**
+     * Return the source position of the entity, or null if
+     * no position is available.
+     */
+    @Override
+    public SourcePosition position() {
+        JavaFileObject path;
+        return ((path = getOverviewPath()) == null) ?
+            null :
+            SourcePositionImpl.make(path, Position.NOPOS, null);
+    }
+
+    /**
+     * Return the locale provided by the user or the default locale value.
+     */
+    public Locale getLocale() {
+        return env.doclocale.locale;
+    }
+
+    /**
+     * Return the current file manager.
+     */
+    public JavaFileManager getFileManager() {
+        return env.fileManager;
+    }
+
+    public void initDocLint(Collection<String> opts, Collection<String> customTagNames,
+            String htmlVersion) {
+        env.initDoclint(opts, customTagNames, htmlVersion);
+    }
+
+    public boolean isFunctionalInterface(AnnotationDesc annotationDesc) {
+        return env.source.allowLambda()
+            && annotationDesc.annotationType().qualifiedName().equals(
+                env.syms.functionalInterfaceType.toString());
+    }
+
+    public boolean showTagMessages() {
+        return env.showTagMessages();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SeeTagImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,542 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import java.io.File;
+import java.util.Locale;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.code.Printer;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Type.CapturedType;
+import com.sun.tools.javac.util.*;
+
+import static com.sun.tools.javac.code.Kinds.Kind.*;
+
+/**
+ * Represents a see also documentation tag.
+ * The @see tag can be plain text, or reference a class or member.
+ *
+ *  <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>
+ *
+ * @author Kaiyang Liu (original)
+ * @author Robert Field (rewrite)
+ * @author Atul M Dambalkar
+ *
+ */
+class SeeTagImpl extends TagImpl implements SeeTag, LayoutCharacters {
+
+    //### TODO: Searching for classes, fields, and methods
+    //### should follow the normal rules applied by the compiler.
+
+    /**
+     * where of  where#what - i.e. the class name (may be empty)
+     */
+    private String where;
+
+    /**
+     * what of  where#what - i.e. the member (may be null)
+     */
+    private String what;
+
+    private PackageDoc referencedPackage;
+    private ClassDoc referencedClass;
+    private MemberDoc referencedMember;
+
+    String label = "";
+
+    SeeTagImpl(DocImpl holder, String name, String text) {
+        super(holder, name, text);
+        parseSeeString();
+        if (where != null) {
+            ClassDocImpl container = null;
+            if (holder instanceof MemberDoc) {
+                container =
+                  (ClassDocImpl)((ProgramElementDoc)holder).containingClass();
+            } else if (holder instanceof ClassDoc) {
+                container = (ClassDocImpl)holder;
+            }
+            findReferenced(container);
+            if (showRef) showRef();
+        }
+    }
+
+    private static final boolean showRef = false;
+
+    private void showRef() {
+        Symbol sym;
+        if (referencedMember != null) {
+            if (referencedMember instanceof MethodDocImpl)
+                sym = ((MethodDocImpl) referencedMember).sym;
+            else if (referencedMember instanceof FieldDocImpl)
+                sym = ((FieldDocImpl) referencedMember).sym;
+            else
+                sym = ((ConstructorDocImpl) referencedMember).sym;
+        } else if (referencedClass != null) {
+            sym = ((ClassDocImpl) referencedClass).tsym;
+        } else if (referencedPackage != null) {
+            sym = ((PackageDocImpl) referencedPackage).sym;
+        } else
+            return;
+
+        final JavacMessages messages = JavacMessages.instance(docenv().context);
+        Locale locale = Locale.getDefault();
+        Printer printer = new Printer() {
+            int count;
+            @Override
+            protected String localize(Locale locale, String key, Object... args) {
+                return messages.getLocalizedString(locale, key, args);
+            }
+            @Override
+            protected String capturedVarId(CapturedType t, Locale locale) {
+                return "CAP#" + (++count);
+            }
+        };
+
+        String s = text.replaceAll("\\s+", " ");  // normalize white space
+        int sp = s.indexOf(" ");
+        int lparen = s.indexOf("(");
+        int rparen = s.indexOf(")");
+        String seetext = (sp == -1) ? s
+                : (lparen == -1 || sp < lparen) ? s.substring(0, sp)
+                : s.substring(0, rparen + 1);
+
+        File file = new File(holder.position().file().getAbsoluteFile().toURI().normalize());
+
+        StringBuilder sb = new StringBuilder();
+        sb.append("+++ ").append(file).append(": ")
+                .append(name()).append(" ").append(seetext).append(": ");
+        sb.append(sym.getKind()).append(" ");
+        if (sym.kind == MTH || sym.kind == VAR)
+            sb.append(printer.visit(sym.owner, locale)).append(".");
+        sb.append(printer.visit(sym, locale));
+
+        System.err.println(sb);
+    }
+
+    /**
+     * get the class name part of @see, For instance,
+     * if the comment is @see String#startsWith(java.lang.String) .
+     *      This function returns String.
+     * Returns null if format was not that of java reference.
+     * Return empty string if class name was not specified..
+     */
+    public String referencedClassName() {
+        return where;
+    }
+
+    /**
+     * get the package referenced by  @see. For instance,
+     * if the comment is @see java.lang
+     *      This function returns a PackageDocImpl for java.lang
+     * Returns null if no known package found.
+     */
+    public PackageDoc referencedPackage() {
+        return referencedPackage;
+    }
+
+    /**
+     * get the class referenced by the class name part of @see, For instance,
+     * if the comment is @see String#startsWith(java.lang.String) .
+     *      This function returns a ClassDocImpl for java.lang.String.
+     * Returns null if class is not a class specified on the javadoc command line..
+     */
+    public ClassDoc referencedClass() {
+        return referencedClass;
+    }
+
+    /**
+     * get the name of the member referenced by the prototype part of @see,
+     * For instance,
+     * if the comment is @see String#startsWith(java.lang.String) .
+     *      This function returns "startsWith(java.lang.String)"
+     * Returns null if format was not that of java reference.
+     * Return empty string if member name was not specified..
+     */
+    public String referencedMemberName() {
+        return what;
+    }
+
+    /**
+     * get the member referenced by the prototype part of @see,
+     * For instance,
+     * if the comment is @see String#startsWith(java.lang.String) .
+     *      This function returns a MethodDocImpl for startsWith.
+     * Returns null if member could not be determined.
+     */
+    public MemberDoc referencedMember() {
+        return referencedMember;
+    }
+
+
+    /**
+     * parse @see part of comment. Determine 'where' and 'what'
+     */
+    private void parseSeeString() {
+        int len = text.length();
+        if (len == 0) {
+            return;
+        }
+        switch (text.charAt(0)) {
+            case '<':
+                if (text.charAt(len-1) != '>') {
+                    docenv().warning(holder,
+                                     "tag.see.no_close_bracket_on_url",
+                                     name, text);
+                }
+                return;
+            case '"':
+                if (len == 1 || text.charAt(len-1) != '"') {
+                    docenv().warning(holder,
+                                     "tag.see.no_close_quote",
+                                     name, text);
+                } else {
+//                    text = text.substring(1,len-1); // strip quotes
+                }
+                return;
+        }
+
+        // check that the text is one word, with possible parentheses
+        // this part of code doesn't allow
+        // @see <a href=.....>asfd</a>
+        // comment it.
+
+        // the code assumes that there is no initial white space.
+        int parens = 0;
+        int commentstart = 0;
+        int start = 0;
+        int cp;
+        for (int i = start; i < len ; i += Character.charCount(cp)) {
+            cp = text.codePointAt(i);
+            switch (cp) {
+                case '(': parens++; break;
+                case ')': parens--; break;
+                case '[': case ']': case '.': case '#': break;
+                case ',':
+                    if (parens <= 0) {
+                        docenv().warning(holder,
+                                         "tag.see.malformed_see_tag",
+                                         name, text);
+                        return;
+                    }
+                    break;
+                case ' ': case '\t': case '\n': case CR:
+                    if (parens == 0) { //here onwards the comment starts.
+                        commentstart = i;
+                        i = len;
+                    }
+                    break;
+                default:
+                    if (!Character.isJavaIdentifierPart(cp)) {
+                        docenv().warning(holder,
+                                         "tag.see.illegal_character",
+                                         name, ""+cp, text);
+                    }
+                    break;
+            }
+        }
+        if (parens != 0) {
+            docenv().warning(holder,
+                             "tag.see.malformed_see_tag",
+                             name, text);
+            return;
+        }
+
+        String seetext = "";
+        String labeltext = "";
+
+        if (commentstart > 0) {
+            seetext = text.substring(start, commentstart);
+            labeltext = text.substring(commentstart + 1);
+            // strip off the white space which can be between seetext and the
+            // actual label.
+            for (int i = 0; i < labeltext.length(); i++) {
+                char ch2 = labeltext.charAt(i);
+                if (!(ch2 == ' ' || ch2 == '\t' || ch2 == '\n')) {
+                    label = labeltext.substring(i);
+                    break;
+                }
+            }
+        } else {
+            seetext = text;
+            label = "";
+        }
+
+        int sharp = seetext.indexOf('#');
+        if (sharp >= 0) {
+            // class#member
+            where = seetext.substring(0, sharp);
+            what = seetext.substring(sharp + 1);
+        } else {
+            if (seetext.indexOf('(') >= 0) {
+                docenv().warning(holder,
+                                 "tag.see.missing_sharp",
+                                 name, text);
+                where = "";
+                what = seetext;
+            }
+            else {
+                // no member specified, text names class
+                where = seetext;
+                what = null;
+            }
+        }
+    }
+
+    /**
+     * Find what is referenced by the see also.  If possible, sets
+     * referencedClass and referencedMember.
+     *
+     * @param containingClass the class containing the comment containing
+     * the tag. May be null, if, for example, it is a package comment.
+     */
+    private void findReferenced(ClassDocImpl containingClass) {
+        if (where.length() > 0) {
+            if (containingClass != null) {
+                referencedClass = containingClass.findClass(where);
+            } else {
+                referencedClass = docenv().lookupClass(where);
+            }
+            if (referencedClass == null && holder() instanceof ProgramElementDoc) {
+                referencedClass = docenv().lookupClass(
+                    ((ProgramElementDoc) holder()).containingPackage().name() + "." + where);
+            }
+
+            if (referencedClass == null) { /* may just not be in this run */
+                // check if it's a package name
+                referencedPackage = docenv().lookupPackage(where);
+                return;
+            }
+        } else {
+            if (containingClass == null) {
+                docenv().warning(holder,
+                                 "tag.see.class_not_specified",
+                                 name, text);
+                return;
+            } else {
+                referencedClass = containingClass;
+            }
+        }
+        where = referencedClass.qualifiedName();
+
+        if (what == null) {
+            return;
+        } else {
+            int paren = what.indexOf('(');
+            String memName = (paren >= 0 ? what.substring(0, paren) : what);
+            String[] paramarr;
+            if (paren > 0) {
+                // has parameter list -- should be method or constructor
+                paramarr = new ParameterParseMachine(what.
+                        substring(paren, what.length())).parseParameters();
+                if (paramarr != null) {
+                    referencedMember = findExecutableMember(memName, paramarr,
+                                                            referencedClass);
+                } else {
+                    referencedMember = null;
+                }
+            } else {
+                // no parameter list -- should be field
+                referencedMember = findExecutableMember(memName, null,
+                                                        referencedClass);
+                FieldDoc fd = ((ClassDocImpl)referencedClass).
+                                                            findField(memName);
+                // when no args given, prefer fields over methods
+                if (referencedMember == null ||
+                    (fd != null &&
+                     fd.containingClass()
+                         .subclassOf(referencedMember.containingClass()))) {
+                    referencedMember = fd;
+                }
+            }
+            if (referencedMember == null) {
+                docenv().warning(holder,
+                                 "tag.see.can_not_find_member",
+                                 name, what, where);
+            }
+        }
+    }
+
+    private MemberDoc findReferencedMethod(String memName, String[] paramarr,
+                                           ClassDoc referencedClass) {
+        MemberDoc meth = findExecutableMember(memName, paramarr, referencedClass);
+        if (meth == null) {
+            for (ClassDoc nestedClass : referencedClass.innerClasses()) {
+                meth = findReferencedMethod(memName, paramarr, nestedClass);
+                if (meth != null) {
+                    return meth;
+                }
+            }
+        }
+        return null;
+    }
+
+    private MemberDoc findExecutableMember(String memName, String[] paramarr,
+                                           ClassDoc referencedClass) {
+        String className = referencedClass.name();
+        if (memName.equals(className.substring(className.lastIndexOf(".") + 1))) {
+            return ((ClassDocImpl)referencedClass).findConstructor(memName,
+                                                                   paramarr);
+        } else {   // it's a method.
+            return ((ClassDocImpl)referencedClass).findMethod(memName,
+                                                              paramarr);
+        }
+    }
+
+    // separate "int, String" from "(int, String)"
+    // (int i, String s) ==> [0] = "int",  [1] = String
+    // (int[][], String[]) ==> [0] = "int[][]" // [1] = "String[]"
+    class ParameterParseMachine {
+        static final int START = 0;
+        static final int TYPE = 1;
+        static final int NAME = 2;
+        static final int TNSPACE = 3;  // space between type and name
+        static final int ARRAYDECORATION = 4;
+        static final int ARRAYSPACE = 5;
+
+        String parameters;
+
+        StringBuilder typeId;
+
+        ListBuffer<String> paramList;
+
+        ParameterParseMachine(String parameters) {
+            this.parameters = parameters;
+            this.paramList = new ListBuffer<>();
+            typeId = new StringBuilder();
+        }
+
+        public String[] parseParameters() {
+            if (parameters.equals("()")) {
+                return new String[0];
+            }   // now strip off '(' and ')'
+            int state = START;
+            int prevstate = START;
+            parameters = parameters.substring(1, parameters.length() - 1);
+            int cp;
+            for (int index = 0; index < parameters.length(); index += Character.charCount(cp)) {
+                cp = parameters.codePointAt(index);
+                switch (state) {
+                    case START:
+                        if (Character.isJavaIdentifierStart(cp)) {
+                            typeId.append(Character.toChars(cp));
+                            state = TYPE;
+                        }
+                        prevstate = START;
+                        break;
+                    case TYPE:
+                        if (Character.isJavaIdentifierPart(cp) || cp == '.') {
+                            typeId.append(Character.toChars(cp));
+                        } else if (cp == '[') {
+                            typeId.append('[');
+                            state = ARRAYDECORATION;
+                        } else if (Character.isWhitespace(cp)) {
+                            state = TNSPACE;
+                        } else if (cp == ',') {  // no name, just type
+                            addTypeToParamList();
+                            state = START;
+                        }
+                        prevstate = TYPE;
+                        break;
+                    case TNSPACE:
+                        if (Character.isJavaIdentifierStart(cp)) { // name
+                            if (prevstate == ARRAYDECORATION) {
+                                docenv().warning(holder,
+                                                 "tag.missing_comma_space",
+                                                 name,
+                                                 "(" + parameters + ")");
+                                return (String[])null;
+                            }
+                            addTypeToParamList();
+                            state = NAME;
+                        } else if (cp == '[') {
+                            typeId.append('[');
+                            state = ARRAYDECORATION;
+                        } else if (cp == ',') {   // just the type
+                            addTypeToParamList();
+                            state = START;
+                        } // consume rest all
+                        prevstate = TNSPACE;
+                        break;
+                    case ARRAYDECORATION:
+                        if (cp == ']') {
+                            typeId.append(']');
+                            state = TNSPACE;
+                        } else if (!Character.isWhitespace(cp)) {
+                            docenv().warning(holder,
+                                             "tag.illegal_char_in_arr_dim",
+                                             name,
+                                             "(" + parameters + ")");
+                            return (String[])null;
+                        }
+                        prevstate = ARRAYDECORATION;
+                        break;
+                    case NAME:
+                        if (cp == ',') {  // just consume everything till ','
+                            state = START;
+                        }
+                        prevstate = NAME;
+                        break;
+                }
+            }
+            if (state == ARRAYDECORATION ||
+                (state == START && prevstate == TNSPACE)) {
+                docenv().warning(holder,
+                                 "tag.illegal_see_tag",
+                                 "(" + parameters + ")");
+            }
+            if (typeId.length() > 0) {
+                paramList.append(typeId.toString());
+            }
+            return paramList.toArray(new String[paramList.length()]);
+        }
+
+        void addTypeToParamList() {
+            if (typeId.length() > 0) {
+                paramList.append(typeId.toString());
+                typeId.setLength(0);
+            }
+        }
+    }
+
+    /**
+     * Return the kind of this tag.
+     */
+    @Override
+    public String kind() {
+        return "@see";
+    }
+
+    /**
+     * Return the label of the see tag.
+     */
+    public String label() {
+        return label;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SerialFieldTagImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 1998, 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.tools.javadoc.main;
+
+import com.sun.javadoc.*;
+
+/**
+ * Documents a Serializable field defined by an ObjectStreamField.
+ * <pre>
+ * The class parses and stores the three serialField tag parameters:
+ *
+ * - field name
+ * - field type name
+ *      (fully-qualified or visible from the current import context)
+ * - description of the valid values for the field
+
+ * </pre>
+ * This tag is only allowed in the javadoc for the special member
+ * serialPersistentFields.
+ *
+ *  <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>
+ *
+ * @author Joe Fialli
+ * @author Neal Gafter
+ *
+ * @see java.io.ObjectStreamField
+ */
+class SerialFieldTagImpl
+    extends TagImpl
+    implements SerialFieldTag, Comparable<Object>
+{
+    //### These could be final, except that the constructor
+    //### does not set them directly.
+
+    private String fieldName;    // Required Argument 1 of serialField
+    private String fieldType;    // Required Argument 2 of serialField
+    private String description;  // Optional Remaining Arguments of serialField
+
+    private ClassDoc containingClass;   // Class containing serialPersistentField member
+    private ClassDoc fieldTypeDoc;      // ClassDocImpl of fieldType
+    private FieldDocImpl matchingField; // FieldDocImpl with same name as fieldName
+
+   /* Constructor. */
+   SerialFieldTagImpl(DocImpl holder, String name, String text) {
+        super(holder, name, text);
+        parseSerialFieldString();
+        if (holder instanceof MemberDoc) {
+            containingClass = ((MemberDocImpl)holder).containingClass();
+        }
+    }
+
+    /*
+     * The serialField tag is composed of three entities.
+     *
+     *   serialField  serializableFieldName serisliableFieldType
+     *                 description of field.
+     *
+     * The fieldName and fieldType must be legal Java Identifiers.
+     */
+    private void parseSerialFieldString() {
+        int len = text.length();
+        if (len == 0) {
+            return;
+        }
+
+        // if no white space found
+        /* Skip white space. */
+        int inx = 0;
+        int cp;
+        for (; inx < len; inx += Character.charCount(cp)) {
+             cp = text.codePointAt(inx);
+             if (!Character.isWhitespace(cp)) {
+                 break;
+             }
+        }
+
+        /* find first word. */
+        int first = inx;
+        int last = inx;
+        cp = text.codePointAt(inx);
+        if (! Character.isJavaIdentifierStart(cp)) {
+            docenv().warning(holder,
+                             "tag.serialField.illegal_character",
+                             new String(Character.toChars(cp)), text);
+            return;
+        }
+
+        for (inx += Character.charCount(cp); inx < len; inx += Character.charCount(cp)) {
+             cp = text.codePointAt(inx);
+             if (!Character.isJavaIdentifierPart(cp)) {
+                 break;
+             }
+        }
+
+        if (inx < len && ! Character.isWhitespace(cp = text.codePointAt(inx))) {
+            docenv().warning(holder,
+                             "tag.serialField.illegal_character",
+                             new String(Character.toChars(cp)), text);
+            return;
+        }
+
+        last = inx;
+        fieldName = text.substring(first, last);
+
+        /* Skip white space. */
+        for (; inx < len; inx += Character.charCount(cp)) {
+             cp = text.codePointAt(inx);
+             if (!Character.isWhitespace(cp)) {
+                 break;
+             }
+        }
+
+        /* find second word. */
+        first = inx;
+        last = inx;
+
+        for (; inx < len; inx += Character.charCount(cp)) {
+             cp = text.codePointAt(inx);
+             if (Character.isWhitespace(cp)) {
+                 break;
+             }
+        }
+        if (inx < len && ! Character.isWhitespace(cp = text.codePointAt(inx))) {
+            docenv().warning(holder,
+                             "tag.serialField.illegal_character",
+                             new String(Character.toChars(cp)), text);
+            return;
+        }
+        last = inx;
+        fieldType = text.substring(first, last);
+
+        /* Skip leading white space. Rest of string is description for serialField.*/
+        for (; inx < len; inx += Character.charCount(cp)) {
+             cp = text.codePointAt(inx);
+             if (!Character.isWhitespace(cp)) {
+                 break;
+             }
+        }
+        description = text.substring(inx);
+    }
+
+    /**
+     * return a key for sorting.
+     */
+    String key() {
+        return fieldName;
+    }
+
+    /*
+     * Optional. Link this serialField tag to its corrsponding
+     * field in the class. Note: there is no requirement that
+     * there be a field in the class that matches serialField tag.
+     */
+    void mapToFieldDocImpl(FieldDocImpl fd) {
+        matchingField = fd;
+    }
+
+    /**
+     * Return the serialziable field name.
+     */
+    public String fieldName() {
+        return fieldName;
+    }
+
+    /**
+     * Return the field type string.
+     */
+    public String fieldType() {
+        return fieldType;
+    }
+
+    /**
+     * Return the ClassDocImpl for field type.
+     *
+     * @returns null if no ClassDocImpl for field type is visible from
+     *          containingClass context.
+     */
+    public ClassDoc fieldTypeDoc() {
+        if (fieldTypeDoc == null && containingClass != null) {
+            fieldTypeDoc = containingClass.findClass(fieldType);
+        }
+        return fieldTypeDoc;
+    }
+
+    /**
+     * Return the corresponding FieldDocImpl for this SerialFieldTagImpl.
+     *
+     * @returns null if no matching FieldDocImpl.
+     */
+    FieldDocImpl getMatchingField() {
+        return matchingField;
+    }
+
+    /**
+     * Return the field comment. If there is no serialField comment, return
+     * javadoc comment of corresponding FieldDocImpl.
+     */
+    public String description() {
+        if (description.length() == 0 && matchingField != null) {
+
+            //check for javadoc comment of corresponding field.
+            Comment comment = matchingField.comment();
+            if (comment != null) {
+                return comment.commentText();
+            }
+        }
+        return description;
+    }
+
+    /**
+     * Return the kind of this tag.
+     */
+    public String kind() {
+        return "@serialField";
+    }
+
+    /**
+     * Convert this object to a string.
+     */
+    public String toString() {
+        return name + ":" + text;
+    }
+
+    /**
+     * Compares this Object with the specified Object for order.  Returns a
+     * negative integer, zero, or a positive integer as this Object is less
+     * than, equal to, or greater than the given Object.
+     * <p>
+     * Included to make SerialFieldTagImpl items java.lang.Comparable.
+     *
+     * @param   obj the <code>Object</code> to be compared.
+     * @return  a negative integer, zero, or a positive integer as this Object
+     *          is less than, equal to, or greater than the given Object.
+     * @exception ClassCastException the specified Object's type prevents it
+     *            from being compared to this Object.
+     * @since 1.2
+     */
+    public int compareTo(Object obj) {
+        return key().compareTo(((SerialFieldTagImpl)obj).key());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SerializedForm.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,287 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.MethodSymbol;
+import com.sun.tools.javac.code.Symbol.VarSymbol;
+import com.sun.tools.javac.util.*;
+
+import static com.sun.tools.javac.code.Kinds.Kind.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
+
+/**
+ * The serialized form is the specification of a class' serialization
+ * state. <p>
+ *
+ * It consists of the following information:<p>
+ *
+ * <pre>
+ * 1. Whether class is Serializable or Externalizable.
+ * 2. Javadoc for serialization methods.
+ *    a. For Serializable, the optional readObject, writeObject,
+ *       readResolve and writeReplace.
+ *       serialData tag describes, in prose, the sequence and type
+ *       of optional data written by writeObject.
+ *    b. For Externalizable, writeExternal and readExternal.
+ *       serialData tag describes, in prose, the sequence and type
+ *       of optional data written by writeExternal.
+ * 3. Javadoc for serialization data layout.
+ *    a. For Serializable, the name,type and description
+ *       of each Serializable fields.
+ *    b. For Externalizable, data layout is described by 2(b).
+ * </pre>
+ *
+ *  <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>
+ *
+ * @since 1.2
+ * @author Joe Fialli
+ * @author Neal Gafter (rewrite but not too proud)
+ */
+class SerializedForm {
+    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<>();
+
+    /* True if class specifies serializable fields explicitly.
+     * using special static member, serialPersistentFields.
+     */
+    private boolean definesSerializableFields = false;
+
+    // Specially treated field/method names defined by Serialization.
+    private static final String SERIALIZABLE_FIELDS = "serialPersistentFields";
+    private static final String READOBJECT  = "readObject";
+    private static final String WRITEOBJECT = "writeObject";
+    private static final String READRESOLVE  = "readResolve";
+    private static final String WRITEREPLACE = "writeReplace";
+    private static final String READOBJECTNODATA = "readObjectNoData";
+
+    /**
+     * Constructor.
+     *
+     * Catalog Serializable fields for Serializable class.
+     * Catalog serialization methods for Serializable and
+     * Externalizable classes.
+     */
+    SerializedForm(DocEnv env, ClassSymbol def, ClassDocImpl cd) {
+        if (cd.isExternalizable()) {
+            /* look up required public accessible methods,
+             *   writeExternal and readExternal.
+             */
+            String[] readExternalParamArr = { "java.io.ObjectInput" };
+            String[] writeExternalParamArr = { "java.io.ObjectOutput" };
+            MethodDoc md = cd.findMethod("readExternal", readExternalParamArr);
+            if (md != null) {
+                methods.append(md);
+            }
+            md = cd.findMethod("writeExternal", writeExternalParamArr);
+            if (md != null) {
+                methods.append(md);
+                Tag tag[] = md.tags("serialData");
+            }
+        // } else { // isSerializable() //### ???
+        } else if (cd.isSerializable()) {
+
+            VarSymbol dsf = getDefinedSerializableFields(def);
+            if (dsf != null) {
+
+                /* Define serializable fields with array of ObjectStreamField.
+                 * Each ObjectStreamField should be documented by a
+                 * serialField tag.
+                 */
+                definesSerializableFields = true;
+                //### No modifier filtering applied here.
+                FieldDocImpl dsfDoc = env.getFieldDoc(dsf);
+                fields.append(dsfDoc);
+                mapSerialFieldTagImplsToFieldDocImpls(dsfDoc, env, def);
+            } else {
+
+                /* Calculate default Serializable fields as all
+                 * non-transient, non-static fields.
+                 * Fields should be documented by serial tag.
+                 */
+                computeDefaultSerializableFields(env, def, cd);
+            }
+
+           /* Check for optional customized readObject, writeObject,
+            * readResolve and writeReplace, which can all contain
+            * the serialData tag.        */
+            addMethodIfExist(env, def, READOBJECT);
+            addMethodIfExist(env, def, WRITEOBJECT);
+            addMethodIfExist(env, def, READRESOLVE);
+            addMethodIfExist(env, def, WRITEREPLACE);
+            addMethodIfExist(env, def, READOBJECTNODATA);
+        }
+    }
+
+    /*
+     * Check for explicit Serializable fields.
+     * Check for a private static array of ObjectStreamField with
+     * name SERIALIZABLE_FIELDS.
+     */
+    private VarSymbol getDefinedSerializableFields(ClassSymbol def) {
+        Names names = def.name.table.names;
+
+        /* SERIALIZABLE_FIELDS can be private,
+         * so must lookup by ClassSymbol, not by ClassDocImpl.
+         */
+        for (Symbol sym : def.members().getSymbolsByName(names.fromString(SERIALIZABLE_FIELDS))) {
+            if (sym.kind == VAR) {
+                VarSymbol f = (VarSymbol)sym;
+                if ((f.flags() & Flags.STATIC) != 0 &&
+                    (f.flags() & Flags.PRIVATE) != 0) {
+                    return f;
+                }
+            }
+        }
+        return null;
+    }
+
+    /*
+     * Compute default Serializable fields from all members of ClassSymbol.
+     *
+     * Since the fields of ClassDocImpl might not contain private or
+     * package accessible fields, must walk over all members of ClassSymbol.
+     */
+    private void computeDefaultSerializableFields(DocEnv env,
+                                                  ClassSymbol def,
+                                                  ClassDocImpl cd) {
+        for (Symbol sym : def.members().getSymbols(NON_RECURSIVE)) {
+            if (sym != null && sym.kind == VAR) {
+                VarSymbol f = (VarSymbol)sym;
+                if ((f.flags() & Flags.STATIC) == 0 &&
+                    (f.flags() & Flags.TRANSIENT) == 0) {
+                    //### No modifier filtering applied here.
+                    FieldDocImpl fd = env.getFieldDoc(f);
+                    //### Add to beginning.
+                    //### Preserve order used by old 'javadoc'.
+                    fields.prepend(fd);
+                }
+            }
+        }
+    }
+
+    /*
+     * Catalog Serializable method if it exists in current ClassSymbol.
+     * Do not look for method in superclasses.
+     *
+     * Serialization requires these methods to be non-static.
+     *
+     * @param method should be an unqualified Serializable method
+     *               name either READOBJECT, WRITEOBJECT, READRESOLVE
+     *               or WRITEREPLACE.
+     * @param visibility the visibility flag for the given method.
+     */
+    private void addMethodIfExist(DocEnv env, ClassSymbol def, String methodName) {
+        Names names = def.name.table.names;
+
+        for (Symbol sym : def.members().getSymbolsByName(names.fromString(methodName))) {
+            if (sym.kind == MTH) {
+                MethodSymbol md = (MethodSymbol)sym;
+                if ((md.flags() & Flags.STATIC) == 0) {
+                    /*
+                     * WARNING: not robust if unqualifiedMethodName is overloaded
+                     *          method. Signature checking could make more robust.
+                     * READOBJECT takes a single parameter, java.io.ObjectInputStream.
+                     * WRITEOBJECT takes a single parameter, java.io.ObjectOutputStream.
+                     */
+                    methods.append(env.getMethodDoc(md));
+                }
+            }
+        }
+    }
+
+    /*
+     * Associate serialField tag fieldName with FieldDocImpl member.
+     * Note: A serialField tag does not have to map an existing field
+     *       of a class.
+     */
+    private void mapSerialFieldTagImplsToFieldDocImpls(FieldDocImpl spfDoc,
+                                                       DocEnv env,
+                                                       ClassSymbol def) {
+        Names names = def.name.table.names;
+        for (SerialFieldTag tag : spfDoc.serialFieldTags()) {
+            if (tag.fieldName() == null || tag.fieldType() == null) // ignore malformed @serialField tags
+                continue;
+
+            Name fieldName = names.fromString(tag.fieldName());
+
+            // Look for a FieldDocImpl that is documented by serialFieldTagImpl.
+            for (Symbol sym : def.members().getSymbolsByName(fieldName)) {
+                if (sym.kind == VAR) {
+                    VarSymbol f = (VarSymbol) sym;
+                    FieldDocImpl fdi = env.getFieldDoc(f);
+                    ((SerialFieldTagImpl) (tag)).mapToFieldDocImpl(fdi);
+                    break;
+                }
+            }
+        }
+    }
+
+    /**
+     * Return serializable fields in class. <p>
+     *
+     * Returns either a list of default fields documented by serial tag comment or
+     *         javadoc comment<p>
+     * Or Returns a single FieldDocImpl for serialPersistentField. There is a
+     *         serialField tag for each serializable field.<p>
+     *
+     * @return an array of FieldDocImpl for representing the visible
+     *         fields in this class.
+     */
+    FieldDoc[] fields() {
+        return (FieldDoc[])fields.toArray(new FieldDocImpl[fields.length()]);
+    }
+
+    /**
+     * Return serialization methods in class.
+     *
+     * @return an array of MethodDocImpl for serialization methods in this class.
+     */
+    MethodDoc[] methods() {
+        return methods.toArray(new MethodDoc[methods.length()]);
+    }
+
+    /**
+     * Returns true if Serializable fields are defined explicitly using
+     * member, serialPersistentFields.
+     *
+     * @see #fields()
+     */
+    boolean definesSerializableFields() {
+        return definesSerializableFields;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SourcePositionImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javadoc.main;
+
+import java.io.File;
+import javax.tools.FileObject;
+
+import com.sun.javadoc.SourcePosition;
+import com.sun.tools.javac.util.Position;
+
+/**
+ * A source position: filename, line number, and column number.
+ *
+ *  <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>
+ *
+ * @since J2SE1.4
+ * @author Neal M Gafter
+ * @author Michael Van De Vanter (position representation changed to char offsets)
+ */
+public class SourcePositionImpl implements SourcePosition {
+    FileObject filename;
+    int position;
+    Position.LineMap lineMap;
+
+    /** The source file. Returns null if no file information is
+     *  available. */
+    public File file() {
+        return (filename == null) ? null : new File(filename.getName());
+    }
+
+    /** The source file. Returns null if no file information is
+     *  available. */
+    public FileObject fileObject() {
+        return filename;
+    }
+
+    /** The line in the source file. The first line is numbered 1;
+     *  0 means no line number information is available. */
+    public int line() {
+        if (lineMap == null) {
+            return 0;
+        } else {
+            return lineMap.getLineNumber(position);
+        }
+    }
+
+    /** The column in the source file. The first column is
+     *  numbered 1; 0 means no column information is available.
+     *  Columns count characters in the input stream; a tab
+     *  advances the column number to the next 8-column tab stop.
+     */
+    public int column() {
+        if (lineMap == null) {
+            return 0;
+        }else {
+            return lineMap.getColumnNumber(position);
+        }
+    }
+
+    private SourcePositionImpl(FileObject file, int position,
+                               Position.LineMap lineMap) {
+        super();
+        this.filename = file;
+        this.position = position;
+        this.lineMap = lineMap;
+    }
+
+    public static SourcePosition make(FileObject file, int pos,
+                                      Position.LineMap lineMap) {
+        if (file == null) return null;
+        return new SourcePositionImpl(file, pos, lineMap);
+    }
+
+    public String toString() {
+        // Backwards compatibility hack. ZipFileObjects use the format
+        // zipfile(zipentry) but javadoc has been using zipfile/zipentry
+        String fn = filename.getName();
+        if (fn.endsWith(")")) {
+            int paren = fn.lastIndexOf("(");
+            if (paren != -1) {
+                int i = paren+1;
+                if (fn.charAt(i) == '/')
+                    i++;
+                fn = fn.substring(0, paren)
+                        + File.separatorChar
+                        + fn.substring(i, fn.length() - 1);
+            }
+        }
+
+        if (position == Position.NOPOS)
+            return fn;
+        else
+            return fn + ":" + line();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,557 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javadoc.main;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Objects;
+
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.main.CommandLine;
+import com.sun.tools.javac.main.Option;
+import com.sun.tools.javac.file.BaseFileManager;
+import com.sun.tools.javac.platform.PlatformDescription;
+import com.sun.tools.javac.platform.PlatformUtils;
+import com.sun.tools.javac.util.ClientCodeException;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.Options;
+
+import static com.sun.tools.javac.code.Flags.*;
+
+/**
+ * Main program of Javadoc.
+ * Previously named "Main".
+ *
+ *  <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>
+ *
+ * @since 1.2
+ * @author Robert Field
+ * @author Neal Gafter (rewrite)
+ */
+public class Start extends ToolOption.Helper {
+    /** Context for this invocation. */
+    private final Context context;
+
+    private final String defaultDocletClassName;
+    private final ClassLoader docletParentClassLoader;
+
+    private static final String javadocName = "javadoc";
+
+    private static final String standardDocletClassName =
+        "com.sun.tools.doclets.standard.Standard";
+
+    private final long defaultFilter = PUBLIC | PROTECTED;
+
+    private final Messager messager;
+
+    private DocletInvoker docletInvoker;
+
+    /**
+     * In API mode, exceptions thrown while calling the doclet are
+     * propagated using ClientCodeException.
+     */
+    private boolean apiMode;
+
+    private JavaFileManager fileManager;
+
+    public Start(String programName,
+          PrintWriter errWriter,
+          PrintWriter warnWriter,
+          PrintWriter noticeWriter,
+          String defaultDocletClassName) {
+        this(programName, errWriter, warnWriter, noticeWriter, defaultDocletClassName, null);
+    }
+
+    public Start(PrintWriter pw) {
+        this(javadocName, pw, pw, pw, standardDocletClassName);
+    }
+
+    public Start(String programName,
+          PrintWriter errWriter,
+          PrintWriter warnWriter,
+          PrintWriter noticeWriter,
+          String defaultDocletClassName,
+          ClassLoader docletParentClassLoader) {
+        context = new Context();
+        messager = new Messager(context, programName, errWriter, warnWriter, noticeWriter);
+        this.defaultDocletClassName = defaultDocletClassName;
+        this.docletParentClassLoader = docletParentClassLoader;
+    }
+
+    public Start(String programName, String defaultDocletClassName) {
+        this(programName, defaultDocletClassName, null);
+    }
+
+    public Start(String programName, String defaultDocletClassName,
+          ClassLoader docletParentClassLoader) {
+        context = new Context();
+        messager = new Messager(context, programName);
+        this.defaultDocletClassName = defaultDocletClassName;
+        this.docletParentClassLoader = docletParentClassLoader;
+    }
+
+    public Start(String programName, ClassLoader docletParentClassLoader) {
+        this(programName, standardDocletClassName, docletParentClassLoader);
+    }
+
+    public Start(String programName) {
+        this(programName, standardDocletClassName);
+    }
+
+    public Start(ClassLoader docletParentClassLoader) {
+        this(javadocName, docletParentClassLoader);
+    }
+
+    public Start() {
+        this(javadocName);
+    }
+
+    public Start(Context context) {
+        this.context = Objects.requireNonNull(context);
+        apiMode = true;
+        defaultDocletClassName = standardDocletClassName;
+        docletParentClassLoader = null;
+
+        Log log = context.get(Log.logKey);
+        if (log instanceof Messager)
+            messager = (Messager) log;
+        else {
+            PrintWriter out = context.get(Log.outKey);
+            messager = (out == null) ? new Messager(context, javadocName)
+                    : new Messager(context, javadocName, out, out, out);
+        }
+    }
+
+    /**
+     * Usage
+     */
+    @Override
+    void usage() {
+        usage(true);
+    }
+
+    void usage(boolean exit) {
+        usage("main.usage", "-help", null, exit);
+    }
+
+    @Override
+    void Xusage() {
+        Xusage(true);
+    }
+
+    void Xusage(boolean exit) {
+        usage("main.Xusage", "-X", "main.Xusage.foot", exit);
+    }
+
+    private void usage(String main, String doclet, String foot, boolean exit) {
+        // RFE: it would be better to replace the following with code to
+        // write a header, then help for each option, then a footer.
+        messager.notice(main);
+
+        // let doclet print usage information (does nothing on error)
+        if (docletInvoker != null) {
+            // RFE: this is a pretty bad way to get the doclet to show
+            // help info. Moreover, the output appears on stdout,
+            // and <i>not</i> on any of the standard streams passed
+            // to javadoc, and in particular, not to the noticeWriter
+            // But, to fix this, we need to fix the Doclet API.
+            docletInvoker.optionLength(doclet);
+        }
+
+        if (foot != null)
+            messager.notice(foot);
+
+        if (exit) exit();
+    }
+
+    /**
+     * Exit
+     */
+    private void exit() {
+        messager.exit();
+    }
+
+
+    /**
+     * Main program - external wrapper
+     */
+    public int begin(String... argv) {
+        boolean ok = begin(null, argv, Collections.<JavaFileObject> emptySet());
+        return ok ? 0 : 1;
+    }
+
+    public boolean begin(Class<?> docletClass, Iterable<String> options, Iterable<? extends JavaFileObject> fileObjects) {
+        Collection<String> opts = new ArrayList<>();
+        for (String opt: options) opts.add(opt);
+        return begin(docletClass, opts.toArray(new String[opts.size()]), fileObjects);
+    }
+
+    private boolean begin(Class<?> docletClass, String[] options, Iterable<? extends JavaFileObject> fileObjects) {
+        boolean failed = false;
+
+        try {
+            failed = !parseAndExecute(docletClass, options, fileObjects);
+        } catch (Messager.ExitJavadoc exc) {
+            // ignore, we just exit this way
+        } catch (OutOfMemoryError ee) {
+            messager.error(Messager.NOPOS, "main.out.of.memory");
+            failed = true;
+        } catch (ClientCodeException e) {
+            // simply rethrow these exceptions, to be caught and handled by JavadocTaskImpl
+            throw e;
+        } catch (Error ee) {
+            ee.printStackTrace(System.err);
+            messager.error(Messager.NOPOS, "main.fatal.error");
+            failed = true;
+        } catch (Exception ee) {
+            ee.printStackTrace(System.err);
+            messager.error(Messager.NOPOS, "main.fatal.exception");
+            failed = true;
+        } finally {
+            if (fileManager != null
+                    && fileManager instanceof BaseFileManager
+                    && ((BaseFileManager) fileManager).autoClose) {
+                try {
+                    fileManager.close();
+                } catch (IOException ignore) {
+                }
+            }
+            messager.exitNotice();
+            messager.flush();
+        }
+        failed |= messager.nerrors() > 0;
+        failed |= rejectWarnings && messager.nwarnings() > 0;
+        return !failed;
+    }
+
+    /**
+     * Main program - internal
+     */
+    private boolean parseAndExecute(
+            Class<?> docletClass,
+            String[] argv,
+            Iterable<? extends JavaFileObject> fileObjects) throws IOException {
+        long tm = System.currentTimeMillis();
+
+        ListBuffer<String> javaNames = new ListBuffer<>();
+
+        // Preprocess @file arguments
+        try {
+            argv = CommandLine.parse(argv);
+        } catch (FileNotFoundException e) {
+            messager.error(Messager.NOPOS, "main.cant.read", e.getMessage());
+            exit();
+        } catch (IOException e) {
+            e.printStackTrace(System.err);
+            exit();
+        }
+
+
+        fileManager = context.get(JavaFileManager.class);
+
+        setDocletInvoker(docletClass, fileManager, argv);
+
+        compOpts = Options.instance(context);
+        // Make sure no obsolete source/target messages are reported
+        compOpts.put("-Xlint:-options", "-Xlint:-options");
+
+        // Parse arguments
+        for (int i = 0 ; i < argv.length ; i++) {
+            String arg = argv[i];
+
+            ToolOption o = ToolOption.get(arg);
+            if (o != null) {
+                // hack: this restriction should be removed
+                if (o == ToolOption.LOCALE && i > 0)
+                    usageError("main.locale_first");
+
+                if (o.hasArg) {
+                    oneArg(argv, i++);
+                    o.process(this, argv[i]);
+                } else {
+                    setOption(arg);
+                    o.process(this);
+                }
+            } else if (arg.equals("-XDaccessInternalAPI")) {
+                // pass this hidden option down to the doclet, if it wants it
+                if (docletInvoker.optionLength("-XDaccessInternalAPI") == 1) {
+                    setOption(arg);
+                }
+            } else if (arg.startsWith("-XD")) {
+                // hidden javac options
+                String s = arg.substring("-XD".length());
+                int eq = s.indexOf('=');
+                String key = (eq < 0) ? s : s.substring(0, eq);
+                String value = (eq < 0) ? s : s.substring(eq+1);
+                compOpts.put(key, value);
+            }
+            // call doclet for its options
+            // other arg starts with - is invalid
+            else if (arg.startsWith("-")) {
+                int optionLength;
+                optionLength = docletInvoker.optionLength(arg);
+                if (optionLength < 0) {
+                    // error already displayed
+                    exit();
+                } else if (optionLength == 0) {
+                    // option not found
+                    usageError("main.invalid_flag", arg);
+                } else {
+                    // doclet added option
+                    if ((i + optionLength) > argv.length) {
+                        usageError("main.requires_argument", arg);
+                    }
+                    ListBuffer<String> args = new ListBuffer<>();
+                    for (int j = 0; j < optionLength-1; ++j) {
+                        args.append(argv[++i]);
+                    }
+                    setOption(arg, args.toList());
+                }
+            } else {
+                javaNames.append(arg);
+            }
+        }
+
+        if (fileManager == null) {
+            JavacFileManager.preRegister(context);
+            fileManager = context.get(JavaFileManager.class);
+            if (fileManager instanceof BaseFileManager) {
+                ((BaseFileManager) fileManager).autoClose = true;
+            }
+        }
+        if (fileManager instanceof BaseFileManager) {
+            ((BaseFileManager) fileManager).handleOptions(fileManagerOpts);
+        }
+
+        String platformString = compOpts.get("-release");
+
+        if (platformString != null) {
+            if (compOpts.isSet("-source")) {
+                usageError("main.release.bootclasspath.conflict", "-source");
+            }
+            if (fileManagerOpts.containsKey(Option.BOOTCLASSPATH)) {
+                usageError("main.release.bootclasspath.conflict", Option.BOOTCLASSPATH.getText());
+            }
+
+            PlatformDescription platformDescription =
+                    PlatformUtils.lookupPlatformDescription(platformString);
+
+            if (platformDescription == null) {
+                usageError("main.unsupported.release.version", platformString);
+            }
+
+            compOpts.put(Option.SOURCE, platformDescription.getSourceVersion());
+
+            context.put(PlatformDescription.class, platformDescription);
+
+            Collection<Path> platformCP = platformDescription.getPlatformPath();
+
+            if (platformCP != null) {
+                if (fileManager instanceof StandardJavaFileManager) {
+                    StandardJavaFileManager sfm = (StandardJavaFileManager) fileManager;
+
+                    sfm.setLocationFromPaths(StandardLocation.PLATFORM_CLASS_PATH, platformCP);
+                } else {
+                    usageError("main.release.not.standard.file.manager", platformString);
+                }
+            }
+        }
+
+        compOpts.notifyListeners();
+
+        if (javaNames.isEmpty() && subPackages.isEmpty() && isEmpty(fileObjects)) {
+            usageError("main.No_packages_or_classes_specified");
+        }
+
+        if (!docletInvoker.validOptions(options.toList())) {
+            // error message already displayed
+            exit();
+        }
+
+        JavadocTool comp = JavadocTool.make0(context);
+        if (comp == null) return false;
+
+        if (showAccess == null) {
+            setFilter(defaultFilter);
+        }
+
+        LanguageVersion languageVersion = docletInvoker.languageVersion();
+        RootDocImpl root = comp.getRootDocImpl(
+                docLocale,
+                encoding,
+                showAccess,
+                javaNames.toList(),
+                options.toList(),
+                fileObjects,
+                breakiterator,
+                subPackages.toList(),
+                excludedPackages.toList(),
+                docClasses,
+                // legacy?
+                languageVersion == null || languageVersion == LanguageVersion.JAVA_1_1,
+                quiet);
+
+        // release resources
+        comp = null;
+
+        // pass off control to the doclet
+        boolean ok = root != null;
+        if (ok) ok = docletInvoker.start(root);
+
+        // We're done.
+        if (compOpts.get("-verbose") != null) {
+            tm = System.currentTimeMillis() - tm;
+            messager.notice("main.done_in", Long.toString(tm));
+        }
+
+        return ok;
+    }
+
+    private <T> boolean isEmpty(Iterable<T> iter) {
+        return !iter.iterator().hasNext();
+    }
+
+    /**
+     * Init the doclet invoker.
+     * The doclet class may be given explicitly, or via the -doclet option in
+     * argv.
+     * If the doclet class is not given explicitly, it will be loaded from
+     * the file manager's DOCLET_PATH location, if available, or via the
+     * -doclet path option in argv.
+     * @param docletClass The doclet class. May be null.
+     * @param fileManager The file manager used to get the class loader to load
+     * the doclet class if required. May be null.
+     * @param argv Args containing -doclet and -docletpath, in case they are required.
+     */
+    private void setDocletInvoker(Class<?> docletClass, JavaFileManager fileManager, String[] argv) {
+        boolean exportInternalAPI = false;
+        String docletClassName = null;
+        String docletPath = null;
+
+        // Parse doclet specifying arguments
+        for (int i = 0 ; i < argv.length ; i++) {
+            String arg = argv[i];
+            if (arg.equals(ToolOption.DOCLET.opt)) {
+                oneArg(argv, i++);
+                if (docletClassName != null) {
+                    usageError("main.more_than_one_doclet_specified_0_and_1",
+                               docletClassName, argv[i]);
+                }
+                docletClassName = argv[i];
+            } else if (arg.equals(ToolOption.DOCLETPATH.opt)) {
+                oneArg(argv, i++);
+                if (docletPath == null) {
+                    docletPath = argv[i];
+                } else {
+                    docletPath += File.pathSeparator + argv[i];
+                }
+            } else if (arg.equals("-XDaccessInternalAPI")) {
+                exportInternalAPI = true;
+            }
+        }
+
+        if (docletClass != null) {
+            // TODO, check no -doclet, -docletpath
+            docletInvoker = new DocletInvoker(messager, docletClass, apiMode, exportInternalAPI);
+        } else {
+            if (docletClassName == null) {
+                docletClassName = defaultDocletClassName;
+            }
+
+            // attempt to find doclet
+            docletInvoker = new DocletInvoker(messager, fileManager,
+                    docletClassName, docletPath,
+                    docletParentClassLoader,
+                    apiMode,
+                    exportInternalAPI);
+        }
+    }
+
+    /**
+     * Set one arg option.
+     * Error and exit if one argument is not provided.
+     */
+    private void oneArg(String[] args, int index) {
+        if ((index + 1) < args.length) {
+            setOption(args[index], args[index+1]);
+        } else {
+            usageError("main.requires_argument", args[index]);
+        }
+    }
+
+    @Override
+    void usageError(String key, Object... args) {
+        messager.error(Messager.NOPOS, key, args);
+        usage(true);
+    }
+
+    /**
+     * indicate an option with no arguments was given.
+     */
+    private void setOption(String opt) {
+        String[] option = { opt };
+        options.append(option);
+    }
+
+    /**
+     * indicate an option with one argument was given.
+     */
+    private void setOption(String opt, String argument) {
+        String[] option = { opt, argument };
+        options.append(option);
+    }
+
+    /**
+     * indicate an option with the specified list of arguments was given.
+     */
+    private void setOption(String opt, List<String> arguments) {
+        String[] args = new String[arguments.length() + 1];
+        int k = 0;
+        args[k++] = opt;
+        for (List<String> i = arguments; i.nonEmpty(); i=i.tail) {
+            args[k++] = i.head;
+        }
+        options.append(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TagImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 1997, 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.tools.javadoc.main;
+
+import com.sun.javadoc.*;
+
+/**
+ * Represents a documentation tag, e.g. @since, @author, @version.
+ * Given a tag (e.g. "@since 1.2"), holds tag name (e.g. "@since")
+ * and tag text (e.g. "1.2").  TagImpls with structure or which require
+ * special processing are handled by subclasses (ParamTagImpl, SeeTagImpl,
+ * and ThrowsTagImpl
+ *
+ *  <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>
+ *
+ * @author Robert Field
+ * @author Atul M Dambalkar
+ * @author Neal M Gafter
+ * @see SeeTagImpl
+ * @see ParamTagImpl
+ * @see ThrowsTagImpl
+ * @see Doc#tags()
+ *
+ */
+class TagImpl implements Tag {
+
+    protected final String text;
+    protected final String name;
+    protected final DocImpl holder;
+
+    /**
+     * Cached first sentence.
+     */
+    private Tag[] firstSentence;
+
+    /**
+     * Cached inline tags.
+     */
+    private Tag[] inlineTags;
+
+    /**
+     *  Constructor
+     */
+    TagImpl(DocImpl holder, String name, String text) {
+        this.holder = holder;
+        this.name = name;
+        this.text = text;
+    }
+
+    /**
+     * Return the name of this tag.
+     */
+    public String name() {
+        return name;
+    }
+
+    /**
+     * Return the containing {@link Doc} of this Tag element.
+     */
+    public Doc holder() {
+        return holder;
+    }
+
+    /**
+     * Return the kind of this tag.
+     */
+    public String kind() {
+        return name;
+    }
+
+    /**
+     * Return the text of this tag, that is, portion beyond tag name.
+     */
+    public String text() {
+        return text;
+    }
+
+    DocEnv docenv() {
+        return holder.env;
+    }
+
+    /**
+     * for use by subclasses which have two part tag text.
+     */
+    String[] divideAtWhite() {
+        String[] sa = new String[2];
+        int len = text.length();
+        // if no white space found
+        sa[0] = text;
+        sa[1] = "";
+        for (int inx = 0; inx < len; ++inx) {
+            char ch = text.charAt(inx);
+            if (Character.isWhitespace(ch)) {
+                sa[0] = text.substring(0, inx);
+                for (; inx < len; ++inx) {
+                    ch = text.charAt(inx);
+                    if (!Character.isWhitespace(ch)) {
+                        sa[1] = text.substring(inx, len);
+                        break;
+                    }
+                }
+                break;
+            }
+        }
+        return sa;
+    }
+
+    /**
+     * convert this object to a string.
+     */
+    public String toString() {
+        return name + ":" + text;
+    }
+
+    /**
+     * For documentation comment with embedded @link tags, return the array of
+     * TagImpls consisting of SeeTagImpl(s) and text containing TagImpl(s).
+     * Within a comment string "This is an example of inline tags for a
+     * documentation comment {@link Doc {@link Doc commentlabel}}",
+     * where inside the inner braces, the first "Doc" carries exctly the same
+     * syntax as a SeeTagImpl and the second "commentlabel" is label for the Html
+     * Link, will return an array of TagImpl(s) with first element as TagImpl with
+     * comment text "This is an example of inline tags for a documentation
+     * comment" and second element as SeeTagImpl with referenced class as "Doc"
+     * and the label for the Html Link as "commentlabel".
+     *
+     * @return TagImpl[] Array of tags with inline SeeTagImpls.
+     * @see ParamTagImpl
+     * @see ThrowsTagImpl
+     */
+    public Tag[] inlineTags() {
+        if (inlineTags == null) {
+            inlineTags = Comment.getInlineTags(holder, text);
+        }
+        return inlineTags;
+    }
+
+    /**
+     * Return array of tags for the first sentence in the doc comment text.
+     */
+    public Tag[] firstSentenceTags() {
+        if (firstSentence == null) {
+            //Parse all sentences first to avoid duplicate warnings.
+            inlineTags();
+            try {
+                docenv().setSilent(true);
+                firstSentence = Comment.firstSentenceTags(holder, text);
+            } finally {
+                docenv().setSilent(false);
+            }
+        }
+        return firstSentence;
+    }
+
+    /**
+     * Return the doc item to which this tag is attached.
+     * @return the doc item to which this tag is attached.
+     */
+    public SourcePosition position() {
+        return holder.position();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ThrowsTagImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 1997, 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.tools.javadoc.main;
+
+import com.sun.javadoc.*;
+
+/**
+ * Represents a @throws or @exception documentation tag.
+ * Parses and holds the exception name and exception comment.
+ * The exception name my be the name of a type variable.
+ * Note: @exception is a backwards compatible synonymy for @throws.
+ *
+ *  <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>
+ *
+ * @author Robert Field
+ * @author Atul M Dambalkar
+ * @see ExecutableMemberDocImpl#throwsTags()
+ *
+ */
+class ThrowsTagImpl extends TagImpl implements ThrowsTag {
+
+    private final String exceptionName;
+    private final String exceptionComment;
+
+    /**
+     * Cached inline tags.
+     */
+    private Tag[] inlineTags;
+
+    ThrowsTagImpl(DocImpl holder, String name, String text) {
+        super(holder, name, text);
+        String[] sa = divideAtWhite();
+        exceptionName = sa[0];
+        exceptionComment = sa[1];
+    }
+
+    /**
+     * Return the exception name.
+     */
+    public String exceptionName() {
+        return exceptionName;
+    }
+
+    /**
+     * Return the exception comment.
+     */
+    public String exceptionComment() {
+        return exceptionComment;
+    }
+
+    /**
+     * Return the exception as a ClassDocImpl.
+     */
+    public ClassDoc exception() {
+        ClassDocImpl exceptionClass;
+        if (!(holder instanceof ExecutableMemberDoc)) {
+            exceptionClass = null;
+        } else {
+            ExecutableMemberDocImpl emd = (ExecutableMemberDocImpl)holder;
+            ClassDocImpl con = (ClassDocImpl)emd.containingClass();
+            exceptionClass = (ClassDocImpl)con.findClass(exceptionName);
+        }
+        return exceptionClass;
+    }
+
+    /**
+     * Return the type that represents the exception.
+     * This may be a <code>ClassDoc</code> or a <code>TypeVariable</code>.
+     */
+    public Type exceptionType() {
+        //###(gj) TypeVariable not yet supported.
+        return exception();
+    }
+
+
+    /**
+     * Return the kind of this tag.  Always "@throws" for instances
+     * of ThrowsTagImpl.
+     */
+    @Override
+    public String kind() {
+        return "@throws";
+    }
+
+    /**
+     * For the exception comment with embedded @link tags return the array of
+     * TagImpls consisting of SeeTagImpl(s) and text containing TagImpl(s).
+     *
+     * @return TagImpl[] Array of tags with inline SeeTagImpls.
+     * @see TagImpl#inlineTags()
+     * @see ParamTagImpl#inlineTags()
+     */
+    @Override
+    public Tag[] inlineTags() {
+        if (inlineTags == null) {
+            inlineTags = Comment.getInlineTags(holder, exceptionComment());
+        }
+        return inlineTags;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ToolOption.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,392 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javadoc.main;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.main.Option;
+import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Options;
+
+
+/**
+ * javadoc tool options.
+ *
+ *  <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 enum ToolOption {
+    // ----- options for underlying compiler -----
+
+    BOOTCLASSPATH("-bootclasspath", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setFileManagerOpt(Option.BOOTCLASSPATH, arg);
+        }
+    },
+
+    CLASSPATH("-classpath", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setFileManagerOpt(Option.CLASSPATH, arg);
+        }
+    },
+
+    CP("-cp", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setFileManagerOpt(Option.CP, arg);
+        }
+    },
+
+    EXTDIRS("-extdirs", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setFileManagerOpt(Option.EXTDIRS, arg);
+        }
+    },
+
+    SOURCEPATH("-sourcepath", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setFileManagerOpt(Option.SOURCEPATH, arg);
+        }
+    },
+
+    SYSCLASSPATH("-sysclasspath", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setFileManagerOpt(Option.BOOTCLASSPATH, arg);
+        }
+    },
+
+    MODULESOURCEPATH("-modulesourcepath", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setFileManagerOpt(Option.MODULESOURCEPATH, arg);
+        }
+    },
+
+    UPGRADEMODULEPATH("-upgrademodulepath", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setFileManagerOpt(Option.UPGRADEMODULEPATH, arg);
+        }
+    },
+
+    SYSTEM("-system", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setFileManagerOpt(Option.SYSTEM, arg);
+        }
+    },
+
+    MODULEPATH("-modulepath", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setFileManagerOpt(Option.MODULEPATH, arg);
+        }
+    },
+
+    ADDMODS("-addmods", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setCompilerOpt(opt, arg);
+        }
+    },
+
+    LIMITMODS("-limitmods", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setCompilerOpt(opt, arg);
+        }
+    },
+
+    ENCODING("-encoding", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.encoding = arg;
+            helper.setCompilerOpt(opt, arg);
+        }
+    },
+
+    RELEASE("-release", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setCompilerOpt(opt, arg);
+        }
+    },
+
+    SOURCE("-source", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setCompilerOpt(opt, arg);
+        }
+    },
+
+    XMAXERRS("-Xmaxerrs", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setCompilerOpt(opt, arg);
+        }
+    },
+
+    XMAXWARNS("-Xmaxwarns", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.setCompilerOpt(opt, arg);
+        }
+    },
+
+    // ----- doclet options -----
+
+    DOCLET("-doclet", true), // handled in setDocletInvoker
+
+    DOCLETPATH("-docletpath", true), // handled in setDocletInvoker
+
+    // ----- selection options -----
+
+    SUBPACKAGES("-subpackages", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.addToList(helper.subPackages, arg);
+        }
+    },
+
+    EXCLUDE("-exclude", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.addToList(helper.excludedPackages, arg);
+        }
+    },
+
+    // ----- filtering options -----
+
+    PACKAGE("-package") {
+        @Override
+        public void process(Helper helper) {
+            helper.setFilter(
+                    Flags.PUBLIC | Flags.PROTECTED | ModifierFilter.PACKAGE);
+        }
+    },
+
+    PRIVATE("-private") {
+        @Override
+        public void process(Helper helper) {
+            helper.setFilter(ModifierFilter.ALL_ACCESS);
+        }
+    },
+
+    PROTECTED("-protected") {
+        @Override
+        public void process(Helper helper) {
+            helper.setFilter(Flags.PUBLIC | Flags.PROTECTED);
+        }
+    },
+
+    PUBLIC("-public") {
+        @Override
+        public void process(Helper helper) {
+            helper.setFilter(Flags.PUBLIC);
+        }
+    },
+
+    // ----- output control options -----
+
+    PROMPT("-prompt") {
+        @Override
+        public void process(Helper helper) {
+            helper.compOpts.put("-prompt", "-prompt");
+            helper.promptOnError = true;
+        }
+    },
+
+    QUIET("-quiet") {
+        @Override
+        public void process(Helper helper) {
+            helper.quiet = true;
+        }
+    },
+
+    VERBOSE("-verbose") {
+        @Override
+        public void process(Helper helper) {
+            helper.compOpts.put("-verbose", "");
+        }
+    },
+
+    XWERROR("-Xwerror") {
+        @Override
+        public void process(Helper helper) {
+            helper.rejectWarnings = true;
+
+        }
+    },
+
+    // ----- other options -----
+
+    BREAKITERATOR("-breakiterator") {
+        @Override
+        public void process(Helper helper) {
+            helper.breakiterator = true;
+        }
+    },
+
+    LOCALE("-locale", true) {
+        @Override
+        public void process(Helper helper, String arg) {
+            helper.docLocale = arg;
+        }
+    },
+
+    OVERVIEW("-overview", true),
+
+    XCLASSES("-Xclasses") {
+        @Override
+        public void process(Helper helper) {
+            helper.docClasses = true;
+
+        }
+    },
+
+    // ----- help options -----
+
+    HELP("-help") {
+        @Override
+        public void process(Helper helper) {
+            helper.usage();
+        }
+    },
+
+    X("-X") {
+        @Override
+        public void process(Helper helper) {
+            helper.Xusage();
+        }
+    };
+
+    public final String opt;
+    public final boolean hasArg;
+
+    ToolOption(String opt) {
+        this(opt, false);
+    }
+
+    ToolOption(String opt, boolean hasArg) {
+        this.opt = opt;
+        this.hasArg = hasArg;
+    }
+
+    void process(Helper helper, String arg) { }
+
+    void process(Helper helper) { }
+
+    static ToolOption get(String name) {
+        for (ToolOption o: values()) {
+            if (name.equals(o.opt))
+                return o;
+        }
+        return null;
+    }
+
+    static abstract class Helper {
+        /** List of decoded options. */
+        final ListBuffer<String[]> options = new ListBuffer<>();
+
+        /** Selected packages, from -subpackages. */
+        final ListBuffer<String> subPackages = new ListBuffer<>();
+
+        /** Excluded packages, from -exclude. */
+        final ListBuffer<String> excludedPackages = new ListBuffer<>();
+
+        // File manager options
+        final Map<Option, String> fileManagerOpts = new LinkedHashMap<>();
+
+        /** javac options, set by various options. */
+        Options compOpts; // = Options.instance(context)
+
+        /* Encoding for javac, and files written? set by -encoding. */
+        String encoding = null;
+
+        /** Set by -breakiterator. */
+        boolean breakiterator = false;
+
+        /** Set by -quiet. */
+        boolean quiet = false;
+
+        /** Set by -Xclasses. */
+        boolean docClasses = false;
+
+        /** Set by -Xwerror. */
+        boolean rejectWarnings = false;
+
+        /** Set by -prompt. */
+        boolean promptOnError;
+
+        /** Set by -locale. */
+        String docLocale = "";
+
+        /** Set by -public, private, -protected, -package. */
+        ModifierFilter showAccess = null;
+
+        abstract void usage();
+        abstract void Xusage();
+
+        abstract void usageError(String msg, Object... args);
+
+        void addToList(ListBuffer<String> list, String str){
+            StringTokenizer st = new StringTokenizer(str, ":");
+            String current;
+            while(st.hasMoreTokens()){
+                current = st.nextToken();
+                list.append(current);
+            }
+        }
+
+        void setFilter(long filterBits) {
+            if (showAccess != null) {
+                usageError("main.incompatible.access.flags");
+            }
+            showAccess = new ModifierFilter(filterBits);
+        }
+
+        void setCompilerOpt(String opt, String arg) {
+            if (compOpts.get(opt) != null) {
+                usageError("main.option.already.seen", opt);
+            }
+            compOpts.put(opt, arg);
+        }
+
+        void setFileManagerOpt(Option opt, String arg) {
+            fileManagerOpts.put(opt, arg);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TypeMaker.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,350 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.CompletionFailure;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.ArrayType;
+import com.sun.tools.javac.code.Type.ClassType;
+import com.sun.tools.javac.code.Type.TypeVar;
+import com.sun.tools.javac.util.List;
+import static com.sun.tools.javac.code.TypeTag.ARRAY;
+
+/**
+ *  <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 TypeMaker {
+
+    public static com.sun.javadoc.Type getType(DocEnv env, Type t) {
+        return getType(env, t, true);
+    }
+
+    /**
+     * @param errToClassDoc  if true, ERROR type results in a ClassDoc;
+     *          false preserves legacy behavior
+     */
+    public static com.sun.javadoc.Type getType(DocEnv env, Type t,
+            boolean errorToClassDoc) {
+        return getType(env, t, errorToClassDoc, true);
+    }
+
+    public static com.sun.javadoc.Type getType(DocEnv env, Type t,
+            boolean errToClassDoc, boolean considerAnnotations) {
+        try {
+            return getTypeImpl(env, t, errToClassDoc, considerAnnotations);
+        } catch (CompletionFailure cf) {
+            /* Quietly ignore completion failures and try again - the type
+             * for which the CompletionFailure was thrown shouldn't be completed
+             * again by the completer that threw the CompletionFailure.
+             */
+            return getType(env, t, errToClassDoc, considerAnnotations);
+        }
+    }
+
+    @SuppressWarnings("fallthrough")
+    private static com.sun.javadoc.Type getTypeImpl(DocEnv env, Type t,
+            boolean errToClassDoc, boolean considerAnnotations) {
+        if (env.legacyDoclet) {
+            t = env.types.erasure(t);
+        }
+
+        if (considerAnnotations && t.isAnnotated()) {
+            return new AnnotatedTypeImpl(env, t);
+        }
+
+        switch (t.getTag()) {
+        case CLASS:
+            if (ClassDocImpl.isGeneric((ClassSymbol)t.tsym)) {
+                return env.getParameterizedType((ClassType)t);
+            } else {
+                return env.getClassDoc((ClassSymbol)t.tsym);
+            }
+        case WILDCARD:
+            Type.WildcardType a = (Type.WildcardType)t;
+            return new WildcardTypeImpl(env, a);
+        case TYPEVAR: return new TypeVariableImpl(env, (TypeVar)t);
+        case ARRAY: return new ArrayTypeImpl(env, t);
+        case BYTE: return PrimitiveType.byteType;
+        case CHAR: return PrimitiveType.charType;
+        case SHORT: return PrimitiveType.shortType;
+        case INT: return PrimitiveType.intType;
+        case LONG: return PrimitiveType.longType;
+        case FLOAT: return PrimitiveType.floatType;
+        case DOUBLE: return PrimitiveType.doubleType;
+        case BOOLEAN: return PrimitiveType.booleanType;
+        case VOID: return PrimitiveType.voidType;
+        case ERROR:
+            if (errToClassDoc)
+                return env.getClassDoc((ClassSymbol)t.tsym);
+            // FALLTHRU
+        default:
+            return new PrimitiveType(t.tsym.getQualifiedName().toString());
+        }
+    }
+
+    /**
+     * Convert a list of javac types into an array of javadoc types.
+     */
+    public static com.sun.javadoc.Type[] getTypes(DocEnv env, List<Type> ts) {
+        return getTypes(env, ts, new com.sun.javadoc.Type[ts.length()]);
+    }
+
+    /**
+     * Like the above version, but use and return the array given.
+     */
+    public static com.sun.javadoc.Type[] getTypes(DocEnv env, List<Type> ts,
+                                                  com.sun.javadoc.Type res[]) {
+        int i = 0;
+        for (Type t : ts) {
+            res[i++] = getType(env, t);
+        }
+        return res;
+    }
+
+    public static String getTypeName(Type t, boolean full) {
+        switch (t.getTag()) {
+        case ARRAY:
+            StringBuilder s = new StringBuilder();
+            while (t.hasTag(ARRAY)) {
+                s.append("[]");
+                t = ((ArrayType)t).elemtype;
+            }
+            s.insert(0, getTypeName(t, full));
+            return s.toString();
+        case CLASS:
+            return ClassDocImpl.getClassName((ClassSymbol)t.tsym, full);
+        default:
+            return t.tsym.getQualifiedName().toString();
+        }
+    }
+
+    /**
+     * Return the string representation of a type use.  Bounds of type
+     * variables are not included; bounds of wildcard types are.
+     * Class names are qualified if "full" is true.
+     */
+    static String getTypeString(DocEnv env, Type t, boolean full) {
+        // TODO: should annotations be included here?
+        switch (t.getTag()) {
+        case ARRAY:
+            StringBuilder s = new StringBuilder();
+            while (t.hasTag(ARRAY)) {
+                s.append("[]");
+                t = env.types.elemtype(t);
+            }
+            s.insert(0, getTypeString(env, t, full));
+            return s.toString();
+        case CLASS:
+            return ParameterizedTypeImpl.
+                        parameterizedTypeToString(env, (ClassType)t, full);
+        case WILDCARD:
+            Type.WildcardType a = (Type.WildcardType)t;
+            return WildcardTypeImpl.wildcardTypeToString(env, a, full);
+        default:
+            return t.tsym.getQualifiedName().toString();
+        }
+    }
+
+    /**
+     * Return the formal type parameters of a class or method as an
+     * angle-bracketed string.  Each parameter is a type variable with
+     * optional bounds.  Class names are qualified if "full" is true.
+     * Return "" if there are no type parameters or we're hiding generics.
+     */
+    static String typeParametersString(DocEnv env, Symbol sym, boolean full) {
+        if (env.legacyDoclet || sym.type.getTypeArguments().isEmpty()) {
+            return "";
+        }
+        StringBuilder s = new StringBuilder();
+        for (Type t : sym.type.getTypeArguments()) {
+            s.append(s.length() == 0 ? "<" : ", ");
+            s.append(TypeVariableImpl.typeVarToString(env, (TypeVar)t, full));
+        }
+        s.append(">");
+        return s.toString();
+    }
+
+    /**
+     * Return the actual type arguments of a parameterized type as an
+     * angle-bracketed string.  Class name are qualified if "full" is true.
+     * Return "" if there are no type arguments or we're hiding generics.
+     */
+    static String typeArgumentsString(DocEnv env, ClassType cl, boolean full) {
+        if (env.legacyDoclet || cl.getTypeArguments().isEmpty()) {
+            return "";
+        }
+        StringBuilder s = new StringBuilder();
+        for (Type t : cl.getTypeArguments()) {
+            s.append(s.length() == 0 ? "<" : ", ");
+            s.append(getTypeString(env, t, full));
+        }
+        s.append(">");
+        return s.toString();
+    }
+
+
+    private static class ArrayTypeImpl implements com.sun.javadoc.Type {
+
+        Type arrayType;
+
+        DocEnv env;
+
+        ArrayTypeImpl(DocEnv env, Type arrayType) {
+            this.env = env;
+            this.arrayType = arrayType;
+        }
+
+        private com.sun.javadoc.Type skipArraysCache = null;
+
+        public com.sun.javadoc.Type getElementType() {
+            return TypeMaker.getType(env, env.types.elemtype(arrayType));
+        }
+
+        private com.sun.javadoc.Type skipArrays() {
+            if (skipArraysCache == null) {
+                Type t;
+                for (t = arrayType; t.hasTag(ARRAY); t = env.types.elemtype(t)) { }
+                skipArraysCache = TypeMaker.getType(env, t);
+            }
+            return skipArraysCache;
+        }
+
+        /**
+         * Return the type's dimension information, as a string.
+         * <p>
+         * For example, a two dimensional array of String returns '[][]'.
+         */
+        public String dimension() {
+            StringBuilder dimension = new StringBuilder();
+            for (Type t = arrayType; t.hasTag(ARRAY); t = env.types.elemtype(t)) {
+                dimension.append("[]");
+            }
+            return dimension.toString();
+        }
+
+        /**
+         * Return unqualified name of type excluding any dimension information.
+         * <p>
+         * For example, a two dimensional array of String returns 'String'.
+         */
+        public String typeName() {
+            return skipArrays().typeName();
+        }
+
+        /**
+         * Return qualified name of type excluding any dimension information.
+         *<p>
+         * For example, a two dimensional array of String
+         * returns 'java.lang.String'.
+         */
+        public String qualifiedTypeName() {
+            return skipArrays().qualifiedTypeName();
+        }
+
+        /**
+         * Return the simple name of this type excluding any dimension information.
+         */
+        public String simpleTypeName() {
+            return skipArrays().simpleTypeName();
+        }
+
+        /**
+         * Return this type as a class.  Array dimensions are ignored.
+         *
+         * @return a ClassDocImpl if the type is a Class.
+         * Return null if it is a primitive type..
+         */
+        public ClassDoc asClassDoc() {
+            return skipArrays().asClassDoc();
+        }
+
+        /**
+         * Return this type as a <code>ParameterizedType</code> if it
+         * represents a parameterized type.  Array dimensions are ignored.
+         */
+        public ParameterizedType asParameterizedType() {
+            return skipArrays().asParameterizedType();
+        }
+
+        /**
+         * Return this type as a <code>TypeVariable</code> if it represents
+         * a type variable.  Array dimensions are ignored.
+         */
+        public TypeVariable asTypeVariable() {
+            return skipArrays().asTypeVariable();
+        }
+
+        /**
+         * Return null, as there are no arrays of wildcard types.
+         */
+        public WildcardType asWildcardType() {
+            return null;
+        }
+
+        /**
+         * Return null, as there are no annotations of the type
+         */
+        public AnnotatedType asAnnotatedType() {
+            return null;
+        }
+
+        /**
+         * Return this type as an <code>AnnotationTypeDoc</code> if it
+         * represents an annotation type.  Array dimensions are ignored.
+         */
+        public AnnotationTypeDoc asAnnotationTypeDoc() {
+            return skipArrays().asAnnotationTypeDoc();
+        }
+
+        /**
+         * Return true if this is an array of a primitive type.
+         */
+        public boolean isPrimitive() {
+            return skipArrays().isPrimitive();
+        }
+
+        /**
+         * Return a string representation of the type.
+         *
+         * Return name of type including any dimension information.
+         * <p>
+         * For example, a two dimensional array of String returns
+         * <code>String[][]</code>.
+         *
+         * @return name of type including any dimension information.
+         */
+        @Override
+        public String toString() {
+            return qualifiedTypeName() + dimension();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TypeVariableImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,152 @@
+/*
+ * 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
+ * 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.javadoc.main;
+
+import com.sun.javadoc.*;
+
+import com.sun.tools.javac.code.Attribute;
+import com.sun.tools.javac.code.Attribute.TypeCompound;
+import com.sun.tools.javac.code.Kinds;
+import com.sun.tools.javac.code.Kinds.KindSelector;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.MethodSymbol;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.TypeVar;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Names;
+
+/**
+ * Implementation of <code>TypeVariable</code>, which
+ * represents a type variable.
+ *
+ *  <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>
+ *
+ * @author Scott Seligman
+ * @since 1.5
+ */
+public class TypeVariableImpl extends AbstractTypeImpl implements TypeVariable {
+
+    TypeVariableImpl(DocEnv env, TypeVar type) {
+        super(env, type);
+    }
+
+    /**
+     * Return the bounds of this type variable.
+     */
+    public com.sun.javadoc.Type[] bounds() {
+        return TypeMaker.getTypes(env, getBounds((TypeVar)type, env));
+    }
+
+    /**
+     * Return the class, interface, method, or constructor within
+     * which this type variable is declared.
+     */
+    public ProgramElementDoc owner() {
+        Symbol osym = type.tsym.owner;
+        if (osym.kind.matches(KindSelector.TYP)) {
+            return env.getClassDoc((ClassSymbol)osym);
+        }
+        Names names = osym.name.table.names;
+        if (osym.name == names.init) {
+            return env.getConstructorDoc((MethodSymbol)osym);
+        } else {
+            return env.getMethodDoc((MethodSymbol)osym);
+        }
+    }
+
+    /**
+     * Return the ClassDoc of the erasure of this type variable.
+     */
+    @Override
+    public ClassDoc asClassDoc() {
+        return env.getClassDoc((ClassSymbol)env.types.erasure(type).tsym);
+    }
+
+    @Override
+    public TypeVariable asTypeVariable() {
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        return typeVarToString(env, (TypeVar)type, true);
+    }
+
+
+    /**
+     * Return the string form of a type variable along with any
+     * "extends" clause.  Class names are qualified if "full" is true.
+     */
+    static String typeVarToString(DocEnv env, TypeVar v, boolean full) {
+        StringBuilder s = new StringBuilder(v.toString());
+        List<Type> bounds = getBounds(v, env);
+        if (bounds.nonEmpty()) {
+            boolean first = true;
+            for (Type b : bounds) {
+                s.append(first ? " extends " : " & ");
+                s.append(TypeMaker.getTypeString(env, b, full));
+                first = false;
+            }
+        }
+        return s.toString();
+    }
+
+    /**
+     * Get the bounds of a type variable as listed in the "extends" clause.
+     */
+    private static List<Type> getBounds(TypeVar v, DocEnv env) {
+        final Type upperBound = v.getUpperBound();
+        Name boundname = upperBound.tsym.getQualifiedName();
+        if (boundname == boundname.table.names.java_lang_Object
+            && !upperBound.isAnnotated()) {
+            return List.nil();
+        } else {
+            return env.types.getBounds(v);
+        }
+    }
+
+    /**
+     * Get the annotations of this program element.
+     * Return an empty array if there are none.
+     */
+    public AnnotationDesc[] annotations() {
+        if (!type.isAnnotated()) {
+            return new AnnotationDesc[0];
+        }
+        List<? extends TypeCompound> tas = type.getAnnotationMirrors();
+        AnnotationDesc res[] = new AnnotationDesc[tas.length()];
+        int i = 0;
+        for (Attribute.Compound a : tas) {
+            res[i++] = new AnnotationDescImpl(env, a);
+        }
+        return res;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/WildcardTypeImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2003, 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.tools.javadoc.main;
+
+import com.sun.javadoc.*;
+
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.util.List;
+
+
+/**
+ * Implementation of <code>WildcardType</code>, which
+ * represents a wildcard type.
+ *
+ *  <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>
+ *
+ * @author Scott Seligman
+ * @since 1.5
+ */
+public class WildcardTypeImpl extends AbstractTypeImpl implements WildcardType {
+
+    WildcardTypeImpl(DocEnv env, Type.WildcardType type) {
+        super(env, type);
+    }
+
+    /**
+     * Return the upper bounds of this wildcard type argument
+     * as given by the <i>extends</i> clause.
+     * Return an empty array if no such bounds are explicitly given.
+     */
+    public com.sun.javadoc.Type[] extendsBounds() {
+        return TypeMaker.getTypes(env, getExtendsBounds((Type.WildcardType)type));
+    }
+
+    /**
+     * Return the lower bounds of this wildcard type argument
+     * as given by the <i>super</i> clause.
+     * Return an empty array if no such bounds are explicitly given.
+     */
+    public com.sun.javadoc.Type[] superBounds() {
+        return TypeMaker.getTypes(env, getSuperBounds((Type.WildcardType)type));
+    }
+
+    /**
+     * Return the ClassDoc of the erasure of this wildcard type.
+     */
+    @Override
+    public ClassDoc asClassDoc() {
+        return env.getClassDoc((ClassSymbol)env.types.erasure(type).tsym);
+    }
+
+    @Override
+    public WildcardType asWildcardType() {
+        return this;
+    }
+
+    @Override
+    public String typeName()            { return "?"; }
+    @Override
+    public String qualifiedTypeName()   { return "?"; }
+    @Override
+    public String simpleTypeName()      { return "?"; }
+
+    @Override
+    public String toString() {
+        return wildcardTypeToString(env, (Type.WildcardType)type, true);
+    }
+
+
+    /**
+     * Return the string form of a wildcard type ("?") along with any
+     * "extends" or "super" clause.  Delimiting brackets are not
+     * included.  Class names are qualified if "full" is true.
+     */
+    static String wildcardTypeToString(DocEnv env,
+                                       Type.WildcardType wildThing, boolean full) {
+        if (env.legacyDoclet) {
+            return TypeMaker.getTypeName(env.types.erasure(wildThing), full);
+        }
+        StringBuilder s = new StringBuilder("?");
+        List<Type> bounds = getExtendsBounds(wildThing);
+        if (bounds.nonEmpty()) {
+            s.append(" extends ");
+        } else {
+            bounds = getSuperBounds(wildThing);
+            if (bounds.nonEmpty()) {
+                s.append(" super ");
+            }
+        }
+        boolean first = true;   // currently only one bound is allowed
+        for (Type b : bounds) {
+            if (!first) {
+                s.append(" & ");
+            }
+            s.append(TypeMaker.getTypeString(env, b, full));
+            first = false;
+        }
+        return s.toString();
+    }
+
+    private static List<Type> getExtendsBounds(Type.WildcardType wild) {
+        return wild.isSuperBound()
+                ? List.<Type>nil()
+                : List.of(wild.type);
+    }
+
+    private static List<Type> getSuperBounds(Type.WildcardType wild) {
+        return wild.isExtendsBound()
+                ? List.<Type>nil()
+                : List.of(wild.type);
+    }
+}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -91,6 +91,19 @@
     }
 
     /**
+     * Get the module link.
+     *
+     * @return a content tree for the module link
+     */
+    @Override
+    protected Content getNavLinkModule() {
+        Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(annotationType),
+                moduleLabel);
+        Content li = HtmlTree.LI(linkContent);
+        return li;
+    }
+
+    /**
      * Get this package link.
      *
      * @return a content tree for the package link
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java	Tue May 17 05:38:15 2016 -0700
@@ -505,6 +505,19 @@
     }
 
     /**
+     * Get the module link.
+     *
+     * @return a content tree for the module link
+     */
+    @Override
+    protected Content getNavLinkModule() {
+        Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(typeElement),
+                moduleLabel);
+        Content li = HtmlTree.LI(linkContent);
+        return li;
+    }
+
+    /**
      * Get this package link.
      *
      * @return a content tree for the package link
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -105,6 +105,19 @@
     }
 
     /**
+     * Get the module link.
+     *
+     * @return a content tree for the module link
+     */
+    @Override
+    protected Content getNavLinkModule() {
+        Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(typeElement),
+                moduleLabel);
+        Content li = HtmlTree.LI(linkContent);
+        return li;
+    }
+
+    /**
      * Get this package link.
      *
      * @return a content tree for the package link
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Tue May 17 05:38:15 2016 -0700
@@ -570,6 +570,11 @@
             if (configuration.createoverview) {
                 navList.addContent(getNavLinkContents());
             }
+            if (configuration.modules.size() == 1) {
+                navList.addContent(getNavLinkModule(configuration.modules.first()));
+            } else if (!configuration.modules.isEmpty()) {
+                navList.addContent(getNavLinkModule());
+            }
             if (configuration.packages.size() == 1) {
                 navList.addContent(getNavLinkPackage(configuration.packages.first()));
             } else if (!configuration.packages.isEmpty()) {
@@ -679,6 +684,28 @@
     }
 
     /**
+     * Get link to the module summary page for the module passed.
+     *
+     * @param mdle Module to which link will be generated
+     * @return a content tree for the link
+     */
+    protected Content getNavLinkModule(ModuleElement mdle) {
+        Content linkContent = getModuleLink(mdle, moduleLabel);
+        Content li = HtmlTree.LI(linkContent);
+        return li;
+    }
+
+    /**
+     * Get the word "Module", to indicate that link is not available here.
+     *
+     * @return a content tree for the link
+     */
+    protected Content getNavLinkModule() {
+        Content li = HtmlTree.LI(moduleLabel);
+        return li;
+    }
+
+    /**
      * Get link to the "package-summary.html" page for the package passed.
      *
      * @param pkg Package to which link will be generated
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -268,6 +268,17 @@
     }
 
     /**
+     * Get this module link.
+     *
+     * @return a content tree for the module link
+     */
+    @Override
+    protected Content getNavLinkModule() {
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, moduleLabel);
+        return li;
+    }
+
+    /**
      * Get "PREV MODULE" link in the navigation bar.
      *
      * @return a content tree for the previous link
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java	Tue May 17 05:38:15 2016 -0700
@@ -224,6 +224,19 @@
     }
 
     /**
+     * Get the module link.
+     *
+     * @return a content tree for the module link
+     */
+    @Override
+    protected Content getNavLinkModule() {
+        Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
+                moduleLabel);
+        Content li = HtmlTree.LI(linkContent);
+        return li;
+    }
+
+    /**
      * Get link to the package summary page for the package of this tree.
      *
      * @return a content tree for the package link
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java	Tue May 17 05:38:15 2016 -0700
@@ -304,6 +304,19 @@
     }
 
     /**
+     * Get the module link.
+     *
+     * @return a content tree for the module link
+     */
+    @Override
+    protected Content getNavLinkModule() {
+        Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
+                moduleLabel);
+        Content li = HtmlTree.LI(linkContent);
+        return li;
+    }
+
+    /**
      * Get this package link.
      *
      * @return a content tree for the package link
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -376,6 +376,19 @@
     }
 
     /**
+     * Get the module link.
+     *
+     * @return a content tree for the module link
+     */
+    @Override
+    protected Content getNavLinkModule() {
+        Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
+                moduleLabel);
+        Content li = HtmlTree.LI(linkContent);
+        return li;
+    }
+
+    /**
      * Highlight "Package" in the navigation bar, as this is the package page.
      *
      * @return a content tree for the package link
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Tue May 17 05:38:15 2016 -0700
@@ -329,6 +329,7 @@
     public abstract MessageRetriever getDocletSpecificMsg();
 
     public CommentUtils cmtUtils;
+    public SortedSet<ModuleElement> modules;
 
     /**
      * A sorted set of packages specified on the command-line merged with a
@@ -395,6 +396,8 @@
                 s.add(p);
             }
         }
+        modules = new TreeSet<>(utils.makeModuleComparator());
+        modules.addAll(modulePackages.keySet());
         showModules = (modulePackages.size() > 1);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java	Tue May 17 05:38:15 2016 -0700
@@ -283,8 +283,8 @@
             }
         } else {
             if (this.apiMode) {
-                com.sun.tools.javadoc.Start ostart
-                        = new com.sun.tools.javadoc.Start(context);
+                com.sun.tools.javadoc.main.Start ostart
+                        = new com.sun.tools.javadoc.main.Start(context);
                 return ostart.begin(docletClass, options, fileObjects);
             }
             warn("main.legacy_api");
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,10 +40,13 @@
 import com.sun.source.tree.Tree;
 import com.sun.source.tree.Tree.Kind;
 import com.sun.source.tree.VariableTree;
+import com.sun.source.util.JavacTask;
 import com.sun.source.util.SourcePositions;
 import com.sun.source.util.TreePath;
 import com.sun.source.util.TreePathScanner;
+import com.sun.source.util.Trees;
 import com.sun.tools.javac.api.JavacScope;
+import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.code.Flags;
 import com.sun.tools.javac.code.Symbol.CompletionFailure;
 import com.sun.tools.javac.code.Symbol.VarSymbol;
@@ -119,8 +122,12 @@
 import javax.lang.model.type.TypeKind;
 import javax.lang.model.util.ElementFilter;
 import javax.lang.model.util.Types;
+import javax.tools.JavaCompiler;
 import javax.tools.JavaFileManager.Location;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
 import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
 
 import static jdk.jshell.Util.REPL_DOESNOTMATTER_CLASS_NAME;
 
@@ -932,6 +939,12 @@
         }
     }
 
+    //tweaked by tests to disable reading parameter names from classfiles so that tests using
+    //JDK's classes are stable for both release and fastdebug builds:
+    private final String[] keepParameterNames = new String[] {
+        "-XDsave-parameter-names=true"
+    };
+
     private String documentationImpl(String code, int cursor) {
         code = code.substring(0, cursor);
         if (code.trim().isEmpty()) { //TODO: comment handling
@@ -942,7 +955,7 @@
             return null;
 
         OuterWrap codeWrap = proc.outerMap.wrapInTrialClass(Wrap.methodWrap(code));
-        AnalyzeTask at = proc.taskFactory.new AnalyzeTask(codeWrap);
+        AnalyzeTask at = proc.taskFactory.new AnalyzeTask(codeWrap, keepParameterNames);
         SourcePositions sp = at.trees().getSourcePositions();
         CompilationUnitTree topLevel = at.firstCuTree();
         TreePath tp = pathFor(topLevel, sp, codeWrap.snippetIndexToWrapIndex(cursor));
@@ -983,9 +996,11 @@
                         .collect(Collectors.toList());
         }
 
-        return Util.stream(candidates)
-                .map(method -> Util.expunge(element2String(method.fst)))
-                .collect(joining("\n"));
+        try (SourceCache sourceCache = new SourceCache(at)) {
+            return Util.stream(candidates)
+                    .map(method -> Util.expunge(element2String(sourceCache, method.fst)))
+                    .collect(joining("\n"));
+        }
     }
 
     private boolean isEmptyArgumentsContext(List<? extends ExpressionTree> arguments) {
@@ -996,19 +1011,173 @@
         return false;
     }
 
-    private String element2String(Element el) {
+    private String element2String(SourceCache sourceCache, Element el) {
+        try {
+            if (hasSyntheticParameterNames(el)) {
+                el = sourceCache.getSourceMethod(el);
+            }
+        } catch (IOException ex) {
+            proc.debug(ex, "SourceCodeAnalysisImpl.element2String(..., " + el + ")");
+        }
+
+        return Util.expunge(elementHeader(el));
+    }
+
+    private boolean hasSyntheticParameterNames(Element el) {
+        if (el.getKind() != ElementKind.CONSTRUCTOR && el.getKind() != ElementKind.METHOD)
+            return false;
+
+        ExecutableElement ee = (ExecutableElement) el;
+
+        if (ee.getParameters().isEmpty())
+            return false;
+
+        return ee.getParameters()
+                 .stream()
+                 .allMatch(param -> param.getSimpleName().toString().startsWith("arg"));
+    }
+
+    private final class SourceCache implements AutoCloseable {
+        private final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        private final Map<String, Map<String, Element>> topLevelName2Signature2Method = new HashMap<>();
+        private final AnalyzeTask originalTask;
+        private final StandardJavaFileManager fm;
+
+        public SourceCache(AnalyzeTask originalTask) {
+            this.originalTask = originalTask;
+            List<Path> sources = findSources();
+            if (sources.iterator().hasNext()) {
+                StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
+                try {
+                    fm.setLocationFromPaths(StandardLocation.SOURCE_PATH, sources);
+                } catch (IOException ex) {
+                    proc.debug(ex, "SourceCodeAnalysisImpl.SourceCache.<init>(...)");
+                    fm = null;
+                }
+                this.fm = fm;
+            } else {
+                //don't waste time if there are no sources
+                this.fm = null;
+            }
+        }
+
+        public Element getSourceMethod(Element method) throws IOException {
+            if (fm == null)
+                return method;
+
+            TypeElement type = topLevelType(method);
+
+            if (type == null)
+                return method;
+
+            String binaryName = originalTask.task.getElements().getBinaryName(type).toString();
+
+            Map<String, Element> cache = topLevelName2Signature2Method.get(binaryName);
+
+            if (cache == null) {
+                topLevelName2Signature2Method.put(binaryName, cache = createMethodCache(binaryName));
+            }
+
+            String handle = elementHeader(method, false);
+
+            return cache.getOrDefault(handle, method);
+        }
+
+        private TypeElement topLevelType(Element el) {
+            while (el != null && el.getEnclosingElement().getKind() != ElementKind.PACKAGE) {
+                el = el.getEnclosingElement();
+            }
+
+            return el != null && (el.getKind().isClass() || el.getKind().isInterface()) ? (TypeElement) el : null;
+        }
+
+        private Map<String, Element> createMethodCache(String binaryName) throws IOException {
+            Pair<JavacTask, CompilationUnitTree> source = findSource(binaryName);
+
+            if (source == null)
+                return Collections.emptyMap();
+
+            Map<String, Element> signature2Method = new HashMap<>();
+            Trees trees = Trees.instance(source.fst);
+
+            new TreePathScanner<Void, Void>() {
+                @Override @DefinedBy(Api.COMPILER_TREE)
+                public Void visitMethod(MethodTree node, Void p) {
+                    Element currentMethod = trees.getElement(getCurrentPath());
+
+                    if (currentMethod != null) {
+                        signature2Method.put(elementHeader(currentMethod, false), currentMethod);
+                    }
+
+                    return null;
+                }
+            }.scan(source.snd, null);
+
+            return signature2Method;
+        }
+
+        private Pair<JavacTask, CompilationUnitTree> findSource(String binaryName) throws IOException {
+            JavaFileObject jfo = fm.getJavaFileForInput(StandardLocation.SOURCE_PATH,
+                                                        binaryName,
+                                                        JavaFileObject.Kind.SOURCE);
+
+            if (jfo == null)
+                return null;
+
+            List<JavaFileObject> jfos = Arrays.asList(jfo);
+            JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, fm, d -> {}, null, null, jfos);
+            Iterable<? extends CompilationUnitTree> cuts = task.parse();
+
+            task.enter();
+
+            return Pair.of(task, cuts.iterator().next());
+        }
+
+        @Override
+        public void close() {
+            try {
+                if (fm != null) {
+                    fm.close();
+                }
+            } catch (IOException ex) {
+                proc.debug(ex, "SourceCodeAnalysisImpl.SourceCache.close()");
+            }
+        }
+    }
+
+    private List<Path> availableSources;
+
+    private List<Path> findSources() {
+        if (availableSources != null) {
+            return availableSources;
+        }
+        List<Path> result = new ArrayList<>();
+        Path home = Paths.get(System.getProperty("java.home"));
+        Path srcZip = home.resolve("src.zip");
+        if (!Files.isReadable(srcZip))
+            srcZip = home.getParent().resolve("src.zip");
+        if (Files.isReadable(srcZip))
+            result.add(srcZip);
+        return availableSources = result;
+    }
+
+    private String elementHeader(Element el) {
+        return elementHeader(el, true);
+    }
+
+    private String elementHeader(Element el, boolean includeParameterNames) {
         switch (el.getKind()) {
             case ANNOTATION_TYPE: case CLASS: case ENUM: case INTERFACE:
                 return ((TypeElement) el).getQualifiedName().toString();
             case FIELD:
-                return element2String(el.getEnclosingElement()) + "." + el.getSimpleName() + ":" + el.asType();
+                return elementHeader(el.getEnclosingElement()) + "." + el.getSimpleName() + ":" + el.asType();
             case ENUM_CONSTANT:
-                return element2String(el.getEnclosingElement()) + "." + el.getSimpleName();
+                return elementHeader(el.getEnclosingElement()) + "." + el.getSimpleName();
             case EXCEPTION_PARAMETER: case LOCAL_VARIABLE: case PARAMETER: case RESOURCE_VARIABLE:
                 return el.getSimpleName() + ":" + el.asType();
             case CONSTRUCTOR: case METHOD:
                 StringBuilder header = new StringBuilder();
-                header.append(element2String(el.getEnclosingElement()));
+                header.append(elementHeader(el.getEnclosingElement()));
                 if (el.getKind() == ElementKind.METHOD) {
                     header.append(".");
                     header.append(el.getSimpleName());
@@ -1026,8 +1195,10 @@
                     } else {
                         header.append(p.asType());
                     }
-                    header.append(" ");
-                    header.append(p.getSimpleName());
+                    if (includeParameterNames) {
+                        header.append(" ");
+                        header.append(p.getSimpleName());
+                    }
                     sep = ", ";
                 }
                 header.append(")");
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java	Tue May 17 05:38:15 2016 -0700
@@ -215,17 +215,21 @@
 
         private final Iterable<? extends CompilationUnitTree> cuts;
 
-        AnalyzeTask(final OuterWrap wrap) {
-            this(Collections.singletonList(wrap));
+        AnalyzeTask(final OuterWrap wrap, String... extraArgs) {
+            this(Collections.singletonList(wrap), extraArgs);
         }
 
-        AnalyzeTask(final Collection<OuterWrap> wraps) {
+        AnalyzeTask(final Collection<OuterWrap> wraps, String... extraArgs) {
             this(wraps.stream(),
                     new WrapSourceHandler(),
-                    "-XDshouldStopPolicy=FLOW", "-Xlint:unchecked", "-XaddExports:jdk.jshell/jdk.internal.jshell.remote=ALL-UNNAMED", "-proc:none");
+                    Util.join(new String[] {
+                        "-XDshouldStopPolicy=FLOW", "-Xlint:unchecked",
+                        "-XaddExports:jdk.jshell/jdk.internal.jshell.remote=ALL-UNNAMED",
+                        "-proc:none"
+                    }, extraArgs));
         }
 
-        <T>AnalyzeTask(final Stream<T> stream, SourceHandler<T> sourceHandler,
+        private <T>AnalyzeTask(final Stream<T> stream, SourceHandler<T> sourceHandler,
                 String... extraOptions) {
             super(stream, sourceHandler, extraOptions);
             cuts = analyze();
@@ -264,7 +268,7 @@
 
         CompileTask(final Collection<OuterWrap> wraps) {
             super(wraps.stream(), new WrapSourceHandler(),
-                    "-Xlint:unchecked", "-XaddExports:jdk.jshell/jdk.internal.jshell.remote=ALL-UNNAMED", "-proc:none");
+                    "-Xlint:unchecked", "-XaddExports:jdk.jshell/jdk.internal.jshell.remote=ALL-UNNAMED", "-proc:none", "-parameters");
         }
 
         boolean compile() {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Util.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Util.java	Tue May 17 05:38:15 2016 -0700
@@ -25,6 +25,9 @@
 
 package jdk.jshell;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 import java.util.Locale;
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
@@ -95,6 +98,15 @@
         return StreamSupport.stream(iterable.spliterator(), false);
     }
 
+    static String[] join(String[] a1, String[] a2) {
+        List<String> result = new ArrayList<>();
+
+        result.addAll(Arrays.asList(a1));
+        result.addAll(Arrays.asList(a2));
+
+        return result.toArray(new String[0]);
+    }
+
     static class Pair<T, U> {
         final T first;
         final U second;
--- a/langtools/test/Makefile	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/test/Makefile	Tue May 17 05:38:15 2016 -0700
@@ -86,6 +86,8 @@
 # Default JTREG to run
 ifdef JPRT_JTREG_HOME
   JTREG_HOME = $(JPRT_JTREG_HOME)
+else ifdef JT_HOME
+  JTREG_HOME = $(JT_HOME)
 else
   JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.1-jigsaw/nightly/binaries/jtreg/
 endif
@@ -113,10 +115,12 @@
 #
 # JT_JAVA is the version of java used to run jtreg/JCK. 
 #
-ifdef JPRT_JAVA_HOME
-  JT_JAVA = $(JPRT_JAVA_HOME)
-else
-  JT_JAVA = $(SLASH_JAVA)/re/jdk/1.9.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
+ifndef JT_JAVA
+  ifdef JPRT_JAVA_HOME
+    JT_JAVA = $(JPRT_JAVA_HOME)
+  else
+    JT_JAVA = $(SLASH_JAVA)/re/jdk/1.9.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
+  endif
 endif
 
 # Default JDK to test
@@ -149,6 +153,10 @@
 	-refvmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH)
 endif
 
+ifdef EXTRA_JTREG_OPTIONS
+  JTREG_OPTIONS += $(EXTRA_JTREG_OPTIONS)
+endif
+
 # Concurrency is the number of tests that can execute at once.
 # On an otherwise empty machine, suggest setting to (#cpus + 2)
 # If unset, the default is (#cpus)
@@ -262,6 +270,12 @@
 javap:		JTREG_TESTDIRS = tools/javap
 jdeps:		JTREG_TESTDIRS = tools/jdeps
 
+# a way to select jtreg tests from outside
+ifdef TEST_SELECTION
+  JTREG_TESTDIRS = $(TEST_SELECTION)
+endif
+
+
 # Run jtreg tests
 #
 # JTREG_HOME
@@ -290,13 +304,13 @@
 	  -J-Xmx512m \
 	  -vmoption:-Xmx768m \
 	  -a -ignore:quiet $(if $(JTREG_VERBOSE),-v:$(JTREG_VERBOSE)) \
-          -r:$(JTREG_OUTPUT_DIR)/JTreport \
-          -w:$(JTREG_OUTPUT_DIR)/JTwork \
-          -jdk:$(TESTJAVA) \
-          $(JAVA_ARGS:%=-vmoption:%) \
-          $(JTREG_EXCLUSIONS) \
+	  -r:$(JTREG_OUTPUT_DIR)/JTreport \
+	  -w:$(JTREG_OUTPUT_DIR)/JTwork \
+	  -jdk:$(TESTJAVA) \
+	  $(JAVA_ARGS:%=-vmoption:%) \
+	  $(JTREG_EXCLUSIONS) \
 	  $(JTREG_OPTIONS) \
-          $(JTREG_TESTDIRS) \
+	  $(JTREG_TESTDIRS) \
 	|| ( $(call EXIT_IF_FATAL,$(FATAL_JTREG_EXIT)) ; \
 	    echo $$status > $(JTREG_OUTPUT_DIR)/status.txt \
 	)
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Tue May 17 05:38:15 2016 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8154119
+ * @bug 8154119 8154262
  * @summary Test modules support in javadoc.
  * @author bpatel
  * @library ../lib
@@ -41,46 +41,58 @@
 
     @Test
     void test1() {
-        javadoc("-d", "out",
+        javadoc("-d", "out", "-use",
                 "-modulesourcepath", testSrc,
                 "-addmods", "module1,module2",
                 "testpkgmdl1", "testpkgmdl2");
         checkExit(Exit.OK);
         testDescription(true);
         testNoDescription(false);
+        testModuleLink();
     }
 
     @Test
     void test2() {
-        javadoc("-d", "out-html5", "-html5",
+        javadoc("-d", "out-html5", "-html5", "-use",
                 "-modulesourcepath", testSrc,
                 "-addmods", "module1,module2",
                 "testpkgmdl1", "testpkgmdl2");
         checkExit(Exit.OK);
         testHtml5Description(true);
         testHtml5NoDescription(false);
+        testModuleLink();
     }
 
     @Test
     void test3() {
-        javadoc("-d", "out-nocomment", "-nocomment",
+        javadoc("-d", "out-nocomment", "-nocomment", "-use",
                 "-modulesourcepath", testSrc,
                 "-addmods", "module1,module2",
                 "testpkgmdl1", "testpkgmdl2");
         checkExit(Exit.OK);
         testDescription(false);
         testNoDescription(true);
+        testModuleLink();
     }
 
     @Test
     void test4() {
-        javadoc("-d", "out-html5-nocomment", "-nocomment", "-html5",
+        javadoc("-d", "out-html5-nocomment", "-nocomment", "-html5", "-use",
                 "-modulesourcepath", testSrc,
                 "-addmods", "module1,module2",
                 "testpkgmdl1", "testpkgmdl2");
         checkExit(Exit.OK);
         testHtml5Description(false);
         testHtml5NoDescription(true);
+        testModuleLink();
+    }
+
+    @Test
+    void test5() {
+        javadoc("-d", "out-nomodule", "-use",
+                "-sourcepath", testSrc,
+                "testpkgnomodule");
+        checkExit(Exit.OK);
     }
 
     void testDescription(boolean found) {
@@ -142,4 +154,37 @@
                 + "<li class=\"blockList\">\n"
                 + "<table class=\"overviewSummary\">");
     }
+
+    void testModuleLink() {
+        checkOutput("overview-summary.html", true,
+                "<li>Module</li>");
+        checkOutput("module1-summary.html", true,
+                "<li class=\"navBarCell1Rev\">Module</li>");
+        checkOutput("module2-summary.html", true,
+                "<li class=\"navBarCell1Rev\">Module</li>");
+        checkOutput("testpkgmdl1/package-summary.html", true,
+                "<li><a href=\"../module1-summary.html\">Module</a></li>");
+        checkOutput("testpkgmdl1/TestClassInModule1.html", true,
+                "<li><a href=\"../module1-summary.html\">Module</a></li>");
+        checkOutput("testpkgmdl1/class-use/TestClassInModule1.html", true,
+                "<li><a href=\"../../module1-summary.html\">Module</a></li>");
+        checkOutput("testpkgmdl2/package-summary.html", true,
+                "<li><a href=\"../module2-summary.html\">Module</a></li>");
+        checkOutput("testpkgmdl2/TestClassInModule2.html", true,
+                "<li><a href=\"../module2-summary.html\">Module</a></li>");
+        checkOutput("testpkgmdl2/class-use/TestClassInModule2.html", true,
+                "<li><a href=\"../../module2-summary.html\">Module</a></li>");
+    }
+
+    void testNoModuleLink() {
+        checkOutput("testpkgnomodule/package-summary.html", true,
+                "<ul class=\"navList\" title=\"Navigation\">\n"
+                + "<li><a href=\"../testpkgnomodule/package-summary.html\">Package</a></li>");
+        checkOutput("testpkgnomodule/TestClassNoModule.html", true,
+                "<ul class=\"navList\" title=\"Navigation\">\n"
+                + "<li><a href=\"../testpkgnomodule/package-summary.html\">Package</a></li>");
+        checkOutput("testpkgnomodule/class-use/TestClassNoModule.html", true,
+                "<ul class=\"navList\" title=\"Navigation\">\n"
+                + "<li><a href=\"../../testpkgnomodule/package-summary.html\">Package</a></li>");
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/testpkgnomodule/TestClassNoModule.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package testpkgnomodule;
+
+public class TestClassNoModule {
+}
--- a/langtools/test/jdk/jshell/CompletionSuggestionTest.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/test/jdk/jshell/CompletionSuggestionTest.java	Tue May 17 05:38:15 2016 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8141092
+ * @bug 8141092 8153761
  * @summary Test Completion
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -34,14 +34,20 @@
  * @run testng CompletionSuggestionTest
  */
 
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Set;
 import java.util.HashSet;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
 
 import jdk.jshell.Snippet;
+import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import static jdk.jshell.Snippet.Status.VALID;
@@ -295,10 +301,11 @@
         assertCompletion("import inner.|");
     }
 
-    public void testDocumentation() {
+    public void testDocumentation() throws Exception {
+        dontReadParameterNamesFromClassFile();
         assertDocumentation("System.getProperty(|",
-                "java.lang.System.getProperty(java.lang.String arg0)",
-                "java.lang.System.getProperty(java.lang.String arg0, java.lang.String arg1)");
+                "java.lang.System.getProperty(java.lang.String key)",
+                "java.lang.System.getProperty(java.lang.String key, java.lang.String def)");
         assertEval("char[] chars = null;");
         assertDocumentation("new String(chars, |",
                 "java.lang.String(char[] arg0, int arg1, int arg2)");
@@ -313,7 +320,8 @@
                                                      "java.lang.String.getBytes(java.nio.charset.Charset arg0)");
     }
 
-    public void testMethodsWithNoArguments() {
+    public void testMethodsWithNoArguments() throws Exception {
+        dontReadParameterNamesFromClassFile();
         assertDocumentation("System.out.println(|",
                 "java.io.PrintStream.println()",
                 "java.io.PrintStream.println(boolean arg0)",
@@ -442,29 +450,30 @@
     public void testDocumentationOfUserDefinedMethods() {
         assertEval("void f() {}");
         assertDocumentation("f(|", "f()");
-        assertEval("void f(int a) {}");
-        assertDocumentation("f(|", "f()", "f(int arg0)");
-        assertEval("<T> void f(T... a) {}", DiagCheck.DIAG_WARNING, DiagCheck.DIAG_OK);
-        assertDocumentation("f(|", "f()", "f(int arg0)", "f(T... arg0)");
+        assertEval("void f(int i) {}");
+        assertDocumentation("f(|", "f()", "f(int i)");
+        assertEval("<T> void f(T... ts) {}", DiagCheck.DIAG_WARNING, DiagCheck.DIAG_OK);
+        assertDocumentation("f(|", "f()", "f(int i)", "f(T... ts)");
         assertEval("class A {}");
         assertEval("void f(A a) {}");
-        assertDocumentation("f(|", "f()", "f(int arg0)", "f(T... arg0)", "f(A arg0)");
+        assertDocumentation("f(|", "f()", "f(int i)", "f(T... ts)", "f(A a)");
     }
 
     public void testDocumentationOfUserDefinedConstructors() {
         Snippet a = classKey(assertEval("class A {}"));
         assertDocumentation("new A(|", "A()");
-        Snippet a2 = classKey(assertEval("class A { A() {} A(int a) {}}",
+        Snippet a2 = classKey(assertEval("class A { A() {} A(int i) {}}",
                 ste(MAIN_SNIPPET, VALID, VALID, true, null),
                 ste(a, VALID, OVERWRITTEN, false, MAIN_SNIPPET)));
-        assertDocumentation("new A(|", "A()", "A(int arg0)");
-        assertEval("class A<T> { A(T a) {} A(int a) {}}",
+        assertDocumentation("new A(|", "A()", "A(int i)");
+        assertEval("class A<T> { A(T t) {} A(int i) {}}",
                 ste(MAIN_SNIPPET, VALID, VALID, true, null),
                 ste(a2, VALID, OVERWRITTEN, false, MAIN_SNIPPET));
-        assertDocumentation("new A(|", "A(T arg0)", "A(int arg0)");
+        assertDocumentation("new A(|", "A(T t)", "A(int i)");
     }
 
-    public void testDocumentationOfOverriddenMethods() {
+    public void testDocumentationOfOverriddenMethods() throws Exception {
+        dontReadParameterNamesFromClassFile();
         assertDocumentation("\"\".wait(|",
             "java.lang.Object.wait(long arg0)",
             "java.lang.Object.wait(long arg0, int arg1)",
@@ -502,13 +511,13 @@
         assertEval("void method(int n, Object o) { }");
         assertEval("void method(Object n, int o) { }");
         assertDocumentation("method(primitive,|",
-                "method(int arg0, java.lang.Object arg1)",
-                "method(java.lang.Object arg0, int arg1)");
+                "method(int n, java.lang.Object o)",
+                "method(java.lang.Object n, int o)");
         assertDocumentation("method(boxed,|",
-                "method(int arg0, java.lang.Object arg1)",
-                "method(java.lang.Object arg0, int arg1)");
+                "method(int n, java.lang.Object o)",
+                "method(java.lang.Object n, int o)");
         assertDocumentation("method(object,|",
-                "method(java.lang.Object arg0, int arg1)");
+                "method(java.lang.Object n, int o)");
     }
 
     public void testVarArgs() {
@@ -546,4 +555,36 @@
         assertEval("class Foo { static void m(String str) {} static void m(Baz<String> baz) {} }");
         assertCompletion("Foo.m(new Baz<>(|", true, "str");
     }
+
+    @BeforeMethod
+    public void setUp() {
+        super.setUp();
+
+        Path srcZip = Paths.get("src.zip");
+
+        try (JarOutputStream out = new JarOutputStream(Files.newOutputStream(srcZip))) {
+            out.putNextEntry(new JarEntry("java/lang/System.java"));
+            out.write(("package java.lang;\n" +
+                       "public class System {\n" +
+                       "    public String getProperty(String key) { return null; }\n" +
+                       "    public String getProperty(String key, String def) { return def; }\n" +
+                       "}\n").getBytes());
+        } catch (IOException ex) {
+            throw new IllegalStateException(ex);
+        }
+
+        try {
+            Field availableSources = getAnalysis().getClass().getDeclaredField("availableSources");
+            availableSources.setAccessible(true);
+            availableSources.set(getAnalysis(), Arrays.asList(srcZip));
+        } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException ex) {
+            throw new IllegalStateException(ex);
+        }
+    }
+
+    private void dontReadParameterNamesFromClassFile() throws Exception {
+        Field keepParameterNames = getAnalysis().getClass().getDeclaredField("keepParameterNames");
+        keepParameterNames.setAccessible(true);
+        keepParameterNames.set(getAnalysis(), new String[0]);
+    }
 }
--- a/langtools/test/tools/javac/6330997/T6330997.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/test/tools/javac/6330997/T6330997.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,8 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  * @clean T1 T2
- * @compile -source 8 -target 8 T1.java
- * @compile -source 8 -target 8 T2.java
+ * @compile -source 9 -target 9 T1.java
+ * @compile -source 9 -target 9 T2.java
  * @run main/othervm T6330997
  */
 
--- a/langtools/test/tools/javac/classfiles/ClassVersionChecker.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/ClassVersionChecker.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
 public class ClassVersionChecker {
 
     int errors;
-    String[] jdk = {"","1.6","1.7","1.8"};
+    String[] jdk = {"", "1.6", "1.7", "1.8", "1.9"};
     File javaFile = null;
 
     public static void main(String[] args) throws Throwable {
@@ -58,10 +58,10 @@
          * -1 => invalid combinations
          */
         int[][] ver =
-                {{52, -1, -1, -1},
-                 {52, 50, 51, 52},
-                 {52, -1, 51, 52},
-                 {52, -1, -1, 52}};
+                {{53, -1, -1, -1, -1},
+                 {53, 50, 51, 52, 53},
+                 {53, -1, 51, 52, 53},
+                 {53, -1, -1, 52, 53}};
 
         // Loop to run all possible combinations of source/target values
         for (int i = 0; i< ver.length; i++) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/importscope/TestDeepFinishClassStack.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 8156097
+ * @summary Check that nested TypeEnter.MembersPhase invocations don't cause StackOverflowError
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ */
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
+public class TestDeepFinishClassStack {
+    public static void main(String... args) throws IOException {
+        new TestDeepFinishClassStack().run();
+    }
+
+    int depth = 1000;
+
+    void run() throws IOException {
+        Path src = Paths.get("src");
+
+        Files.createDirectories(src);
+
+        ToolBox tb = new ToolBox();
+
+        for (int i = 0; i < depth; i++) {
+            tb.writeJavaFiles(src, "public class C" + i + " { public void test(C" + (i + 1) + " c) { } }");
+        }
+
+        tb.writeJavaFiles(src, "public class C" + depth + " { }");
+
+        new JavacTask(tb).files(src.resolve("C0.java"))
+                         .sourcepath(src)
+                         .outdir(".")
+                         .run()
+                         .writeAll();
+    }
+
+}
--- a/langtools/test/tools/javac/versions/Versions.java	Sat May 14 09:11:07 2016 -0700
+++ b/langtools/test/tools/javac/versions/Versions.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,16 +61,14 @@
 
     void run() {
 
-        String jdk9cv = "52.0";  // class version.change when ./dev pushed to 53
-
         String TC = "";
         System.out.println("Version.java: Starting");
 
-        check("52.0");
-        check("52.0", "-source 1.6");
-        check("52.0", "-source 1.7");
-        check("52.0", "-source 1.8");
-        check(jdk9cv, "-source 1.9");
+        check("53.0");
+        check("53.0", "-source 1.6");
+        check("53.0", "-source 1.7");
+        check("53.0", "-source 1.8");
+        check("53.0", "-source 1.9");
 
         check_source_target("50.0", "6", "6");
         check_source_target("51.0", "6", "7");
@@ -78,10 +76,10 @@
         check_source_target("52.0", "6", "8");
         check_source_target("52.0", "7", "8");
         check_source_target("52.0", "8", "8");
-        check_source_target(jdk9cv, "6", "9");
-        check_source_target(jdk9cv, "7", "9");
-        check_source_target(jdk9cv, "8", "9");
-        check_source_target(jdk9cv, "9", "9");
+        check_source_target("53.0", "6", "9");
+        check_source_target("53.0", "7", "9");
+        check_source_target("53.0", "8", "9");
+        check_source_target("53.0", "9", "9");
 
         checksrc16("-source 1.6");
         checksrc16("-source 6");
--- a/make/Images.gmk	Sat May 14 09:11:07 2016 -0700
+++ b/make/Images.gmk	Tue May 17 05:38:15 2016 -0700
@@ -114,8 +114,18 @@
 # Use this file inside the image as target for make rule
 JIMAGE_TARGET_FILE := bin/java$(EXE_SUFFIX)
 
+JLINK_ORDER_RESOURCES := \
+    *module-info.class* \
+    @$(SUPPORT_OUTPUTDIR)/classlist/classlist,/java.base/java/* \
+    /java.base/jdk/* \
+    /java.base/sun/* \
+    /java.base/com/* \
+    /jdk.localedata/* \
+    #
+
 JLINK_TOOL := $(JLINK) --modulepath $(IMAGES_OUTPUTDIR)/jmods \
               --endian $(OPENJDK_BUILD_CPU_ENDIAN) \
+              --order-resources=$(call CommaList, $(JLINK_ORDER_RESOURCES)) \
               --release-info $(BASE_RELEASE_FILE)
 
 ifeq ($(JLINK_KEEP_PACKAGED_MODULES), true)
--- a/make/common/NativeCompilation.gmk	Sat May 14 09:11:07 2016 -0700
+++ b/make/common/NativeCompilation.gmk	Tue May 17 05:38:15 2016 -0700
@@ -770,13 +770,20 @@
 		$$(call ExecuteWithLog, $$@, \
 		    $$($1_RC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) $(CC_OUT_OPTION)$$@ \
 		    $$($1_VERSIONINFO_RESOURCE))
-                # Windows RC compiler does not support -showIncludes, so we mis-use CL for this.
+                # Windows RC compiler does not support -showIncludes, so we mis-use CL
+                # for this. Filter out RC specific arguments that are unknown to CL.
+                # For some unknown reason, in this case CL actually outputs the show
+                # includes to stderr so need to redirect it to hide the output from the
+                # main log.
 		$$(call ExecuteWithLog, $$($1_RES_DEP).obj, \
-		    $$($1_CC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) -showIncludes -nologo -TC \
-		    $(CC_OUT_OPTION)$$($1_RES_DEP).obj -P -Fi$$($1_RES_DEP).pp \
-		    $$($1_VERSIONINFO_RESOURCE)) > $$($1_RES_DEP).raw 2>&1 || true ; \
+		    $$($1_CC) $$(filter-out -l%, $$($1_RC_FLAGS)) \
+		        $$($1_SYSROOT_CFLAGS) -showIncludes -nologo -TC \
+		        $(CC_OUT_OPTION)$$($1_RES_DEP).obj -P -Fi$$($1_RES_DEP).pp \
+		        $$($1_VERSIONINFO_RESOURCE)) 2>&1 \
+		    | $(GREP) -v -e "^Note: including file:" \
+		        -e "^$$(notdir $$($1_VERSIONINFO_RESOURCE))$$$$" || test "$$$$?" = "1" ; \
 		$(ECHO) $$($1_RES): \\ > $$($1_RES_DEP) ; \
-		$(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).raw >> $$($1_RES_DEP) ; \
+		$(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).obj.log >> $$($1_RES_DEP) ; \
 		$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_RES_DEP) > $$($1_RES_DEP_TARGETS)
     endif
   endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/idea.gmk	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,39 @@
+include Makefile
+include make/MainSupport.gmk
+
+.PHONY: idea
+
+ifeq ($(SPEC),)
+  ifneq ($(words $(SPECS)),1)
+	@echo "Error: Multiple build specification files found. Please select one explicitly."
+	@exit 2
+  endif
+  idea:
+	@cd $(topdir)
+	@$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/idea/idea.gmk SPEC=$(SPECS) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) MODULES="$(MODULES)" idea
+else #with SPEC
+  include make/common/Modules.gmk
+
+  ifeq ($(MODULES),)
+    SEL_MODULES := $(call FindAllModules)
+  else
+    SEL_MODULES := $(MODULES)
+  endif
+
+  # Find all source dirs for a particular module
+  # $1 - Module to find source dirs for
+  FindIdeaModuleSrcDirs = \
+    $(strip $(addsuffix /$(strip $1), $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \
+        $(wildcard $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS)))))
+
+
+  idea:
+	$(ECHO) "SUPPORT=$(SUPPORT_OUTPUTDIR)" >> $(OUT)
+	$(ECHO) "MODULE_ROOTS=\"$(foreach mod, $(SEL_MODULES), $(call FindIdeaModuleSrcDirs,$(mod)))\"" >> $(OUT)
+	$(ECHO) "MODULE_NAMES=\"$(strip $(foreach mod, $(SEL_MODULES), $(mod)))\"" >> $(OUT)
+	$(ECHO) "SEL_MODULES=\"$(SEL_MODULES)\"" >> $(OUT)
+	$(ECHO) "BOOT_JDK=\"$(BOOT_JDK)\"" >> $(OUT)
+	$(ECHO) "CYGPATH=\"$(CYGPATH)\"" >> $(OUT)
+	$(ECHO) "SPEC=\"$(SPEC)\"" >> $(OUT)
+
+endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/.name	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,1 @@
+jdk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/ant.xml	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AntConfiguration">
+    <buildFile url="file://$PROJECT_DIR$/.idea/build.xml">
+      <properties>
+        <property name="boot.java.home" value="$JDKPath$" />
+        <property name="jtreg.tests" value="$FilePath$" />
+        <property name="jtreg.home" value="###" />
+        <property name="build.target.dir" value="specDir" /> <!-- this will be replaced --> 
+        <property name="jtreg.jpda.jvmargs" value="-agentlib:jdwp=transport=dt_socket,server=n,address=localhost:5900,suspend=y" />
+        <property name="module.name" value="java.base" /> <!-- this will be replaced -->
+      </properties>
+      <executeOn event="afterCompilation" target="post-make" />
+    </buildFile>
+  </component>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/build.xml	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,126 @@
+<!-- importing.xml -->
+<project name="jdk" basedir="..">
+
+    <script language="javascript" classpath=".idea/classes">
+        var JdkLogger = Java.type("idea.JdkIdeaAntLogger");
+        new JdkLogger(project)
+    </script>
+
+     <!-- java.marker is set to a marker file to check for within a Java install dir.
+         The best file to check for across Solaris/Linux/Windows/MacOS is one of the
+         executables; regrettably, that is OS-specific. -->
+    <condition property="java.marker" value="bin/java">
+        <os family="unix"/>
+    </condition>
+    <condition property="java.marker" value="bin/java.exe">
+        <os family="windows"/>
+    </condition>
+
+    <property name="test.dir" value="${basedir}/jdk/test"/>
+
+    <macrodef name="call-make">
+            <attribute name="dir"/>
+            <attribute name="args"/>
+            <sequential>
+                <exec executable="make" dir="@{dir}" failonerror="true">
+                    <arg line="@{args}"/>
+                    <env key="CLASSPATH" value = ""/>
+                </exec>
+            </sequential>
+        </macrodef>
+
+    <macrodef name="exec-target">
+        <attribute name="antfile" default="${ant.file}" />
+        <attribute name="target" />
+        <sequential>
+            <java classname="org.apache.tools.ant.Main" fork="true" spawn="true">
+                <arg value="-f"/>
+                <arg value="@{antfile}"/>  
+                <arg value="-Dboot.java.home=${boot.java.home}"/>
+                <arg value="-Dbuild.target.dir=${build.target.dir}"/>
+                <arg value="-Djtreg.home=${jtreg.home}"/>
+                <arg value="-Djtreg.tests=${jtreg.tests}"/>
+                <arg value="-Djtreg.jpda.jvmargs=${jtreg.jpda.jvmargs}"/>
+                <arg value="@{target}"/>
+                <classpath>           
+                    <pathelement path="${java.class.path}"/>
+                </classpath>
+            </java>
+        </sequential>
+    </macrodef>
+
+    <target name="post-make" depends="build-module"/>
+
+    <!--
+        **** Global JDK Build Targets
+    -->
+
+    <target name="clean" depends="-do-configure">
+        <echo message="base = ${basedir}"/>
+        <call-make dir = "${build.target.dir}" args = "clean"/>
+    </target>
+    
+    <target name="-do-configure">
+        <echo message="base = ${basedir}"/>
+        <fail message="Not part of a full JDK forest">
+            <condition>
+                <not>
+                    <available file="${basedir}/configure" />
+                </not>
+            </condition>
+        </fail>
+        <exec executable="sh" dir="${basedir}" failonerror="true">
+            <arg line="configure --with-boot-jdk=${boot.java.home}"/>
+        </exec>
+    </target>
+
+    <target name="images">
+        <call-make dir = "${build.target.dir}" args = "images"/>
+    </target>
+
+    <target name="jimages">
+        <call-make dir = "${build.target.dir}" args = "jimages"/>
+    </target>
+
+    <target name="check-env">
+        <exec executable="env" dir="${basedir}"/>
+    </target>
+
+    <target name="build-module">
+        <call-make dir = "${build.target.dir}" args = "${module.name}"/>
+    </target>
+
+    <target name="-check-boot.java.home" depends="-def-check">
+        <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/>
+    </target>
+
+    <target name="-def-check">
+        <macrodef name="check">
+            <attribute name="name"/>
+            <attribute name="property"/>
+            <attribute name="marker" default=""/>
+            <sequential>
+                <fail message="Cannot locate @{name}: please set @{property} to its location">
+                    <condition>
+                        <not>
+                            <isset property="@{property}"/>
+                        </not>
+                    </condition>
+                </fail>
+                <fail message="@{name} is not installed in ${@{property}}">
+                    <condition>
+                        <and>
+                            <not>
+                                <equals arg1="@{marker}" arg2=""/>
+                            </not>
+                            <not>
+                                <available file="${@{property}}/@{marker}"/>
+                            </not>
+                        </and>
+                    </condition>
+                </fail>
+            </sequential>
+        </macrodef>
+    </target>
+</project>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/compiler.xml	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <option name="DEFAULT_COMPILER" value="Javac" />
+    <excludeFromCompile>
+      <directory url="file://$PROJECT_DIR$/jdk/src" includeSubdirectories="true" />
+      <directory url="file://$PROJECT_DIR$/langtools/src" includeSubdirectories="true" />
+      <directory url="file://$PROJECT_DIR$/jaxp/src" includeSubdirectories="true" />
+      <directory url="file://$PROJECT_DIR$/jaxws/src" includeSubdirectories="true" />
+      <directory url="file://$PROJECT_DIR$/corba/src" includeSubdirectories="true" />
+      <directory url="file://$PROJECT_DIR$/nashorn/src" includeSubdirectories="true" />
+      <directory url="file://$PROJECT_DIR$/build" includeSubdirectories="true" />
+      <directory url="file://$PROJECT_DIR$/jdk/test" includeSubdirectories="true" />
+      <directory url="file://$PROJECT_DIR$/jaxp/test" includeSubdirectories="true" />
+      <directory url="file://$PROJECT_DIR$/langtools/test" includeSubdirectories="true" />
+      <directory url="file://$PROJECT_DIR$/langtools" includeSubdirectories="true" />
+    </excludeFromCompile>
+    <resourceExtensions />
+    <wildcardResourcePatterns>
+      <entry name="!?*.java" />
+      <entry name="!?*.form" />
+      <entry name="!?*.class" />
+      <entry name="!?*.groovy" />
+      <entry name="!?*.scala" />
+      <entry name="!?*.flex" />
+      <entry name="!?*.kt" />
+      <entry name="!?*.clj" />
+    </wildcardResourcePatterns>
+    <annotationProcessing>
+      <profile default="true" name="Default" enabled="false">
+        <processorPath useClasspath="true" />
+      </profile>
+    </annotationProcessing>
+  </component>
+</project>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/copyright/profiles_settings.xml	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,3 @@
+<component name="CopyrightManager">
+  <settings default="" />
+</component>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/jdk.iml	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/####" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/jdk/test" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/langtools/test" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/jaxp/test" isTestSource="true" />
+      <excludeFolder url="file://$MODULE_DIR$/####/buildtools" />
+      <excludeFolder url="file://$MODULE_DIR$/####/configure-support" />
+      <excludeFolder url="file://$MODULE_DIR$/####/hotspot" />
+      <excludeFolder url="file://$MODULE_DIR$/####/images" />
+      <excludeFolder url="file://$MODULE_DIR$/####/ide" />
+      <excludeFolder url="file://$MODULE_DIR$/####/jdk" />
+      <excludeFolder url="file://$MODULE_DIR$/####/make-support" />
+      <excludeFolder url="file://$MODULE_DIR$/####/testoutput" />
+    </content>    
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="inheritedJdk" />
+  </component>
+</module>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/misc.xml	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="EntryPointsManager">
+    <entry_points version="2.0" />
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_9" assert-keyword="true" jdk-15="true">
+    <output url="file://$PROJECT_DIR$/build/idea/out" />
+  </component>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/modules.xml	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/jdk.iml" filepath="$PROJECT_DIR$/.idea/jdk.iml" />
+    </modules>
+  </component>
+</project>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/scopes/scope_settings.xml	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,5 @@
+<component name="DependencyValidationManager">
+  <state>
+    <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+  </state>
+</component>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/src/idea/JdkIdeaAntLogger.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,373 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package idea;
+
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.DefaultLogger;
+import org.apache.tools.ant.Project;
+
+import java.util.EnumSet;
+import java.util.Stack;
+
+import static org.apache.tools.ant.Project.*;
+
+/**
+ * This class is used to wrap the IntelliJ ant logger in order to provide more meaningful
+ * output when building langtools. The basic ant output in IntelliJ can be quite cumbersome to
+ * work with, as it provides two separate views: (i) a tree view, which is good to display build task
+ * in a hierarchical fashion as they are processed; and a (ii) plain text view, which gives you
+ * the full ant output. The main problem is that javac-related messages are buried into the
+ * ant output (which is made very verbose by IntelliJ in order to support the tree view). It is
+ * not easy to figure out which node to expand in order to see the error message; switching
+ * to plain text doesn't help either, as now the output is totally flat.
+ *
+ * This logger class removes a lot of verbosity from the IntelliJ ant logger by not propagating
+ * all the events to the IntelliJ's logger. In addition, certain events are handled in a custom
+ * fashion, to generate better output during the build.
+ */
+public final class JdkIdeaAntLogger extends DefaultLogger {
+
+    /**
+     * This is just a way to pass in customized binary string predicates;
+     *
+     * TODO: replace with @code{BiPredicate<String, String>} and method reference when moving to 8
+     */
+    enum StringBinaryPredicate {
+        CONTAINS() {
+            @Override
+            boolean apply(String s1, String s2) {
+                return s1.contains(s2);
+            }
+        },
+        STARTS_WITH {
+            @Override
+            boolean apply(String s1, String s2) {
+                return s1.startsWith(s2);
+            }
+        },
+        MATCHES {
+            @Override
+            boolean apply(String s1, String s2) {
+                return s1.matches(s2);
+            }
+        };
+
+        abstract boolean apply(String s1, String s2);
+    }
+
+    /**
+     * Various kinds of ant messages that we shall intercept
+     */
+    enum MessageKind {
+
+        /** a make error */
+        MAKE_ERROR(StringBinaryPredicate.CONTAINS, MSG_ERR, "error:", "compiler.err"),
+        /** a make warning */
+        MAKE_WARNING(StringBinaryPredicate.CONTAINS, MSG_WARN, "warning:", "compiler.warn"),
+        /** a make note */
+        MAKE_NOTE(StringBinaryPredicate.CONTAINS, MSG_INFO, "note:", "compiler.note"),
+        /** std make output */
+        MAKE_OTHER(StringBinaryPredicate.MATCHES, MSG_INFO, ".*"),
+        /** a javac crash */
+        JAVAC_CRASH(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "An exception has occurred in the compiler"),
+        /** jtreg test success */
+        JTREG_TEST_PASSED(StringBinaryPredicate.STARTS_WITH, MSG_INFO, "Passed: "),
+        /** jtreg test failure */
+        JTREG_TEST_FAILED(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "FAILED: "),
+        /** jtreg test error */
+        JTREG_TEST_ERROR(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "Error: ");
+
+        StringBinaryPredicate sbp;
+        int priority;
+        String[] keys;
+
+        MessageKind(StringBinaryPredicate sbp, int priority, String... keys) {
+            this.sbp = sbp;
+            this.priority = priority;
+            this.keys = keys;
+        }
+
+        /**
+         * Does a given message string matches this kind?
+         */
+        boolean matches(String s) {
+            for (String key : keys) {
+                if (sbp.apply(s, key)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    /**
+     * This enum is used to represent the list of tasks we need to keep track of during logging.
+     */
+    enum Task {
+        /** javac task - invoked during compilation */
+        MAKE("exec", MessageKind.MAKE_ERROR, MessageKind.MAKE_WARNING, MessageKind.MAKE_NOTE,
+                       MessageKind.MAKE_OTHER, MessageKind.JAVAC_CRASH),
+        /** jtreg task - invoked during test execution */
+        JTREG("jtreg", MessageKind.JTREG_TEST_PASSED, MessageKind.JTREG_TEST_FAILED, MessageKind.JTREG_TEST_ERROR),
+        /** initial synthetic task when the logger is created */
+        ROOT("") {
+            @Override
+            boolean matches(String s) {
+                return false;
+            }
+        },
+        /** synthetic task catching any other tasks not in this list */
+        ANY("") {
+            @Override
+            boolean matches(String s) {
+                return true;
+            }
+        };
+
+        String taskName;
+        MessageKind[] msgs;
+
+        Task(String taskName, MessageKind... msgs) {
+            this.taskName = taskName;
+            this.msgs = msgs;
+        }
+
+        boolean matches(String s) {
+            return s.equals(taskName);
+        }
+    }
+
+    /**
+     * This enum is used to represent the list of targets we need to keep track of during logging.
+     * A regular expression is used to match a given target name.
+     */
+    enum Target {
+        /** jtreg target - executed when launching tests */
+        JTREG("jtreg") {
+            @Override
+            String getDisplayMessage(BuildEvent e) {
+                return "Running jtreg tests: " + e.getProject().getProperty("jtreg.tests");
+            }
+        },
+        /** build selected modules */
+        BUILD_MODULE("build-module") {
+            @Override
+            String getDisplayMessage(BuildEvent e) {
+                return "Building modules: " + e.getProject().getProperty("module.name") + "...";
+            }
+        },
+        /** build images */
+        BUILD_IMAGES("images") {
+            @Override
+            String getDisplayMessage(BuildEvent e) {
+                return "Building images...";
+            }
+        },
+        /** build images */
+        CONFIGURE("-do-configure") {
+            @Override
+            String getDisplayMessage(BuildEvent e) {
+                return "Configuring build...";
+            }
+        },
+        /** synthetic target catching any other target not in this list */
+        ANY("") {
+            @Override
+            String getDisplayMessage(BuildEvent e) {
+                return "Executing Ant target(s): " + e.getProject().getProperty("ant.project.invoked-targets");
+            }
+            @Override
+            boolean matches(String msg) {
+                return true;
+            }
+        };
+
+        String targetRegex;
+
+        Target(String targetRegex) {
+            this.targetRegex = targetRegex;
+        }
+
+        boolean matches(String msg) {
+            return msg.matches(targetRegex);
+        }
+
+        abstract String getDisplayMessage(BuildEvent e);
+    }
+
+    /**
+     * A custom build event used to represent status changes which should be notified inside
+     * Intellij
+     */
+    static class StatusEvent extends BuildEvent {
+
+        /** the target to which the status update refers */
+        Target target;
+
+        StatusEvent(BuildEvent e, Target target) {
+            super(new StatusTask(e, target.getDisplayMessage(e)));
+            this.target = target;
+            setMessage(getTask().getTaskName(), 2);
+        }
+
+        /**
+         * A custom task used to channel info regarding a status change
+         */
+        static class StatusTask extends org.apache.tools.ant.Task {
+            StatusTask(BuildEvent event, String msg) {
+                setProject(event.getProject());
+                setOwningTarget(event.getTarget());
+                setTaskName(msg);
+            }
+        }
+    }
+
+    /** wrapped ant logger (IntelliJ's own logger) */
+    DefaultLogger logger;
+
+    /** flag - is this the first target we encounter? */
+    boolean firstTarget = true;
+
+    /** flag - should subsequenet failures be suppressed ? */
+    boolean suppressTaskFailures = false;
+
+    /** flag - have we ran into a javac crash ? */
+    boolean crashFound = false;
+
+    /** stack of status changes associated with pending targets */
+    Stack<StatusEvent> statusEvents = new Stack<>();
+
+    /** stack of pending tasks */
+    Stack<Task> tasks = new Stack<>();
+
+    public JdkIdeaAntLogger(Project project) {
+        for (Object o : project.getBuildListeners()) {
+            if (o instanceof DefaultLogger) {
+                this.logger = (DefaultLogger)o;
+                project.removeBuildListener((BuildListener)o);
+                project.addBuildListener(this);
+            }
+        }
+        tasks.push(Task.ROOT);
+    }
+
+    @Override
+    public void buildStarted(BuildEvent event) {
+        //do nothing
+    }
+
+    @Override
+    public void buildFinished(BuildEvent event) {
+        //do nothing
+    }
+
+    @Override
+    public void targetStarted(BuildEvent event) {
+        EnumSet<Target> statusKinds = firstTarget ?
+                EnumSet.allOf(Target.class) :
+                EnumSet.complementOf(EnumSet.of(Target.ANY));
+
+        String targetName = event.getTarget().getName();
+
+        for (Target statusKind : statusKinds) {
+            if (statusKind.matches(targetName)) {
+                StatusEvent statusEvent = new StatusEvent(event, statusKind);
+                statusEvents.push(statusEvent);
+                logger.taskStarted(statusEvent);
+                firstTarget = false;
+                return;
+            }
+        }
+    }
+
+    @Override
+    public void targetFinished(BuildEvent event) {
+        if (!statusEvents.isEmpty()) {
+            StatusEvent lastEvent = statusEvents.pop();
+            if (lastEvent.target.matches(event.getTarget().getName())) {
+                logger.taskFinished(lastEvent);
+            }
+        }
+    }
+
+    @Override
+    public void taskStarted(BuildEvent event) {
+        String taskName = event.getTask().getTaskName();
+        System.err.println("task started " + taskName);
+        for (Task task : Task.values()) {
+            if (task.matches(taskName)) {
+                tasks.push(task);
+                return;
+            }
+        }
+    }
+
+    @Override
+    public void taskFinished(BuildEvent event) {
+        if (tasks.peek() == Task.ROOT) {
+            //we need to 'close' the root task to get nicer output
+            logger.taskFinished(event);
+        } else if (!suppressTaskFailures && event.getException() != null) {
+            //the first (innermost) task failure should always be logged
+            event.setMessage(event.getException().toString(), 0);
+            event.setException(null);
+            //note: we turn this into a plain message to avoid stack trace being logged by Idea
+            logger.messageLogged(event);
+            suppressTaskFailures = true;
+        }
+        tasks.pop();
+    }
+
+    @Override
+    public void messageLogged(BuildEvent event) {
+        String msg = event.getMessage();
+
+        boolean processed = false;
+
+        if (!tasks.isEmpty()) {
+            Task task = tasks.peek();
+            for (MessageKind messageKind : task.msgs) {
+                if (messageKind.matches(msg)) {
+                    event.setMessage(msg, messageKind.priority);
+                    processed = true;
+                    if (messageKind == MessageKind.JAVAC_CRASH) {
+                        crashFound = true;
+                    }
+                    break;
+                }
+            }
+        }
+
+        if (event.getPriority() == MSG_ERR || crashFound) {
+            //we log errors regardless of owning task
+            logger.messageLogged(event);
+            suppressTaskFailures = true;
+        } else if (processed) {
+            logger.messageLogged(event);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/vcs.xml	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="hg4idea" />
+    <mapping directory="$PROJECT_DIR$/jdk" vcs="hg4idea" />
+    <mapping directory="$PROJECT_DIR$/langtools" vcs="hg4idea" />
+    <mapping directory="$PROJECT_DIR$/hotspot" vcs="hg4idea" />
+    <mapping directory="$PROJECT_DIR$/nashorn" vcs="hg4idea" />
+    <mapping directory="$PROJECT_DIR$/jaxp" vcs="hg4idea" />
+    <mapping directory="$PROJECT_DIR$/jaxws" vcs="hg4idea" />
+    <mapping directory="$PROJECT_DIR$/corba" vcs="hg4idea" />
+  </component>
+</project>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/idea/template/workspace.xml	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ChangeListManager">
+    <ignored path="jdk.iws" />
+    <ignored path="$PROJECT_DIR$/build/idea/out/" />
+    <ignored path=".idea/" />
+  </component>
+  <component name="StructureViewFactory">
+    <option name="ACTIVE_ACTIONS" value=",ALPHA_COMPARATOR" />
+  </component>
+  <component name="antWorkspaceConfiguration">
+    <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
+    <option name="FILTER_TARGETS" value="false" />
+    <buildFile url="file://$PROJECT_DIR$/.idea/build.xml">
+      <runInBackground value="false" />
+      <targetFilters>
+        <filter targetName="post-make" isVisible="false" />
+        <filter targetName="clean" isVisible="true" />
+        <filter targetName="-do-configure" isVisible="false" />
+        <filter targetName="images" isVisible="true" />
+        <filter targetName="build-module" isVisible="true" />
+        <filter targetName="jtreg-debug" isVisible="false" />
+        <filter targetName="jtreg-debug-internal" isVisible="false" />
+        <filter targetName="jtreg" isVisible="false" />
+        <filter targetName="-check-jtreg.home" isVisible="false" />
+        <filter targetName="-def-check" isVisible="false" />
+        <filter targetName="-def-jtreg" isVisible="false" />
+        <filter targetName="-check-boot.java.home" isVisible="false" />
+        <filter targetName="-check-target.java.home" isVisible="false" />
+        <filter targetName="find-jdk-build-dir" isVisible="false" />
+        <filter targetName="check-env" isVisible="false" />
+      </targetFilters>
+      <treeView value="false" />
+      <expanded value="true" />
+    </buildFile>
+  </component>
+  <component name="ProjectView">
+    <navigator currentView="PackagesPane" proportions="" version="1">
+      <flattenPackages />
+      <showMembers />
+      <showModules />
+      <showLibraryContents />
+      <hideEmptyPackages />
+      <abbreviatePackageNames />
+      <autoscrollToSource />
+      <autoscrollFromSource />
+      <sortByType />
+    </navigator>
+    <panes>
+      <pane id="ProjectPane">
+        <subPane>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="jdk" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+            </PATH_ELEMENT>
+          </PATH>
+        </subPane>
+      </pane>
+      <pane id="PackagesPane">
+        <subPane>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="jdk" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="jdk" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
+            </PATH_ELEMENT>
+          </PATH>
+        </subPane>
+      </pane>
+      <pane id="Scope" />
+    </panes>
+  </component>
+</project>
--- a/nashorn/.hgtags	Sat May 14 09:11:07 2016 -0700
+++ b/nashorn/.hgtags	Tue May 17 05:38:15 2016 -0700
@@ -351,3 +351,4 @@
 295ac208a4443d433214d0c1f32d2ea45a3a32d2 jdk-9+115
 208388a5622dcca8227d6ad6c268f2c88087d283 jdk-9+116
 5267e91811614bac129817e566f730e9d63cf22a jdk-9+117
+05679aac2f7ec3d8dd2a96d7e7899906224bf5cf jdk-9+118
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/DynamicLinker.java	Sat May 14 09:11:07 2016 -0700
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/DynamicLinker.java	Tue May 17 05:38:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,6 +83,7 @@
 
 package jdk.dynalink;
 
+import java.lang.StackWalker.StackFrame;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
@@ -172,6 +173,8 @@
     private static final String INITIAL_LINK_METHOD_NAME = "linkCallSite";
     private static final String INVOKE_PACKAGE_PREFIX = "java.lang.invoke.";
 
+    private static final StackWalker stackWalker = StackWalker.getInstance(StackWalker.Option.SHOW_HIDDEN_FRAMES);
+
     private final LinkerServices linkerServices;
     private final GuardedInvocationTransformer prelinkTransformer;
     private final boolean syncOnRelink;
@@ -300,21 +303,16 @@
      *         site is being linked.
      */
     public static StackTraceElement getLinkedCallSiteLocation() {
-        final StackTraceElement[] trace = new Throwable().getStackTrace();
-        for(int i = 0; i < trace.length - 1; ++i) {
-            final StackTraceElement frame = trace[i];
-            // If we found any of our linking entry points on the stack...
-            if(isRelinkFrame(frame) || isInitialLinkFrame(frame)) {
+        return stackWalker.walk(s -> s
+                // Find one of our linking entry points on the stack...
+                .dropWhile(f -> !(isRelinkFrame(f) || isInitialLinkFrame(f)))
+                .skip(1)
                 // ... then look for the first thing calling it that isn't j.l.invoke
-                for (int j = i + 1; j < trace.length; ++j) {
-                    final StackTraceElement frame2 = trace[j];
-                    if (!frame2.getClassName().startsWith(INVOKE_PACKAGE_PREFIX)) {
-                        return frame2;
-                    }
-                }
-            }
-        }
-        return null;
+                .dropWhile(f -> f.getClassName().startsWith(INVOKE_PACKAGE_PREFIX))
+                .findFirst()
+                .map(StackFrame::toStackTraceElement)
+                .orElse(null)
+        );
     }
 
     /**
@@ -326,7 +324,7 @@
      *
      * @return {@code true} if this frame represents {@code MethodHandleNatives.linkCallSite()}.
      */
-    private static boolean isInitialLinkFrame(final StackTraceElement frame) {
+    private static boolean isInitialLinkFrame(final StackFrame frame) {
         return testFrame(frame, INITIAL_LINK_METHOD_NAME, INITIAL_LINK_CLASS_NAME);
     }
 
@@ -339,11 +337,11 @@
      *
      * @return {@code true} if this frame represents {@code DynamicLinker.relink()}.
      */
-    private static boolean isRelinkFrame(final StackTraceElement frame) {
+    private static boolean isRelinkFrame(final StackFrame frame) {
         return testFrame(frame, RELINK_METHOD_NAME, CLASS_NAME);
     }
 
-    private static boolean testFrame(final StackTraceElement frame, final String methodName, final String className) {
+    private static boolean testFrame(final StackFrame frame, final String methodName, final String className) {
         return methodName.equals(frame.getMethodName()) && className.equals(frame.getClassName());
     }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/NashornException.java	Sat May 14 09:11:07 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/NashornException.java	Tue May 17 05:38:15 2016 -0700
@@ -174,10 +174,8 @@
                 String methodName = st.getMethodName();
                 if (methodName.equals(CompilerConstants.PROGRAM.symbolName())) {
                     methodName = "<program>";
-                }
-
-                if (methodName.contains(CompilerConstants.ANON_FUNCTION_PREFIX.symbolName())) {
-                    methodName = "<anonymous>";
+                } else {
+                    methodName = stripMethodName(methodName);
                 }
 
                 filtered.add(new StackTraceElement(className, methodName,
@@ -187,6 +185,22 @@
         return filtered.toArray(new StackTraceElement[0]);
     }
 
+    private static String stripMethodName(final String methodName) {
+        String name = methodName;
+
+        final int nestedSeparator = name.lastIndexOf(CompilerConstants.NESTED_FUNCTION_SEPARATOR.symbolName());
+        if (nestedSeparator >= 0) {
+            name = name.substring(nestedSeparator + 1);
+        }
+
+        final int idSeparator = name.indexOf(CompilerConstants.ID_FUNCTION_SEPARATOR.symbolName());
+        if (idSeparator >= 0) {
+            name = name.substring(0, idSeparator);
+        }
+
+        return name.contains(CompilerConstants.ANON_FUNCTION_PREFIX.symbolName()) ? "<anonymous>" : name;
+    }
+
     /**
      * Return a formatted script stack trace string with frames information separated by '\n'
      *
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilerConstants.java	Sat May 14 09:11:07 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilerConstants.java	Tue May 17 05:38:15 2016 -0700
@@ -78,6 +78,12 @@
     /** function prefix for anonymous functions */
     ANON_FUNCTION_PREFIX("L:"),
 
+    /** separator for method names of nested functions */
+    NESTED_FUNCTION_SEPARATOR("#"),
+
+    /** separator for making method names unique by appending numeric ids */
+    ID_FUNCTION_SEPARATOR("-"),
+
     /** method name for Java method that is the program entry point */
     PROGRAM(":program"),
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Namespace.java	Sat May 14 09:11:07 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Namespace.java	Tue May 17 05:38:15 2016 -0700
@@ -68,7 +68,7 @@
     }
 
     /**
-     * Create a uniqueName name in the namespace in the form base$n where n varies.
+     * Create a uniqueName name in the namespace in the form base-n where n varies.
      * Also truncates very long names that would otherwise break ASM.
      *
      * @param base Base of name.  Base will be returned if uniqueName.
@@ -83,7 +83,7 @@
             if (counter != null) {
                 final int count = counter + 1;
                 namespaceDirectory.put(truncatedBase, count);
-                return truncatedBase + '-' + count;
+                return truncatedBase + CompilerConstants.ID_FUNCTION_SEPARATOR.symbolName() + count;
             }
         }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/AbstractParser.java	Sat May 14 09:11:07 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/AbstractParser.java	Tue May 17 05:38:15 2016 -0700
@@ -203,8 +203,10 @@
      * @return tokenType of next token.
      */
     private TokenType nextToken() {
-        // Capture last token tokenType.
-        last = type;
+        // Capture last token type, but ignore comments (which are irrelevant for the purpose of newline detection).
+        if (type != COMMENT) {
+            last = type;
+        }
         if (type != EOF) {
 
             // Set up next token.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java	Sat May 14 09:11:07 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java	Tue May 17 05:38:15 2016 -0700
@@ -534,7 +534,7 @@
 
         final ParserContextFunctionNode parentFunction = lc.getCurrentFunction();
         if (parentFunction != null && !parentFunction.isProgram()) {
-            sb.append(parentFunction.getName()).append('$');
+            sb.append(parentFunction.getName()).append(CompilerConstants.NESTED_FUNCTION_SEPARATOR.symbolName());
         }
 
         assert ident.getName() != null;
@@ -1827,7 +1827,7 @@
 
     /**
      * ExpressionStatement :
-     *      Expression ; // [lookahead ~( or  function )]
+     *      Expression ; // [lookahead ~({ or  function )]
      *
      * See 12.4
      *
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java	Sat May 14 09:11:07 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java	Tue May 17 05:38:15 2016 -0700
@@ -313,18 +313,8 @@
         }
     }
 
-    /**
-     * Returns an iterator over property values used in the {@code for each...in} statement. Aside from built-in JS
-     * objects, it also operates on Java arrays, any {@link Iterable}, as well as on {@link Map} objects, iterating over
-     * map values.
-     * @param obj object to iterate on.
-     * @return iterator over the object's property values.
-     */
-    public static Iterator<?> toValueIterator(final Object obj) {
-        if (obj instanceof ScriptObject) {
-            return ((ScriptObject)obj).valueIterator();
-        }
-
+    // value Iterator for important Java objects - arrays, maps, iterables.
+    private static Iterator<?> iteratorForJavaArrayOrList(final Object obj) {
         if (obj != null && obj.getClass().isArray()) {
             final Object array  = obj;
             final int    length = Array.getLength(obj);
@@ -352,18 +342,38 @@
             };
         }
 
+        if (obj instanceof Iterable) {
+            return ((Iterable<?>)obj).iterator();
+        }
+
+        return null;
+    }
+
+    /**
+     * Returns an iterator over property values used in the {@code for each...in} statement. Aside from built-in JS
+     * objects, it also operates on Java arrays, any {@link Iterable}, as well as on {@link Map} objects, iterating over
+     * map values.
+     * @param obj object to iterate on.
+     * @return iterator over the object's property values.
+     */
+    public static Iterator<?> toValueIterator(final Object obj) {
+        if (obj instanceof ScriptObject) {
+            return ((ScriptObject)obj).valueIterator();
+        }
+
         if (obj instanceof JSObject) {
             return ((JSObject)obj).values().iterator();
         }
 
+        final Iterator<?> itr = iteratorForJavaArrayOrList(obj);
+        if (itr != null) {
+            return itr;
+        }
+
         if (obj instanceof Map) {
             return ((Map<?,?>)obj).values().iterator();
         }
 
-        if (obj instanceof Iterable) {
-            return ((Iterable<?>)obj).iterator();
-        }
-
         final Object wrapped = Global.instance().wrapAsObject(obj);
         if (wrapped instanceof ScriptObject) {
             return ((ScriptObject)wrapped).valueIterator();
@@ -380,6 +390,14 @@
      * @return iterator based on the ECMA 6 Iterator interface.
      */
     public static Iterator<?> toES6Iterator(final Object obj) {
+        // if not a ScriptObject, try convenience iterator for Java objects!
+        if (!(obj instanceof ScriptObject)) {
+            final Iterator<?> itr = iteratorForJavaArrayOrList(obj);
+            if (itr != null) {
+                return itr;
+            }
+        }
+
         final Global global = Global.instance();
         final Object iterator = AbstractIterator.getIterator(Global.toObject(obj), global);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/Makefile	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,371 @@
+#
+# Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+
+#
+# Makefile to run various nashorn tests
+#
+
+.DEFAULT : all
+
+# Empty these to get rid of some default rules
+.SUFFIXES:
+.SUFFIXES: .java
+CO=
+GET=
+
+# Utilities used
+AWK       = awk
+CAT       = cat
+CD        = cd
+CHMOD     = chmod
+CP        = cp
+CUT       = cut
+DIRNAME   = dirname
+ECHO      = echo
+EGREP     = egrep
+EXPAND    = expand
+FIND      = find
+MKDIR     = mkdir
+PWD       = pwd
+SED       = sed
+SORT      = sort
+TEE       = tee
+UNAME     = uname
+UNIQ      = uniq
+WC        = wc
+ZIP       = zip
+
+# Get OS name from uname (Cygwin inexplicably adds _NT-5.1)
+UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_)
+
+# Commands to run on paths to make mixed paths for java on windows
+ifeq ($(UNAME_S), CYGWIN)
+  # Location of developer shared files
+  SLASH_JAVA = J:
+  GETMIXEDPATH = cygpath -m
+else
+  # Location of developer shared files
+  SLASH_JAVA = /java
+
+  GETMIXEDPATH=$(ECHO)
+endif
+
+# Root of this test area (important to use full paths in some places)
+TEST_ROOT := $(shell $(PWD))
+
+# Root of all test results
+ifdef TEST_OUTPUT_DIR
+  $(shell $(MKDIR) -p $(TEST_OUTPUT_DIR)/jtreg)
+  ABS_TEST_OUTPUT_DIR := \
+    $(shell $(CD) $(TEST_OUTPUT_DIR)/jtreg && $(PWD))
+else
+  ifdef ALT_OUTPUTDIR
+    ABS_OUTPUTDIR = $(shell $(CD) $(ALT_OUTPUTDIR) && $(PWD))
+  else
+    ABS_OUTPUTDIR = $(shell $(CD) $(TEST_ROOT)/.. && $(PWD))
+  endif
+
+  ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
+  ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
+endif
+
+# Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
+ifndef PRODUCT_HOME
+  # Try to use images/jdk if it exists
+  ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/images/jdk
+  PRODUCT_HOME :=                       		\
+    $(shell                             		\
+      if [ -d $(ABS_JDK_IMAGE) ] ; then 		\
+         $(ECHO) "$(ABS_JDK_IMAGE)";    		\
+       else                             		\
+         $(ECHO) "$(ABS_PLATFORM_BUILD_ROOT)";		\
+       fi)
+  PRODUCT_HOME := $(PRODUCT_HOME)
+endif
+
+# Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.)
+#   Should be passed into 'java' only.
+#   Could include: -d64 -server -client OR any java option
+ifdef JPRT_PRODUCT_ARGS
+  JAVA_ARGS = $(JPRT_PRODUCT_ARGS)
+endif
+
+# Expect JPRT to set JPRT_PRODUCT_VM_ARGS (e.g. -Xcomp etc.)
+#   Should be passed into anything running the vm (java, javac, javadoc, ...).
+ifdef JPRT_PRODUCT_VM_ARGS
+  JAVA_VM_ARGS = $(JPRT_PRODUCT_VM_ARGS)
+endif
+
+# jtreg -nativepath <dir>
+#
+# Local make tests will be TEST_IMAGE_DIR and JPRT with jprt.use.reg.test.bundle=true
+# should be JPRT_TESTNATIVE_PATH
+ifdef TEST_IMAGE_DIR
+  TESTNATIVE_DIR = $(TEST_IMAGE_DIR)
+else ifdef JPRT_TESTNATIVE_PATH
+  TESTNATIVE_DIR = $(JPRT_TESTNATIVE_PATH)
+endif
+ifdef TESTNATIVE_DIR
+  JTREG_NATIVE_PATH = -nativepath:$(shell $(GETMIXEDPATH) "$(TESTNATIVE_DIR)/nashorn/jtreg/native")
+endif
+
+# jtreg failure handler config
+ifeq ($(FAILURE_HANDLER_DIR), )
+  ifneq ($(TESTNATIVE_DIR), )
+    FAILURE_HANDLER_DIR := $(TESTNATIVE_DIR)/failure_handler
+  endif
+endif
+ifneq ($(FAILURE_HANDLER_DIR), )
+  FAILURE_HANDLER_DIR_MIXED := $(shell $(GETMIXEDPATH) "$(FAILURE_HANDLER_DIR)")
+  JTREG_FAILURE_HANDLER_OPTIONS := \
+      -timeoutHandlerDir:$(FAILURE_HANDLER_DIR_MIXED)/jtregFailureHandler.jar \
+      -observerDir:$(FAILURE_HANDLER_DIR_MIXED)/jtregFailureHandler.jar \
+      -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
+      -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver
+  ifeq ($(UNAME_S), CYGWIN)
+    JTREG_FAILURE_HANDLER_OPTIONS += -J-Djava.library.path="$(FAILURE_HANDLER_DIR_MIXED)"
+  endif
+endif
+
+# Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
+ifdef JPRT_ARCHIVE_BUNDLE
+  ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
+else
+  ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
+endif
+
+# How to create the test bundle (pass or fail, we want to create this)
+#   Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
+ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`     \
+	           && $(CD) $(ABS_TEST_OUTPUT_DIR)             \
+	           && $(CHMOD) -R a+r . \
+	           && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
+
+# important results files
+SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt")
+STATS_TXT_NAME = Stats.txt
+STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)")
+RUNLIST   = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt")
+PASSLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt")
+FAILLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt")
+EXITCODE  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt")
+
+TESTEXIT = \
+  if [ ! -s $(EXITCODE) ] ; then \
+    $(ECHO) "ERROR: EXITCODE file not filled in."; \
+    $(ECHO) "1" > $(EXITCODE); \
+  fi ; \
+  testExitCode=`$(CAT) $(EXITCODE)`; \
+  $(ECHO) "EXIT CODE: $${testExitCode}"; \
+  exit $${testExitCode}
+
+BUNDLE_UP_AND_EXIT = \
+( \
+  jtregExitCode=$$? && \
+  _summary="$(SUMMARY_TXT)"; \
+  $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
+  $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
+  if [ -r "$${_summary}" ] ; then \
+    $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \
+    $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
+    $(EGREP) ' Passed\.' $(RUNLIST) \
+      | $(EGREP) -v ' Error\.' \
+      | $(EGREP) -v ' Failed\.' > $(PASSLIST); \
+    ( $(EGREP) ' Failed\.' $(RUNLIST); \
+      $(EGREP) ' Error\.' $(RUNLIST); \
+      $(EGREP) -v ' Passed\.' $(RUNLIST) ) \
+      | $(SORT) | $(UNIQ) > $(FAILLIST); \
+    if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
+      $(EXPAND) $(FAILLIST) \
+        | $(CUT) -d' ' -f1 \
+        | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
+      if [ $${jtregExitCode} = 0 ] ; then \
+        jtregExitCode=1; \
+      fi; \
+    fi; \
+    runc="`$(CAT) $(RUNLIST)      | $(WC) -l | $(AWK) '{print $$1;}'`"; \
+    passc="`$(CAT) $(PASSLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
+    failc="`$(CAT) $(FAILLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
+    exclc="FIXME CODETOOLS-7900176"; \
+    $(ECHO) "TEST STATS: name=$(UNIQUE_DIR)  run=$${runc}  pass=$${passc}  fail=$${failc}" \
+      >> $(STATS_TXT); \
+  else \
+    $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
+  fi; \
+  if [ -f $(STATS_TXT) ] ; then \
+    $(CAT) $(STATS_TXT); \
+  fi; \
+  $(ZIP_UP_RESULTS) ; \
+  $(TESTEXIT) \
+)
+
+################################################################
+
+# Default make rule (runs default nashorn tests)
+all: nashorn_default
+	@$(ECHO) "Testing completed successfully"
+
+# Prep for output
+# Change execute permissions on shared library files.
+# Files in repositories should never have execute permissions, but
+# there are some tests that have pre-built shared libraries, and these
+# windows dll files must have execute permission. Adding execute
+# permission may happen automatically on windows when using certain
+# versions of mercurial but it cannot be guaranteed. And blindly
+# adding execute permission might be seen as a mercurial 'change', so
+# we avoid adding execute permission to repository files. But testing
+# from a plain source tree needs the chmod a+rx. Applying the chmod to
+# all shared libraries not just dll files. And with CYGWIN and sshd
+# service, you may need CYGWIN=ntsec for this to work.
+prep:
+	@$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
+	@$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
+	@if [ ! -d $(TEST_ROOT)/../.hg ] ; then                          \
+	  $(FIND) $(TEST_ROOT) \( -name \*.dll -o -name \*.DLL -o -name \*.so \)  \
+	        -exec $(CHMOD) a+rx {} \; ;                             \
+        fi
+
+# Cleanup
+clean:
+	@$(RM) -r $(ABS_TEST_OUTPUT_DIR)
+	@$(RM) $(ARCHIVE_BUNDLE)
+
+################################################################
+
+# jtreg tests
+
+# Expect JT_HOME to be set for jtreg tests. (home for jtreg)
+ifndef JT_HOME
+  JT_HOME = $(SLASH_JAVA)/re/jtreg/4.2/promoted/latest/binaries/jtreg
+  ifdef JPRT_JTREG_HOME
+    JT_HOME = $(JPRT_JTREG_HOME)
+  endif
+endif
+
+# Problematic tests to be excluded
+PROBLEM_LISTS=$(call MixedDirs,$(wildcard ProblemList.txt closed/ProblemList.txt))
+
+# Create exclude list for this platform and arch
+ifdef NO_EXCLUDES
+  JTREG_EXCLUSIONS =
+else
+  JTREG_EXCLUSIONS = $(PROBLEM_LISTS:%=-exclude:%)
+endif
+
+# convert list of directories to dos paths
+define MixedDirs
+$(foreach i,$1,$(shell $(GETMIXEDPATH) "${i}"))
+endef
+
+define SummaryInfo
+$(ECHO) "########################################################"
+$(CAT) $(?:%=$(ABS_TEST_OUTPUT_DIR)/%/$(STATS_TXT_NAME))
+$(ECHO) "########################################################"
+endef
+
+# ------------------------------------------------------------------
+
+nashorn_%:
+	$(ECHO) "Running tests: $@"
+	for each in $@; do \
+	        $(MAKE) -j 1 TEST_SELECTION=":$$each" UNIQUE_DIR=$$each jtreg_tests; \
+	done
+
+# ------------------------------------------------------------------
+
+# When called from JPRT the TESTDIRS variable is set to the jtreg tests to run
+ifdef TESTDIRS
+  TEST_SELECTION = $(TESTDIRS)
+endif
+
+ifdef CONCURRENCY
+  EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
+endif
+
+# Default JTREG to run
+JTREG = $(JT_HOME)/bin/jtreg
+# run in agentvm mode
+JTREG_BASIC_OPTIONS += -agentvm
+# Only run automatic tests
+JTREG_BASIC_OPTIONS += -a
+# Always turn on assertions
+JTREG_ASSERT_OPTION = -ea -esa
+JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION)
+# Report details on all failed or error tests, times too
+JTREG_BASIC_OPTIONS += -v:fail,error,time
+# Retain all files for failing tests
+JTREG_BASIC_OPTIONS += -retain:fail,error
+# Ignore tests are not run and completely silent about it
+JTREG_IGNORE_OPTION = -ignore:quiet
+JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION)
+# Multiple by 4 the timeout numbers
+JTREG_TIMEOUT_OPTION =  -timeoutFactor:4
+JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION)
+# Set the max memory for jtreg control vm
+JTREG_MEMORY_OPTION = -J-Xmx512m
+JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
+# Give tests access to JT_JAVA, see JDK-8141609
+JTREG_BASIC_OPTIONS += -e:JDK8_HOME=${JT_JAVA}
+# Add any extra options
+JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
+# Set other vm and test options
+JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
+# Set the GC options for test vms
+#JTREG_GC_OPTION = -vmoption:-XX:+UseSerialGC
+#JTREG_TEST_OPTIONS += $(JTREG_GC_OPTION)
+# Set the max memory for jtreg target test vms
+JTREG_TESTVM_MEMORY_OPTION = -vmoption:-Xmx512m
+JTREG_TEST_OPTIONS += $(JTREG_TESTVM_MEMORY_OPTION)
+
+# Make sure jtreg exists
+$(JTREG): $(JT_HOME)
+
+# Run jtreg
+jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
+	(                                                                    \
+	  ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)");                   \
+            export JT_HOME;                                                  \
+            $(shell $(GETMIXEDPATH) "$(JTREG)")                              \
+              $(JTREG_BASIC_OPTIONS)                                         \
+              -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport")  \
+              -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork")    \
+              -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                \
+              $(JTREG_NATIVE_PATH)                                           \
+              $(JTREG_FAILURE_HANDLER_OPTIONS)                               \
+              $(JTREG_EXCLUSIONS)                                            \
+              $(JTREG_TEST_OPTIONS)                                          \
+              $(TEST_SELECTION)                                                    \
+	  ) ;                                                                \
+	  $(BUNDLE_UP_AND_EXIT)                                              \
+	) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
+
+PHONY_LIST += jtreg_tests
+
+################################################################
+
+# Phony targets (e.g. these are not filenames)
+.PHONY: all clean prep $(PHONY_LIST)
+
+################################################################
--- a/nashorn/test/script/basic/JDK-8025515.js	Sat May 14 09:11:07 2016 -0700
+++ b/nashorn/test/script/basic/JDK-8025515.js	Tue May 17 05:38:15 2016 -0700
@@ -61,8 +61,8 @@
 var f = (function() {
     return function() { a.b.c; };
 })();
-testMethodName(f, "f$L:62");
+testMethodName(f, "f#L:62");
 
 testMethodName((function() {
     return function() { return a.b.c; };
-})(), "L:66$L:67");
+})(), "L:66#L:67");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8156714.js	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * 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.
+ */
+
+/**
+ * JDK-8156714: Parsing issue with automatic semicolon insertion
+ *
+ * @test
+ * @run
+ */
+
+a = function() {
+}
+
+/* */ function b() {
+}
+
+c = function() {
+} /*
+
+*/ function d() {
+}
+
+try {
+    eval("x = function() {} /* */ function y() {}");
+    throw new Error("Error expected");
+} catch (e) {
+    if (!(e instanceof SyntaxError)) {
+        throw new Error("Unexpected error: " + e);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8156896.js	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * 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.
+ */
+
+/**
+ * JDK-8156896: Script stack trace should display function names
+ *
+ * @test
+ * @run
+ */
+
+function checkNamedFunction(stack) {
+    Assert.assertTrue(stack.indexOf("Error\n\tat bar (") === 0);
+}
+
+function checkAnonymousFunction(stack) {
+    Assert.assertTrue(stack.indexOf("Error\n\tat <anonymous> (") === 0);
+}
+
+// Named functions
+function bar() { try { throw new Error(); } catch(e) { return e.stack; } }
+checkNamedFunction(bar());
+
+bar = function() { try { throw new Error(); } catch(e) { return e.stack; } };
+checkNamedFunction(bar());
+
+f = (function() {return function bar() { try { throw new Error(); } catch(e) { return e.stack; } } })();
+checkNamedFunction(f());
+
+f = new Function("return function bar() { try { throw new Error(); } catch(e) { return e.stack; } }")();
+checkNamedFunction(f());
+
+// Anonymous functions
+checkAnonymousFunction((function() { try { throw new Error(); } catch(e) { return e.stack; } })());
+
+f = (function() {return function() { try { throw new Error(); } catch(e) { return e.stack; } } })();
+checkAnonymousFunction(f());
+
+f = new Function("return function() { try { throw new Error(); } catch(e) { return e.stack; } }")();
+checkAnonymousFunction(f());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/es6/JDK-8156665.js	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * 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.
+ */
+
+/**
+ * JDK-8156665: ES6 for..of should work on Java Iterables and Java arrays
+ *
+ * @test
+ * @run
+ * @option --language=es6
+ */
+
+var ca = new (Java.type("char[]"))(3);
+ca[0] = 'a', ca[1] = 'b', ca[2] = 'c';
+for (i of ca) print(i);
+
+var al = new java.util.ArrayList();
+al.add("hello");
+al.add("world");
+
+for (i of al) print(i);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/es6/JDK-8156665.js.EXPECTED	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,5 @@
+a
+b
+c
+hello
+world
--- a/nashorn/test/script/nosecurity/parserapi.js.EXPECTED	Sat May 14 09:11:07 2016 -0700
+++ b/nashorn/test/script/nosecurity/parserapi.js.EXPECTED	Tue May 17 05:38:15 2016 -0700
@@ -4864,7 +4864,7 @@
   "kind": "COMPILATION_UNIT",
   "sourceElements": [
     {
-      "endPosition": "1242",
+      "endPosition": "1222",
       "kind": "FUNCTION",
       "name": "Parser",
       "body": {
@@ -5419,7 +5419,7 @@
         },
         "startPosition": "1809"
       },
-      "endPosition": "1973",
+      "endPosition": "1901",
       "kind": "EXPRESSION_STATEMENT",
       "startPosition": "1809"
     },
@@ -6310,7 +6310,7 @@
       "startPosition": "1974"
     },
     {
-      "endPosition": "3767",
+      "endPosition": "3726",
       "kind": "FUNCTION",
       "name": "processFiles",
       "body": {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/dynalink/test/LinkedCallSiteLocationTest.java	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.dynalink.test;
+
+import static jdk.dynalink.StandardOperation.CALL_METHOD;
+
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import jdk.dynalink.CallSiteDescriptor;
+import jdk.dynalink.DynamicLinker;
+import jdk.dynalink.DynamicLinkerFactory;
+import jdk.dynalink.NamedOperation;
+import jdk.dynalink.linker.GuardingDynamicLinker;
+import jdk.dynalink.support.SimpleRelinkableCallSite;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class LinkedCallSiteLocationTest {
+    @Test
+    public void testLinkedCallSiteLocation() throws Throwable {
+        final StackTraceElement[] lastLinked = new StackTraceElement[1];
+
+        final GuardingDynamicLinker testLinker =
+                (r, s) -> { lastLinked[0] = DynamicLinker.getLinkedCallSiteLocation(); return null; };
+
+        final DynamicLinkerFactory factory = new DynamicLinkerFactory();
+        factory.setPrioritizedLinker(testLinker);
+        final DynamicLinker linker = factory.createLinker();
+        final SimpleRelinkableCallSite callSite = new SimpleRelinkableCallSite(
+                new CallSiteDescriptor(
+                        MethodHandles.lookup(),
+                        new NamedOperation(CALL_METHOD, "foo"),
+                        MethodType.methodType(void.class, Object.class)));
+        linker.link(callSite);
+
+        // Test initial linking
+        callSite.dynamicInvoker().invoke(new TestClass1()); final int l1 = getLineNumber();
+        assertLocation(lastLinked[0], l1);
+
+        // Test relinking
+        callSite.dynamicInvoker().invoke(new TestClass2()); final int l2 = getLineNumber();
+        assertLocation(lastLinked[0], l2);
+    }
+
+    private void assertLocation(final StackTraceElement frame, final int lineNumber) {
+        Assert.assertNotNull(frame);
+        Assert.assertEquals(frame.getLineNumber(), lineNumber);
+        Assert.assertEquals(frame.getClassName(), this.getClass().getName());
+    }
+
+    private static int getLineNumber() {
+        return StackWalker.getInstance().walk(s -> s.skip(1).findFirst().get().getLineNumber());
+    }
+
+    public static class TestClass1 {
+        public void foo() {
+        }
+    }
+
+    public static class TestClass2 {
+        public void foo() {
+        }
+    }
+}
--- a/test/Makefile	Sat May 14 09:11:07 2016 -0700
+++ b/test/Makefile	Tue May 17 05:38:15 2016 -0700
@@ -87,7 +87,7 @@
 #
 # Invocation:
 #
-# make jtreg_tests TESTDIRS=<test-dirs>
+# make jtreg_tests TESTDIRS=<test-dirs> TEST_SELECTION=<path to test or jtreg group> TEST_OUTPUT_DIR=<path>
 #
 # where <test-dirs> is something like '../<component>/test/runtime',
 # <component> in turn being one of the top level directories (for
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/make/TestIdea.gmk	Tue May 17 05:38:15 2016 -0700
@@ -0,0 +1,46 @@
+
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include $(SPEC)
+include MakeBase.gmk
+
+default: all
+
+IDEA_OUTPUT_DIR := $(TESTMAKE_OUTPUTDIR)/verify-idea
+
+clean-idea:
+	$(RM) -r $(IDEA_OUTPUT_DIR)
+
+verify-idea:
+	$(MKDIR) -p $(IDEA_OUTPUT_DIR)
+	$(BASH) $(TOPDIR)/common/bin/idea.sh -o $(IDEA_OUTPUT_DIR)/idea1
+	$(BASH) $(TOPDIR)/common/bin/idea.sh -o $(IDEA_OUTPUT_DIR)/idea2 java.base
+	$(BASH) $(TOPDIR)/common/bin/idea.sh -o $(IDEA_OUTPUT_DIR)/idea3 java.base jdk.compiler
+
+TEST_TARGETS += verify-idea 
+
+all: $(TEST_TARGETS)
+
+.PHONY: default all verify-idea
--- a/test/make/TestMake.gmk	Sat May 14 09:11:07 2016 -0700
+++ b/test/make/TestMake.gmk	Tue May 17 05:38:15 2016 -0700
@@ -33,7 +33,10 @@
 java-compilation:
 	+$(MAKE) -f TestJavaCompilation.gmk $(TEST_SUBTARGET)
 
+test-idea:
+	+$(MAKE) -f TestIdea.gmk $(TEST_SUBTARGET)
 
-all: make-base java-compilation
 
-.PHONY: default all make-base java-compilation
+all: make-base java-compilation test-idea
+
+.PHONY: default all make-base java-compilation test-idea