Merge
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index ea2309c..2b62f11 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -301,3 +301,4 @@
 eb7febe45865ba6b81f2ea68082262d0708a0b22 jdk9-b56
 f25ee9f62427a9ba27418e5531a89754791a305b jdk9-b57
 6e78dd9b121037719a065fe8fb25b936babdfecb jdk9-b58
+39e8a131289e8386aa4c3e4b184faa812a7c0421 jdk9-b59
diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4
index d9df087..02a096e 100644
--- a/common/autoconf/basics.m4
+++ b/common/autoconf/basics.m4
@@ -658,6 +658,8 @@
     fi
     OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}"
     $MKDIR -p "$OUTPUT_ROOT"
+    CONFIGURESUPPORT_OUTPUTDIR="$OUTPUT_ROOT/configure-support"
+    $MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
     if test ! -d "$OUTPUT_ROOT"; then
       AC_MSG_ERROR([Could not create build directory $OUTPUT_ROOT])
     fi
@@ -703,6 +705,7 @@
   AC_SUBST(SPEC, $OUTPUT_ROOT/spec.gmk)
   AC_SUBST(CONF_NAME, $CONF_NAME)
   AC_SUBST(OUTPUT_ROOT, $OUTPUT_ROOT)
+  AC_SUBST(CONFIGURESUPPORT_OUTPUTDIR)
 
   # The spec.gmk file contains all variables for the make system.
   AC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in])
diff --git a/common/autoconf/basics_windows.m4 b/common/autoconf/basics_windows.m4
index 1bcb615..7ce14a8 100644
--- a/common/autoconf/basics_windows.m4
+++ b/common/autoconf/basics_windows.m4
@@ -383,45 +383,46 @@
   if test "x$OPENJDK_BUILD_OS" = xwindows; then
     AC_MSG_CHECKING([if fixpath can be created])
     FIXPATH_SRC="$SRC_ROOT/common/src/fixpath.c"
-    FIXPATH_BIN="$OUTPUT_ROOT/fixpath.exe"
+    FIXPATH_BIN="$CONFIGURESUPPORT_OUTPUTDIR/bin/fixpath.exe"
+    FIXPATH_DIR="$CONFIGURESUPPORT_OUTPUTDIR/fixpath"
     if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
-      FIXPATH_SRC=`$CYGPATH -m $FIXPATH_SRC`
-      FIXPATH_BIN=`$CYGPATH -m $FIXPATH_BIN`
       # Important to keep the .exe suffix on Cygwin for Hotspot makefiles
-      FIXPATH="$OUTPUT_ROOT/fixpath.exe -c"
+      FIXPATH="$FIXPATH_BIN -c"
     elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.msys; then
-      FIXPATH_SRC=`cmd //c echo $FIXPATH_SRC`
-      FIXPATH_BIN=`cmd //c echo $FIXPATH_BIN`
-
       # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line
       # @ was chosen as separator to minimize risk of other tools messing around with it
-      all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" | tr ' ' '\n' | grep '^/./' | sort | uniq`
+      all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" \
+          | tr ' ' '\n' | grep '^/./' | sort | uniq`
       fixpath_argument_list=`echo $all_unique_prefixes  | tr ' ' '@'`
-
-      FIXPATH="$OUTPUT_ROOT/fixpath -m$fixpath_argument_list"
+      FIXPATH="$FIXPATH_BIN -m$fixpath_argument_list"
     fi
-    rm -f $OUTPUT_ROOT/fixpath*
-    cd $OUTPUT_ROOT
-    $CC $FIXPATH_SRC -Fe$FIXPATH_BIN > $OUTPUT_ROOT/fixpath1.log 2>&1
+    FIXPATH_SRC_W="$FIXPATH_SRC"
+    FIXPATH_BIN_W="$FIXPATH_BIN"
+    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_SRC_W])
+    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_BIN_W])
+    $RM -rf $FIXPATH_BIN $FIXPATH_DIR
+    $MKDIR -p $FIXPATH_DIR $CONFIGURESUPPORT_OUTPUTDIR/bin
+    cd $FIXPATH_DIR
+    $CC $FIXPATH_SRC_W -Fe$FIXPATH_BIN_W > $FIXPATH_DIR/fixpath1.log 2>&1
     cd $CURDIR
 
-    if test ! -x $OUTPUT_ROOT/fixpath.exe; then
+    if test ! -x $FIXPATH_BIN; then
       AC_MSG_RESULT([no])
-      cat $OUTPUT_ROOT/fixpath1.log
-      AC_MSG_ERROR([Could not create $OUTPUT_ROOT/fixpath.exe])
+      cat $FIXPATH_DIR/fixpath1.log
+      AC_MSG_ERROR([Could not create $FIXPATH_BIN])
     fi
     AC_MSG_RESULT([yes])
     AC_MSG_CHECKING([if fixpath.exe works])
-    cd $OUTPUT_ROOT
-    $FIXPATH $CC $SRC_ROOT/common/src/fixpath.c -Fe$OUTPUT_ROOT/fixpath2.exe > $OUTPUT_ROOT/fixpath2.log 2>&1
+    cd $FIXPATH_DIR
+    $FIXPATH $CC $FIXPATH_SRC -Fe$FIXPATH_DIR/fixpath2.exe \
+        > $FIXPATH_DIR/fixpath2.log 2>&1
     cd $CURDIR
-    if test ! -x $OUTPUT_ROOT/fixpath2.exe; then
+    if test ! -x $FIXPATH_DIR/fixpath2.exe; then
       AC_MSG_RESULT([no])
-      cat $OUTPUT_ROOT/fixpath2.log
+      cat $FIXPATH_DIR/fixpath2.log
       AC_MSG_ERROR([fixpath did not work!])
     fi
     AC_MSG_RESULT([yes])
-    rm -f $OUTPUT_ROOT/fixpath?.??? $OUTPUT_ROOT/fixpath.obj
   fi
 
   AC_SUBST(FIXPATH)
diff --git a/common/autoconf/build-performance.m4 b/common/autoconf/build-performance.m4
index 5b3dbdd..b5911b7 100644
--- a/common/autoconf/build-performance.m4
+++ b/common/autoconf/build-performance.m4
@@ -336,11 +336,4 @@
   AC_MSG_CHECKING([whether to use sjavac])
   AC_MSG_RESULT([$ENABLE_SJAVAC])
   AC_SUBST(ENABLE_SJAVAC)
-
-  if test "x$ENABLE_SJAVAC" = xyes; then
-    SJAVAC_SERVER_DIR="$OUTPUT_ROOT/javacservers"
-  else
-    SJAVAC_SERVER_DIR=
-  fi
-  AC_SUBST(SJAVAC_SERVER_DIR)
 ])
diff --git a/common/autoconf/configure.ac b/common/autoconf/configure.ac
index 29dd146..560f452 100644
--- a/common/autoconf/configure.ac
+++ b/common/autoconf/configure.ac
@@ -261,7 +261,7 @@
 
 # We're messing a bit with internal autoconf variables to put the config.status
 # in the output directory instead of the current directory.
-CONFIG_STATUS="$OUTPUT_ROOT/config.status"
+CONFIG_STATUS="$CONFIGURESUPPORT_OUTPUTDIR/config.status"
 
 # Create the actual output files. Now the main work of configure is done.
 AC_OUTPUT
@@ -269,7 +269,7 @@
 
 # Try to move the config.log file to the output directory.
 if test -e ./config.log; then
-  $MV -f ./config.log "$OUTPUT_ROOT/config.log" 2> /dev/null
+  $MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
 fi
 
 # Make the compare script executable
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index 137ccd5..a7fc898 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -632,7 +632,6 @@
 CFLAGS_CCACHE
 CCACHE
 USE_PRECOMPILED_HEADER
-SJAVAC_SERVER_DIR
 ENABLE_SJAVAC
 SJAVAC_SERVER_JAVA_FLAGS
 SJAVAC_SERVER_JAVA
@@ -884,6 +883,7 @@
 CHECK_MAKE
 CHECK_GMAKE
 PKGHANDLER
+CONFIGURESUPPORT_OUTPUTDIR
 OUTPUT_ROOT
 CONF_NAME
 SPEC
@@ -4365,7 +4365,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1428017006
+DATE_WHEN_GENERATED=1428676283
 
 ###############################################################################
 #
@@ -15266,6 +15266,8 @@
     fi
     OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}"
     $MKDIR -p "$OUTPUT_ROOT"
+    CONFIGURESUPPORT_OUTPUTDIR="$OUTPUT_ROOT/configure-support"
+    $MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
     if test ! -d "$OUTPUT_ROOT"; then
       as_fn_error $? "Could not create build directory $OUTPUT_ROOT" "$LINENO" 5
     fi
@@ -15450,6 +15452,7 @@
   OUTPUT_ROOT=$OUTPUT_ROOT
 
 
+
   # The spec.gmk file contains all variables for the make system.
   ac_config_files="$ac_config_files $OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in"
 
@@ -27622,7 +27625,7 @@
 $as_echo "$as_me: Trying to extract Visual Studio environment variables" >&6;}
 
     # We need to create a couple of temporary files.
-    VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env"
+    VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env"
     $MKDIR -p $VS_ENV_TMP_DIR
 
     # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment).
@@ -43136,50 +43139,69 @@
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fixpath can be created" >&5
 $as_echo_n "checking if fixpath can be created... " >&6; }
     FIXPATH_SRC="$SRC_ROOT/common/src/fixpath.c"
-    FIXPATH_BIN="$OUTPUT_ROOT/fixpath.exe"
+    FIXPATH_BIN="$CONFIGURESUPPORT_OUTPUTDIR/bin/fixpath.exe"
+    FIXPATH_DIR="$CONFIGURESUPPORT_OUTPUTDIR/fixpath"
     if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
-      FIXPATH_SRC=`$CYGPATH -m $FIXPATH_SRC`
-      FIXPATH_BIN=`$CYGPATH -m $FIXPATH_BIN`
       # Important to keep the .exe suffix on Cygwin for Hotspot makefiles
-      FIXPATH="$OUTPUT_ROOT/fixpath.exe -c"
+      FIXPATH="$FIXPATH_BIN -c"
     elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.msys; then
-      FIXPATH_SRC=`cmd //c echo $FIXPATH_SRC`
-      FIXPATH_BIN=`cmd //c echo $FIXPATH_BIN`
-
       # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line
       # @ was chosen as separator to minimize risk of other tools messing around with it
-      all_unique_prefixes=`echo "${all_fixpath_prefixes[@]}" | tr ' ' '\n' | grep '^/./' | sort | uniq`
+      all_unique_prefixes=`echo "${all_fixpath_prefixes[@]}" \
+          | tr ' ' '\n' | grep '^/./' | sort | uniq`
       fixpath_argument_list=`echo $all_unique_prefixes  | tr ' ' '@'`
-
-      FIXPATH="$OUTPUT_ROOT/fixpath -m$fixpath_argument_list"
+      FIXPATH="$FIXPATH_BIN -m$fixpath_argument_list"
     fi
-    rm -f $OUTPUT_ROOT/fixpath*
-    cd $OUTPUT_ROOT
-    $CC $FIXPATH_SRC -Fe$FIXPATH_BIN > $OUTPUT_ROOT/fixpath1.log 2>&1
+    FIXPATH_SRC_W="$FIXPATH_SRC"
+    FIXPATH_BIN_W="$FIXPATH_BIN"
+
+  unix_path="$FIXPATH_SRC_W"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    windows_path=`$CYGPATH -m "$unix_path"`
+    FIXPATH_SRC_W="$windows_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    windows_path=`cmd //c echo $unix_path`
+    FIXPATH_SRC_W="$windows_path"
+  fi
+
+
+  unix_path="$FIXPATH_BIN_W"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    windows_path=`$CYGPATH -m "$unix_path"`
+    FIXPATH_BIN_W="$windows_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    windows_path=`cmd //c echo $unix_path`
+    FIXPATH_BIN_W="$windows_path"
+  fi
+
+    $RM -rf $FIXPATH_BIN $FIXPATH_DIR
+    $MKDIR -p $FIXPATH_DIR $CONFIGURESUPPORT_OUTPUTDIR/bin
+    cd $FIXPATH_DIR
+    $CC $FIXPATH_SRC_W -Fe$FIXPATH_BIN_W > $FIXPATH_DIR/fixpath1.log 2>&1
     cd $CURDIR
 
-    if test ! -x $OUTPUT_ROOT/fixpath.exe; then
+    if test ! -x $FIXPATH_BIN; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-      cat $OUTPUT_ROOT/fixpath1.log
-      as_fn_error $? "Could not create $OUTPUT_ROOT/fixpath.exe" "$LINENO" 5
+      cat $FIXPATH_DIR/fixpath1.log
+      as_fn_error $? "Could not create $FIXPATH_BIN" "$LINENO" 5
     fi
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fixpath.exe works" >&5
 $as_echo_n "checking if fixpath.exe works... " >&6; }
-    cd $OUTPUT_ROOT
-    $FIXPATH $CC $SRC_ROOT/common/src/fixpath.c -Fe$OUTPUT_ROOT/fixpath2.exe > $OUTPUT_ROOT/fixpath2.log 2>&1
+    cd $FIXPATH_DIR
+    $FIXPATH $CC $FIXPATH_SRC -Fe$FIXPATH_DIR/fixpath2.exe \
+        > $FIXPATH_DIR/fixpath2.log 2>&1
     cd $CURDIR
-    if test ! -x $OUTPUT_ROOT/fixpath2.exe; then
+    if test ! -x $FIXPATH_DIR/fixpath2.exe; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-      cat $OUTPUT_ROOT/fixpath2.log
+      cat $FIXPATH_DIR/fixpath2.log
       as_fn_error $? "fixpath did not work!" "$LINENO" 5
     fi
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-    rm -f $OUTPUT_ROOT/fixpath?.??? $OUTPUT_ROOT/fixpath.obj
   fi
 
 
@@ -51415,13 +51437,6 @@
 $as_echo "$ENABLE_SJAVAC" >&6; }
 
 
-  if test "x$ENABLE_SJAVAC" = xyes; then
-    SJAVAC_SERVER_DIR="$OUTPUT_ROOT/javacservers"
-  else
-    SJAVAC_SERVER_DIR=
-  fi
-
-
 
 # Can the C/C++ compiler use precompiled headers?
 
@@ -51849,7 +51864,7 @@
 
 # We're messing a bit with internal autoconf variables to put the config.status
 # in the output directory instead of the current directory.
-CONFIG_STATUS="$OUTPUT_ROOT/config.status"
+CONFIG_STATUS="$CONFIGURESUPPORT_OUTPUTDIR/config.status"
 
 # Create the actual output files. Now the main work of configure is done.
 cat >confcache <<\_ACEOF
@@ -53017,7 +53032,7 @@
 
 # Try to move the config.log file to the output directory.
 if test -e ./config.log; then
-  $MV -f ./config.log "$OUTPUT_ROOT/config.log" 2> /dev/null
+  $MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
 fi
 
 # Make the compare script executable
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index 35437b1..8ae5165 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -59,7 +59,7 @@
 MAKE := @MAKE@
 
 # The default make arguments
-MAKE_ARGS = $(MAKE_LOG_FLAGS) -R -I $(TOPDIR)/make/common SPEC=$(SPEC) \
+MAKE_ARGS = $(MAKE_LOG_FLAGS) -r -R -I $(TOPDIR)/make/common SPEC=$(SPEC) \
     MAKE_LOG_FLAGS="$(MAKE_LOG_FLAGS)" LOG_LEVEL=$(LOG_LEVEL)
 
 OUTPUT_SYNC_SUPPORTED:=@OUTPUT_SYNC_SUPPORTED@
@@ -231,13 +231,14 @@
 # Colon left out to be able to override IMAGES_OUTPUTDIR for bootcycle-images
 SUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/support
 BUILDTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/buildtools
-MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/makesupport
 
 HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
 JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
 IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
 TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/test-make
 MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
+# This does not get overridden in a bootcycle build
+CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@
 
 HOTSPOT_DIST=@HOTSPOT_DIST@
 
@@ -259,7 +260,7 @@
 ENABLE_SJAVAC:=@ENABLE_SJAVAC@
 # Store sjavac server synchronization files here, and
 # the sjavac server log files.
-SJAVAC_SERVER_DIR:=@SJAVAC_SERVER_DIR@
+SJAVAC_SERVER_DIR=$(MAKESUPPORT_OUTPUTDIR)/javacservers
 
 # Number of parallel jobs to use for compilation
 JOBS?=@JOBS@
diff --git a/common/autoconf/toolchain_windows.m4 b/common/autoconf/toolchain_windows.m4
index dc1a248..87850a2 100644
--- a/common/autoconf/toolchain_windows.m4
+++ b/common/autoconf/toolchain_windows.m4
@@ -270,7 +270,7 @@
     AC_MSG_NOTICE([Trying to extract Visual Studio environment variables])
 
     # We need to create a couple of temporary files.
-    VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env"
+    VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env"
     $MKDIR -p $VS_ENV_TMP_DIR
 
     # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment).
diff --git a/corba/.hgtags b/corba/.hgtags
index b467c4b..263095c 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -301,3 +301,4 @@
 ef4afd6832b00b8687832c2a36c90e43750ebe40 jdk9-b56
 d8ebf1a5b18ccbc849f5bf0f80aa3d78583eee68 jdk9-b57
 86dd5de1f5cb09073019bd629e22cfcd012d8b4b jdk9-b58
+cda6ae062f85fac5555f4e1318885b0ecd998bd1 jdk9-b59
diff --git a/corba/src/java.corba/share/classes/javax/activity/package.html b/corba/src/java.corba/share/classes/javax/activity/package.html
index bceb353..d9696cc 100644
--- a/corba/src/java.corba/share/classes/javax/activity/package.html
+++ b/corba/src/java.corba/share/classes/javax/activity/package.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
 This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
 <body bgcolor="white">
 Contains Activity service related exceptions thrown by the ORB machinery during
 unmarshalling.
-<p>
+
 @since 1.5
 </body>
 </html>
diff --git a/corba/src/java.corba/share/classes/javax/rmi/CORBA/Util.java b/corba/src/java.corba/share/classes/javax/rmi/CORBA/Util.java
index 61d91c7..5a18212 100644
--- a/corba/src/java.corba/share/classes/javax/rmi/CORBA/Util.java
+++ b/corba/src/java.corba/share/classes/javax/rmi/CORBA/Util.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -232,6 +232,8 @@
      * and <tt>loader</tt> is non-null, then call <tt>loader.loadClass(className)</tt>.
      * <LI>If a class was successfully loaded by step 1, 2, 3, or 4, then
      *  return the loaded class, else throw <tt>ClassNotFoundException</tt>.
+     * </UL>
+     *
      * @param className the name of the class.
      * @param remoteCodebase a space-separated list of URLs at which
      * the class might be found. May be null.
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/Any.java b/corba/src/java.corba/share/classes/org/omg/CORBA/Any.java
index a5f7a9c..df47eec 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/Any.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/Any.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,21 +52,21 @@
  * </OL>
  *
  * <P>
- * <a name="anyOps"</a>
+ * <a name="anyOps"></a>
  * A large part of the <code>Any</code> class consists of pairs of methods
  * for inserting values into and extracting values from an
  * <code>Any</code> object.
  * <P>
  * For a given primitive type X, these methods are:
  *  <dl>
- *      <dt><code><bold> void insert_X(X x)</bold></code>
+ *      <dt><code><b>void insert_X(X x)</b></code>
  *      <dd> This method allows the insertion of
  *        an instance <code>x</code> of primitive type <code>X</code>
  *    into the <code>value</code> field of the <code>Any</code> object.
  *    Note that the method
  *    <code>insert_X</code> also resets the <code>Any</code> object's
  *    <code>type</code> field if necessary.
- *      <dt> <code><bold>X extract_X()</bold></code>
+ *      <dt> <code><b>X extract_X()</b></code>
  *      <dd> This method allows the extraction of an instance of
  *        type <code>X</code> from the <code>Any</code> object.
  *    <BR>
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/CompletionStatus.java b/corba/src/java.corba/share/classes/org/omg/CORBA/CompletionStatus.java
index b3ba945..a8ad47d 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/CompletionStatus.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/CompletionStatus.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,10 +40,10 @@
  * <P>
  * The class also contains two methods:
  * <UL>
- * <LI><code>public int <bold>value</bold>()</code> -- which accesses the
+ * <LI><code>public int <b>value</b>()</code> -- which accesses the
  * <code>value</code> field of a <code>CompletionStatus</code> object
  * <LI><code>public static CompletionStatus
- * <bold>from_int</bold>(int i)</code> --
+ * <b>from_int</b>(int i)</code> --
  * for creating an instance from one of the <code>int</code> members
  * </UL>
  * @see     org.omg.CORBA.SystemException
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/DataInputStream.java b/corba/src/java.corba/share/classes/org/omg/CORBA/DataInputStream.java
index 653d304..d90792a 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/DataInputStream.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/DataInputStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
 {
     /** Reads an IDL <code>Any</code> value from the input stream.
     * @return  the <code>Any</code> read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -43,7 +43,7 @@
 
     /** Reads an IDL boolean value from the input stream.
     * @return  the boolean read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -51,7 +51,7 @@
 
     /** Reads an IDL character value from the input stream.
     * @return  the character read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -59,7 +59,7 @@
 
     /** Reads an IDL wide character value from the input stream.
     * @return  the wide character read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -67,7 +67,7 @@
 
     /** Reads an IDL octet value from the input stream.
     * @return  the octet value read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -75,7 +75,7 @@
 
     /** Reads an IDL short from the input stream.
     * @return  the short read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -83,7 +83,7 @@
 
     /** Reads an IDL unsigned short from the input stream.
     * @return  the unsigned short read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -91,7 +91,7 @@
 
     /** Reads an IDL long from the input stream.
     * @return  the long read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -99,7 +99,7 @@
 
     /** Reads an IDL unsigned long from the input stream.
     * @return  the unsigned long read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -107,7 +107,7 @@
 
     /** Reads an IDL long long from the input stream.
     * @return  the long long read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -115,7 +115,7 @@
 
     /** Reads an unsigned IDL long long from the input stream.
     * @return  the unsigned long long read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -123,7 +123,7 @@
 
     /** Reads an IDL float from the input stream.
     * @return  the float read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -131,7 +131,7 @@
 
     /** Reads an IDL double from the input stream.
     * @return  the double read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -140,7 +140,7 @@
 
     /** Reads an IDL string from the input stream.
     * @return  the string read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -148,7 +148,7 @@
 
     /** Reads an IDL wide string from the input stream.
     * @return  the wide string read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -156,7 +156,7 @@
 
     /** Reads an IDL CORBA::Object from the input stream.
     * @return  the CORBA::Object read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -164,7 +164,7 @@
 
     /** Reads an IDL Abstract interface from the input stream.
     * @return  the Abstract interface read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -172,7 +172,7 @@
 
     /** Reads an IDL value type from the input stream.
     * @return  the value type read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -180,7 +180,7 @@
 
     /** Reads an IDL typecode from the input stream.
     * @return  the typecode read.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -192,7 +192,7 @@
     * @param offset The index into seq of the first element to read from the
     * input stream.
     * @param length The number of elements to read from the input stream.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -204,7 +204,7 @@
     * @param offset The index into seq of the first element to read from the
     * input stream.
     * @param length The number of elements to read from the input stream.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -216,7 +216,7 @@
     * @param offset The index into seq of the first element to read from the
     * input stream.
     * @param length The number of elements to read from the input stream.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -228,7 +228,7 @@
     * @param offset The index into seq of the first element to read from the
     * input stream.
     * @param length The number of elements to read from the input stream.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -240,7 +240,7 @@
     * @param offset The index into seq of the first element to read from the
     * input stream.
     * @param length The number of elements to read from the input stream.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -252,7 +252,7 @@
     * @param offset The index into seq of the first element to read from the
     * input stream.
     * @param length The number of elements to read from the input stream.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -264,7 +264,7 @@
     * @param offset The index into seq of the first element to read from the
     * input stream.
     * @param length The number of elements to read from the input stream.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -276,7 +276,7 @@
     * @param offset The index into seq of the first element to read from the
     * input stream.
     * @param length The number of elements to read from the input stream.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -288,7 +288,7 @@
     * @param offset The index into seq of the first element to read from the
     * input stream.
     * @param length The number of elements to read from the input stream.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -300,7 +300,7 @@
     * @param offset The index into seq of the first element to read from the
     * input stream.
     * @param length The number of elements to read from the input stream.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -312,7 +312,7 @@
     * @param offset The index into seq of the first element to read from the
     * input stream.
     * @param length The number of elements to read from the input stream.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -324,7 +324,7 @@
     * @param offset The index into seq of the first element to read from the
     * input stream.
     * @param length The number of elements to read from the input stream.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
@@ -336,7 +336,7 @@
     * @param offset The index into seq of the first element to read from the
     * input stream.
     * @param length The number of elements to read from the input stream.
-    * @throws <code>org.omg.CORBA.MARSHAL</code>
+    * @throws org.omg.CORBA.MARSHAL
     * If an inconsistency is detected, including not having registered
     * a streaming policy, then the standard system exception MARSHAL is raised.
     */
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/LocalObject.java b/corba/src/java.corba/share/classes/org/omg/CORBA/LocalObject.java
index 048c6a2..6aba94a 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/LocalObject.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/LocalObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@
      * to attempt determination of whether two distinct object references
      * refer to the same object, since such determination could be impractically
      * expensive.
-     * <P>Default implementation of the org.omg.CORBA.Object method. <P>
+     * <P>Default implementation of the org.omg.CORBA.Object method.
      *
      * @param that the object reference with which to check for equivalence
      * @return <code>true</code> if this object reference is known to be
@@ -87,7 +87,7 @@
     /**
      * Always returns <code>false</code>.
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
      *
      * @return <code>false</code>
      */
@@ -99,9 +99,10 @@
      * Returns a hash value that is consistent for the
      * lifetime of the object, using the given number as the maximum.
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
+     *
      * @param maximum an <code>int</code> identifying maximum value of
-     *                  the hashcode
+     *                the hashcode
      * @return this instance's hashcode
      */
     public int _hash(int maximum) {
@@ -113,7 +114,7 @@
      * the message "This is a locally constrained object."  This method
      * does not apply to local objects and is therefore not implemented.
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
      *
      * @param repository_id a <code>String</code>
      * @return NO_IMPLEMENT because this is a locally constrained object
@@ -131,7 +132,8 @@
      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
      * the message "This is a locally constrained object."
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
+     *
      * @return a duplicate of this <code>LocalObject</code> instance.
      * @exception NO_IMPLEMENT
      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
@@ -145,7 +147,8 @@
      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
      * the message "This is a locally constrained object."
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
+     *
      * @exception NO_IMPLEMENT
      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
      *      comments for unimplemented features</a>
@@ -158,7 +161,7 @@
      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
      * the message "This is a locally constrained object."
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
      *
      * @param operation a <code>String</code> giving the name of an operation
      *        to be performed by the request that is returned
@@ -175,7 +178,7 @@
      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
      * the message "This is a locally constrained object."
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
      *
      * @param ctx          a <code>Context</code> object containing
      *                     a list of properties
@@ -202,7 +205,7 @@
      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
      * the message "This is a locally constrained object."
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
      *
      * @param ctx          a <code>Context</code> object containing
      *                     a list of properties
@@ -237,7 +240,8 @@
      * the message "This is a locally constrained object." This method
      * does not apply to local objects and is therefore not implemented.
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
+     *
      * @return NO_IMPLEMENT because this is a locally constrained object
      *      and this method does not apply to local objects
      * @exception NO_IMPLEMENT because this is a locally constrained object
@@ -254,7 +258,8 @@
      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
      * the message "This is a locally constrained object."
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
+     *
      * @exception NO_IMPLEMENT
      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
      *      comments for unimplemented features</a>
@@ -275,7 +280,7 @@
      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
      * the message "This is a locally constrained object."
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
      * @return the ORB instance that created the Delegate contained in this
      * <code>ObjectImpl</code>
      * @exception NO_IMPLEMENT
@@ -291,7 +296,8 @@
      * the message "This is a locally constrained object." This method
      * does not apply to local objects and is therefore not implemented.
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
+     *
      * @param policy_type  an <code>int</code>
      * @return NO_IMPLEMENT because this is a locally constrained object
      *      and this method does not apply to local objects
@@ -310,7 +316,8 @@
      * the message "This is a locally constrained object." This method
      * does not apply to local objects and is therefore not implemented.
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
+     *
      * @exception NO_IMPLEMENT
      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
      *      comments for unimplemented features</a>
@@ -347,7 +354,8 @@
      * the message "This is a locally constrained object."
      * This method is the default implementation of the
      * <code>org.omg.CORBA.Object</code> method.<P>
-     * Returns <code>true</code> for this <code>LocalObject</code> instance.<P>
+     * Returns <code>true</code> for this <code>LocalObject</code> instance.
+     *
      * @return <code>true</code> always
      * @exception NO_IMPLEMENT
      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
@@ -361,7 +369,8 @@
      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
      * the message "This is a locally constrained object."
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
+     *
      * @param operation a <code>String</code> indicating which operation
      *                  to preinvoke
      * @param expectedType the class of the type of operation mentioned above
@@ -381,7 +390,8 @@
      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
      * the message "This is a locally constrained object."
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
+     *
      * @param servant the servant object on which to post-invoke
      * @exception NO_IMPLEMENT
      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
@@ -403,8 +413,8 @@
      * <code>org.omg.CORBA.Object</code> method.
      * <P>Called by a stub to obtain an OutputStream for
      * marshaling arguments. The stub must supply the operation name,
-     * and indicate if a response is expected (i.e is this a oneway
-     * call).<P>
+     * and indicate if a response is expected (i.e is this a oneway call).
+     *
      * @param operation the name of the operation being requested
      * @param responseExpected <code>true</code> if a response is expected,
      *                         <code>false</code> if it is a one-way call
@@ -433,7 +443,8 @@
      * marshaled reply. If an exception occurs, <code>_invoke</code> may throw an
      * <code>ApplicationException</code> object which contains an
      * <code>InputStream</code> from
-     * which the user exception state may be unmarshaled.<P>
+     * which the user exception state may be unmarshaled.
+     *
      * @param output the <code>OutputStream</code> to invoke
      * @return NO_IMPLEMENT because this is a locally constrained object
      *      and this method does not apply to local objects
@@ -470,7 +481,8 @@
      * <code>ApplicationException.getInputStream()</code>.
      * A null
      * value may also be passed to <code>_releaseReply</code>, in which case the
-     * method is a no-op.<P>
+     * method is a no-op.
+     *
      * @param input the reply stream back to the ORB or null
      * @exception NO_IMPLEMENT
      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
@@ -485,7 +497,8 @@
      * the message "This is a locally constrained object." This method
      * does not apply to local objects and is therefore not implemented.
      * This method is the default implementation of the
-     * <code>org.omg.CORBA.Object</code> method.<P>
+     * <code>org.omg.CORBA.Object</code> method.
+     *
      * @return NO_IMPLEMENT because this is a locally constrained object
      *      and this method does not apply to local objects
      * @exception NO_IMPLEMENT because this is a locally constrained object
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/NVList.java b/corba/src/java.corba/share/classes/org/omg/CORBA/NVList.java
index 993610f..e60a7e3 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/NVList.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/NVList.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,7 +63,6 @@
  * Note also that you can add any number of
  * <code>NamedValue</code> objects to this list regardless of
  * its original length.
- * <P>
  * <LI><code>org.omg.CORBA.ORB.create_operation_list</code>
  * <PRE>
  *    org.omg.CORBA.NVList nv = orb.create_operation_list(myOperationDef);
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java b/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java
index cc66222..1f1fbd0 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,7 +101,7 @@
  * <P>
  * When an ORB instance is being created, the class name of the ORB
  * implementation is located using
- * the following standard search order:<P>
+ * the following standard search order:
  *
  * <OL>
  *     <LI>check in Applet parameter or application string array, if any
@@ -1036,7 +1036,7 @@
      * <P>
      * Recursive types can only appear within sequences which can be empty.
      * That way marshaling problems, when transmitting the struct in an Any, are avoided.
-     * <P>
+     *
      * @param id                 the logical id of the referenced type
      * @return                   the requested TypeCode
      */
@@ -1179,7 +1179,7 @@
      * value <tt>true</tt>. If no information for the requested
      * services type is available, the operation returns <tt>false</tt>
      *  (i.e., the service is not supported by this ORB).
-     * <P>
+     *
      * @param service_type a <code>short</code> indicating the
      *        service type for which information is being requested
      * @param service_info a <code>ServiceInformationHolder</code> object
@@ -1203,7 +1203,7 @@
     /**
      * Creates a new <code>DynAny</code> object from the given
      * <code>Any</code> object.
-     * <P>
+     *
      * @param value the <code>Any</code> object from which to create a new
      *        <code>DynAny</code> object
      * @return the new <code>DynAny</code> object created from the given
@@ -1221,7 +1221,7 @@
     /**
      * Creates a basic <code>DynAny</code> object from the given
      * <code>TypeCode</code> object.
-     * <P>
+     *
      * @param type the <code>TypeCode</code> object from which to create a new
      *        <code>DynAny</code> object
      * @return the new <code>DynAny</code> object created from the given
@@ -1241,7 +1241,7 @@
     /**
      * Creates a new <code>DynStruct</code> object from the given
      * <code>TypeCode</code> object.
-     * <P>
+     *
      * @param type the <code>TypeCode</code> object from which to create a new
      *        <code>DynStruct</code> object
      * @return the new <code>DynStruct</code> object created from the given
@@ -1261,7 +1261,7 @@
     /**
      * Creates a new <code>DynSequence</code> object from the given
      * <code>TypeCode</code> object.
-     * <P>
+     *
      * @param type the <code>TypeCode</code> object from which to create a new
      *        <code>DynSequence</code> object
      * @return the new <code>DynSequence</code> object created from the given
@@ -1282,7 +1282,7 @@
     /**
      * Creates a new <code>DynArray</code> object from the given
      * <code>TypeCode</code> object.
-     * <P>
+     *
      * @param type the <code>TypeCode</code> object from which to create a new
      *        <code>DynArray</code> object
      * @return the new <code>DynArray</code> object created from the given
@@ -1302,7 +1302,7 @@
     /**
      * Creates a new <code>DynUnion</code> object from the given
      * <code>TypeCode</code> object.
-     * <P>
+     *
      * @param type the <code>TypeCode</code> object from which to create a new
      *        <code>DynUnion</code> object
      * @return the new <code>DynUnion</code> object created from the given
@@ -1322,7 +1322,7 @@
     /**
      * Creates a new <code>DynEnum</code> object from the given
      * <code>TypeCode</code> object.
-     * <P>
+     *
      * @param type the <code>TypeCode</code> object from which to create a new
      *        <code>DynEnum</code> object
      * @return the new <code>DynEnum</code> object created from the given
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/Object.java b/corba/src/java.corba/share/classes/org/omg/CORBA/Object.java
index df7c023..7875dd9 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/Object.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/Object.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
  * <code>org.omg.CORBA.Object</code>
  * are provided in the class <code>org.omg.CORBA.portable.ObjectImpl</code>,
  * which is the base class for stubs and object implementations.
- * <p>
+ *
  * @see org.omg.CORBA.portable.ObjectImpl
  */
 
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/Principal.java b/corba/src/java.corba/share/classes/org/omg/CORBA/Principal.java
index 8c30a84..f845970 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/Principal.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/Principal.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  * the client, for access control
  * and other purposes. It contains a single attribute, the name of the
  * <code>Principal</code>, encoded as a sequence of bytes.
- * <P>
+ *
  * @deprecated Deprecated by CORBA 2.2.
  */
 @Deprecated
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/ServerRequest.java b/corba/src/java.corba/share/classes/org/omg/CORBA/ServerRequest.java
index 9131cf8..f4f5ed2 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ServerRequest.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ServerRequest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@
  * Similarly, type information needs to be provided for the response,
  * for either the expected result or for an exception, so the methods
  * <code>result</code> and <code>except</code> take an <code>Any</code>
- * object as a parameter. <p>
+ * object as a parameter.
  *
  * @see org.omg.CORBA.DynamicImplementation
  * @see org.omg.CORBA.NVList
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java b/corba/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java
index 646730c..8ed7eb3 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,8 @@
 /**
  * The Holder for <tt>Short</tt>.  For more information on
  * Holder files, see <a href="doc-files/generatedfiles.html#holder">
- * "Generated Files: Holder Files"</a>.<P
- * A Holder class for a <code>short</code>
+ * "Generated Files: Holder Files"</a>.
+ * <P>A Holder class for a <code>short</code>
  * that is used to store "out" and "inout" parameters in IDL operations.
  * If an IDL operation signature has an IDL <code>short</code> as an "out"
  * or "inout" parameter, the programmer must pass an instance of
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/TCKind.java b/corba/src/java.corba/share/classes/org/omg/CORBA/TCKind.java
index bfacebf..60e89a8 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/TCKind.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TCKind.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@
  * The variable <code>k</code> represents the <code>TCKind</code>
  * instance for the IDL type <code>string</code>, which is
  * <code>tk_string</code>.
- * <P>
+ *
  * <LI>the method <code>value</code> for accessing the
  * <code>_value</code> field of a <code>TCKind</code> constant
  * <P>Example:
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java b/corba/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java
index 74fc7d9..8366a75 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
 /**
  * A container for information about a specific CORBA data
  * type.
- *<P>
+ * <P>
  * <code>TypeCode</code> objects are used:
  * <UL>
  * <LI>in the Dynamic Invocation Interface -- to indicate the types
@@ -59,7 +59,7 @@
  * with the value
  * <code>TCKind.tk_sequence</code> and also fields with the values
  * <code>boolean</code> and <code>10</code> for the
- * type of sequence elements and the length of the sequence. <p>
+ * type of sequence elements and the length of the sequence.
  * </UL>
  *
  * <code>TypeCode</code> objects can be obtained in various ways:
@@ -164,8 +164,7 @@
  *
  * Java IDL extends the CORBA specification to allow all operations permitted
  * on a <code>struct</code> <code>TypeCode</code> to be permitted
- * on an <code>exception</code> <code>TypeCode</code> as well. <p>
- *
+ * on an <code>exception</code> <code>TypeCode</code> as well.
  */
 public abstract class TypeCode implements IDLEntity {
 
@@ -175,23 +174,21 @@
      * they are interchangeable and give identical results when
      * <code>TypeCode</code> operations are applied to them.
      *
-     * @param tc                the <code>TypeCode</code> object to compare against
-     * @return          <code>true</code> if the type codes are equal;
+     * @param tc      the <code>TypeCode</code> object to compare against
+     * @return        <code>true</code> if the type codes are equal;
      *                <code>false</code> otherwise
      */
-
     public abstract boolean equal(TypeCode tc);
 
     /**
-         * Tests to see if the given <code>TypeCode</code> object is
-         * equivalent to this <code>TypeCode</code> object.
-         * <P>
-         *
-         *
-         * @param tc the typecode to compare with this typecode
-         *
-         * @return <code>true</code> if the given typecode is equivalent to
-         *         this typecode; <code>false</code> otherwise
+     * Tests to see if the given <code>TypeCode</code> object is
+     * equivalent to this <code>TypeCode</code> object.
+     *
+     *
+     * @param tc the typecode to compare with this typecode
+     *
+     * @return <code>true</code> if the given typecode is equivalent to
+     *         this typecode; <code>false</code> otherwise
      *
      */
     public abstract boolean equivalent(TypeCode tc);
@@ -199,9 +196,9 @@
     /**
      * Strips out all optional name and member name fields,
      * but leaves all alias typecodes intact.
-         * @return a <code>TypeCode</code> object with optional name and
-         *         member name fields stripped out, except for alias typecodes,
-         *         which are left intact
+     * @return a <code>TypeCode</code> object with optional name and
+     *         member name fields stripped out, except for alias typecodes,
+     *         which are left intact
      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
      *      comments for unimplemented features</a>
      */
@@ -220,7 +217,6 @@
      *            value of the <code>kind</code> field of this
      *                  <code>TypeCode</code> object
      */
-
     public abstract TCKind kind();
 
     /**
@@ -239,13 +235,12 @@
      * also always have a RepositoryId. If there is no RepositoryId, the
      * method can return an empty string.
      *
-     * @return          the RepositoryId for this <code>TypeCode</code> object
-     *                or an empty string if there is no RepositoryID
+     * @return the RepositoryId for this <code>TypeCode</code> object
+     *         or an empty string if there is no RepositoryID
      * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method
      *           is invoked on an inappropriate kind of<code>TypeCode</code>
      *           object
      */
-
     public abstract String id() throws BadKind;
 
     /**
@@ -268,7 +263,6 @@
      *           is invoked on an inappropriate kind of<code>TypeCode</code>
      *           object
      */
-
     public abstract String name() throws BadKind;
 
     /**
@@ -287,7 +281,6 @@
      *           is invoked on an inappropriate kind of <code>TypeCode</code>
      *           object
      */
-
     public abstract int member_count() throws BadKind;
 
     /**
@@ -312,7 +305,6 @@
      *           is invoked on an inappropriate kind of <code>TypeCode</code>
      *           object
      */
-
     public abstract String member_name(int index)
         throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds;
 
@@ -336,7 +328,6 @@
      *           is invoked on an inappropriate kind of <code>TypeCode</code>
      *           object
      */
-
     public abstract TypeCode member_type(int index)
         throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds;
 
@@ -344,13 +335,13 @@
      * Retrieves the label of the union member
      * identified by the given index. For the default member,
      * the label is the zero octet.
-     *<P>
+     * <P>
      * The method <code>member_label</code> can only be invoked on union
      * <code>TypeCode</code> objects.
      *
-     * @param index     index of the union member for which the
+     * @param index   index of the union member for which the
      *                label is being requested
-     * @return          an <code>Any</code> object describing the label of
+     * @return        an <code>Any</code> object describing the label of
      *                the requested union member or the zero octet for
      *                the default member
      * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is
@@ -360,7 +351,6 @@
      *           is invoked on a non-union <code>TypeCode</code>
      *           object
      */
-
     public abstract Any member_label(int index)
         throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds;
 
@@ -376,7 +366,6 @@
      *           is invoked on a non-union <code>TypeCode</code>
      *           object
      */
-
     public abstract TypeCode discriminator_type()
         throws BadKind;
 
@@ -393,7 +382,6 @@
      *           is invoked on a non-union <code>TypeCode</code>
      *           object
      */
-
     public abstract int default_index() throws BadKind;
 
     /**
@@ -412,7 +400,6 @@
      *           is invoked on an inappropriate kind of <code>TypeCode</code>
      *           object
      */
-
     public abstract int length() throws BadKind;
 
     /**
@@ -424,7 +411,7 @@
      * that multidimensional arrays are represented by nesting
      * <code>TypeCode</code> objects, one per dimension.
      * For boxed valuetypes, it returns the boxed type.
-     *<P>
+     * <P>
      * The method <code>content_type</code> can be invoked on sequence, array,
      * alias, and boxed valuetype <code>TypeCode</code> objects.
      *
@@ -436,37 +423,36 @@
      *           is invoked on an inappropriate kind of <code>TypeCode</code>
      *           object
      */
-
     public abstract TypeCode content_type() throws BadKind;
 
 
     /**
-         * Returns the number of digits in the fixed type described by this
-         * <code>TypeCode</code> object. For example, the typecode for
-         * the number 3000.275d could be <code>fixed<7,3></code>, where
-         * 7 is the precision and 3 is the scale.
-         *
-         * @return the total number of digits
+     * Returns the number of digits in the fixed type described by this
+     * <code>TypeCode</code> object. For example, the typecode for
+     * the number 3000.275d could be <code>fixed&lt;7,3&gt;</code>, where
+     * 7 is the precision and 3 is the scale.
+     *
+     * @return the total number of digits
      * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method
      *           is invoked on an inappropriate kind of <code>TypeCode</code>
      *           object
-         *
+     *
      */
     public abstract short fixed_digits() throws BadKind ;
 
     /**
-         * Returns the scale of the fixed type described by this
-         * <code>TypeCode</code> object. A positive number indicates the
-         * number of digits to the right of the decimal point.
-         * For example, the number 3000d could have the
-         * typecode <code>fixed<4,0></code>, where the first number is
-         * the precision and the second number is the scale.
-         * A negative number is also possible and adds zeroes to the
-         * left of the decimal point.  In this case, <code>fixed<1,-3></code>,
-         * could be the typecode for the number 3000d.
-         *
-         * @return the scale of the fixed type that this
-         *         <code>TypeCode</code> object describes
+     * Returns the scale of the fixed type described by this
+     * <code>TypeCode</code> object. A positive number indicates the
+     * number of digits to the right of the decimal point.
+     * For example, the number 3000d could have the
+     * typecode <code>fixed&lt;4,0&gt;</code>, where the first number is
+     * the precision and the second number is the scale.
+     * A negative number is also possible and adds zeroes to the
+     * left of the decimal point.  In this case, <code>fixed&lt;1,-3&gt;</code>,
+     * could be the typecode for the number 3000d.
+     *
+     * @return the scale of the fixed type that this
+     *         <code>TypeCode</code> object describes
      * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method
      *           is invoked on an inappropriate kind of <code>TypeCode</code>
      *           object
@@ -492,7 +478,6 @@
      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
      *      comments for unimplemented features</a>
      */
-
     abstract public short member_visibility(int index)
         throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds ;
 
@@ -512,7 +497,6 @@
      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
      *      comments for unimplemented features</a>
      */
-
     abstract public short type_modifier() throws BadKind ;
 
     /**
@@ -528,6 +512,5 @@
      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
      *      comments for unimplemented features</a>
      */
-
     abstract public TypeCode concrete_base_type() throws BadKind ;
 }
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html b/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html
index ff57fbd..1ccbbfd 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html
@@ -55,44 +55,30 @@
 
 <li>
 CORBA 2.3.1 chapter 4 with the following replacements from the Portable
-Interceptors specification:</li>
-
-	<ul>
-	<li>
-	section 4.2.3.5 <TT>destroy</TT></li>
-
-	<li>
-	section 4.5.2 <TT>CodeFactory</TT> and <TT>PICurrent</TT> are required</li>
-
-	<li>
-	Section 4.5.3.4 as updated for <TT>register_initial_reference</TT></li>
-	</ul>
+Interceptors specification:
+ <ul>
+ <li>section 4.2.3.5 <TT>destroy</TT></li>
+ <li>section 4.5.2 <TT>CodeFactory</TT> and <TT>PICurrent</TT> are required</li>
+ <li>Section 4.5.3.4 as updated for <TT>register_initial_reference</TT></li>
+ </ul>
+</li>
 
 <li>
 CORBA 2.3.1 chapter 5 with the following update from the Portable Interceptors
-specification:</li>
-
-	<ul>
-	<li>
-	5.5.2 <TT>StringSeq</TT> and <TT>WStringSeq</TT> are required. This adds the 
-following 
-	classes
-	to <TT>org.omg.CORBA</TT>:</li>
-
-	<ul>
-	<li>
-	<TT>StringSeqHolder</TT></li>
-
-	<li>
-	<TT>StringSeqHelper</TT></li>
-
-	<li>
-	<TT>WStringSeqHolder</TT></li>
-
-	<li>
-	<TT>WStringSeqHelper</TT></li>
-	</ul>
-</ul>
+specification:
+ <ul>
+  <li>
+  5.5.2 <TT>StringSeq</TT> and <TT>WStringSeq</TT> are required. 
+  This adds the following classes to <TT>org.omg.CORBA</TT>:
+    <ul>
+    <li><TT>StringSeqHolder</TT></li>
+    <li><TT>StringSeqHelper</TT></li>
+    <li><TT>WStringSeqHolder</TT></li>
+    <li><TT>WStringSeqHelper</TT></li>
+    </ul>
+  </li>
+ </ul>
+</li>
 
 <li>
 CORBA 2.3.1 sections 10.6.1 and 10.6.2 are supported for repository IDs.</li>
@@ -101,18 +87,13 @@
 CORBA 2.3.1 section 10.7 for <TT>TypeCode</TT> APIs.</li>
 
 <li>
-CORBA 2.3.1 chapter 11, Portable Object Adapter (POA), with the following updates from the Portable Interceptors specification:</li>
-
-<ul>
-<li>
-Section 11.3.7 POAs must preserve all policies</li>
-
-<li>
-Section 11.3.8.2 again states that POAs must preserve all policies</li>
-
-<li>
-Section 11.3.8.26 <tt>POA::id</tt> is required.</li>
-</ul>
+CORBA 2.3.1 chapter 11, Portable Object Adapter (POA), with the following updates from the Portable Interceptors specification:
+  <ul>
+  <li>Section 11.3.7 POAs must preserve all policies</li>
+  <li>Section 11.3.8.2 again states that POAs must preserve all policies</li>
+  <li>Section 11.3.8.26 <tt>POA::id</tt> is required.</li>
+  </ul>
+</li>
 
 <li>
 CORBA 2.3.1 chapters 13 and 15 define GIOP 1.0, 1.1, and 1.2. The Java SE 6
@@ -124,8 +105,7 @@
 
 <li>
 Portable Interceptors section 13.8 (the new <TT>Coder</TT>/<TT>Decoder</TT> interfaces) 
-and
-all of chapter 21 (the interceptor specification).</li>
+and all of chapter 21 (the interceptor specification).</li>
 
 <li>Section 1.21.8 of the Revised IDL to Java Language Mapping Specification (ptc/00-11-03) 
 has been changed from the version in the  IDL to Java Language Mapping Specification (ptc/00-01-08).</li>
@@ -135,40 +115,24 @@
 Tools</h2>
 
 <ul>
-<li>
-The IDL to Java compiler (<TT>idlj</TT>) complies with:</li>
+<li>The IDL to Java compiler (<TT>idlj</TT>) complies with:
+  <ul>
+  <li>CORBA 2.3.1 chapter 3 (IDL definition)</li>
+  <li>CORBA 2.3.1 chapters 5 and 6 (semantics of Value types)</li>
+  <li>CORBA 2.3.1 section 10.6.5 (pragmas)</li>
+  <li>The IDL to Java mapping specification</li>
+  <li>The Revised IDL to Java language mapping specification section 1.12.1 "local interfaces"</li>
+  </ul>
+</li>
 
-<ul>
-<li>
-CORBA 2.3.1 chapter 3 (IDL definition)</li>
-
-<li>
-CORBA 2.3.1 chapters 5 and 6 (semantics of Value types)</li>
-
-<li>
-CORBA 2.3.1 section 10.6.5 (pragmas)</li>
-
-<li>
-The IDL to Java mapping specification</li>
-
-<li>
-The Revised IDL to Java language mapping specification section 1.12.1 "local interfaces"</li>
-</ul>
-
-<li>
-The Java to IDL compiler (the IIOP backend for <tt>rmic</tt>) complies with:</li>
-
-<ul>
-<li>
-CORBA 2.3.1 chapters 5 and 6 (value types)</li>
-
-<li>
-The Java to IDL language mapping. Note that this implicitly references
-section 1.21 of the IDL to Java language mapping</li>
-
-<li>
-IDL generated by the <tt>-idl</tt> flag complies with CORBA 2.3.1 chapter 3.</li>
-</ul>
+<li>The Java to IDL compiler (the IIOP backend for <tt>rmic</tt>) complies with:
+  <ul>
+  <li>CORBA 2.3.1 chapters 5 and 6 (value types)</li>
+  <li>The Java to IDL language mapping. Note that this implicitly references
+      section 1.21 of the IDL to Java language mapping</li>
+  <li>IDL generated by the <tt>-idl</tt> flag complies with CORBA 2.3.1 chapter 3.</li>
+  </ul>
+</li>
 </ul>
 
 </body>
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html b/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html
index d63460d..fdc02ae 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html
@@ -8,65 +8,101 @@
 
 <H1>IDL-to-Java Generated Files</H1>
 
-<P>The files that are generated by the IDL-to-Java compiler, in accordance with the <em><a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">IDL-to-Java Language Mapping Specification</a></em>, which is implemented in Java<sup><font size="-2">TM</font></sup> SE 6 according the <a href="compliance.html">compliance</a> document.
+<P>The files that are generated by the IDL-to-Java compiler, in accordance with 
+the <em><a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">IDL-to-Java Language Mapping Specification</a></em>,
+which is implemented in Java<sup><font size="-2">TM</font></sup> SE 6 
+according the <a href="compliance.html">compliance</a> document.
 
 
-<P>In general IDL names and identifiers are mapped to Java names and identifiers with no change. Because of the nature of the Java language, a single IDL construct may be mapped to several (differently named) Java constructs. The  additional  names are constructed by appending a descriptive suffix. For example, the IDL interface <tt>foo</tt> is mapped to the Java interfaces <tt>foo</tt> and <tt>fooOperations</tt>, and additional Java classes <tt>fooHelper</tt>, <tt>fooHolder</tt>, <tt>fooPOA</tt>, and optionally <tt>fooPOATie</tt>. 
+<P>In general IDL names and identifiers are mapped to Java names 
+and identifiers with no change. Because of the nature of the Java language,
+a single IDL construct may be mapped to several (differently named) Java constructs.
+The additional names are constructed by appending a descriptive suffix.
+For example, the IDL interface <tt>foo</tt> is mapped to the Java
+interfaces <tt>foo</tt> and <tt>fooOperations</tt>, and additional
+Java classes <tt>fooHelper</tt>, <tt>fooHolder</tt>, <tt>fooPOA</tt>,
+and optionally <tt>fooPOATie</tt>.
 
 
 
-<P>The mapping in effect reserves the use of several names for its own purposes. These are: 
-<P>
+<P>The mapping in effect reserves the use of several names for its own purposes. These are:
 <UL>
-<LI>The Java class <tt><a href="#helper">&lt;type&gt;Helper</tt></a>, where <tt>&lt;type&gt;</tt> is the name of an IDL defined type. 
-<LI>The Java class <tt><a href="#holder">&lt;type&gt;Holder</tt></a>, where <tt>&lt;type&gt;</tt> is the name of an IDL defined type (with certain exceptions such as <tt>typedef</tt> aliases).
-<LI>The Java classes <tt>&lt;basicJavaType&gt;Holder</tt>, where <tt>&lt;basicJavaType&gt;</tt> is one of the Java primitive datatypes that is used by one of the IDL basic datatypes. 
-<LI>The Java classes <tt><a href="#operations">&lt;interface&gt;Operations</tt></a>, <tt>&lt;interface&gt;POA</tt>, and <tt>&lt;interface&gt;POATie</tt>, where <tt>&lt;interface&gt;</tt> is the name of an IDL interface type. 
-<LI>The nested scope Java package name <tt>&lt;interface&gt;Package</tt>, where <tt>&lt;interface&gt;</tt> is the name of an IDL interface.
+<LI>The Java class <a href="#helper"><tt>&lt;type&gt;Helper</tt></a>, where <tt>&lt;type&gt;</tt> is the name of an IDL defined type.
+<LI>The Java class <a href="#holder"><tt>&lt;type&gt;Holder</tt></a>, where <tt>&lt;type&gt;</tt>
+is the name of an IDL defined type (with certain exceptions such as <tt>typedef</tt> aliases).
+<LI>The Java classes <tt>&lt;basicJavaType&gt;Holder</tt>, where <tt>&lt;basicJavaType&gt;</tt>
+is one of the Java primitive datatypes that is used by one of the IDL basic datatypes.
+<LI>The Java classes <a href="#operations"><tt>&lt;interface&gt;Operations</tt></a>, <tt>&lt;interface&gt;POA</tt>,
+and <tt>&lt;interface&gt;POATie</tt>, where <tt>&lt;interface&gt;</tt> is the name of an IDL interface type.
+<LI>The nested scope Java package name <tt>&lt;interface&gt;Package</tt>, where <tt>&lt;interface&gt;</tt>
+is the name of an IDL interface.
+</UL>
 
 
-<a name="helper">
-<H2>Helper Files</H2></a>
-<P>
-Helper files supply several static methods needed to manipulate the type. These include <tt>Any</tt> insert and extract operations for the type, getting the repository id, getting the typecode, and reading and writing the type from and to a stream. 
+<H2><a name="helper">Helper Files</a></H2>
 
-<P>The helper class for a mapped IDL interface or abstract interface also include narrow operation(s). The static narrow method allows an <tt>org.omg.CORBA.Object</tt> to be narrowed to the object reference of a more specific type. The IDL exception <tt>CORBA::BAD_PARAM</tt> is thrown if the narrow fails because the object reference does not support the requested type. A different system exception is raised to indicate other kinds of errors. Trying to narrow a null will always succeed with a return value of null.
+<P>Helper files supply several static methods needed to manipulate the type.
+These include <tt>Any</tt> insert and extract operations for the type,
+getting the repository id, getting the typecode, and reading
+and writing the type from and to a stream.
+
+<P>The helper class for a mapped IDL interface or abstract interface also
+include narrow operation(s). The static narrow method allows an <tt>org.omg.CORBA.Object</tt>
+to be narrowed to the object reference of a more specific type.
+The IDL exception <tt>CORBA::BAD_PARAM</tt> is thrown if the narrow fails because
+the object reference does not support the requested type. A different system exception
+is raised to indicate other kinds of errors. Trying to narrow a null will always succeed with a return value of null.
+
+<H2><a name="holder">Holder Files</a></H2>
+
+<P>Support for out and inout parameter passing modes requires the use of additional holder classes.
+These classes are available for all of the basic IDL datatypes in the <tt>org.omg.CORBA</tt> package
+and are generated for all named user defined IDL types except those defined by typedefs.
+(Note that in this context user defined includes types that are defined in OMG specifications
+such as those for the Interface Repository, and other OMG services.)
+
+<P>Each holder class has a constructor from an instance, a default constructor, and has
+a public instance member, <tt>value</tt> which is the typed value. The default constructor
+sets the value field to the default value for the type as defined by the Java language:
+false for boolean, 0 for numeric and char types, null for strings, null for object references.
+
+<P>To support portable stubs and skeletons, holder classes also implement
+the <tt>org.omg.CORBA.portable.Streamable</tt> interface.
 
 
+<H2><a name="operations">Operations Files</a></H2>
 
-<P>
+<P>A non abstract IDL interface is mapped to two public Java interfaces:
+a <em>signature</em> interface and an <em>operations</em> interface.
+The signature interface, which extends <tt>IDLEntity</tt>, has the same
+name as the IDL interface name and is used as the signature type in method declarations
+when interfaces of the specified type are used in other interfaces.
+The operations interface has the same name as the IDL interface with the suffix <tt>Operations</tt>
+appended to the end and is used in the server-side mapping and as a mechanism
+for providing optimized calls for collocated client and servers.
+
+<P>The Java operations interface contains the mapped operation signatures.
+The Java signature interface extends the operations interface,
+the (mapped) base <tt>org.omg.CORBA.Object</tt>, as well as <tt>org.omg.portable.IDLEntity</tt>.
+Methods can be invoked on the signature interface. Interface inheritance
+expressed in IDL is reflected in both the Java signature interface and operations interface hierarchies.
 
 
-<a name="holder">
-<H2>Holder Files</H2></a>
-<P>
-Support for out and inout parameter passing modes requires the use of additional  holder  classes. These classes are available for all of the basic IDL datatypes in the <tt>org.omg.CORBA</tt> package and are generated for all named user defined IDL types except those defined by typedefs. (Note that in this context user defined includes types that are defined in OMG specifications such as those for the Interface Repository, and other OMG services.) 
+<H2><a name="stub">Stubs</a></H2>
 
-
-<P>Each holder class has a constructor from an instance, a default constructor, and has a public instance member, <tt>value</tt> which is the typed value. The default constructor sets the value field to the default value for the type as defined by the Java language: false for boolean, 0 for numeric and char types, null for strings, null for object references.
-
-<P>To support portable stubs and skeletons, holder classes also implement the <tt>org.omg.CORBA.portable.Streamable</tt> interface.
-
-
-<a name="operations">
-<H2>Operations Files</H2></a>
-<P>
-A non abstract IDL interface is mapped to two public Java interfaces: a <em>signature</em> interface and an <em>operations</em> interface. The signature interface, which extends <tt>IDLEntity</tt>, has the same name as the IDL interface name and is used as the signature type in method declarations when interfaces of the specified type are used in other interfaces. The operations interface has the same name as the IDL interface with the suffix <tt>Operations</tt> appended to the end and is used in the server-side mapping and as a mechanism for providing optimized calls for collocated client and servers.
-
-<P>The Java operations interface contains the mapped operation signatures. The Java signature interface extends the operations interface, the (mapped) base <tt>org.omg.CORBA.Object</tt>, as well as <tt>org.omg.portable.IDLEntity</tt>. Methods can be invoked on the signature interface. Interface inheritance expressed in IDL is reflected in both the Java signature interface and operations interface hierarchies.
-
-
-
-
-<a name="stub">
-<H2>Stubs</H2></a>
-<P>For the mapping of a non-object-oriented language, there will be a programming interface to the stubs for each interface type. Generally, the stubs will present access to the OMG IDL-defined operations on an object in a way that is easy for programmers to predict once they are familiar with OMG IDL and the language mapping for the particular programming language. The stubs make calls on the rest of the ORB using interfaces that are private to, and presumably optimized for, the particular ORB Core. If more than one ORB is available, there may be different stubs corresponding to the different ORBs. In this case, it is necessary for the ORB and language mapping to cooperate to associate the correct stubs with the particular object reference. 
+<P>For the mapping of a non-object-oriented language, there will be
+a programming interface to the stubs for each interface type. Generally, the stubs
+will present access to the OMG IDL-defined operations on an object in a way that is easy
+for programmers to predict once they are familiar with OMG IDL and the language mapping
+for the particular programming language. The stubs make calls on the rest of the ORB
+using interfaces that are private to, and presumably optimized for, the particular ORB Core.
+If more than one ORB is available, there may be different stubs corresponding to the different ORBs.
+In this case, it is necessary for the ORB and language mapping to cooperate to associate
+the correct stubs with the particular object reference.
 
 <P>Object-oriented programming languages, such as Java, C++, and Smalltalk, do not require stub interfaces.
-<P><P><BR><BR>
 
-
-
+<BR><BR>
 
 </body>
 </html>
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/package.html b/corba/src/java.corba/share/classes/org/omg/CORBA/package.html
index 437b848..2d28793 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/package.html
@@ -6,7 +6,7 @@
    <TITLE>package</TITLE>
 <!--
 /*
-* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -73,7 +73,6 @@
 <TT>ORB</TT> Methods</H3>
 
 <P>Before an application can enter the CORBA environment, it must first: 
-<P>
 <UL>
 <LI>Be initialized into the ORB and possibly the object adapter (POA) environments.
 <LI>Get references to ORB object (for use in future ORB operations) 
@@ -81,7 +80,6 @@
 </UL>
 <P>The following operations are provided to initialize applications and obtain
  the appropriate object references:
- <P>
  <UL>
  <LI>Operations providing access to the ORB, which are discussed in this
  section.
@@ -107,13 +105,13 @@
  that provide access to the ORB:
 <UL>
 <LI>
-<TT><bold>init</bold>()</TT> 
+<TT><b>init</b>()</TT>
 
 <LI>
-<TT><bold>init</bold>(String [] args, Properties props)</TT>
+<TT><b>init</b>(String [] args, Properties props)</TT>
 
 <LI>
-<TT><bold>init</bold>(Applet app, Properties props)</TT>
+<TT><b>init</b>(Applet app, Properties props)</TT>
 </UL>
 
 <P>Using the <tt>init()</tt> method without parameters initiates 
@@ -142,11 +140,11 @@
 resolve initial object references.  These are:
 <UL>
 <LI>
-<TT><bold>resolve_initial_references</bold>(String name)</TT>
+<TT><b>resolve_initial_references</b>(String name)</TT>
 <LI>
-<TT><bold>list_initial_services</bold>()</TT>
+<TT><b>list_initial_services</b>()</TT>
 <LI>
-<TT><bold>register_initial_reference</bold>(String id, 
+<TT><b>register_initial_reference</b>(String id, 
 org.omg.CORBA.Object obj)</TT>
 </UL>
 
@@ -278,7 +276,6 @@
 
 
 <P>Each holder class has:
-<P>
 <UL>
 <LI>a constructor from an instance
 <LI>a default constructor
@@ -291,7 +288,6 @@
 
 <P>The default constructor sets the value field to the default value for the 
 type as defined by the Java language: 
-<P>
 <UL>
 <LI><tt>false</tt> for boolean
 <LI><tt>0</tt> for numeric and char types
@@ -391,7 +387,6 @@
 <h2>Helper Classes </h2>
 <P>Helper files supply several static methods needed to manipulate the type.
  These include:
- <P>
  <UL>
  <LI><tt>Any</tt> insert and extract operations for the type
  <LI>getting the repository id
@@ -455,14 +450,13 @@
 <P>The <A HREF="{@docRoot}/../technotes/guides/idl/jidlExample.html"><em>Hello World</em></A> 
 tutorial uses a <tt>narrow</tt> method that looks 
 like this:
-<P>
 <PRE>
         // create and initialize the ORB
-	ORB orb = ORB.init(args, null);
+        ORB orb = ORB.init(args, null);
 
         // get the root naming context
         org.omg.CORBA.Object objRef = 
-	    orb.resolve_initial_references("NameService");
+            orb.resolve_initial_references("NameService");
         // Use NamingContextExt instead of NamingContext. This is 
         // part of latest Inter-Operable naming Service.  
         NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
@@ -554,7 +548,6 @@
 
 }
 </PRE>
-<P>
 
 <h3>Value Type Helper Classes</h3>
 A helper class for a value type includes different renderings of
@@ -844,7 +837,7 @@
 interfaces have been included for the purpose of creating typecodes (see
 create_value_tc, create_struct_tc, create_union_tc and create_exception_tc
 methods in interface org.omg.CORBA.ORB):
-<BR>&nbs
+<BR>&nbsp;
 <UL>
 <LI>
 IRObject
@@ -893,20 +886,19 @@
 <P>Some of the API included in <TT>org.omg</TT> subpackages throw 
 <tt>NO_IMPLEMENT</tt> exceptions for various reasons.  Among these reasons
 are:
-<P>
-	<UL>
-	<LI>In some cases, for example <tt>LocalObject</tt>, the complete
-	implementation according to the specification indicates that 
-	these API should throw <tt>NO_IMPLEMENT</tt>.
-	<P>
-	<LI>In most cases, for example methods in <tt>ORB.java</tt>, 
-	methods that throw  
-	<tt>NO_IMPLEMENT</tt> are actually implemented in subclasses
-	elsewhere in the ORB code.
-	<P>
-	<LI>In some cases, for example <tt>_get_interface_def()</tt> 
-	and <tt>_get_interface</tt>, API are really not yet implemented.
-	</UL>
+    <UL>
+    <LI>In some cases, for example <tt>LocalObject</tt>, the complete
+    implementation according to the specification indicates that 
+    these API should throw <tt>NO_IMPLEMENT</tt>.
+
+    <LI>In most cases, for example methods in <tt>ORB.java</tt>, 
+    methods that throw  
+    <tt>NO_IMPLEMENT</tt> are actually implemented in subclasses
+    elsewhere in the ORB code.
+
+    <LI>In some cases, for example <tt>_get_interface_def()</tt> 
+    and <tt>_get_interface</tt>, API are really not yet implemented.
+    </UL>
 
 
 
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/portable/InvokeHandler.java b/corba/src/java.corba/share/classes/org/omg/CORBA/portable/InvokeHandler.java
index 158ba40..b626a5c 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/portable/InvokeHandler.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/portable/InvokeHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,7 +56,7 @@
      * <p>5. Marshal reply into OutputStream returned by
      *    ResponseHandler.
      * <p>6. Return OutputStream to ORB.
-     * <p>
+     *
      * @param method The method name.
      * @param input The <code>InputStream</code> containing the marshalled arguments.
      * @param handler The <code>ResponseHandler</code> which the servant uses
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html b/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html
index 445b78d..c8f6b33 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
 This code is free software; you can redistribute it and/or modify it
@@ -46,57 +46,51 @@
 can override them to provide real implementations.  The ORB included in
 Sun's release of the Java[tm] Platform, Standard Edition 6, includes 
 implementations for the following methods.
-<p>
+
 <h2>List of Unimplemented Features in Package
 <code>org.omg.CORBA.portable</code></h2>
-<p>
+
 <h3>Unimplemented Interfaces in package <code>org.omg.CORBA.portable</code></h3>
   <ul>
-<code>
-    <li>InvokeHandler
-    <li>ResponseHandler
-</code>
+    <li><code>InvokeHandler</code>
+    <li><code>ResponseHandler</code>
   </ul>
-<p>
+
 <h3>Unimplemented Methods in package <code>org.omg.CORBA.portable</code></h3>
 <ul>
-<code>
-<li>InputStream
+<li><code>InputStream</code>
   <ul>
-    <li>public int read()
-    <li>public.math.BigDecimal read_fixed()
-    <li>public org.omg.CORBA.Context read_Context() 
-    <li>public  org.omg.CORBA.Object read_Object(java.lang.Class clz)
-    <li>public org.omg.CORBA.ORB orb() 
+    <li><code>public int read()</code>
+    <li><code>public.math.BigDecimal read_fixed()</code>
+    <li><code>public org.omg.CORBA.Context read_Context()</code>
+    <li><code>public  org.omg.CORBA.Object read_Object(java.lang.Class clz)</code>
+    <li><code>public org.omg.CORBA.ORB orb()</code>
   </ul>
-<li>OutputStream
+<li><code>OutputStream</code>
   <ul>
-    <li>public org.omg.CORBA.ORB orb()
-    <li>public void write_Context(org.omg.CORBA.Context ctx,
-			      org.omg.CORBA.ContextList contexts) 
-    <li>public void write_fixed(java.math.BigDecimal value) 
-    <li>public void write(int b) 
+    <li><code>public org.omg.CORBA.ORB orb()</code>
+    <li><code>public void write_Context(org.omg.CORBA.Context ctx,
+        org.omg.CORBA.ContextList contexts)</code>
+    <li><code>public void write_fixed(java.math.BigDecimal value)</code>
+    <li><code>public void write(int b)</code>
   </ul>
-<li>Delegate
+<li><code>Delegate</code>
   <ul>
-    <li>public void releaseReply(org.omg.CORBA.Object self, InputStream input)
-    <li>public InputStream invoke(org.omg.CORBA.Object self, OutputStream output)
-    <li>public OutputStream request(org.omg.CORBA.Object self, String operation,
-				 boolean responseExpected)
-    <li>public org.omg.CORBA.Object set_policy_override(org.omg.CORBA.Object self,
+    <li><code>public void releaseReply(org.omg.CORBA.Object self, InputStream input)</code>
+    <li><code>public InputStream invoke(org.omgl.CORBA.Object self, OutputStream output)</code>
+    <li><code>public OutputStream request(org.omg.CORBA.Object self, String operation,
+        boolean responseExpected)</code>
+    <li><code>public org.omg.CORBA.Object set_policy_override(org.omg.CORBA.Object self,
                                         org.omg.CORBA.Policy[] policies,
-                                        org.omg.CORBA.SetOverrideType set_add)
-    <li>public org.omg.CORBA.DomainManager[] get_domain_managers(
-                                                org.omg.CORBA.Object
-						self)
-    <li>public org.omg.CORBA.Policy get_policy(org.omg.CORBA.Object self,
-                                         int policy_type)
+                                        org.omg.CORBA.SetOverrideType set_add)</code>
+    <li><code>public org.omg.CORBA.DomainManager[] get_domain_managers(
+                                                org.omg.CORBA.Objectself)</code>
+    <li><code>public org.omg.CORBA.Policy get_policy(org.omg.CORBA.Object self,
+                                         int policy_type)</code>
   </ul>
-</code>
 </ul>
 
 @since JDK1.2
 @serial exclude
 </body>
 </html>
-
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html b/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html
index 53d923b..c1869b1 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html
@@ -6,7 +6,7 @@
    <title>package</title>
 <!--
 /*
-* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -43,23 +43,21 @@
  
 <P>For a precise list of supported sections of official specifications with which 
 the Java[tm] Platform, Standard Edition 6, ORB complies, see <A 
-HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
 support in Java[tm] SE 6</A>.
 <P>
 <a name="unimpl"></a>
 The following methods in the abstract class 
 <code>org.omg.CORBA_2_3.ORB</code> are unimplemented:
 <UL>
-  <code>
-  <LI>public org.omg.CORBA.portable.ValueFactory 
-  <b>register_value_factory(String id, org.omg.CORBA.portable.ValueFactory 
-factory)</b>
-  <LI>public void <b>unregister_value_factory(String id)</b>
-  <LI>public org.omg.CORBA.portable.ValueFactory 
-  <b>lookup_value_factory(String id)</b>
-  <LI>public org.omg.CORBA.Object <b>get_value_def(String repid)</b>
-  <LI>public void <b>set_delegate(java.lang.Object wrapper)</b>
-  </code>
+  <LI><code>public org.omg.CORBA.portable.ValueFactory 
+  <b>register_value_factory(String id, org.omg.CORBA.portable.ValueFactory
+     factory)</b></code>
+  <LI><code>public void <b>unregister_value_factory(String id)</b></code>
+  <LI><code>public org.omg.CORBA.portable.ValueFactory 
+  <b>lookup_value_factory(String id)</b></code>
+  <LI><code>public org.omg.CORBA.Object <b>get_value_def(String repid)</b></code>
+  <LI><code>public void <b>set_delegate(java.lang.Object wrapper)</b></code>
 </UL>
 @since JDK 1.3
 <br>
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java b/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java
index 90d9ea6..dd32dfd 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java
@@ -77,7 +77,7 @@
      *
      * throw SecurityException if SecurityManager is installed and
      * enableSubclassImplementation SerializablePermission
-     * is not granted or jdk.corba.allowOutputStreamSubclass system
+     * is not granted or jdk.corba.allowInputStreamSubclass system
      * property is either not set or is set to 'false'
      */
     public InputStream() {
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/package.html b/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/package.html
index 5607754..6b3f430 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
 /*
-* Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */
-
 -->
 
 </head>
@@ -34,7 +33,7 @@
 
  Provides methods for the input and output of value types, and contains 
  other updates to the <code>org/omg/CORBA/portable</code> package.
-<p>
+
 @since 1.3
 @serial exclude
 </body>
diff --git a/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html b/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html
index 1d5e960..4f4284c 100644
--- a/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
 /*
-* Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+* 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
@@ -32,21 +32,20 @@
 <body bgcolor="white">
 <P>This package contains the following classes, which are used in 
 <tt>org.omg.CosNaming.NamingContextExt</tt>:
-<P>
 <UL>
-<LI><tt>AddressHelper</tt>
+ <LI><tt>AddressHelper</tt>
  <LI><tt>StringNameHelper</tt>
  <LI><tt>URLStringHelper</tt>
  <LI><tt>InvalidAddress</tt>
-
+</UL>
 
 <H3>Package Specification</H3>
- 
+
 <P>For a precise list of supported sections of official specifications with which 
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextPackage/package.html b/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextPackage/package.html
index 2d699e0..ded3092 100644
--- a/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextPackage/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextPackage/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
 /*
-* Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+* 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
@@ -32,7 +32,6 @@
 <body bgcolor="white">
 <P>This package contains Exception classes for the <tt>org.omg.CosNaming</tt>
  package.  The list  of exception classes are:
- <P>
  <UL>
   <LI><tt>AlreadyBound</tt>
   <LI><tt>CannotProceed</tt>
@@ -40,6 +39,7 @@
   <LI><tt>NotEmpty</tt>
   <LI><tt>NotFound</tt>
   <LI><tt>NotFoundReason</tt>
+ </UL>
 
 
 <H3>Package Specification</H3>
@@ -48,7 +48,7 @@
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/CosNaming/nameservice.idl b/corba/src/java.corba/share/classes/org/omg/CosNaming/nameservice.idl
index 9e5ec9b..ff43e32 100644
--- a/corba/src/java.corba/share/classes/org/omg/CosNaming/nameservice.idl
+++ b/corba/src/java.corba/share/classes/org/omg/CosNaming/nameservice.idl
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,12 +64,12 @@
     Istring id;
     Istring kind;
   };
-    
+
   /**
    * A name is a sequence of name components.
    */
   typedef sequence <NameComponent> Name;
-    
+
   /**
    * Specifies whether the given binding is for a object (that is not a
    * naming context) or for a naming context.
@@ -79,7 +79,7 @@
     nobject, 	// name is bound to an object
     ncontext	// name is bound to a naming context
   };
-    
+
   /**
    * A name-to-object association is called a Binding.
    */
@@ -89,12 +89,12 @@
     BindingType binding_type;	// whether name is bound to an object
                                 //  or a naming context
   };
-    
+
   /**
    * List of Bindings.
    */
-  typedef sequence <Binding> BindingList;    
-    
+  typedef sequence <Binding> BindingList;
+
   /**
    * The BindingIterator interface allows a client to iterate through
    * the bindings using the next_one or next_n operations.
@@ -112,24 +112,24 @@
      * @param b the returned binding
      */ 
     boolean next_one(out Binding b);
-    
+
     /**
      * This operation returns at most the requested number of bindings.
      * 
-     * @param how_many the maximum number of bindings tro return <p>
+     * @param how_many the maximum number of bindings to return
      * 
      * @param bl the returned bindings
      */ 
     boolean next_n(in unsigned long how_many, 
-		   out BindingList bl);
-        
+                   out BindingList bl);
+
     // Destroy binding iterator
     /**
      * This operation destroys the iterator.
      */ 
     void destroy();
   };
-    
+
 /** 
  * A naming context is an object that contains a set of name bindings in 
  * which each name is unique. Different names can be bound to an object 
@@ -151,7 +151,7 @@
             not_context, 
             not_object 
         };
-        
+
 /** 
  * Indicates the name does not identify a binding.
  */
@@ -160,7 +160,7 @@
             NotFoundReason why;
             Name rest_of_name;
         };
-    
+
 /**
  * Indicates that the implementation has given up for some reason.
  * The client, however, may be able to continue the operation at the
@@ -171,130 +171,130 @@
             NamingContext cxt;
             Name rest_of_name;
         };
-                                         
+
 /** 
  * Indicates the name is invalid. 
  */
         exception InvalidName 
-        {};                        
-    
+        {};
+
 /**
  * Indicates an object is already bound to the specified name. Only
  * one object can be bound to a particular name in a context. 
  */
         exception AlreadyBound 
         {};
-    
+
 /**
  * Indicates that the Naming Context contains bindings.
  */
         exception NotEmpty 
         {};
-    
+
 /**
  * Creates a binding of a name and an object in the naming context.
  * Naming contexts that are bound using bind do not participate in name
  * resolution when compound names are passed to be resolved. 
  * 
- * @param n Name of the object <p>
+ * @param n Name of the object.
  * 
- * @param obj The Object to bind with the given name<p>
+ * @param obj The Object to bind with the given name.
  * 
  * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates
- * the name does not identify a binding.<p>
+ * the name does not identify a binding.
  * 
  * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed 
  * Indicates that the implementation has given up for some reason.
  * The client, however, may be able to continue the operation
- * at the returned naming context.<p>
+ * at the returned naming context.
  * 
  * @exception org.omg.CosNaming.NamingContextPackage.InvalidName 
- * Indicates that the name is invalid. <p>
+ * Indicates that the name is invalid.
  *
  * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound 
- * Indicates an object is already bound to the specified name.<p> 
+ * Indicates an object is already bound to the specified name.
  */ 
         void bind(in Name n, 
-	      in Object obj)
+                  in Object obj)
         raises(NotFound, 
-	     CannotProceed, 
-	     InvalidName, 
-	     AlreadyBound);
-    
+               CannotProceed, 
+               InvalidName, 
+               AlreadyBound);
+
 /**
  * Names an object that is a naming context. Naming contexts that
  * are bound using bind_context() participate in name resolution 
  * when compound names are passed to be resolved.
  * 
- * @param n Name of the object <p>
+ * @param n Name of the object.
  * 
- * @param nc NamingContect object to bind with the given name <p>
+ * @param nc NamingContect object to bind with the given name.
  * 
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.<p>
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.
  * 
  * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
  * given up for some reason. The client, however, may be able to 
- * continue the operation at the returned naming context.<p>
+ * continue the operation at the returned naming context.
  * 
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. <p>
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid.
  *
  * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound Indicates an object is already 
- * bound to the specified name.<p>
+ * bound to the specified name.
  */ 
     void bind_context(in Name n, 
-		      in NamingContext nc)
+                      in NamingContext nc)
       raises(NotFound, 
-	     CannotProceed, 
-	     InvalidName, 
-	     AlreadyBound);
-    
+             CannotProceed, 
+             InvalidName, 
+             AlreadyBound);
+
 /**
  * Creates a binding of a name and an object in the naming context
  * even if the name is already bound in the context. Naming contexts 
  * that are bound using rebind do not participate in name resolution 
  * when compound names are passed to be resolved.
  * 
- * @param  n Name of the object <p>
+ * @param  n Name of the object.
  * 
- * @param obj The Object to rebind with the given name <p>
+ * @param obj The Object to rebind with the given name.
  * 
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.<p>
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.
  * 
  * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
  * given up for some reason. The client, however, may be able to 
- * continue the operation at the returned naming context.<p>
+ * continue the operation at the returned naming context.
  * 
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. <p>
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid.
  */ 
     void rebind(in Name n, 
-		in Object obj)
+                in Object obj)
       raises(NotFound, 
-	     CannotProceed, 
-	     InvalidName);
-    
+             CannotProceed, 
+             InvalidName);
+
 /** 
  * Creates a binding of a name and a naming context in the naming
  * context even if the name is already bound in the context. Naming 
  * contexts that are bound using rebind_context() participate in name 
  * resolution when compound names are passed to be resolved.
  * 
- * @param n Name of the object <p>
+ * @param n Name of the object.
  * 
- * @param nc NamingContect object to rebind with the given name <p>
+ * @param nc NamingContect object to rebind with the given name.
  * 
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.<p>
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.
  * 
  * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
  * given up for some reason. The client, however, may be able to 
- * continue the operation at the returned naming context.<p>
+ * continue the operation at the returned naming context.
  * 
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. <p>
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid.
  */ 
     void rebind_context(in Name n, 
-			in NamingContext nc)
+                        in NamingContext nc)
       raises(NotFound, 
-	     CannotProceed, 
-	     InvalidName);
+             CannotProceed, 
+             InvalidName);
 
 /** 
  * The resolve operation is the process of retrieving an object
@@ -304,39 +304,39 @@
  * to the appropriate type. That is, clients typically cast the returned 
  * object from Object to a more specialized interface.
  * 
- * @param n Name of the object <p>
+ * @param n Name of the object.
  * 
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.<p>
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.
  * 
  * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
  * given up for some reason. The client, however, may be able to 
- * continue the operation at the returned naming context.<p>
+ * continue the operation at the returned naming context.
  * 
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. <p>
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid.
  */ 
     Object resolve(in Name n)
       raises(NotFound, 
-	     CannotProceed, 
-	     InvalidName);
-    
+             CannotProceed, 
+             InvalidName);
+
 /** 
  * The unbind operation removes a name binding from a context.
  * 
- * @param n Name of the object <p>
+ * @param n Name of the object.
  * 
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.<p>
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.
  * 
  * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
  * given up for some reason. The client, however, may be able to 
- * continue the operation at the returned naming context.<p>
+ * continue the operation at the returned naming context.
  * 
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. <p>
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid.
  */ 
     void unbind(in Name n)
       raises(NotFound, 
-	     CannotProceed, 
-	     InvalidName);
-    
+             CannotProceed, 
+             InvalidName);
+
 /**
  * The list operation allows a client to iterate through a set of
  * bindings in a naming context. <p>
@@ -351,15 +351,15 @@
  * bindings, the binding iterator is a nil object reference.
  * </ul>
  * 
- * @param how_many the maximum number of bindings to return <p>
+ * @param how_many the maximum number of bindings to return.
  * 
- * @param bl the returned list of bindings <p>
+ * @param bl the returned list of bindings.
  * 
- * @param bi the returned binding iterator <p>
+ * @param bi the returned binding iterator.
  */ 
     void list(in unsigned long how_many, 
-	      out BindingList bl, 
-	      out BindingIterator bi);
+              out BindingList bl, 
+              out BindingIterator bi);
 
 /**
  * This operation returns a naming context implemented by the same
@@ -367,7 +367,7 @@
  * The new context is not bound to any name.
  */ 
     NamingContext new_context();
-    
+
 /**
  * This operation creates a new context and binds it to the name
  * supplied as an argument. The newly-created context is implemented 
@@ -375,25 +375,25 @@
  * is, the naming server that implements the context denoted by the 
  * name argument excluding the last component).
  * 
- * @param n Name of the object <p>
+ * @param n Name of the object.
  * 
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.<p>
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.
  * 
  * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound Indicates an object is already 
- * bound to the specified name.<p>
+ * bound to the specified name.
  * 
  * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
  * given up for some reason. The client, however, may be able to 
- * continue the operation at the returned naming context.<p>
+ * continue the operation at the returned naming context.
  * 
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. <p>
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid.
  */ 
     NamingContext bind_new_context(in Name n)
       raises(NotFound, 
-	     AlreadyBound, 
-	     CannotProceed, 
-	     InvalidName);
-    
+             AlreadyBound, 
+             CannotProceed, 
+             InvalidName);
+
 /** 
  * The destroy operation deletes a naming context. If the naming 
  * context contains bindings, the NotEmpty exception is raised.
@@ -402,7 +402,7 @@
  */
     void destroy()
       raises(NotEmpty);
-    
+
   };
 
 
@@ -413,7 +413,7 @@
  * part of Interoperable Naming Service.
  * Different names can be bound to an object in the same or different
  * contexts at the same time. Using <tt>NamingContextExt</tt>, you can use
- * URL-based names to bind and resolve. <p>
+ * URL-based names to bind and resolve.
  * 
  * See <a href="http://www.omg.org/technology/documents/formal/naming_service.htm">
  * CORBA COS 
@@ -425,86 +425,84 @@
  * StringName is the Stringified Name, Array of Name Components 
  * represented as a String.
  */
-	typedef string StringName;
+        typedef string StringName;
 
 /**
  * Address is the Host and Port information represented as a String.
  */
-	typedef string Address;
-   
+        typedef string Address;
+
 /**
  * URLString is the URL address (corbaloc: or corbaname:) represented as
  * a String.
  */
-	typedef string URLString;
+        typedef string URLString;
 
 /**
  * This operation creates a stringified name from the array of Name
  * components.
  * 
- * @param n Name of the object <p>
+ * @param n Name of the object.
  * 
  * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.<p>
+ * Indicates the name does not identify a binding.
  * 
  */ 
-	StringName to_string( in Name n ) raises (InvalidName);
+        StringName to_string( in Name n ) raises (InvalidName);
 
 /**
  * This operation  converts a Stringified Name into an  equivalent array
- * of Name Components. 
+ * of Name Components.
  * 
- * @param sn Stringified Name of the object <p>
+ * @param sn Stringified Name of the object.
  * 
  * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.<p>
+ * Indicates the name does not identify a binding.
  * 
  */ 
-	Name to_name( in StringName sn ) raises (InvalidName);
+        Name to_name( in StringName sn ) raises (InvalidName);
 
 
 /** 
  * Indicates the invalid Stringified name for the object, The
  * reason could be invalid syntax. 
  */
-	exception InvalidAddress 
-	{ };
+        exception InvalidAddress 
+        { };
 
 /**
  * This operation creates a URL based "iiopname://" format name
  * from the Stringified Name of the object.
  * 
- * @param addr internet based address of the host machine where  Name Service is running <p>
- * @param sn Stringified Name of the object <p>
+ * @param addr internet based address of the host machine where Name Service is running.
+ * @param sn Stringified Name of the object.
  * 
  * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.<p>
+ * Indicates the name does not identify a binding.
  * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
- * Indicates the internet based address of the host machine is 
- * incorrect <p>
- * 
- */ 
-	URLString to_url( in Address addr, in StringName sn )
-			raises( InvalidAddress, InvalidName );
+ * Indicates the internet based address of the host machine is incorrect
+ */
+        URLString to_url( in Address addr, in StringName sn )
+            raises( InvalidAddress, InvalidName );
 
 
 /**
  * This operation resolves the Stringified name into the object
  * reference. 
  * 
- * @param sn Stringified Name of the object <p>
+ * @param sn Stringified Name of the object.
  * 
  * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * Indicates there is no object reference for the given name. <p>
+ * Indicates there is no object reference for the given name.
  * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * Indicates that the given compound name is incorrect <p>
+ * Indicates that the given compound name is incorrect.
  * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.<p>
+ * Indicates the name does not identify a binding.
  * 
  */ 
-	Object resolve_str( in StringName sn)
-		raises( NotFound, CannotProceed,
-			InvalidName);
+        Object resolve_str( in StringName sn)
+            raises( NotFound, CannotProceed,
+            InvalidName);
 
   };
 
diff --git a/corba/src/java.corba/share/classes/org/omg/CosNaming/package.html b/corba/src/java.corba/share/classes/org/omg/CosNaming/package.html
index a7fca8f..26e027a 100644
--- a/corba/src/java.corba/share/classes/org/omg/CosNaming/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/CosNaming/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
 /*
-* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -32,20 +32,20 @@
 
   Provides a naming service for Java&nbsp;IDL.  The Object Request Broker Daemon
   (ORBD) also includes both a transient and persistent naming service.
-  
+
 
   <P>
   The package and all its classes and interfaces 
   were generated by running the tool <code>idlj</code> on the file
   <code>nameservice.idl</code>, which is a module written in OMG IDL.
-  
+
   <H3>Package Specification</H3>
- 
+
 <P>For a precise list of supported sections of official specifications with which 
 the Java[tm] Platform, Standard Edition 6, ORB complies, see <A 
 HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-  <P>
+
   <H2>Interfaces</H2>
   The package <tt>org.omg.CosNaming</tt> contains two public interfaces
   and several auxiliary classes. 
@@ -62,7 +62,7 @@
   interface supplies the main functionality for the naming service, and
   <code>BindingIterator</code> provides a means of iterating through a list
   of name/object reference bindings.
-  <P>
+
   <H2>Auxiliary Classes</H2>
   In order to map an OMG IDL interface to the Java programming language,
   the idlj compiler creates Java classes that can be thought of
@@ -70,13 +70,13 @@
   Comments for the generated auxiliary classes
   used by the interfaces <code>NamingContext</code> and 
   <code>BindingIterator</code> are included here.
-  <P>
+
   <H3>Classes Used by <code>NamingContext</code> and
   <code>BindingIterator</code></H3>
   The following are classes used by
   the naming service.  (Helper and  holder classes, which are
   generated for each of the classes listed here,  are discussed below.)
- 
+
   <UL>
     <LI><code>public final class <B>NameComponent</B></code> -- 
     a building block for names.  (Names are bound to object references
@@ -89,8 +89,7 @@
     A <code><B>NameComponent</B></code> object consists of two fields:
     <OL>
     <LI><code><B>id</B></code> -- a <code>String</code> used as an identifier
-    <LI><code><B>kind</B></code> -- a <code>String</code> that can be used for 
-any
+    <LI><code><B>kind</B></code> -- a <code>String</code> that can be used for any
     descriptive purpose.  Its importance is that it
     can be used to describe an object without affecting syntax.
     The C programming language, for example, uses the the syntactic convention
@@ -102,16 +101,15 @@
     <code>"c_source"</code>, <code>"object_code"</code>,
     <code>"executable"</code>, 
     <code>"postscript"</code>, and <code>""</code>.  It is not unusual
-	for the <code>kind</code> field to be the empty string.
+    for the <code>kind</code> field to be the empty string.
     </OL>
     <P>
     In a name, each <code>NameComponent</code> object except the last denotes
     a <code>NamingContext</code> object; the last <code>NameComponent</code>
     object denotes the bound object reference.
     This is similar to a path name, in which the last name is the
-    file name, and all names before it are directory names.<p>
-    <P>
-   
+    file name, and all names before it are directory names.
+
     <LI><code>public final class <B>Binding</B></code> -- 
     an object that associates a name with an object reference or a
     naming context.
@@ -125,45 +123,44 @@
     </OL>
     <P>
     The interface <code>NamingContext</code> has methods for
-	binding/unbinding names with object references or naming contexts,
-	for listing bindings,
+    binding/unbinding names with object references or naming contexts,
+    for listing bindings,
     and for resolving bindings (given a name, the method
     <code>resolve</code> returns the object reference bound to it).
-   
-  <P>
-  <LI><code>public final class <B>BindingType</B></code> --
+
+    <LI><code>public final class <B>BindingType</B></code> --
     an object that specifies whether the given <code>Binding</code>
     object is a binding between a name and an object reference (that is,
     not a naming context) or between a name and a naming context.
     <P>
     The class<code>BindingType</code> consists of two methods and
-	four constants. Two of these constants are
-	<code>BindingType</code> objects, and two are <code>int</code>s.
-	<P>
-	The <code>BindingType</code> objects
+    four constants. Two of these constants are
+    <code>BindingType</code> objects, and two are <code>int</code>s.
+    <P>
+    The <code>BindingType</code> objects
     can be passed to the constructor for the class
     <code>Binding</code> or used as parameters or return values.  These
-	<code>BindingType</code> objects are:
+    <code>BindingType</code> objects are:
     <UL>
     <LI><code>public static final BindingType <B>nobject</B></code> -- 
-	to indicate that the binding is with an object reference
+    to indicate that the binding is with an object reference
     <LI><code>public static final BindingType <B>ncontext</B></code> -- 
-	to indicate that the binding is with a naming context
+    to indicate that the binding is with a naming context
     </UL>
     <P>
-	The <code>int</code> constants can be supplied to the method
-	<code>from_int</code> to create  <code>BindingType</code> objects,
-	or they can be return values for the method <code>value</code>.
-	These constants are:
-	<UL>
+    The <code>int</code> constants can be supplied to the method
+    <code>from_int</code> to create  <code>BindingType</code> objects,
+    or they can be return values for the method <code>value</code>.
+    These constants are:
+    <UL>
     <LI><code>public static final int <B>_nobject</B></code>
     <LI><code>public static final int <B>_ncontext</B></code>
-	</UL>
+    </UL>
     If the method <code>from_int</code> is supplied with anything other
-	than <code>_nobject</code>
+    than <code>_nobject</code>
     or <code>_ncontext</code>, it will throw
-	the exception <code>org.omg.CORBA.BAD_PARAM</code>. 
-	<P>Usage is as follows:
+    the exception <code>org.omg.CORBA.BAD_PARAM</code>. 
+    <P>Usage is as follows:
     <PRE>
        BindingType btObject = from_int(_nobject);
        BindingType btContext = from_int(_ncontext);
@@ -182,9 +179,9 @@
        int bt = BindingType.value();
     </PRE>
   </UL>
-  
+
   <H3>Holder Classes</H3>
- 
+
   OMG IDL uses OUT and INOUT parameters for returning values from operations.
   The mapping to the Java programming language, which does not have OUT
   and INOUT parameters, creates a special class for each type, called
@@ -308,7 +305,6 @@
       This associates <code>NameService</code> with the Root Naming
       Context of the <code>CosNaming</code> implementation that you 
       want to use.
-	  <P>
   <LI>Start the standalone Bootstrap server using the following command:
   <pre>
       <code>
@@ -340,13 +336,13 @@
 <code>CosNaming</code> API, please see:
 <ul>
   <li><a href="../../../../technotes/guides/idl/tnameserv.html">
-	Naming Service</a>
+    Naming Service</a>
 </ul>
 <p>
 For an overview of Java&nbsp;IDL, please see:
 <ul>
   <li><a href="../../../../technotes/guides/idl/index.html">
-	Java&nbsp;IDL home page</a>
+    Java&nbsp;IDL home page</a>
 </ul>
 
 @since JDK1.3
diff --git a/corba/src/java.corba/share/classes/org/omg/Dynamic/package.html b/corba/src/java.corba/share/classes/org/omg/Dynamic/package.html
index 0a9895f..f860282 100644
--- a/corba/src/java.corba/share/classes/org/omg/Dynamic/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/Dynamic/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
 /*
-* Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+* 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
@@ -45,7 +45,7 @@
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyFactoryPackage/package.html b/corba/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyFactoryPackage/package.html
index 9f9e72f..fc4d237 100644
--- a/corba/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyFactoryPackage/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyFactoryPackage/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
 /*
-* Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+* 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
@@ -48,7 +48,7 @@
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyPackage/package.html b/corba/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyPackage/package.html
index 480ed55..7725f96 100644
--- a/corba/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyPackage/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyPackage/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
  
- Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ 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
@@ -46,7 +46,7 @@
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/DynamicAny/package.html b/corba/src/java.corba/share/classes/org/omg/DynamicAny/package.html
index ced7646..287f8fd 100644
--- a/corba/src/java.corba/share/classes/org/omg/DynamicAny/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/DynamicAny/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
 
- Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -197,22 +197,14 @@
  interface may raise the standard NO_IMPLEMENT exception.
  An attempt to use a <code>DynAny</code> object with the DII may raise the NO_IMPLEMENT 
 exception.
- 
-
-
-
-
-
-<P>
-
 
 <H3>Package Specification</H3>
- 
+
 <P>For a precise list of supported sections of official specifications with which 
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/IOP/CodecFactoryPackage/package.html b/corba/src/java.corba/share/classes/org/omg/IOP/CodecFactoryPackage/package.html
index 0a6bc3b..6962336 100644
--- a/corba/src/java.corba/share/classes/org/omg/IOP/CodecFactoryPackage/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/IOP/CodecFactoryPackage/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
  
-Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+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
@@ -42,7 +42,7 @@
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/IOP/CodecPackage/package.html b/corba/src/java.corba/share/classes/org/omg/IOP/CodecPackage/package.html
index 0301fb5..d86dfb1 100644
--- a/corba/src/java.corba/share/classes/org/omg/IOP/CodecPackage/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/IOP/CodecPackage/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
 
-Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+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
@@ -45,7 +45,7 @@
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/IOP/package.html b/corba/src/java.corba/share/classes/org/omg/IOP/package.html
index f0016bf..afc735c 100644
--- a/corba/src/java.corba/share/classes/org/omg/IOP/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/IOP/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
 
-Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+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
@@ -52,7 +52,7 @@
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/Messaging/package.html b/corba/src/java.corba/share/classes/org/omg/Messaging/package.html
index 61e73d5..6076bcf 100644
--- a/corba/src/java.corba/share/classes/org/omg/Messaging/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/Messaging/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
 
-Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+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
@@ -47,7 +47,7 @@
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/IOP.idl b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/IOP.idl
index 8c0ba08..d3c4ed7 100644
--- a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/IOP.idl
+++ b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/IOP.idl
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -258,14 +258,14 @@
      * <p>
      * The <code>TAG_ALTERNATE_IIOP_ADDRESS</code> component has an 
      * associated value of type:
-     * <code>
-     *   <pre>
+     * <pre>
+     *   <code>
      *     struct { 
      *         string HostID, 
      *         short Port 
-     *     }; 
-     *   </pre>
-     * </code>
+     *     };
+     *   </code>
+     * </pre>
      * encoded as a CDR encapsulation. 
      * <p>
      * Zero or more instances of the <code>TAG_ALTERNATE_IIOP_ADDRESS</code> 
@@ -601,7 +601,7 @@
 
     /**
      * Create a <code>Codec</code> of the given encoding.
-     * <p>
+     *
      * @param enc The encoding for which to create a <code>Codec</code>.
      * @return A <code>Codec</code> obtained with the given encoding.
      * @exception UnknownEncoding thrown if this factory cannot create a 
diff --git a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl
index e55408d..bcb9b54 100644
--- a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl
+++ b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -479,7 +479,7 @@
      * On the client:
      * <ul>
      *   <li>Within the <code>receive_reply</code> interception point, this 
-     *       will only return <code>SUCCESSFUL</code></li>.
+     *       will only return <code>SUCCESSFUL</code>.</li>
      *   <li>Within the <code>receive_exception</code> interception point, 
      *       this will be either <code>SYSTEM_EXCEPTION</code> or 
      *       <code>USER_EXCEPTION</code>.</li>
@@ -545,7 +545,7 @@
     /**
      * Returns a copy of the service context with the given ID that 
      * is associated with the request. 
-     * <p>
+     *
      * @param id The <code>IOP.ServiceId</code> of the service context 
      *     which is to be returned. 
      * @return The <code>IOP.ServiceContext</code> obtained with the 
@@ -579,7 +579,6 @@
    * validity of each attribute or operation.  If it is not valid, attempting 
    * to access it will result in a <code>BAD_INV_ORDER</code> being thrown
    * with a standard minor code of 14.
-   * <p>
    *
    * <table border=1 summary="Shows the validity of each attribute or operation">
    *  <thead>
@@ -934,7 +933,6 @@
    * of each attribute or operation.  If it is not valid, attempting to access 
    * it will result in a <code>BAD_INV_ORDER</code> being thrown with a 
    * standard minor code of 14.
-   * <p>
    *
    *
    * <table border=1 summary="Shows the validity of each attribute or operation">
@@ -1028,7 +1026,7 @@
    *    <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
    * 
    *    <tr><td><b>arguments</b></td>
-   *    <td>no </td> <td>yes<sub>1</sub</td> 
+   *    <td>no </td> <td>yes<sub>1</sub></td>
    *                              <td>yes</td> <td>no<sub>2</sub></td> 
    *                                                        <td>no<sub>2</sub>
    *                                                        </td></tr>
@@ -1133,7 +1131,7 @@
    *       servant, which may no longer be available to the ORB. For example, 
    *       if the object's adapter is a POA that uses a 
    *       <code>ServantLocator</code>, then the ORB invokes the interception 
-   *       point after it calls <code>ServantLocator.postinvoke()</code></li>.
+   *       point after it calls <code>ServantLocator.postinvoke()</code>.</li>
    * </ol>
    *
    * @see ServerRequestInterceptor
@@ -1889,7 +1887,7 @@
      * @param type An int specifying the type of policy being created. 
      * @param value An any containing data with which to construct the 
      *     <code>CORBA.Policy</code>. 
-     * @return A <code>CORBA.Policy<code> object of the specified type and 
+     * @return A <code>CORBA.Policy</code> object of the specified type and
      *     value.
      */
     CORBA::Policy create_policy 
@@ -2124,7 +2122,7 @@
    * <p>
    * A client-side logging service written by company X, for example, may 
    * have the following ORBInitializer implementation: 
-   * <code><pre>
+   * <pre><code>
    * package com.x.logging;
    * 
    * import org.omg.PortableInterceptor.Interceptor; 
@@ -2144,7 +2142,7 @@
    *         // This service does not need two init points. 
    *     } 
    * } 
-   * </pre></code>
+   * </code></pre>
    * To run a program called <code>MyApp</code> using this logging 
    * service, the user could type: 
    *   <blockquote><code>
diff --git a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/ORBInitInfoPackage/package.html b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/ORBInitInfoPackage/package.html
index d648d5a..438decf 100644
--- a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/ORBInitInfoPackage/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/ORBInitInfoPackage/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
 
-Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+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
@@ -44,7 +44,7 @@
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/package.html b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/package.html
index 08782dd..3e19270 100644
--- a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
 
-Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
 This code is free software; you can redistribute it and/or modify it
@@ -56,41 +56,39 @@
 <h2>Known limitations / unimplemented methods in package 
 <code>org.omg.PortableInterceptor</code></h2>
 
-<code>
 <ul>
   <li>
-    <b>RequestInfo</b>
+    <code><b>RequestInfo</b></code>
     <ul>
-      <li><b>sync_scope()</b>: Always returns SYNC_WITH_TRANSPORT</li>
-      <li><b>arguments()</b>: Only supported for DII/DSI calls</li>
-      <li><b>exceptions()</b>: Only supported for DII calls on client side.  
+      <li><code><b>sync_scope()</b></code>: Always returns SYNC_WITH_TRANSPORT</li>
+      <li><code><b>arguments()</b></code>: Only supported for DII/DSI calls</li>
+      <li><code><b>exceptions()</b></code>: Only supported for DII calls on client side.  
           Not supported on server-side.</li>
-      <li><b>contexts()</b>: Only supported for DII calls on client side.
+      <li><code><b>contexts()</b></code>: Only supported for DII calls on client side.
           Not supported on server-side since our ORB does not send contexts.
           </li>
-      <li><b>operation_context()</b>: Only supported for DII calls 
+      <li><code><b>operation_context()</b></code>: Only supported for DII calls 
           on client side.  Not supported on server-side since ORB 
           does not send contexts.</li>
-      <li><b>result()</b>: Only supported for DII/DSI calls</li>
+      <li><code><b>result()</b></code>: Only supported for DII/DSI calls</li>
     </ul>
   </li>
   <li>
-    <b>ClientRequestInfo</b>
+    <code><b>ClientRequestInfo</b></code>
     <ul>
-      <li><b>received_exception_id()</b>: Always returns null in the 
+      <li><code><b>received_exception_id()</b></code>: Always returns null in the 
           DII case</li>
-      <li><b>get_request_policy(int type)</b>: Not implemented.</li>
+      <li><code><b>get_request_policy(int type)</b></code>: Not implemented.</li>
     </ul>
   </li>
   <li>
-    <b>ServerRequestInfo</b>
+    <code><b>ServerRequestInfo</b></code>
     <ul>
-      <li><b>sending_exception()</b>: Does not support user exceptions on 
+      <li><code><b>sending_exception()</b></code>: Does not support user exceptions on 
           the server side in non-DSI case.</li>
     </ul>
   </li>
 </ul>
-</code>
 
 <h2>Package Specification</h2>
 <P>For a precise list of supported sections of official OMG specifications with which 
diff --git a/corba/src/java.corba/share/classes/org/omg/PortableServer/CurrentPackage/package.html b/corba/src/java.corba/share/classes/org/omg/PortableServer/CurrentPackage/package.html
index c372327..cb33802 100644
--- a/corba/src/java.corba/share/classes/org/omg/PortableServer/CurrentPackage/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/PortableServer/CurrentPackage/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
  
- Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ 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
@@ -53,7 +53,7 @@
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/PortableServer/POAManagerPackage/package.html b/corba/src/java.corba/share/classes/org/omg/PortableServer/POAManagerPackage/package.html
index b93de2f..7bdbaec 100644
--- a/corba/src/java.corba/share/classes/org/omg/PortableServer/POAManagerPackage/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/PortableServer/POAManagerPackage/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
  
- Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ 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
@@ -43,7 +43,7 @@
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/PortableServer/POAPackage/package.html b/corba/src/java.corba/share/classes/org/omg/PortableServer/POAPackage/package.html
index 63b92b2..0d642f1 100644
--- a/corba/src/java.corba/share/classes/org/omg/PortableServer/POAPackage/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/PortableServer/POAPackage/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
  
- Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ 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
@@ -36,7 +36,6 @@
 between different ORB products.  
 
 <P>The Portable Object Adaptor (POA) is designed to meet the following goals:
-<P>
 <UL>
 <LI>Allow programmers to construct object implementations that are portable between different ORB products.
 <LI>Provide support for objects with persistent identities.
@@ -66,7 +65,7 @@
 the Java[tm] Platform, Standard Edition 6, ORB complies, see <A 
 HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-<p>
+
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/package.html b/corba/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/package.html
index 19640db..e767bdc 100644
--- a/corba/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
  
- Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ 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
@@ -43,13 +43,6 @@
 the Java[tm] Platform, Standard Edition 6 complies, see <A 
 HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-<p>
-
-
-
-
-
-
 
 @since 1.4
 <br>
diff --git a/corba/src/java.corba/share/classes/org/omg/PortableServer/package.html b/corba/src/java.corba/share/classes/org/omg/PortableServer/package.html
index 3f51ea1..497385b 100644
--- a/corba/src/java.corba/share/classes/org/omg/PortableServer/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/PortableServer/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
  
- Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -52,12 +52,10 @@
 the Java[tm] Platform, Standard Edition 6 complies, see <A 
 HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-<p>
 
 <H2>POA-related Interfaces</H2>
 
 <P>The <TT>PortableServer</TT> module defines the following POA-related interfaces:
-<P>
 <UL>
 	<LI><TT>POA</TT>
 	<LI><TT>POAManager</TT>
@@ -79,12 +77,18 @@
 
 <H3>Operations classes</H3>
 
-<P>Each of the interfaces listed above has an associated <code>Operations</code> interface.  The <code>Operations</code> interface is generated by the <code>idlj</code> compiler and contains the method signatures for methods defined in its associated interface.  The <code>Operations</code> interface can be accessed by both the client and the server, while its associated interface can only be called by the client.
+<P>Each of the interfaces listed above has an associated <code>Operations</code> interface.
+The <code>Operations</code> interface is generated by the <code>idlj</code> compiler and
+contains the method signatures for methods defined in its associated interface.
+The <code>Operations</code> interface can be accessed by both the client and the server,
+while its associated interface can only be called by the client.
 
 <H3>Value Classes</H3>
 
-Classes ending in the suffix <code>PolicyValue</code> provide the values used for the <code>create_POA</code> call, which sets the policy for the POA.   See the <a href="#sampleserver">sample code</a> below for a demonstration.  <code>PolicyValue</code> files include the following:
-<P>
+Classes ending in the suffix <code>PolicyValue</code> provide the values used
+for the <code>create_POA</code> call, which sets the policy for the POA. See
+the <a href="#sampleserver">sample code</a> below for a demonstration. 
+<code>PolicyValue</code> files include the following:
 <UL>
 <LI><code>IdAssignmentPolicyValue</code> 
 <LI><code>IdUniquenessPolicyValue</code>
@@ -98,8 +102,11 @@
 <H3>Helper Classes</H3>
 
 <P>Helper classes, which are generated for all user-defined types in an OMG IDL 
-interface, supply static methods needed to manipulate those types.  There is only one method in a helper class that an application programmer uses: the  <code>narrow</code> method.  Only Java interfaces mapped from IDL interfaces will have a helper class that includes a <code>narrow</code> method, so in the <code>PortableServer</code> package, only the following classes have a <code>narrow</code> method:
-<P>
+interface, supply static methods needed to manipulate those types.
+There is only one method in a helper class that an application programmer uses: 
+the  <code>narrow</code> method.  Only Java interfaces mapped from IDL interfaces 
+will have a helper class that includes a <code>narrow</code> method, so in
+the <code>PortableServer</code> package, only the following classes have a <code>narrow</code> method:
 <UL>
 <LI><code>ForwardRequestHelper</code>
 <LI><code>ServantActivatorHelper</code>
@@ -113,22 +120,31 @@
 <H3>Exceptions</H3>
 
 <P>The <code>ForwardRequest</code> exception indicates to the ORB 
-that it is responsible for delivering the current request and subsequent <code>ForwardRequest</code> requests to the object denoted in the 
- <code>forward_reference</code> member of the exception.
+that it is responsible for delivering the current request and
+subsequent <code>ForwardRequest</code> requests to the object denoted in the
+<code>forward_reference</code> member of the exception.
 
 <H3>Interfaces Implemented by the Application Programmer</H3>
 
-<P>Most of what <code>PortableServer</code> does is transparent to the user.  The result is that programmers will use only a few of the interfaces mentioned above.  The remaining interfaces will be provided by the ORB implementation.  The interfaces of interest to application programmers are the following:
-<P>
+<P>Most of what <code>PortableServer</code> does is transparent to the user.
+The result is that programmers will use only a few of the interfaces mentioned above.
+The remaining interfaces will be provided by the ORB implementation.
+The interfaces of interest to application programmers are the following:
 <ul>
-	<LI><code>AdapterActivator</code>
-	<P>Adapter activators are associated with POAs.  An adapter activator supplies a POA with the ability to create child POAs on demand, as a side-effect of receiving a request that names the child POA (or one of its children), or when <code>find_POA</code> is called with an activate parameter value of <code>TRUE</code>.  An application server that creates all its needed POAs at the beginning of execution does not need to use or provide an adapter activator; it is necessary only for the case in which POAs need to be created during request processing.
-	<P>
-	<LI><code>ServantLocator</code>
-	<P>When the POA has the <code>NON_RETAIN</code> policy, it uses servant managers that are <code>ServantLocator</code>s.
-	<P>
-	<LI><code>ServantActivator</code>
-	<P>When the POA has the <code>RETAIN</code> policy, it uses servant managers that are <code>ServantActivator</code>s.
+  <LI><code>AdapterActivator</code>
+  <P>Adapter activators are associated with POAs. 
+  An adapter activator supplies a POA with the ability to create child POAs on demand,
+  as a side-effect of receiving a request that names the child POA (or one of its children),
+  or when <code>find_POA</code> is called with an activate parameter value of <code>TRUE</code>.
+  An application server that creates all its needed POAs at the beginning of execution
+  does not need to use or provide an adapter activator; it is necessary
+  only for the case in which POAs need to be created during request processing.
+  <LI><code>ServantLocator</code>
+  <P>When the POA has the <code>NON_RETAIN</code> policy,
+  it uses servant managers that are <code>ServantLocator</code>s.
+  <LI><code>ServantActivator</code>
+  <P>When the POA has the <code>RETAIN</code> policy,
+  it uses servant managers that are <code>ServantActivator</code>s.
 </ul>
 
 
@@ -141,13 +157,11 @@
 <H2>Related Documentation</H2>
 
 <P>For an overview of Java IDL, please see:
-<P>
-<LI><A HREF="../../../../technotes/guides/idl/index.html">Java IDL home page</A>.
+<A HREF="../../../../technotes/guides/idl/index.html">Java IDL home page</A>.
 
 <H2>Example Code</H2>
 <a name="sampleserver"></a>
 <H3>Example Server Code</H3>
-<P>
 <PRE>
 import javax.naming.InitialContext;
 import javax.naming.Context;
@@ -209,9 +223,6 @@
 
 
 
-<P>
-
-
 @since 1.4
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/SendingContext/package.html b/corba/src/java.corba/share/classes/org/omg/SendingContext/package.html
index 3f17faf..a76f241 100644
--- a/corba/src/java.corba/share/classes/org/omg/SendingContext/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/SendingContext/package.html
@@ -3,7 +3,7 @@
 <head>
 <!--
  
- Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -68,7 +68,7 @@
 the Java[tm] Platform, Standard Edition 6 ORB complies, see <A 
 HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
 support in Java[tm] SE 6</A>.
-<p>
+
 @since 1.3
 <br>
 @serial exclude
diff --git a/corba/src/java.corba/share/classes/org/omg/stub/java/rmi/package.html b/corba/src/java.corba/share/classes/org/omg/stub/java/rmi/package.html
index 0d7df8d..abd3fa1 100644
--- a/corba/src/java.corba/share/classes/org/omg/stub/java/rmi/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/stub/java/rmi/package.html
@@ -3,7 +3,7 @@
 <title>org.omg.stub.java.rmi package</title>
 <!--
  
- Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
 <body bgcolor="white">
   Contains RMI-IIOP Stubs for the Remote types that occur in the 
   <tt>java.rmi</tt> package.
-<p>
+
 @since 1.3
 <br>
 @serial exclude
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 22f9730..efc54cf 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -461,3 +461,4 @@
 fd2d5ec7e7b16c7bf4043a7fe7cfd8af96b819e2 jdk9-b56
 56a85ffe743d3f9d70ba25d6ce82ddd2ad1bf33c jdk9-b57
 ee878f3d6732856f7725c590312bfbe2ffa52cc7 jdk9-b58
+96bcaec07cb165782bae1b9a1f28450b37a10e3a jdk9-b59
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java
index 26b1073..b39c460 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java
@@ -37,7 +37,9 @@
   private static CIntegerField nGensField;
   private static AddressField youngGenField;
   private static AddressField oldGenField;
-  private static AddressField genSpecsField;
+
+  private static AddressField youngGenSpecField;
+  private static AddressField oldGenSpecField;
 
   private static GenerationFactory genFactory;
 
@@ -55,9 +57,12 @@
     nGensField = type.getCIntegerField("_n_gens");
     youngGenField = type.getAddressField("_young_gen");
     oldGenField = type.getAddressField("_old_gen");
-    genSpecsField = type.getAddressField("_gen_specs");
 
     genFactory = new GenerationFactory();
+
+    Type collectorPolicyType = db.lookupType("GenCollectorPolicy");
+    youngGenSpecField = collectorPolicyType.getAddressField("_young_gen_spec");
+    oldGenSpecField = collectorPolicyType.getAddressField("_old_gen_spec");
   }
 
   public GenCollectedHeap(Address addr) {
@@ -115,21 +120,23 @@
   /** Package-private access to GenerationSpecs */
   GenerationSpec spec(int level) {
     if (Assert.ASSERTS_ENABLED) {
-      Assert.that((level >= 0) && (level < nGens()), "Index " + level +
-                  " out of range (should be between 0 and " + nGens() + ")");
+      Assert.that((level == 0) || (level == 1), "Index " + level +
+                  " out of range (should be 0 or 1)");
     }
 
-    if ((level < 0) || (level >= nGens())) {
+    if ((level != 0) && (level != 1)) {
       return null;
     }
 
-    Address ptrList = genSpecsField.getValue(addr);
-    if (ptrList == null) {
-      return null;
+    if (level == 0) {
+      return (GenerationSpec)
+              VMObjectFactory.newObject(GenerationSpec.class,
+                      youngGenSpecField.getAddress());
+    } else {
+      return (GenerationSpec)
+              VMObjectFactory.newObject(GenerationSpec.class,
+                      oldGenSpecField.getAddress());
     }
-    return (GenerationSpec)
-      VMObjectFactory.newObject(GenerationSpec.class,
-                                ptrList.getAddressAt(level * VM.getVM().getAddressSize()));
   }
 
   public CollectedHeapName kind() {
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
index 0bc3a84..a4960ad 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -52,9 +52,10 @@
 }
 
 void ConcurrentMarkSweepPolicy::initialize_generations() {
-  _generations = NEW_C_HEAP_ARRAY(GenerationSpecPtr, number_of_generations(), mtGC);
-  _generations[0] = new GenerationSpec(Generation::ParNew, _initial_young_size, _max_young_size);
-  _generations[1] = new GenerationSpec(Generation::ConcurrentMarkSweep, _initial_old_size, _max_old_size);
+  _young_gen_spec = new GenerationSpec(Generation::ParNew, _initial_young_size,
+                                       _max_young_size, _gen_alignment);
+  _old_gen_spec   = new GenerationSpec(Generation::ConcurrentMarkSweep,
+                                       _initial_old_size, _max_old_size, _gen_alignment);
 }
 
 void ConcurrentMarkSweepPolicy::initialize_size_policy(size_t init_eden_size,
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
index e273c20..037abd9 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -65,8 +65,6 @@
 #include "services/memoryService.hpp"
 #include "services/runtimeService.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 // statics
 CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL;
 bool CMSCollector::_full_gc_requested = false;
@@ -1593,7 +1591,7 @@
   bitMapLock()->lock_without_safepoint_check();
   if (TraceCMSState) {
     gclog_or_tty->print_cr("CMS foreground collector has asked for control "
-      INTPTR_FORMAT " with first state %d", Thread::current(), first_state);
+      INTPTR_FORMAT " with first state %d", p2i(Thread::current()), first_state);
     gclog_or_tty->print_cr("    gets control with state %d", _collectorState);
   }
 
@@ -1763,27 +1761,27 @@
   // Eden
   if (_eden_chunk_array != NULL) {
     gclog_or_tty->print_cr("eden " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
-                           eden_space->bottom(), eden_space->top(),
-                           eden_space->end(), eden_space->capacity());
+                           p2i(eden_space->bottom()), p2i(eden_space->top()),
+                           p2i(eden_space->end()), eden_space->capacity());
     gclog_or_tty->print_cr("_eden_chunk_index=" SIZE_FORMAT ", "
                            "_eden_chunk_capacity=" SIZE_FORMAT,
                            _eden_chunk_index, _eden_chunk_capacity);
     for (size_t i = 0; i < _eden_chunk_index; i++) {
       gclog_or_tty->print_cr("_eden_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT,
-                             i, _eden_chunk_array[i]);
+                             i, p2i(_eden_chunk_array[i]));
     }
   }
   // Survivor
   if (_survivor_chunk_array != NULL) {
     gclog_or_tty->print_cr("survivor " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
-                           from_space->bottom(), from_space->top(),
-                           from_space->end(), from_space->capacity());
+                           p2i(from_space->bottom()), p2i(from_space->top()),
+                           p2i(from_space->end()), from_space->capacity());
     gclog_or_tty->print_cr("_survivor_chunk_index=" SIZE_FORMAT ", "
                            "_survivor_chunk_capacity=" SIZE_FORMAT,
                            _survivor_chunk_index, _survivor_chunk_capacity);
     for (size_t i = 0; i < _survivor_chunk_index; i++) {
       gclog_or_tty->print_cr("_survivor_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT,
-                             i, _survivor_chunk_array[i]);
+                             i, p2i(_survivor_chunk_array[i]));
     }
   }
 }
@@ -1890,7 +1888,7 @@
   while (_collectorState != Idling) {
     if (TraceCMSState) {
       gclog_or_tty->print_cr("Thread " INTPTR_FORMAT " in CMS state %d",
-        Thread::current(), _collectorState);
+        p2i(Thread::current()), _collectorState);
     }
     // The foreground collector
     //   holds the Heap_lock throughout its collection.
@@ -1924,7 +1922,7 @@
         if (TraceCMSState) {
           gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT
             " exiting collection CMS state %d",
-            Thread::current(), _collectorState);
+            p2i(Thread::current()), _collectorState);
         }
         return;
       } else {
@@ -2031,7 +2029,7 @@
     }
     if (TraceCMSState) {
       gclog_or_tty->print_cr("  Thread " INTPTR_FORMAT " done - next CMS state %d",
-        Thread::current(), _collectorState);
+        p2i(Thread::current()), _collectorState);
     }
     assert(_foregroundGCShouldWait, "block post-condition");
   }
@@ -2054,7 +2052,7 @@
   if (TraceCMSState) {
     gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT
       " exiting collection CMS state %d",
-      Thread::current(), _collectorState);
+      p2i(Thread::current()), _collectorState);
   }
   if (PrintGC && Verbose) {
     _cmsGen->print_heap_change(prev_used);
@@ -2112,7 +2110,7 @@
     CGC_lock->notify();
     if (TraceCMSState) {
       gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT " waiting at CMS state %d",
-        Thread::current(), _collectorState);
+        p2i(Thread::current()), _collectorState);
     }
     while (_foregroundGCIsActive) {
       CGC_lock->wait(Mutex::_no_safepoint_check_flag);
@@ -2124,7 +2122,7 @@
   }
   if (TraceCMSState) {
     gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT " continuing at CMS state %d",
-      Thread::current(), _collectorState);
+      p2i(Thread::current()), _collectorState);
   }
   return res;
 }
@@ -2356,13 +2354,13 @@
 
   // Clear the marking bit map array before starting, but, just
   // for kicks, first report if the given address is already marked
-  gclog_or_tty->print_cr("Start: Address " PTR_FORMAT " is%s marked", addr,
+  gclog_or_tty->print_cr("Start: Address " PTR_FORMAT " is%s marked", p2i(addr),
                 _markBitMap.isMarked(addr) ? "" : " not");
 
   if (verify_after_remark()) {
     MutexLockerEx x(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
     bool result = verification_mark_bm()->isMarked(addr);
-    gclog_or_tty->print_cr("TransitiveMark: Address " PTR_FORMAT " %s marked", addr,
+    gclog_or_tty->print_cr("TransitiveMark: Address " PTR_FORMAT " %s marked", p2i(addr),
                            result ? "IS" : "is NOT");
     return result;
   } else {
@@ -2377,13 +2375,13 @@
   CMSCollector* collector = ConcurrentMarkSweepGeneration::_collector;
   if (collector != NULL) {
     CMSBitMap* bitmap = &collector->_markBitMap;
-    st->print_cr("Marking Bits: (CMSBitMap*) " PTR_FORMAT, bitmap);
+    st->print_cr("Marking Bits: (CMSBitMap*) " PTR_FORMAT, p2i(bitmap));
     bitmap->print_on_error(st, " Bits: ");
 
     st->cr();
 
     CMSBitMap* mut_bitmap = &collector->_modUnionTable;
-    st->print_cr("Mod Union Table: (CMSBitMap*) " PTR_FORMAT, mut_bitmap);
+    st->print_cr("Mod Union Table: (CMSBitMap*) " PTR_FORMAT, p2i(mut_bitmap));
     mut_bitmap->print_on_error(st, " Bits: ");
   }
 }
@@ -2406,7 +2404,7 @@
     HeapWord* addr = _marks->offsetToHeapWord(offset);
     if (!_marks->isMarked(addr)) {
       oop(addr)->print_on(gclog_or_tty);
-      gclog_or_tty->print_cr(" ("INTPTR_FORMAT" should have been marked)", addr);
+      gclog_or_tty->print_cr(" ("INTPTR_FORMAT" should have been marked)", p2i(addr));
       _failed = true;
     }
     return true;
@@ -2474,7 +2472,7 @@
     // presumably, a mutation to A failed to be picked up by preclean/remark?
     verify_after_remark_work_2();
   } else {
-    warning("Unrecognized value %d for CMSRemarkVerifyVariant",
+    warning("Unrecognized value " UINTX_FORMAT " for CMSRemarkVerifyVariant",
             CMSRemarkVerifyVariant);
   }
   if (!silent) gclog_or_tty->print(" done] ");
@@ -5056,7 +5054,7 @@
       for (size_t i = 0; i < total - 1; i++) {
         if (PrintCMSStatistics > 0) {
           gclog_or_tty->print(" (chunk" SIZE_FORMAT ":" INTPTR_FORMAT ") ",
-                              i, _survivor_chunk_array[i]);
+                              i, p2i(_survivor_chunk_array[i]));
         }
         assert(_survivor_chunk_array[i] < _survivor_chunk_array[i+1],
                "Not sorted");
@@ -5700,8 +5698,8 @@
     gclog_or_tty->print_cr(
       "CMS: Large Block: " PTR_FORMAT ";"
       " Proximity: " PTR_FORMAT " -> " PTR_FORMAT,
-      largestAddr,
-      _cmsSpace->nearLargestChunk(), minAddr + nearLargestOffset);
+      p2i(largestAddr),
+      p2i(_cmsSpace->nearLargestChunk()), p2i(minAddr + nearLargestOffset));
   }
   _cmsSpace->set_nearLargestChunk(minAddr + nearLargestOffset);
 }
@@ -6184,7 +6182,7 @@
     _verification_bm->mark(addr);
     if (!_cms_bm->isMarked(addr)) {
       oop(addr)->print();
-      gclog_or_tty->print_cr(" (" INTPTR_FORMAT " should have been marked)", addr);
+      gclog_or_tty->print_cr(" (" INTPTR_FORMAT " should have been marked)", p2i(addr));
       fatal("... aborting");
     }
   }
@@ -6979,7 +6977,7 @@
     if (!_cms_bm->isMarked(addr)) {
       oop(addr)->print();
       gclog_or_tty->print_cr(" (" INTPTR_FORMAT " should have been marked)",
-                             addr);
+                             p2i(addr));
       fatal("... aborting");
     }
 
@@ -7375,16 +7373,16 @@
          "sweep _limit out of bounds");
   if (CMSTraceSweeper) {
     gclog_or_tty->print_cr("\n====================\nStarting new sweep with limit " PTR_FORMAT,
-                        _limit);
+                        p2i(_limit));
   }
 }
 
 void SweepClosure::print_on(outputStream* st) const {
   tty->print_cr("_sp = [" PTR_FORMAT "," PTR_FORMAT ")",
-                _sp->bottom(), _sp->end());
-  tty->print_cr("_limit = " PTR_FORMAT, _limit);
-  tty->print_cr("_freeFinger = " PTR_FORMAT, _freeFinger);
-  NOT_PRODUCT(tty->print_cr("_last_fc = " PTR_FORMAT, _last_fc);)
+                p2i(_sp->bottom()), p2i(_sp->end()));
+  tty->print_cr("_limit = " PTR_FORMAT, p2i(_limit));
+  tty->print_cr("_freeFinger = " PTR_FORMAT, p2i(_freeFinger));
+  NOT_PRODUCT(tty->print_cr("_last_fc = " PTR_FORMAT, p2i(_last_fc));)
   tty->print_cr("_inFreeRange = %d, _freeRangeInFreeLists = %d, _lastFreeRangeCoalesced = %d",
                 _inFreeRange, _freeRangeInFreeLists, _lastFreeRangeCoalesced);
 }
@@ -7428,7 +7426,7 @@
   }
   if (CMSTraceSweeper) {
     gclog_or_tty->print_cr("end of sweep with _limit = " PTR_FORMAT "\n================",
-                           _limit);
+                           p2i(_limit));
   }
 }
 #endif  // PRODUCT
@@ -7437,7 +7435,7 @@
     bool freeRangeInFreeLists) {
   if (CMSTraceSweeper) {
     gclog_or_tty->print("---- Start free range at " PTR_FORMAT " with free block (%d)\n",
-               freeFinger, freeRangeInFreeLists);
+               p2i(freeFinger), freeRangeInFreeLists);
   }
   assert(!inFreeRange(), "Trampling existing free range");
   set_inFreeRange(true);
@@ -7501,14 +7499,14 @@
     // coalesced chunk to the appropriate free list.
     if (inFreeRange()) {
       assert(freeFinger() >= _sp->bottom() && freeFinger() < _limit,
-             err_msg("freeFinger() " PTR_FORMAT" is out-of-bounds", freeFinger()));
+             err_msg("freeFinger() " PTR_FORMAT" is out-of-bounds", p2i(freeFinger())));
       flush_cur_free_chunk(freeFinger(),
                            pointer_delta(addr, freeFinger()));
       if (CMSTraceSweeper) {
         gclog_or_tty->print("Sweep: last chunk: ");
         gclog_or_tty->print("put_free_blk " PTR_FORMAT " ("SIZE_FORMAT") "
                    "[coalesced:%d]\n",
-                   freeFinger(), pointer_delta(addr, freeFinger()),
+                   p2i(freeFinger()), pointer_delta(addr, freeFinger()),
                    lastFreeRangeCoalesced() ? 1 : 0);
       }
     }
@@ -7652,7 +7650,7 @@
         // the midst of a free range, we are coalescing
         print_free_block_coalesced(fc);
         if (CMSTraceSweeper) {
-          gclog_or_tty->print("  -- pick up free block " PTR_FORMAT " (" SIZE_FORMAT ")\n", fc, size);
+          gclog_or_tty->print("  -- pick up free block " PTR_FORMAT " (" SIZE_FORMAT ")\n", p2i(fc), size);
         }
         // remove it from the free lists
         _sp->removeFreeChunkFromFreeLists(fc);
@@ -7714,7 +7712,7 @@
       // this will be swept up when we hit the end of the
       // free range
       if (CMSTraceSweeper) {
-        gclog_or_tty->print("  -- pick up garbage " PTR_FORMAT " (" SIZE_FORMAT ")\n", fc, size);
+        gclog_or_tty->print("  -- pick up garbage " PTR_FORMAT " (" SIZE_FORMAT ")\n", p2i(fc), size);
       }
       // If the chunk is being coalesced and the current free range is
       // in the free lists, remove the current free range so that it
@@ -7807,7 +7805,7 @@
   }
 
   if (CMSTraceSweeper) {
-    gclog_or_tty->print_cr("  -- pick up another chunk at " PTR_FORMAT " (" SIZE_FORMAT ")", fc, chunkSize);
+    gclog_or_tty->print_cr("  -- pick up another chunk at " PTR_FORMAT " (" SIZE_FORMAT ")", p2i(fc), chunkSize);
   }
 
   HeapWord* const fc_addr = (HeapWord*) fc;
@@ -7906,14 +7904,14 @@
          err_msg("eob = " PTR_FORMAT " eob-1 = " PTR_FORMAT " _limit = " PTR_FORMAT
                  " out of bounds wrt _sp = [" PTR_FORMAT "," PTR_FORMAT ")"
                  " when examining fc = " PTR_FORMAT "(" SIZE_FORMAT ")",
-                 eob, eob-1, _limit, _sp->bottom(), _sp->end(), fc, chunk_size));
+                 p2i(eob), p2i(eob-1), p2i(_limit), p2i(_sp->bottom()), p2i(_sp->end()), p2i(fc), chunk_size));
   if (eob >= _limit) {
     assert(eob == _limit || fc->is_free(), "Only a free chunk should allow us to cross over the limit");
     if (CMSTraceSweeper) {
       gclog_or_tty->print_cr("_limit " PTR_FORMAT " reached or crossed by block "
                              "[" PTR_FORMAT "," PTR_FORMAT ") in space "
                              "[" PTR_FORMAT "," PTR_FORMAT ")",
-                             _limit, fc, eob, _sp->bottom(), _sp->end());
+                             p2i(_limit), p2i(fc), p2i(eob), p2i(_sp->bottom()), p2i(_sp->end()));
     }
     // Return the storage we are tracking back into the free lists.
     if (CMSTraceSweeper) {
@@ -7937,7 +7935,7 @@
     }
     if (CMSTraceSweeper) {
       gclog_or_tty->print_cr(" -- add free block " PTR_FORMAT " (" SIZE_FORMAT ") to free lists",
-                    chunk, size);
+                    p2i(chunk), size);
     }
     // A new free range is going to be starting.  The current
     // free range has not been added to the free lists yet or
@@ -8010,7 +8008,7 @@
 void SweepClosure::print_free_block_coalesced(FreeChunk* fc) const {
   if (CMSTraceSweeper) {
     gclog_or_tty->print_cr("Sweep:coal_free_blk " PTR_FORMAT " (" SIZE_FORMAT ")",
-                           fc, fc->size());
+                           p2i(fc), fc->size());
   }
 }
 
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp
index 133ed3c..e58391a 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp
@@ -27,8 +27,6 @@
 #include "memory/freeBlockDictionary.hpp"
 #include "utilities/copy.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 #ifndef PRODUCT
 
 #define baadbabeHeapWord badHeapWordVal
@@ -74,5 +72,5 @@
 
 void FreeChunk::print_on(outputStream* st) {
   st->print_cr("Next: " PTR_FORMAT " Prev: " PTR_FORMAT " %s",
-    next(), prev(), cantCoalesce() ? "[can't coalesce]" : "");
+    p2i(next()), p2i(prev()), cantCoalesce() ? "[can't coalesce]" : "");
 }
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp
index 44f5a28..dfddda7 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp
@@ -28,8 +28,6 @@
 #include "oops/markOop.inline.hpp"
 #include "oops/oop.inline.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 /////////////////////////////////////////////////////////////////////////
 //// PromotionInfo
 /////////////////////////////////////////////////////////////////////////
@@ -360,6 +358,6 @@
 
 void SpoolBlock::print_on(outputStream* st) const {
   st->print("[" PTR_FORMAT "," PTR_FORMAT "), " SIZE_FORMAT " HeapWords -> " PTR_FORMAT,
-            this, (HeapWord*)displacedHdr + bufferSize,
-            bufferSize, nextSpoolBlock);
+            p2i(this), p2i((HeapWord*)displacedHdr + bufferSize),
+            bufferSize, p2i(nextSpoolBlock));
 }
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp
index 9587736..39d86cd 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp
@@ -34,8 +34,6 @@
 #include "runtime/os.hpp"
 #include "utilities/dtrace.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 //////////////////////////////////////////////////////////
 // Methods in abstract class VM_CMS_Operation
 //////////////////////////////////////////////////////////
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index c91b5bc..60ae0b4 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -2088,10 +2088,7 @@
   _cleanup_times.add((end - start) * 1000.0);
 
   if (G1Log::fine()) {
-    g1h->print_size_transition(gclog_or_tty,
-                               start_used_bytes,
-                               g1h->used(),
-                               g1h->capacity());
+    g1h->g1_policy()->print_heap_transition(start_used_bytes);
   }
 
   // Clean up will have freed any regions completely full of garbage.
@@ -2584,7 +2581,7 @@
  public:
   G1RemarkThreadsClosure(G1CollectedHeap* g1h, CMTask* task) :
     _cm_obj(task), _cm_cl(g1h, g1h->concurrent_mark(), task), _code_cl(&_cm_cl, !CodeBlobToOopClosure::FixRelocations),
-    _thread_parity(SharedHeap::heap()->strong_roots_parity()) {}
+    _thread_parity(Threads::thread_claim_parity()) {}
 
   void do_thread(Thread* thread) {
     if (thread->is_Java_thread()) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp
index 76bf850..94f258a 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp
@@ -31,8 +31,6 @@
 #include "services/memTracker.hpp"
 #include "utilities/copy.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 void G1CardCountsMappingChangedListener::on_commit(uint start_idx, size_t num_regions, bool zero_filled) {
   if (zero_filled) {
     return;
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp
index f703758..b09d8a8 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp
@@ -33,8 +33,6 @@
 #include "utilities/hashtable.inline.hpp"
 #include "utilities/stack.inline.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 class CodeRootSetTable : public Hashtable<nmethod*, mtGC> {
   friend class G1CodeRootSetTest;
   typedef HashtableEntry<nmethod*, mtGC> Entry;
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index a9ef5dc..8733e47 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -66,7 +66,6 @@
 #include "memory/iterator.hpp"
 #include "memory/referenceProcessor.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.pcgc.inline.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/vmThread.hpp"
@@ -403,25 +402,6 @@
   return hr;
 }
 
-#ifdef ASSERT
-// A region is added to the collection set as it is retired
-// so an address p can point to a region which will be in the
-// collection set but has not yet been retired.  This method
-// therefore is only accurate during a GC pause after all
-// regions have been retired.  It is used for debugging
-// to check if an nmethod has references to objects that can
-// be move during a partial collection.  Though it can be
-// inaccurate, it is sufficient for G1 because the conservative
-// implementation of is_scavengable() for G1 will indicate that
-// all nmethods must be scanned during a partial collection.
-bool G1CollectedHeap::is_in_partial_collection(const void* p) {
-  if (p == NULL) {
-    return false;
-  }
-  return heap_region_containing(p)->in_collection_set();
-}
-#endif
-
 // Returns true if the reference points to an object that
 // can move in an incremental collection.
 bool G1CollectedHeap::is_scavengable(const void* p) {
@@ -1748,7 +1728,7 @@
 
 
 G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) :
-  SharedHeap(policy_),
+  SharedHeap(),
   _g1_policy(policy_),
   _dirty_card_queue_set(false),
   _into_cset_dirty_card_queue_set(false),
@@ -3732,7 +3712,14 @@
 
     TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
 
-    uint active_workers = workers()->active_workers();
+    uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
+                                                                  workers()->active_workers(),
+                                                                  Threads::number_of_non_daemon_threads());
+    assert(UseDynamicNumberOfGCThreads ||
+           active_workers == workers()->total_workers(),
+           "If not dynamic should be using all the  workers");
+    workers()->set_active_workers(active_workers);
+
     double pause_start_sec = os::elapsedTime();
     g1_policy()->phase_times()->note_gc_start(active_workers, mark_in_progress());
     log_gc_header();
@@ -5430,15 +5417,10 @@
   hot_card_cache->reset_hot_cache_claimed_index();
   hot_card_cache->set_use_cache(false);
 
-  uint n_workers;
-  n_workers =
-    AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
-                                   workers()->active_workers(),
-                                   Threads::number_of_non_daemon_threads());
+  const uint n_workers = workers()->active_workers();
   assert(UseDynamicNumberOfGCThreads ||
          n_workers == workers()->total_workers(),
          "If not dynamic should be using all the  workers");
-  workers()->set_active_workers(n_workers);
   set_par_threads(n_workers);
 
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
index 11955f4..1a3be8c 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
@@ -1008,7 +1008,7 @@
   // Set _n_par_threads according to a policy TBD.
   void set_par_threads();
 
-  virtual CollectedHeap::Name kind() const {
+  virtual Name kind() const {
     return CollectedHeap::G1CollectedHeap;
   }
 
@@ -1379,10 +1379,6 @@
 
   inline bool is_in_young(const oop obj);
 
-#ifdef ASSERT
-  virtual bool is_in_partial_collection(const void* p);
-#endif
-
   virtual bool is_scavengable(const void* addr);
 
   // We don't need barriers for initializing stores to objects
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
index bbb2374..0be44bd 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
@@ -1201,11 +1201,21 @@
   }
 }
 
+void G1CollectorPolicy::print_heap_transition(size_t bytes_before) {
+  size_t bytes_after = _g1->used();
+  size_t capacity = _g1->capacity();
+
+  gclog_or_tty->print(" " SIZE_FORMAT "%s->" SIZE_FORMAT "%s(" SIZE_FORMAT "%s)",
+      byte_size_in_proper_unit(bytes_before),
+      proper_unit_for_byte_size(bytes_before),
+      byte_size_in_proper_unit(bytes_after),
+      proper_unit_for_byte_size(bytes_after),
+      byte_size_in_proper_unit(capacity),
+      proper_unit_for_byte_size(capacity));
+}
+
 void G1CollectorPolicy::print_heap_transition() {
-  _g1->print_size_transition(gclog_or_tty,
-                             _heap_used_bytes_before_gc,
-                             _g1->used(),
-                             _g1->capacity());
+  print_heap_transition(_heap_used_bytes_before_gc);
 }
 
 void G1CollectorPolicy::print_detailed_heap_transition(bool full) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
index a4236a0..3cee936 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
@@ -700,6 +700,8 @@
   void record_heap_size_info_at_start(bool full);
 
   // Print heap sizing transition (with less and more detail).
+
+  void print_heap_transition(size_t bytes_before);
   void print_heap_transition();
   void print_detailed_heap_transition(bool full = false);
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp
index 24379ff..3b7a12b 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp
@@ -154,28 +154,28 @@
     _has_new_data = true;
   }
 
-  double average(){
-    calculate_totals();
+  double average(uint active_threads){
+    calculate_totals(active_threads);
     return _average;
   }
 
-  T sum() {
-    calculate_totals();
+  T sum(uint active_threads) {
+    calculate_totals(active_threads);
     return _sum;
   }
 
-  T minimum() {
-    calculate_totals();
+  T minimum(uint active_threads) {
+    calculate_totals(active_threads);
     return _min;
   }
 
-  T maximum() {
-    calculate_totals();
+  T maximum(uint active_threads) {
+    calculate_totals(active_threads);
     return _max;
   }
 
   void reset() PRODUCT_RETURN;
-  void verify() PRODUCT_RETURN;
+  void verify(uint active_threads) PRODUCT_RETURN;
 
   void set_enabled(bool enabled) { _enabled = enabled; }
 
@@ -183,7 +183,7 @@
 
  private:
 
-  void calculate_totals(){
+  void calculate_totals(uint active_threads){
     if (!_has_new_data) {
       return;
     }
@@ -191,13 +191,14 @@
     _sum = (T)0;
     _min = _data[0];
     _max = _min;
-    for (uint i = 0; i < _length; ++i) {
+    assert(active_threads <= _length, "Wrong number of active threads");
+    for (uint i = 0; i < active_threads; ++i) {
       T val = _data[i];
       _sum += val;
       _min = MIN2(_min, val);
       _max = MAX2(_max, val);
     }
-    _average = (double)_sum / (double)_length;
+    _average = (double)_sum / (double)active_threads;
     _has_new_data = false;
   }
 };
@@ -226,17 +227,18 @@
 }
 
 template <class T>
-void WorkerDataArray<T>::verify() {
+void WorkerDataArray<T>::verify(uint active_threads) {
   if (!_enabled) {
     return;
   }
 
-  for (uint i = 0; i < _length; i++) {
+  assert(active_threads <= _length, "Wrong number of active threads");
+  for (uint i = 0; i < active_threads; i++) {
     assert(_data[i] != WorkerDataArray<T>::uninitialized(),
         err_msg("Invalid data for worker %u in '%s'", i, _title));
   }
   if (_thread_work_items != NULL) {
-    _thread_work_items->verify();
+    _thread_work_items->verify(active_threads);
   }
 }
 
@@ -321,7 +323,7 @@
   }
 
   for (int i = 0; i < GCParPhasesSentinel; i++) {
-    _gc_par_phases[i]->verify();
+    _gc_par_phases[i]->verify(_active_gc_threads);
   }
 }
 
@@ -378,7 +380,7 @@
 
 // return the average time for a phase in milliseconds
 double G1GCPhaseTimes::average_time_ms(GCParPhases phase) {
-  return _gc_par_phases[phase]->average() * 1000.0;
+  return _gc_par_phases[phase]->average(_active_gc_threads) * 1000.0;
 }
 
 double G1GCPhaseTimes::get_time_ms(GCParPhases phase, uint worker_i) {
@@ -386,15 +388,15 @@
 }
 
 double G1GCPhaseTimes::sum_time_ms(GCParPhases phase) {
-  return _gc_par_phases[phase]->sum() * 1000.0;
+  return _gc_par_phases[phase]->sum(_active_gc_threads) * 1000.0;
 }
 
 double G1GCPhaseTimes::min_time_ms(GCParPhases phase) {
-  return _gc_par_phases[phase]->minimum() * 1000.0;
+  return _gc_par_phases[phase]->minimum(_active_gc_threads) * 1000.0;
 }
 
 double G1GCPhaseTimes::max_time_ms(GCParPhases phase) {
-  return _gc_par_phases[phase]->maximum() * 1000.0;
+  return _gc_par_phases[phase]->maximum(_active_gc_threads) * 1000.0;
 }
 
 size_t G1GCPhaseTimes::get_thread_work_item(GCParPhases phase, uint worker_i) {
@@ -404,22 +406,22 @@
 
 size_t G1GCPhaseTimes::sum_thread_work_items(GCParPhases phase) {
   assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
-  return _gc_par_phases[phase]->thread_work_items()->sum();
+  return _gc_par_phases[phase]->thread_work_items()->sum(_active_gc_threads);
 }
 
 double G1GCPhaseTimes::average_thread_work_items(GCParPhases phase) {
   assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
-  return _gc_par_phases[phase]->thread_work_items()->average();
+  return _gc_par_phases[phase]->thread_work_items()->average(_active_gc_threads);
 }
 
 size_t G1GCPhaseTimes::min_thread_work_items(GCParPhases phase) {
   assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
-  return _gc_par_phases[phase]->thread_work_items()->minimum();
+  return _gc_par_phases[phase]->thread_work_items()->minimum(_active_gc_threads);
 }
 
 size_t G1GCPhaseTimes::max_thread_work_items(GCParPhases phase) {
   assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
-  return _gc_par_phases[phase]->thread_work_items()->maximum();
+  return _gc_par_phases[phase]->thread_work_items()->maximum(_active_gc_threads);
 }
 
 class G1GCParPhasePrinter : public StackObj {
@@ -455,14 +457,16 @@
   }
 
   void print_time_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<double>* phase) {
-    for (uint i = 0; i < phase->_length; ++i) {
+    uint active_length = _phase_times->_active_gc_threads;
+    for (uint i = 0; i < active_length; ++i) {
       buf.append("  %.1lf", _phase_times->get_time_ms(phase_id, i));
     }
     buf.print_cr();
   }
 
   void print_count_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<size_t>* thread_work_items) {
-    for (uint i = 0; i < thread_work_items->_length; ++i) {
+    uint active_length = _phase_times->_active_gc_threads;
+    for (uint i = 0; i < active_length; ++i) {
       buf.append("  " SIZE_FORMAT, _phase_times->get_thread_work_item(phase_id, i));
     }
     buf.print_cr();
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp
index 8139048..68a2a96 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp
@@ -27,8 +27,6 @@
 #include "gc_implementation/g1/heapRegion.hpp"
 #include "utilities/ostream.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 const char* G1HRPrinter::action_name(ActionType action) {
   switch(action) {
     case Alloc:          return "ALLOC";
@@ -85,18 +83,18 @@
   if (type_str != NULL) {
     if (top != NULL) {
       gclog_or_tty->print_cr(G1HR_PREFIX" %s(%s) "PTR_FORMAT" "PTR_FORMAT,
-                             action_str, type_str, bottom, top);
+                             action_str, type_str, p2i(bottom), p2i(top));
     } else {
       gclog_or_tty->print_cr(G1HR_PREFIX" %s(%s) "PTR_FORMAT,
-                             action_str, type_str, bottom);
+                             action_str, type_str, p2i(bottom));
     }
   } else {
     if (top != NULL) {
       gclog_or_tty->print_cr(G1HR_PREFIX" %s "PTR_FORMAT" "PTR_FORMAT,
-                             action_str, bottom, top);
+                             action_str, p2i(bottom), p2i(top));
     } else {
       gclog_or_tty->print_cr(G1HR_PREFIX" %s "PTR_FORMAT,
-                             action_str, bottom);
+                             action_str, p2i(bottom));
     }
   }
 }
@@ -105,7 +103,7 @@
   const char* action_str = action_name(action);
 
   gclog_or_tty->print_cr(G1HR_PREFIX" %s ["PTR_FORMAT","PTR_FORMAT"]",
-                         action_str, bottom, end);
+                         action_str, p2i(bottom), p2i(end));
 }
 
 void G1HRPrinter::print(PhaseType phase, size_t phase_num) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp
index 29020bc..38ec4a9 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -33,6 +33,7 @@
 #include "gc_implementation/g1/g1MarkSweep.hpp"
 #include "gc_implementation/g1/g1RootProcessor.hpp"
 #include "gc_implementation/g1/g1StringDedup.hpp"
+#include "gc_implementation/shared/markSweep.inline.hpp"
 #include "gc_implementation/shared/gcHeapSummary.hpp"
 #include "gc_implementation/shared/gcTimer.hpp"
 #include "gc_implementation/shared/gcTrace.hpp"
@@ -217,7 +218,7 @@
         // We must adjust the pointers on the single H object.
         oop obj = oop(r->bottom());
         // point all the oops to the new location
-        obj->adjust_pointers();
+        MarkSweep::adjust_pointers(obj);
       }
     } else {
       // This really ought to be "as_CompactibleSpace"...
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
index 2ec726e..6ffb5fe 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
@@ -27,7 +27,6 @@
 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
 #include "gc_implementation/g1/g1ParScanThreadState.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.pcgc.inline.hpp"
 #include "runtime/prefetch.inline.hpp"
 
 G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp)
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
index eff64c4..b452f9a 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
@@ -39,8 +39,6 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/intHisto.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 #define CARD_REPEAT_HISTO 0
 
 #if CARD_REPEAT_HISTO
@@ -156,9 +154,9 @@
                            "RS names card " SIZE_FORMAT_HEX ": "
                            "[" PTR_FORMAT ", " PTR_FORMAT ")",
                            _worker_i,
-                           card_region->bottom(), card_region->end(),
+                           p2i(card_region->bottom()), p2i(card_region->end()),
                            card_index,
-                           card_start, card_start + G1BlockOffsetSharedArray::N_words);
+                           p2i(card_start), p2i(card_start + G1BlockOffsetSharedArray::N_words));
   }
 
   void scan_strong_code_roots(HeapRegion* r) {
@@ -428,7 +426,7 @@
          err_msg("Card at "PTR_FORMAT" index "SIZE_FORMAT" representing heap at "PTR_FORMAT" (%u) must be in committed heap",
                  p2i(card_ptr),
                  _ct_bs->index_for(_ct_bs->addr_for(card_ptr)),
-                 _ct_bs->addr_for(card_ptr),
+                 p2i(_ct_bs->addr_for(card_ptr)),
                  _g1->addr_to_region(_ct_bs->addr_for(card_ptr))));
 
   // If the card is no longer dirty, nothing to do.
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
index 0d6c16e..77f6c41 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
@@ -39,8 +39,6 @@
 #include "runtime/atomic.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 int    HeapRegion::LogOfHRGrainBytes = 0;
 int    HeapRegion::LogOfHRGrainWords = 0;
 size_t HeapRegion::GrainBytes        = 0;
@@ -505,7 +503,7 @@
           gclog_or_tty->print_cr("Object "PTR_FORMAT" in region "
                                  "["PTR_FORMAT", "PTR_FORMAT") is above "
                                  "top "PTR_FORMAT,
-                                 (void *)obj, _hr->bottom(), _hr->end(), _hr->top());
+                                 p2i(obj), p2i(_hr->bottom()), p2i(_hr->end()), p2i(_hr->top()));
           _failures = true;
           return;
         }
@@ -540,7 +538,7 @@
       if (!nm->is_alive()) {
         gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] has dead nmethod "
                                PTR_FORMAT" in its strong code roots",
-                               _hr->bottom(), _hr->end(), nm);
+                               p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm));
         _failures = true;
       } else {
         VerifyStrongCodeRootOopClosure oop_cl(_hr, nm);
@@ -549,12 +547,12 @@
           gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] has nmethod "
                                  PTR_FORMAT" in its strong code roots "
                                  "with no pointers into region",
-                                 _hr->bottom(), _hr->end(), nm);
+                                 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm));
           _failures = true;
         } else if (oop_cl.failures()) {
           gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] has other "
                                  "failures for nmethod "PTR_FORMAT,
-                                 _hr->bottom(), _hr->end(), nm);
+                                 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm));
           _failures = true;
         }
       }
@@ -589,7 +587,7 @@
     if (strong_code_roots_length > 0) {
       gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is empty "
                              "but has "SIZE_FORMAT" code root entries",
-                             bottom(), end(), strong_code_roots_length);
+                             p2i(bottom()), p2i(end()), strong_code_roots_length);
       *failures = true;
     }
     return;
@@ -624,7 +622,7 @@
     st->print("   ");
   st->print(" TS %5d", _gc_time_stamp);
   st->print(" PTAMS "PTR_FORMAT" NTAMS "PTR_FORMAT,
-            prev_top_at_mark_start(), next_top_at_mark_start());
+            p2i(prev_top_at_mark_start()), p2i(next_top_at_mark_start()));
   G1OffsetTableContigSpace::print_on(st);
 }
 
@@ -687,23 +685,23 @@
           gclog_or_tty->print_cr("Field "PTR_FORMAT
                                  " of live obj "PTR_FORMAT" in region "
                                  "["PTR_FORMAT", "PTR_FORMAT")",
-                                 p, (void*) _containing_obj,
-                                 from->bottom(), from->end());
+                                 p2i(p), p2i(_containing_obj),
+                                 p2i(from->bottom()), p2i(from->end()));
           print_object(gclog_or_tty, _containing_obj);
           gclog_or_tty->print_cr("points to obj "PTR_FORMAT" not in the heap",
-                                 (void*) obj);
+                                 p2i(obj));
         } else {
           HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
           HeapRegion* to   = _g1h->heap_region_containing((HeapWord*)obj);
           gclog_or_tty->print_cr("Field "PTR_FORMAT
                                  " of live obj "PTR_FORMAT" in region "
                                  "["PTR_FORMAT", "PTR_FORMAT")",
-                                 p, (void*) _containing_obj,
-                                 from->bottom(), from->end());
+                                 p2i(p), p2i(_containing_obj),
+                                 p2i(from->bottom()), p2i(from->end()));
           print_object(gclog_or_tty, _containing_obj);
           gclog_or_tty->print_cr("points to dead obj "PTR_FORMAT" in region "
                                  "["PTR_FORMAT", "PTR_FORMAT")",
-                                 (void*) obj, to->bottom(), to->end());
+                                 p2i(obj), p2i(to->bottom()), p2i(to->end()));
           print_object(gclog_or_tty, obj);
         }
         gclog_or_tty->print_cr("----------");
@@ -741,12 +739,12 @@
             gclog_or_tty->print_cr("Field "PTR_FORMAT" "
                                    "of obj "PTR_FORMAT", "
                                    "in region "HR_FORMAT,
-                                   p, (void*) _containing_obj,
+                                   p2i(p), p2i(_containing_obj),
                                    HR_FORMAT_PARAMS(from));
             _containing_obj->print_on(gclog_or_tty);
             gclog_or_tty->print_cr("points to obj "PTR_FORMAT" "
                                    "in region "HR_FORMAT,
-                                   (void*) obj,
+                                   p2i(obj),
                                    HR_FORMAT_PARAMS(to));
             obj->print_on(gclog_or_tty);
             gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.",
@@ -783,7 +781,7 @@
         !g1->is_obj_dead(obj, this)) { // Dead objects may have bigger block_size since they span several objects.
       gclog_or_tty->print_cr("obj "PTR_FORMAT" is of %shumongous size ("
                              SIZE_FORMAT" words) in a %shumongous region",
-                             p, g1->is_humongous(obj_size) ? "" : "non-",
+                             p2i(p), g1->is_humongous(obj_size) ? "" : "non-",
                              obj_size, is_region_humongous ? "" : "non-");
        *failures = true;
        return;
@@ -797,12 +795,12 @@
                                    ClassLoaderDataGraph::unload_list_contains(klass));
         if (!is_metaspace_object) {
           gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" "
-                                 "not metadata", klass, (void *)obj);
+                                 "not metadata", p2i(klass), p2i(obj));
           *failures = true;
           return;
         } else if (!klass->is_klass()) {
           gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" "
-                                 "not a klass", klass, (void *)obj);
+                                 "not a klass", p2i(klass), p2i(obj));
           *failures = true;
           return;
         } else {
@@ -817,7 +815,7 @@
           }
         }
       } else {
-        gclog_or_tty->print_cr(PTR_FORMAT" no an oop", (void *)obj);
+        gclog_or_tty->print_cr(PTR_FORMAT" no an oop", p2i(obj));
         *failures = true;
         return;
       }
@@ -832,7 +830,7 @@
 
   if (p != top()) {
     gclog_or_tty->print_cr("end of last object "PTR_FORMAT" "
-                           "does not match top "PTR_FORMAT, p, top());
+                           "does not match top "PTR_FORMAT, p2i(p), p2i(top()));
     *failures = true;
     return;
   }
@@ -849,7 +847,7 @@
     if (b_start_1 != p) {
       gclog_or_tty->print_cr("BOT look up for top: "PTR_FORMAT" "
                              " yielded "PTR_FORMAT", expecting "PTR_FORMAT,
-                             addr_1, b_start_1, p);
+                             p2i(addr_1), p2i(b_start_1), p2i(p));
       *failures = true;
       return;
     }
@@ -861,7 +859,7 @@
       if (b_start_2 != p) {
         gclog_or_tty->print_cr("BOT look up for top + 1: "PTR_FORMAT" "
                                " yielded "PTR_FORMAT", expecting "PTR_FORMAT,
-                               addr_2, b_start_2, p);
+                               p2i(addr_2), p2i(b_start_2), p2i(p));
         *failures = true;
         return;
       }
@@ -875,7 +873,7 @@
       if (b_start_3 != p) {
         gclog_or_tty->print_cr("BOT look up for top + diff: "PTR_FORMAT" "
                                " yielded "PTR_FORMAT", expecting "PTR_FORMAT,
-                               addr_3, b_start_3, p);
+                               p2i(addr_3), p2i(b_start_3), p2i(p));
         *failures = true;
         return;
       }
@@ -887,7 +885,7 @@
     if (b_start_4 != p) {
       gclog_or_tty->print_cr("BOT look up for end - 1: "PTR_FORMAT" "
                              " yielded "PTR_FORMAT", expecting "PTR_FORMAT,
-                             addr_4, b_start_4, p);
+                             p2i(addr_4), p2i(b_start_4), p2i(p));
       *failures = true;
       return;
     }
@@ -896,7 +894,7 @@
   if (is_region_humongous && object_num > 1) {
     gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is humongous "
                            "but has "SIZE_FORMAT", objects",
-                           bottom(), end(), object_num);
+                           p2i(bottom()), p2i(end()), object_num);
     *failures = true;
     return;
   }
@@ -947,7 +945,7 @@
   print_short();
   gclog_or_tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", "
                 INTPTR_FORMAT ", " INTPTR_FORMAT ")",
-                bottom(), top(), _offsets.threshold(), end());
+                p2i(bottom()), p2i(top()), p2i(_offsets.threshold()), p2i(end()));
 }
 
 HeapWord* G1OffsetTableContigSpace::initialize_threshold() {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp
index 835b8e2..a8416bc 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp
@@ -37,8 +37,6 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/growableArray.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 class PerRegionTable: public CHeapObj<mtGC> {
   friend class OtherRegionsTable;
   friend class HeapRegionRemSetIterator;
@@ -93,10 +91,10 @@
 
     if (G1TraceHeapRegionRememberedSet) {
       gclog_or_tty->print_cr("    PRT::Add_reference_work(" PTR_FORMAT "->" PTR_FORMAT").",
-                             from,
+                             p2i(from),
                              UseCompressedOops
-                             ? (void *)oopDesc::load_decode_heap_oop((narrowOop*)from)
-                             : (void *)oopDesc::load_decode_heap_oop((oop*)from));
+                             ? p2i(oopDesc::load_decode_heap_oop((narrowOop*)from))
+                             : p2i(oopDesc::load_decode_heap_oop((oop*)from)));
     }
 
     HeapRegion* loc_hr = hr();
@@ -412,17 +410,17 @@
 
   if (G1TraceHeapRegionRememberedSet) {
     gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").",
-                                                    from,
+                                                    p2i(from),
                                                     UseCompressedOops
-                                                    ? (void *)oopDesc::load_decode_heap_oop((narrowOop*)from)
-                                                    : (void *)oopDesc::load_decode_heap_oop((oop*)from));
+                                                    ? p2i(oopDesc::load_decode_heap_oop((narrowOop*)from))
+                                                    : p2i(oopDesc::load_decode_heap_oop((oop*)from)));
   }
 
   int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift);
 
   if (G1TraceHeapRegionRememberedSet) {
     gclog_or_tty->print_cr("Table for [" PTR_FORMAT "...): card %d (cache = %d)",
-                  _hr->bottom(), from_card,
+                  p2i(_hr->bottom()), from_card,
                   FromCardCache::at(tid, cur_hrm_ind));
   }
 
@@ -471,7 +469,7 @@
                                 "[" PTR_FORMAT "...) for ref " PTR_FORMAT ".\n",
                                 align_size_down(uintptr_t(from),
                                                 CardTableModRefBS::card_size),
-                                _hr->bottom(), from);
+                                p2i(_hr->bottom()), p2i(from));
           }
         }
         if (G1TraceHeapRegionRememberedSet) {
@@ -533,7 +531,7 @@
                           "[" PTR_FORMAT "...) for ref " PTR_FORMAT ".\n",
                           align_size_down(uintptr_t(from),
                                           CardTableModRefBS::card_size),
-                          _hr->bottom(), from);
+                          p2i(_hr->bottom()), p2i(from));
     }
   }
   assert(contains_reference(from), "We just added it!");
@@ -602,8 +600,8 @@
     if (G1TraceHeapRegionRememberedSet) {
       gclog_or_tty->print("Coarsened entry in region [" PTR_FORMAT "...] "
                  "for region [" PTR_FORMAT "...] (" SIZE_FORMAT " coarse entries).\n",
-                 _hr->bottom(),
-                 max->hr()->bottom(),
+                 p2i(_hr->bottom()),
+                 p2i(max->hr()->bottom()),
                  _n_coarse_entries);
     }
   }
@@ -857,7 +855,7 @@
   while (iter.has_next(card_index)) {
     HeapWord* card_start =
       G1CollectedHeap::heap()->bot_shared()->address_for_index(card_index);
-    gclog_or_tty->print_cr("  Card " PTR_FORMAT, card_start);
+    gclog_or_tty->print_cr("  Card " PTR_FORMAT, p2i(card_start));
   }
   if (iter.n_yielded() != occupied()) {
     gclog_or_tty->print_cr("Yielded disagrees with occupied:");
@@ -1152,8 +1150,8 @@
     }
     gclog_or_tty->print("Added card " PTR_FORMAT " to region [" PTR_FORMAT "...]"
                         " for ref " PTR_FORMAT ".\n",
-                        _recorded_cards[i], _recorded_regions[i]->bottom(),
-                        _recorded_oops[i]);
+                        p2i(_recorded_cards[i]), p2i(_recorded_regions[i]->bottom()),
+                        p2i(_recorded_oops[i]));
   }
 }
 
@@ -1240,7 +1238,7 @@
   while (iter.has_next(card_index)) {
     HeapWord* card_start =
       G1CollectedHeap::heap()->bot_shared()->address_for_index(card_index);
-    gclog_or_tty->print_cr("  Card " PTR_FORMAT ".", card_start);
+    gclog_or_tty->print_cr("  Card " PTR_FORMAT ".", p2i(card_start));
     sum++;
   }
   guarantee(sum == 11 - 3 + 2048, "Failure");
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
index 37a85aa..9657356 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
@@ -27,8 +27,6 @@
 #include "gc_implementation/g1/heapRegionRemSet.hpp"
 #include "gc_implementation/g1/heapRegionSet.inline.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 uint FreeRegionList::_unrealistically_long_length = 0;
 
 void HeapRegionSetBase::fill_in_ext_msg(hrs_ext_msg* msg, const char* message) {
@@ -84,7 +82,7 @@
 
 void HeapRegionSetBase::print_on(outputStream* out, bool print_contents) {
   out->cr();
-  out->print_cr("Set: %s ("PTR_FORMAT")", name(), this);
+  out->print_cr("Set: %s ("PTR_FORMAT")", name(), p2i(this));
   out->print_cr("  Region Assumptions");
   out->print_cr("    humongous         : %s", BOOL_TO_STR(regions_humongous()));
   out->print_cr("    free              : %s", BOOL_TO_STR(regions_free()));
@@ -106,7 +104,7 @@
 }
 
 void FreeRegionList::fill_in_ext_msg_extra(hrs_ext_msg* msg) {
-  msg->append(" hd: "PTR_FORMAT" tl: "PTR_FORMAT, _head, _tail);
+  msg->append(" hd: "PTR_FORMAT" tl: "PTR_FORMAT, p2i(_head), p2i(_tail));
 }
 
 void FreeRegionList::remove_all() {
@@ -277,8 +275,8 @@
 void FreeRegionList::print_on(outputStream* out, bool print_contents) {
   HeapRegionSetBase::print_on(out, print_contents);
   out->print_cr("  Linking");
-  out->print_cr("    head              : "PTR_FORMAT, _head);
-  out->print_cr("    tail              : "PTR_FORMAT, _tail);
+  out->print_cr("    head              : "PTR_FORMAT, p2i(_head));
+  out->print_cr("    tail              : "PTR_FORMAT, p2i(_tail));
 
   if (print_contents) {
     out->print_cr("  Contents");
@@ -306,7 +304,8 @@
 
     count++;
     guarantee(count < _unrealistically_long_length,
-        hrs_err_msg("[%s] the calculated length: %u seems very long, is there maybe a cycle? curr: "PTR_FORMAT" prev0: "PTR_FORMAT" " "prev1: "PTR_FORMAT" length: %u", name(), count, curr, prev0, prev1, length()));
+        hrs_err_msg("[%s] the calculated length: %u seems very long, is there maybe a cycle? curr: "PTR_FORMAT" prev0: "PTR_FORMAT" " "prev1: "PTR_FORMAT" length: %u",
+            name(), count, p2i(curr), p2i(prev0), p2i(prev1), length()));
 
     if (curr->next() != NULL) {
       guarantee(curr->next()->prev() == curr, "Next or prev pointers messed up");
diff --git a/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp
index 2ab5965..4da322f 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp
@@ -32,8 +32,6 @@
 #include "runtime/thread.hpp"
 #include "runtime/vmThread.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 void ObjPtrQueue::flush() {
   // The buffer might contain refs into the CSet. We have to filter it
   // first before we flush it, otherwise we might end up with an
@@ -182,7 +180,7 @@
                         void** buf, size_t index, size_t sz) {
   gclog_or_tty->print_cr("  SATB BUFFER [%s] buf: "PTR_FORMAT" "
                          "index: "SIZE_FORMAT" sz: "SIZE_FORMAT,
-                         name, buf, index, sz);
+                         name, p2i(buf), index, sz);
 }
 #endif // PRODUCT
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp
index 4a2ea6e..13c8124 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp
@@ -29,8 +29,6 @@
 #include "gc_implementation/g1/survRateGroup.hpp"
 #include "memory/allocation.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 SurvRateGroup::SurvRateGroup(G1CollectorPolicy* g1p,
                              const char* name,
                              size_t summary_surv_rates_len) :
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
index efe7e39..9ab7638 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
@@ -36,8 +36,6 @@
 #include "runtime/virtualspace.hpp"
 #include "runtime/vmThread.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
                                                              OopsInGenClosure* cl,
                                                              CardTableRS* ct,
@@ -153,8 +151,7 @@
     // result of the dirty card iteration below.
     OrderAccess::storestore();
 
-    // We do not call the non_clean_card_iterate_serial() version because
-    // we want to clear the cards: clear_cl here does the work of finding
+    // We want to clear the cards: clear_cl here does the work of finding
     // contiguous dirty ranges of cards to process and clear.
     clear_cl.do_MemRegion(chunk_mr);
 
@@ -376,13 +373,14 @@
                          " does not exceed used.end() = " PTR_FORMAT ","
                          " yet last_chunk_index_to_check " INTPTR_FORMAT
                          " exceeds last_chunk_index " INTPTR_FORMAT,
-                         last_block, last_block + last_block_size,
-                         used.end(),
+                         p2i(last_block), p2i(last_block + last_block_size),
+                         p2i(used.end()),
                          last_chunk_index_to_check, last_chunk_index));
           assert(sp->used_region().end() > used.end(),
                  err_msg("Expansion did not happen: "
                          "[" PTR_FORMAT "," PTR_FORMAT ") -> [" PTR_FORMAT "," PTR_FORMAT ")",
-                         sp->used_region().start(), sp->used_region().end(), used.start(), used.end()));
+                         p2i(sp->used_region().start()), p2i(sp->used_region().end()),
+                         p2i(used.start()), p2i(used.end())));
           NOISY(tty->print_cr(" process_chunk_boundary: heap expanded; explicitly bounding last_chunk");)
           last_chunk_index_to_check = last_chunk_index;
         }
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
index 11465b1..775a6a5 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
@@ -46,7 +46,6 @@
 #include "memory/space.hpp"
 #include "oops/objArrayOop.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.pcgc.inline.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/handles.inline.hpp"
@@ -56,8 +55,6 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/workgroup.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 #ifdef _MSC_VER
 #pragma warning( push )
 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list
@@ -1213,7 +1210,7 @@
   if (TraceScavenge) {
     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
        is_in_reserved(new_obj) ? "copying" : "tenuring",
-       new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size());
+       new_obj->klass()->internal_name(), p2i(old), p2i(new_obj), new_obj->size());
   }
 #endif
 
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp
index 7448978..3523ff5 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp
@@ -26,12 +26,11 @@
 #include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
-#include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
+#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
 #include "gc_implementation/parallelScavenge/psTasks.hpp"
 #include "gc_implementation/parallelScavenge/psYoungGen.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.psgc.inline.hpp"
 #include "runtime/prefetch.inline.hpp"
 
 // Checks an individual oop for missing precise marks. Mark
@@ -291,7 +290,7 @@
             Prefetch::write(p, interval);
             oop m = oop(p);
             assert(m->is_oop_or_null(), err_msg("Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m)));
-            m->push_contents(pm);
+            pm->push_contents(m);
             p += m->size();
           }
           pm->drain_stacks_cond_depth();
@@ -299,7 +298,7 @@
           while (p < to) {
             oop m = oop(p);
             assert(m->is_oop_or_null(), err_msg("Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m)));
-            m->push_contents(pm);
+            pm->push_contents(m);
             p += m->size();
           }
           pm->drain_stacks_cond_depth();
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp
index a35c091..d9f38a0 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp
@@ -32,8 +32,6 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/orderAccess.inline.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 //
 // GCTask
 //
@@ -101,7 +99,7 @@
 NOT_PRODUCT(
 void GCTask::print(const char* message) const {
   tty->print(INTPTR_FORMAT " <- " INTPTR_FORMAT "(%u) -> " INTPTR_FORMAT,
-             newer(), this, affinity(), older());
+             p2i(newer()), p2i(this), affinity(), p2i(older()));
 }
 )
 
@@ -113,7 +111,7 @@
   GCTaskQueue* result = new GCTaskQueue(false);
   if (TraceGCTaskQueue) {
     tty->print_cr("GCTaskQueue::create()"
-                  " returns " INTPTR_FORMAT, result);
+                  " returns " INTPTR_FORMAT, p2i(result));
   }
   return result;
 }
@@ -123,7 +121,7 @@
   if (TraceGCTaskQueue) {
     tty->print_cr("GCTaskQueue::create_on_c_heap()"
                   " returns " INTPTR_FORMAT,
-                  result);
+                  p2i(result));
   }
   return result;
 }
@@ -134,7 +132,7 @@
   if (TraceGCTaskQueue) {
     tty->print_cr("[" INTPTR_FORMAT "]"
                   " GCTaskQueue::GCTaskQueue() constructor",
-                  this);
+                  p2i(this));
   }
 }
 
@@ -147,7 +145,7 @@
     tty->print_cr("[" INTPTR_FORMAT "]"
                   " GCTaskQueue::destroy()"
                   "  is_c_heap_obj:  %s",
-                  that,
+                  p2i(that),
                   that->is_c_heap_obj() ? "true" : "false");
   }
   // That instance may have been allocated as a CHeapObj,
@@ -173,7 +171,7 @@
     tty->print_cr("[" INTPTR_FORMAT "]"
                   " GCTaskQueue::enqueue(task: "
                   INTPTR_FORMAT ")",
-                  this, task);
+                  p2i(this), p2i(task));
     print("before:");
   }
   assert(task != NULL, "shouldn't have null task");
@@ -200,7 +198,7 @@
     tty->print_cr("[" INTPTR_FORMAT "]"
                   " GCTaskQueue::enqueue(list: "
                   INTPTR_FORMAT ")",
-                  this, list);
+                  p2i(this), p2i(list));
     print("before:");
     list->print("list:");
   }
@@ -234,14 +232,14 @@
 GCTask* GCTaskQueue::dequeue() {
   if (TraceGCTaskQueue) {
     tty->print_cr("[" INTPTR_FORMAT "]"
-                  " GCTaskQueue::dequeue()", this);
+                  " GCTaskQueue::dequeue()", p2i(this));
     print("before:");
   }
   assert(!is_empty(), "shouldn't dequeue from empty list");
   GCTask* result = remove();
   assert(result != NULL, "shouldn't have NULL task");
   if (TraceGCTaskQueue) {
-    tty->print_cr("    return: " INTPTR_FORMAT, result);
+    tty->print_cr("    return: " INTPTR_FORMAT, p2i(result));
     print("after:");
   }
   return result;
@@ -251,7 +249,7 @@
 GCTask* GCTaskQueue::dequeue(uint affinity) {
   if (TraceGCTaskQueue) {
     tty->print_cr("[" INTPTR_FORMAT "]"
-                  " GCTaskQueue::dequeue(%u)", this, affinity);
+                  " GCTaskQueue::dequeue(%u)", p2i(this), affinity);
     print("before:");
   }
   assert(!is_empty(), "shouldn't dequeue from empty list");
@@ -275,7 +273,7 @@
     result = remove();
   }
   if (TraceGCTaskQueue) {
-    tty->print_cr("    return: " INTPTR_FORMAT, result);
+    tty->print_cr("    return: " INTPTR_FORMAT, p2i(result));
     print("after:");
   }
   return result;
@@ -345,7 +343,7 @@
                 "  remove_end: " INTPTR_FORMAT
                 "  length:       %d"
                 "  %s",
-                this, insert_end(), remove_end(), length(), message);
+                p2i(this), p2i(insert_end()), p2i(remove_end()), length(), message);
   uint count = 0;
   for (GCTask* element = insert_end();
        element != NULL;
@@ -486,7 +484,7 @@
 
   assert(!all_workers_active() || active_workers() == ParallelGCThreads,
          err_msg("all_workers_active() is  incorrect: "
-                 "active %d  ParallelGCThreads %d", active_workers(),
+                 "active %d  ParallelGCThreads " UINTX_FORMAT, active_workers(),
                  ParallelGCThreads));
   if (TraceDynamicGCThreads) {
     gclog_or_tty->print_cr("GCTaskManager::set_active_gang(): "
@@ -598,7 +596,7 @@
   MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
   if (TraceGCTaskManager) {
     tty->print_cr("GCTaskManager::add_task(" INTPTR_FORMAT " [%s])",
-                  task, GCTask::Kind::to_string(task->kind()));
+                  p2i(task), GCTask::Kind::to_string(task->kind()));
   }
   queue()->enqueue(task);
   // Notify with the lock held to avoid missed notifies.
@@ -678,7 +676,7 @@
   assert(result != NULL, "shouldn't have null task");
   if (TraceGCTaskManager) {
     tty->print_cr("GCTaskManager::get_task(%u) => " INTPTR_FORMAT " [%s]",
-                  which, result, GCTask::Kind::to_string(result->kind()));
+                  which, p2i(result), GCTask::Kind::to_string(result->kind()));
     tty->print_cr("     %s", result->name());
   }
   if (!result->is_idle_task()) {
@@ -864,7 +862,7 @@
     tty->print_cr("[" INTPTR_FORMAT "]"
                   " IdleGCTask:::do_it()"
       "  should_wait: %s",
-      this, wait_for_task->should_wait() ? "true" : "false");
+      p2i(this), wait_for_task->should_wait() ? "true" : "false");
   }
   MutexLockerEx ml(manager->monitor(), Mutex::_no_safepoint_check_flag);
   if (TraceDynamicGCThreads) {
@@ -878,7 +876,7 @@
       tty->print_cr("[" INTPTR_FORMAT "]"
                     " IdleGCTask::do_it()"
         "  [" INTPTR_FORMAT "] (%s)->wait()",
-        this, manager->monitor(), manager->monitor()->name());
+        p2i(this), p2i(manager->monitor()), manager->monitor()->name());
     }
     manager->monitor()->wait(Mutex::_no_safepoint_check_flag, 0);
   }
@@ -890,7 +888,7 @@
     tty->print_cr("[" INTPTR_FORMAT "]"
                   " IdleGCTask::do_it() returns"
       "  should_wait: %s",
-      this, wait_for_task->should_wait() ? "true" : "false");
+      p2i(this), wait_for_task->should_wait() ? "true" : "false");
   }
   // Release monitor().
 }
@@ -1000,7 +998,7 @@
     tty->print_cr("[" INTPTR_FORMAT "]"
                   " WaitForBarrierGCTask::WaitForBarrierGCTask()"
                   "  monitor: " INTPTR_FORMAT,
-                  this, monitor());
+                  p2i(this), p2i(monitor()));
   }
 }
 
@@ -1011,9 +1009,9 @@
                     " WaitForBarrierGCTask::destroy()"
                     "  is_c_heap_obj: %s"
                     "  monitor: " INTPTR_FORMAT,
-                    that,
+                    p2i(that),
                     that->is_c_heap_obj() ? "true" : "false",
-                    that->monitor());
+                    p2i(that->monitor()));
     }
     that->destruct();
     if (that->is_c_heap_obj()) {
@@ -1028,7 +1026,7 @@
     tty->print_cr("[" INTPTR_FORMAT "]"
                   " WaitForBarrierGCTask::destruct()"
                   "  monitor: " INTPTR_FORMAT,
-                  this, monitor());
+                  p2i(this), p2i(monitor()));
   }
   this->BarrierGCTask::destruct();
   // Clean up that should be in the destructor,
@@ -1044,7 +1042,7 @@
     tty->print_cr("[" INTPTR_FORMAT "]"
                   " WaitForBarrierGCTask::do_it() waiting for idle"
                   "  monitor: " INTPTR_FORMAT,
-                  this, monitor());
+                  p2i(this), p2i(monitor()));
   }
   {
     // First, wait for the barrier to arrive.
@@ -1062,7 +1060,7 @@
       tty->print_cr("[" INTPTR_FORMAT "]"
                     " WaitForBarrierGCTask::do_it()"
                     "  [" INTPTR_FORMAT "] (%s)->notify_all()",
-                    this, monitor(), monitor()->name());
+                    p2i(this), p2i(monitor()), monitor()->name());
     }
     monitor()->notify_all();
     // Release monitor().
@@ -1074,7 +1072,7 @@
     tty->print_cr("[" INTPTR_FORMAT "]"
                   " WaitForBarrierGCTask::wait_for()"
       "  should_wait: %s",
-      this, should_wait() ? "true" : "false");
+      p2i(this), should_wait() ? "true" : "false");
   }
   {
     // Grab the lock and check again.
@@ -1084,7 +1082,7 @@
         tty->print_cr("[" INTPTR_FORMAT "]"
                       " WaitForBarrierGCTask::wait_for()"
           "  [" INTPTR_FORMAT "] (%s)->wait()",
-          this, monitor(), monitor()->name());
+          p2i(this), p2i(monitor()), monitor()->name());
       }
       monitor()->wait(Mutex::_no_safepoint_check_flag, 0);
     }
@@ -1096,7 +1094,7 @@
       tty->print_cr("[" INTPTR_FORMAT "]"
                     " WaitForBarrierGCTask::wait_for() returns"
         "  should_wait: %s",
-        this, should_wait() ? "true" : "false");
+        p2i(this), should_wait() ? "true" : "false");
     }
     // Release monitor().
   }
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
index 91f2361..13060a4 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
@@ -34,8 +34,6 @@
 #include "runtime/os.hpp"
 #include "runtime/thread.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 GCTaskThread::GCTaskThread(GCTaskManager* manager,
                            uint           which,
                            uint           processor_id) :
@@ -79,7 +77,7 @@
   tty->print_cr("GC-Thread %u entries: %d", id(), _time_stamp_index);
   for(uint i=0; i<_time_stamp_index; i++) {
     GCTaskTimeStamp* time_stamp = time_stamp_at(i);
-    tty->print_cr("\t[ %s " INT64_FORMAT " " INT64_FORMAT " ]",
+    tty->print_cr("\t[ %s " JLONG_FORMAT " " JLONG_FORMAT " ]",
                   time_stamp->name(),
                   time_stamp->entry_time(),
                   time_stamp->exit_time());
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
index 39ee16a..a503286 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
@@ -203,17 +203,6 @@
   return is_in_young((oop)addr);
 }
 
-#ifdef ASSERT
-// Don't implement this by using is_in_young().  This method is used
-// in some cases to check that is_in_young() is correct.
-bool ParallelScavengeHeap::is_in_partial_collection(const void *p) {
-  assert(is_in_reserved(p) || p == NULL,
-    "Does not work if address is non-null and outside of the heap");
-  // The order of the generations is old (low addr), young (high addr)
-  return p >= old_gen()->reserved().end();
-}
-#endif
-
 // There are two levels of allocation policy here.
 //
 // When an allocation request fails, the requesting thread must invoke a VM
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp
index 722ed9e..867bdbf 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -83,7 +83,7 @@
     MarkSweep
   };
 
-  ParallelScavengeHeap::Name kind() const {
+  virtual Name kind() const {
     return CollectedHeap::ParallelScavengeHeap;
   }
 
@@ -141,10 +141,6 @@
 
   bool is_in_reserved(const void* p) const;
 
-#ifdef ASSERT
-  virtual bool is_in_partial_collection(const void *p);
-#endif
-
   bool is_in_young(oop p);  // reserved part
   bool is_in_old(oop p);    // reserved part
 
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp
index c277038..fc2cd8c 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp
@@ -27,6 +27,7 @@
 #include "code/codeCache.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #include "gc_implementation/parallelScavenge/pcTasks.hpp"
+#include "gc_implementation/parallelScavenge/psCompactionManager.inline.hpp"
 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
 #include "gc_implementation/shared/gcTimer.hpp"
 #include "gc_implementation/shared/gcTraceTime.hpp"
@@ -34,7 +35,6 @@
 #include "memory/universe.hpp"
 #include "oops/objArrayKlass.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.pcgc.inline.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/jniHandles.hpp"
@@ -42,8 +42,6 @@
 #include "runtime/vmThread.hpp"
 #include "services/management.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 //
 // ThreadRootsMarkingTask
 //
@@ -221,12 +219,11 @@
   int random_seed = 17;
   do {
     while (ParCompactionManager::steal_objarray(which, &random_seed, task)) {
-      ObjArrayKlass* k = (ObjArrayKlass*)task.obj()->klass();
-      k->oop_follow_contents(cm, task.obj(), task.index());
+      cm->follow_contents((objArrayOop)task.obj(), task.index());
       cm->follow_marking_stacks();
     }
     while (ParCompactionManager::steal(which, &random_seed, obj)) {
-      obj->follow_contents(cm);
+      cm->follow_contents(obj);
       cm->follow_marking_stacks();
     }
   } while (!terminator()->offer_termination());
@@ -257,7 +254,7 @@
     which_stack_index = which;
     assert(manager->active_workers() == ParallelGCThreads,
            err_msg("all_workers_active has been incorrectly set: "
-                   " active %d  ParallelGCThreads %d", manager->active_workers(),
+                   " active %d  ParallelGCThreads " UINTX_FORMAT, manager->active_workers(),
                    ParallelGCThreads));
   } else {
     which_stack_index = ParCompactionManager::pop_recycled_stack_index();
@@ -269,7 +266,7 @@
     gclog_or_tty->print_cr("StealRegionCompactionTask::do_it "
                            "region_stack_index %d region_stack = " PTR_FORMAT " "
                            " empty (%d) use all workers %d",
-    which_stack_index, ParCompactionManager::region_list(which_stack_index),
+    which_stack_index, p2i(ParCompactionManager::region_list(which_stack_index)),
     cm->region_stack()->is_empty(),
     use_all_workers);
   }
@@ -336,7 +333,7 @@
     which_stack_index = which;
     assert(manager->active_workers() == ParallelGCThreads,
            err_msg("all_workers_active has been incorrectly set: "
-                   " active %d  ParallelGCThreads %d", manager->active_workers(),
+                   " active %d  ParallelGCThreads " UINTX_FORMAT, manager->active_workers(),
                    ParallelGCThreads));
   } else {
     which_stack_index = stack_index();
@@ -370,7 +367,7 @@
       void* old_region_stack = (void*) cm->region_stack();
       int old_region_stack_index = cm->region_stack_index();
       gclog_or_tty->print_cr("Pushing region stack " PTR_FORMAT "/%d",
-        old_region_stack, old_region_stack_index);
+        p2i(old_region_stack), old_region_stack_index);
     }
 
     cm->set_region_stack(NULL);
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp
index 229b9dd..bf979b9 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp
@@ -35,8 +35,6 @@
 
 #include <math.h>
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 PSAdaptiveSizePolicy::PSAdaptiveSizePolicy(size_t init_eden_size,
                                            size_t init_promo_size,
                                            size_t init_survivor_size,
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp
index f838787..70b619f 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,12 +28,11 @@
 #include "gc_implementation/parallelScavenge/objectStartArray.hpp"
 #include "gc_implementation/parallelScavenge/parMarkBitMap.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
-#include "gc_implementation/parallelScavenge/psCompactionManager.hpp"
+#include "gc_implementation/parallelScavenge/psCompactionManager.inline.hpp"
 #include "gc_implementation/parallelScavenge/psOldGen.hpp"
 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
 #include "oops/objArrayKlass.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.pcgc.inline.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "utilities/stack.inline.hpp"
 
@@ -180,17 +179,16 @@
     // Drain the overflow stack first, to allow stealing from the marking stack.
     oop obj;
     while (marking_stack()->pop_overflow(obj)) {
-      obj->follow_contents(this);
+      follow_contents(obj);
     }
     while (marking_stack()->pop_local(obj)) {
-      obj->follow_contents(this);
+      follow_contents(obj);
     }
 
     // Process ObjArrays one at a time to avoid marking stack bloat.
     ObjArrayTask task;
     if (_objarray_stack.pop_overflow(task) || _objarray_stack.pop_local(task)) {
-      ObjArrayKlass* k = (ObjArrayKlass*)task.obj()->klass();
-      k->oop_follow_contents(this, task.obj(), task.index());
+      follow_contents((objArrayOop)task.obj(), task.index());
     }
   } while (!marking_stacks_empty());
 
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp
index 7d7a9f4..4e5544d 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -196,6 +196,10 @@
   // Process tasks remaining on any stack
   void drain_region_stacks();
 
+  void follow_contents(oop obj);
+  void follow_contents(objArrayOop array, int index);
+
+  void update_contents(oop obj);
 };
 
 inline ParCompactionManager* ParCompactionManager::manager_array(int index) {
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp
index 6cf7635..90c2230 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 
 #include "gc_implementation/parallelScavenge/psCompactionManager.hpp"
 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
+#include "oops/objArrayKlass.inline.hpp"
+#include "oops/oop.pcgc.inline.hpp"
 
 void ParCompactionManager::push_objarray(oop obj, size_t index)
 {
@@ -46,4 +48,17 @@
   region_stack()->push(index);
 }
 
+inline void ParCompactionManager::follow_contents(oop obj) {
+  obj->follow_contents(this);
+}
+
+inline void ParCompactionManager::follow_contents(objArrayOop obj, int index) {
+  ObjArrayKlass* k = (ObjArrayKlass*)obj->klass();
+  k->oop_follow_contents(this, obj, index);
+}
+
+inline void ParCompactionManager::update_contents(oop obj) {
+  obj->update_contents(this);
+}
+
 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSCOMPACTIONMANAGER_INLINE_HPP
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
index 7288b96..171f464 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
@@ -54,8 +54,6 @@
 #include "utilities/events.hpp"
 #include "utilities/stack.inline.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 elapsedTimer        PSMarkSweep::_accumulated_time;
 jlong               PSMarkSweep::_time_of_last_gc   = 0;
 CollectorCounters*  PSMarkSweep::_counters = NULL;
@@ -670,7 +668,7 @@
   jlong ret_val = now - _time_of_last_gc;
   // XXX See note in genCollectedHeap::millis_since_last_gc().
   if (ret_val < 0) {
-    NOT_PRODUCT(warning("time warp: "INT64_FORMAT, ret_val);)
+    NOT_PRODUCT(warning("time warp: " JLONG_FORMAT, ret_val);)
     return 0;
   }
   return ret_val;
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp
index dc79821..2cf0254 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -303,7 +303,7 @@
 
     while (q < end) {
       // point all the oops to the new location
-      size_t size = oop(q)->adjust_pointers();
+      size_t size = MarkSweep::adjust_pointers(oop(q));
       q += size;
     }
 
@@ -324,7 +324,7 @@
     if (oop(q)->is_gc_marked()) {
       // q is alive
       // point all the oops to the new location
-      size_t size = oop(q)->adjust_pointers();
+      size_t size = MarkSweep::adjust_pointers(oop(q));
       debug_only(prev_q = q);
       q += size;
     } else {
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp
index c7ac0eb..61c6caf 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp
@@ -33,8 +33,6 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/java.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 inline const char* PSOldGen::select_name() {
   return UseParallelOldGC ? "ParOldGen" : "PSOldGen";
 }
@@ -440,9 +438,9 @@
                 capacity_in_bytes()/K, used_in_bytes()/K);
   }
   st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")",
-                virtual_space()->low_boundary(),
-                virtual_space()->high(),
-                virtual_space()->high_boundary());
+                p2i(virtual_space()->low_boundary()),
+                p2i(virtual_space()->high()),
+                p2i(virtual_space()->high_boundary()));
 
   st->print("  object"); object_space()->print_on(st);
 }
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
index 3e89b0a..b8f60ff 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
@@ -50,7 +50,6 @@
 #include "memory/referenceProcessor.hpp"
 #include "oops/methodData.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.pcgc.inline.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/safepoint.hpp"
@@ -63,8 +62,6 @@
 
 #include <math.h>
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 // All sizes are in HeapWords.
 const size_t ParallelCompactData::Log2RegionSize  = 16; // 64K words
 const size_t ParallelCompactData::RegionSize      = (size_t)1 << Log2RegionSize;
@@ -223,7 +220,7 @@
                 REGION_IDX_FORMAT " " PTR_FORMAT " "
                 REGION_DATA_FORMAT " " REGION_DATA_FORMAT " "
                 REGION_DATA_FORMAT " " REGION_IDX_FORMAT " %d",
-                i, c->data_location(), dci, c->destination(),
+                i, p2i(c->data_location()), dci, p2i(c->destination()),
                 c->partial_obj_size(), c->live_obj_size(),
                 c->data_size(), c->source_region(), c->destination_count());
 
@@ -273,7 +270,7 @@
   tty->print(SIZE_FORMAT_W(5) " " PTR_FORMAT " "
              SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " "
              SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " %d",
-             i, c->destination(),
+             i, p2i(c->destination()),
              c->partial_obj_size(), c->live_obj_size(),
              c->data_size(), c->source_region(), c->destination_count());
   if (newline) tty->cr();
@@ -634,13 +631,13 @@
     const char * split_type = partial_obj_size == 0 ? "easy" : "hard";
     gclog_or_tty->print_cr("%s split:  src=" PTR_FORMAT " src_c=" SIZE_FORMAT
                            " pos=" SIZE_FORMAT,
-                           split_type, source_next, split_region,
+                           split_type, p2i(source_next), split_region,
                            partial_obj_size);
     gclog_or_tty->print_cr("%s split:  dst=" PTR_FORMAT " dst_c=" SIZE_FORMAT
                            " tn=" PTR_FORMAT,
-                           split_type, split_destination,
+                           split_type, p2i(split_destination),
                            addr_to_region_idx(split_destination),
-                           *target_next);
+                           p2i(*target_next));
 
     if (partial_obj_size != 0) {
       HeapWord* const po_beg = split_info.destination();
@@ -649,8 +646,8 @@
                              "po_beg=" PTR_FORMAT " " SIZE_FORMAT " "
                              "po_end=" PTR_FORMAT " " SIZE_FORMAT,
                              split_type,
-                             po_beg, addr_to_region_idx(po_beg),
-                             po_end, addr_to_region_idx(po_end));
+                             p2i(po_beg), addr_to_region_idx(po_beg),
+                             p2i(po_end), addr_to_region_idx(po_end));
     }
   }
 
@@ -667,8 +664,8 @@
     HeapWord* const source_next_val = source_next == NULL ? NULL : *source_next;
     tty->print_cr("sb=" PTR_FORMAT " se=" PTR_FORMAT " sn=" PTR_FORMAT
                   "tb=" PTR_FORMAT " te=" PTR_FORMAT " tn=" PTR_FORMAT,
-                  source_beg, source_end, source_next_val,
-                  target_beg, target_end, *target_next);
+                  p2i(source_beg), p2i(source_end), p2i(source_next_val),
+                  p2i(target_beg), p2i(target_end), p2i(*target_next));
   }
 
   size_t cur_region = addr_to_region_idx(source_beg);
@@ -1133,9 +1130,9 @@
     const size_t cur_deadwood = pointer_delta(dense_prefix, region_destination);
     if (TraceParallelOldGCDensePrefix && Verbose) {
       tty->print_cr("c#=" SIZE_FORMAT_W(4) " dst=" PTR_FORMAT " "
-                    "dp=" SIZE_FORMAT_W(8) " " "cdw=" SIZE_FORMAT_W(8),
-                    sd.region(cp), region_destination,
-                    dense_prefix, cur_deadwood);
+                    "dp=" PTR_FORMAT " " "cdw=" SIZE_FORMAT_W(8),
+                    sd.region(cp), p2i(region_destination),
+                    p2i(dense_prefix), cur_deadwood);
     }
 
     if (cur_deadwood >= deadwood_goal) {
@@ -1201,7 +1198,7 @@
                 "d2l=" SIZE_FORMAT " d2l%%=%6.4f "
                 "d2r=" SIZE_FORMAT " l2r=" SIZE_FORMAT
                 " ratio=%10.8f",
-                algorithm, addr, region_idx,
+                algorithm, p2i(addr), region_idx,
                 space_live,
                 dead_to_left, dead_to_left_pct,
                 dead_to_right, live_to_right,
@@ -1469,7 +1466,7 @@
 {
   if (TraceParallelOldGCSummaryPhase) {
     tty->print_cr("fill_with_live_objects [" PTR_FORMAT " " PTR_FORMAT ") "
-                  SIZE_FORMAT, start, start + words, words);
+                  SIZE_FORMAT, p2i(start), p2i(start + words), words);
   }
 
   ObjectStartArray* const start_array = _space_info[id].start_array();
@@ -1811,9 +1808,9 @@
     tty->print_cr("id=%d cap=" SIZE_FORMAT " dp=" PTR_FORMAT " "
                   "dp_region=" SIZE_FORMAT " " "dp_count=" SIZE_FORMAT " "
                   "cr_count=" SIZE_FORMAT " " "nt=" PTR_FORMAT,
-                  id, space->capacity_in_words(), dense_prefix_end,
+                  id, space->capacity_in_words(), p2i(dense_prefix_end),
                   dp_region, dp_words / region_size,
-                  cr_words / region_size, new_top);
+                  cr_words / region_size, p2i(new_top));
   }
 }
 
@@ -1831,10 +1828,10 @@
                   SIZE_FORMAT "-" SIZE_FORMAT,
                   src_space_id, space_names[src_space_id],
                   dst_space_id, space_names[dst_space_id],
-                  src_beg, src_end,
+                  p2i(src_beg), p2i(src_end),
                   _summary_data.addr_to_region_idx(src_beg),
                   _summary_data.addr_to_region_idx(src_end),
-                  dst_beg, dst_end,
+                  p2i(dst_beg), p2i(dst_end),
                   _summary_data.addr_to_region_idx(dst_beg),
                   _summary_data.addr_to_region_idx(dst_end));
   }
@@ -2234,8 +2231,8 @@
   heap->trace_heap_after_gc(&_gc_tracer);
 
   if (PrintGCTaskTimeStamps) {
-    gclog_or_tty->print_cr("VM-Thread " INT64_FORMAT " " INT64_FORMAT " "
-                           INT64_FORMAT,
+    gclog_or_tty->print_cr("VM-Thread " JLONG_FORMAT " " JLONG_FORMAT " "
+                           JLONG_FORMAT,
                            marking_start.ticks(), compaction_start.ticks(),
                            collection_exit.ticks());
     gc_task_manager()->print_task_time_stamps();
@@ -2754,7 +2751,7 @@
     const RegionData* const c = sd.region(cur_region);
     if (!c->completed()) {
       warning("region " SIZE_FORMAT " not filled:  "
-              "destination_count=" SIZE_FORMAT,
+              "destination_count=%u",
               cur_region, c->destination_count());
       issued_a_warning = true;
     }
@@ -2764,7 +2761,7 @@
     const RegionData* const c = sd.region(cur_region);
     if (!c->available()) {
       warning("region " SIZE_FORMAT " not empty:   "
-              "destination_count=" SIZE_FORMAT,
+              "destination_count=%u",
               cur_region, c->destination_count());
       issued_a_warning = true;
     }
@@ -2776,6 +2773,11 @@
 }
 #endif  // #ifdef ASSERT
 
+inline void UpdateOnlyClosure::do_addr(HeapWord* addr) {
+  _start_array->allocate_block(addr);
+  compaction_manager()->update_contents(oop(addr));
+}
+
 // Update interior oops in the ranges of regions [beg_region, end_region).
 void
 PSParallelCompact::update_and_deadwood_in_dense_prefix(ParCompactionManager* cm,
@@ -2876,7 +2878,7 @@
       if (start_array != NULL) {
         start_array->allocate_block(addr);
       }
-      oop(addr)->update_contents(cm);
+      cm->update_contents(oop(addr));
       assert(oop(addr)->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(oop(addr))));
     }
   }
@@ -3294,7 +3296,7 @@
   jlong ret_val = now - _time_of_last_gc;
   // XXX See note in genCollectedHeap::millis_since_last_gc().
   if (ret_val < 0) {
-    NOT_PRODUCT(warning("time warp: "INT64_FORMAT, ret_val);)
+    NOT_PRODUCT(warning("time warp: " JLONG_FORMAT, ret_val);)
     return 0;
   }
   return ret_val;
@@ -3360,7 +3362,7 @@
   }
 
   oop moved_oop = (oop) destination();
-  moved_oop->update_contents(compaction_manager());
+  compaction_manager()->update_contents(moved_oop);
   assert(moved_oop->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(moved_oop)));
 
   update_state(words);
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp
index d402309..3e1f919 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp
@@ -1025,9 +1025,6 @@
                             bool maximum_heap_compaction,
                             ParallelOldTracer *gc_tracer);
 
-  template <class T>
-  static inline void follow_root(ParCompactionManager* cm, T* p);
-
   // Compute the dense prefix for the designated space.  This is an experimental
   // implementation currently not used in production.
   static HeapWord* compute_dense_prefix_via_density(const SpaceId id,
@@ -1336,23 +1333,6 @@
 }
 
 template <class T>
-inline void PSParallelCompact::follow_root(ParCompactionManager* cm, T* p) {
-  assert(!Universe::heap()->is_in_reserved(p),
-         "roots shouldn't be things within the heap");
-
-  T heap_oop = oopDesc::load_heap_oop(p);
-  if (!oopDesc::is_null(heap_oop)) {
-    oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
-    if (mark_bitmap()->is_unmarked(obj)) {
-      if (mark_obj(obj)) {
-        obj->follow_contents(cm);
-      }
-    }
-  }
-  cm->follow_marking_stacks();
-}
-
-template <class T>
 inline void PSParallelCompact::mark_and_push(ParCompactionManager* cm, T* p) {
   T heap_oop = oopDesc::load_heap_oop(p);
   if (!oopDesc::is_null(heap_oop)) {
@@ -1524,12 +1504,6 @@
   inline void do_addr(HeapWord* addr);
 };
 
-inline void UpdateOnlyClosure::do_addr(HeapWord* addr)
-{
-  _start_array->allocate_block(addr);
-  oop(addr)->update_contents(compaction_manager());
-}
-
 class FillClosure: public ParMarkBitMapClosure
 {
 public:
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp
index 33d300f..be4a9ed 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp
@@ -33,11 +33,8 @@
 #include "memory/memRegion.hpp"
 #include "memory/padded.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.psgc.inline.hpp"
 #include "utilities/stack.inline.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 PaddedEnd<PSPromotionManager>* PSPromotionManager::_manager_array = NULL;
 OopStarTaskQueueSet*           PSPromotionManager::_stack_array_depth = NULL;
 PSOldGen*                      PSPromotionManager::_old_gen = NULL;
@@ -325,7 +322,7 @@
 
     _promotion_failed_info.register_copy_failure(obj->size());
 
-    obj->push_contents(this);
+    push_contents(obj);
 
     // Save the mark if needed
     PSScavenge::oop_promotion_failed(obj, obj_mark);
@@ -342,7 +339,7 @@
     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " (%d)}",
                            "promotion-failure",
                            obj->klass()->internal_name(),
-                           (void *)obj, obj->size());
+                           p2i(obj), obj->size());
 
   }
 #endif
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp
index b111ff2..d98ed22 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -212,6 +212,8 @@
   template <class T> inline void claim_or_forward_depth(T* p);
 
   TASKQUEUE_STATS_ONLY(inline void record_steal(StarTask& p);)
+
+  void push_contents(oop obj);
 };
 
 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_HPP
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp
index 0ffe2df..cb6445f 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -91,6 +91,9 @@
   }
 }
 
+inline void PSPromotionManager::push_contents(oop obj) {
+  obj->push_contents(this);
+}
 //
 // This method is pretty bulky. It would be nice to split it up
 // into smaller submethods, but we need to be careful not to hurt
@@ -227,7 +230,7 @@
         TASKQUEUE_STATS_ONLY(++_arrays_chunked; ++_masked_pushes);
       } else {
         // we'll just push its contents
-        new_obj->push_contents(this);
+        push_contents(new_obj);
       }
     }  else {
       // We lost, someone else "owns" this object
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
index 3c0542f..04ff184 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
@@ -46,7 +46,6 @@
 #include "memory/referenceProcessor.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.psgc.inline.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/handles.inline.hpp"
@@ -56,8 +55,6 @@
 #include "services/memoryService.hpp"
 #include "utilities/stack.inline.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 HeapWord*                  PSScavenge::_to_space_top_before_gc = NULL;
 int                        PSScavenge::_consecutive_skipped_scavenges = 0;
 ReferenceProcessor*        PSScavenge::_ref_processor = NULL;
@@ -551,8 +548,8 @@
 
        if (PrintTenuringDistribution) {
          gclog_or_tty->cr();
-         gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold "
-                                UINTX_FORMAT " (max threshold " UINTX_FORMAT ")",
+         gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u"
+                                " (max threshold " UINTX_FORMAT ")",
                                 size_policy->calculated_survivor_size_in_bytes(),
                                 _tenuring_threshold, MaxTenuringThreshold);
        }
@@ -694,7 +691,7 @@
   scavenge_exit.update();
 
   if (PrintGCTaskTimeStamps) {
-    tty->print_cr("VM-Thread " INT64_FORMAT " " INT64_FORMAT " " INT64_FORMAT,
+    tty->print_cr("VM-Thread " JLONG_FORMAT " " JLONG_FORMAT " " JLONG_FORMAT,
                   scavenge_entry.ticks(), scavenge_midpoint.ticks(),
                   scavenge_exit.ticks());
     gc_task_manager()->print_task_time_stamps();
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp
index e944dfe..5739331 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp
@@ -35,7 +35,6 @@
 #include "memory/iterator.hpp"
 #include "memory/universe.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.psgc.inline.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/vmThread.hpp"
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp
index 7d11d38..867422e 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp
@@ -27,8 +27,6 @@
 #include "runtime/os.hpp"
 #include "runtime/virtualspace.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 // PSVirtualSpace
 
 PSVirtualSpace::PSVirtualSpace(ReservedSpace rs, size_t alignment) :
@@ -218,22 +216,22 @@
 void PSVirtualSpace::print() const {
   gclog_or_tty->print_cr("virtual space [" PTR_FORMAT "]:  alignment="
                          SIZE_FORMAT "K grows %s%s",
-                         this, alignment() / K, grows_up() ? "up" : "down",
+                         p2i(this), alignment() / K, grows_up() ? "up" : "down",
                          special() ? " (pinned in memory)" : "");
   gclog_or_tty->print_cr("    reserved=" SIZE_FORMAT "K"
                          " [" PTR_FORMAT "," PTR_FORMAT "]"
                          " committed=" SIZE_FORMAT "K"
                          " [" PTR_FORMAT "," PTR_FORMAT "]",
                          reserved_size() / K,
-                         reserved_low_addr(), reserved_high_addr(),
+                         p2i(reserved_low_addr()), p2i(reserved_high_addr()),
                          committed_size() / K,
-                         committed_low_addr(), committed_high_addr());
+                         p2i(committed_low_addr()), p2i(committed_high_addr()));
 }
 #endif // #ifndef PRODUCT
 
 void PSVirtualSpace::print_space_boundaries_on(outputStream* st) const {
   st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")",
-               low_boundary(), high(), high_boundary());
+               p2i(low_boundary()), p2i(high()), p2i(high_boundary()));
 }
 
 PSVirtualSpaceHighToLow::PSVirtualSpaceHighToLow(ReservedSpace rs,
@@ -350,5 +348,5 @@
 void
 PSVirtualSpaceHighToLow::print_space_boundaries_on(outputStream* st) const {
   st->print_cr(" (" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT "]",
-               high_boundary(), low(), low_boundary());
+               p2i(high_boundary()), p2i(low()), p2i(low_boundary()));
 }
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp
index 77c0937..286fbaa 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp
@@ -33,8 +33,6 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/java.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 PSYoungGen::PSYoungGen(size_t        initial_size,
                        size_t        min_size,
                        size_t        max_size) :
@@ -419,20 +417,22 @@
     // s1
     gclog_or_tty->print_cr("Current region: [" PTR_FORMAT ", " PTR_FORMAT ") "
       "New region: [" PTR_FORMAT ", " PTR_FORMAT ")",
-      s1->bottom(), s1->end(), s1MR.start(), s1MR.end());
+      p2i(s1->bottom()), p2i(s1->end()),
+      p2i(s1MR.start()), p2i(s1MR.end()));
     gclog_or_tty->print_cr("    Mangle before: [" PTR_FORMAT ", "
       PTR_FORMAT ")  Mangle after: [" PTR_FORMAT ", " PTR_FORMAT ")",
-      delta1_left.start(), delta1_left.end(), delta1_right.start(),
-      delta1_right.end());
+      p2i(delta1_left.start()), p2i(delta1_left.end()),
+      p2i(delta1_right.start()), p2i(delta1_right.end()));
 
     // s2
     gclog_or_tty->print_cr("Current region: [" PTR_FORMAT ", " PTR_FORMAT ") "
       "New region: [" PTR_FORMAT ", " PTR_FORMAT ")",
-      s2->bottom(), s2->end(), s2MR.start(), s2MR.end());
+      p2i(s2->bottom()), p2i(s2->end()),
+      p2i(s2MR.start()), p2i(s2MR.end()));
     gclog_or_tty->print_cr("    Mangle before: [" PTR_FORMAT ", "
       PTR_FORMAT ")  Mangle after: [" PTR_FORMAT ", " PTR_FORMAT ")",
-      delta2_left.start(), delta2_left.end(), delta2_right.start(),
-      delta2_right.end());
+      p2i(delta2_left.start()), p2i(delta2_left.end()),
+      p2i(delta2_right.start()), p2i(delta2_right.end()));
   }
 
 }
@@ -456,22 +456,22 @@
                   requested_eden_size, requested_survivor_size);
     gclog_or_tty->print_cr("    eden: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  eden_space()->bottom(),
-                  eden_space()->end(),
+                  p2i(eden_space()->bottom()),
+                  p2i(eden_space()->end()),
                   pointer_delta(eden_space()->end(),
                                 eden_space()->bottom(),
                                 sizeof(char)));
     gclog_or_tty->print_cr("    from: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  from_space()->bottom(),
-                  from_space()->end(),
+                  p2i(from_space()->bottom()),
+                  p2i(from_space()->end()),
                   pointer_delta(from_space()->end(),
                                 from_space()->bottom(),
                                 sizeof(char)));
     gclog_or_tty->print_cr("      to: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  to_space()->bottom(),
-                  to_space()->end(),
+                  p2i(to_space()->bottom()),
+                  p2i(to_space()->end()),
                   pointer_delta(  to_space()->end(),
                                   to_space()->bottom(),
                                   sizeof(char)));
@@ -572,18 +572,18 @@
     if (PrintAdaptiveSizePolicy && Verbose) {
       gclog_or_tty->print_cr("    [eden_start .. eden_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    eden_start,
-                    eden_end,
+                    p2i(eden_start),
+                    p2i(eden_end),
                     pointer_delta(eden_end, eden_start, sizeof(char)));
       gclog_or_tty->print_cr("    [from_start .. from_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    from_start,
-                    from_end,
+                    p2i(from_start),
+                    p2i(from_end),
                     pointer_delta(from_end, from_start, sizeof(char)));
       gclog_or_tty->print_cr("    [  to_start ..   to_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    to_start,
-                    to_end,
+                    p2i(to_start),
+                    p2i(to_end),
                     pointer_delta(  to_end,   to_start, sizeof(char)));
     }
   } else {
@@ -629,18 +629,18 @@
     if (PrintAdaptiveSizePolicy && Verbose) {
       gclog_or_tty->print_cr("    [eden_start .. eden_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    eden_start,
-                    eden_end,
+                    p2i(eden_start),
+                    p2i(eden_end),
                     pointer_delta(eden_end, eden_start, sizeof(char)));
       gclog_or_tty->print_cr("    [  to_start ..   to_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    to_start,
-                    to_end,
+                    p2i(to_start),
+                    p2i(to_end),
                     pointer_delta(  to_end,   to_start, sizeof(char)));
       gclog_or_tty->print_cr("    [from_start .. from_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    from_start,
-                    from_end,
+                    p2i(from_start),
+                    p2i(from_end),
                     pointer_delta(from_end, from_start, sizeof(char)));
     }
   }
diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp
index 01e7e88..bcf4fef 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp
@@ -32,8 +32,6 @@
 #include "oops/objArrayKlass.inline.hpp"
 #include "oops/oop.inline.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 uint                    MarkSweep::_total_invocations = 0;
 
 Stack<oop, mtGC>              MarkSweep::_marking_stack;
@@ -64,18 +62,22 @@
   MarkSweep::follow_cld_closure.do_cld(cld);
 }
 
+void MarkSweep::follow_array(objArrayOop array, int index) {
+  ObjArrayKlass* k = (ObjArrayKlass*)array->klass();
+  k->oop_follow_contents(array, index);
+}
+
 void MarkSweep::follow_stack() {
   do {
     while (!_marking_stack.is_empty()) {
       oop obj = _marking_stack.pop();
       assert (obj->is_gc_marked(), "p must be marked");
-      obj->follow_contents();
+      follow_object(obj);
     }
     // Process ObjArrays one at a time to avoid marking stack bloat.
     if (!_objarray_stack.is_empty()) {
       ObjArrayTask task = _objarray_stack.pop();
-      ObjArrayKlass* k = (ObjArrayKlass*)task.obj()->klass();
-      k->oop_follow_contents(task.obj(), task.index());
+      follow_array(objArrayOop(task.obj()), task.index());
     }
   } while (!_marking_stack.is_empty() || !_objarray_stack.is_empty());
 }
diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp
index 37928ea..724d212 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp
@@ -160,10 +160,16 @@
 
   static void follow_stack();   // Empty marking stack.
 
+  static void follow_object(oop obj);
+
+  static void follow_array(objArrayOop array, int index);
+
   static void follow_klass(Klass* klass);
 
   static void follow_class_loader(ClassLoaderData* cld);
 
+  static int adjust_pointers(oop obj);
+
   static void preserve_mark(oop p, markOop mark);
                                 // Save the mark word so it can be restored later
   static void adjust_marks();   // Adjust the pointers in the preserved marks table
diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp
index ebc8906..196dcad 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,6 +58,10 @@
   MarkSweep::mark_and_push(&op);
 }
 
+inline void MarkSweep::follow_object(oop obj) {
+  obj->follow_contents();
+}
+
 template <class T> inline void MarkSweep::follow_root(T* p) {
   assert(!Universe::heap()->is_in_reserved(p),
          "roots shouldn't be things within the heap");
@@ -66,7 +70,7 @@
     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
     if (!obj->mark()->is_marked()) {
       mark_object(obj);
-      obj->follow_contents();
+      follow_object(obj);
     }
   }
   follow_stack();
@@ -90,6 +94,10 @@
   _objarray_stack.push(task);
 }
 
+inline int MarkSweep::adjust_pointers(oop obj) {
+  return obj->adjust_pointers();
+}
+
 template <class T> inline void MarkSweep::adjust_pointer(T* p) {
   T heap_oop = oopDesc::load_heap_oop(p);
   if (!oopDesc::is_null(heap_oop)) {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp
index bdb746f..1d45641 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp
@@ -31,8 +31,6 @@
 #include "runtime/atomic.inline.hpp"
 #include "runtime/thread.inline.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) {
   _lgrp_spaces = new (ResourceObj::C_HEAP, mtGC) GrowableArray<LGRPSpace*>(0, true);
   _page_size = os::vm_page_size();
@@ -973,7 +971,7 @@
       break;
     }
     if (e != scan_end) {
-      assert(e < scan_end, err_msg("e: " PTR_FORMAT " scan_end: " PTR_FORMAT, e, scan_end));
+      assert(e < scan_end, err_msg("e: " PTR_FORMAT " scan_end: " PTR_FORMAT, p2i(e), p2i(scan_end)));
 
       if ((page_expected.size != page_size || page_expected.lgrp_id != lgrp_id())
           && page_expected.size != 0) {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp
index e2e4a6b..a0884bf 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp
@@ -33,8 +33,6 @@
 #include "runtime/thread.hpp"
 #endif // INCLUDE_ALL_GCS
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 MutableSpace::MutableSpace(size_t alignment): ImmutableSpace(), _top(NULL), _alignment(alignment) {
   assert(MutableSpace::alignment() % os::vm_page_size() == 0,
          "Space should be aligned");
@@ -253,7 +251,7 @@
 void MutableSpace::print_on(outputStream* st) const {
   MutableSpace::print_short_on(st);
   st->print_cr(" [" INTPTR_FORMAT "," INTPTR_FORMAT "," INTPTR_FORMAT ")",
-                 bottom(), top(), end());
+                 p2i(bottom()), p2i(top()), p2i(end()));
 }
 
 void MutableSpace::verify() {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp
index 15e38aa..1ff1e51 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp
@@ -27,8 +27,6 @@
 #include "memory/space.inline.hpp"
 #include "utilities/copy.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 // Catch-all file for utility classes
 
 #ifndef PRODUCT
@@ -86,7 +84,7 @@
   assert(ZapUnusedHeapArea, "Mangling should not be in use");
 #ifdef ASSERT
   if(TraceZapUnusedHeapArea) {
-    gclog_or_tty->print("Mangling [" PTR_FORMAT " to " PTR_FORMAT ")", mr.start(), mr.end());
+    gclog_or_tty->print("Mangling [" PTR_FORMAT " to " PTR_FORMAT ")", p2i(mr.start()), p2i(mr.end()));
   }
   Copy::fill_to_words(mr.start(), mr.word_size(), badHeapWord);
   if(TraceZapUnusedHeapArea) {
diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp
index dba48ae..5dec0ec 100644
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp
@@ -185,8 +185,6 @@
 
  public:
   enum Name {
-    Abstract,
-    SharedHeap,
     GenCollectedHeap,
     ParallelScavengeHeap,
     G1CollectedHeap
@@ -196,7 +194,7 @@
     return _filler_array_max_size;
   }
 
-  virtual CollectedHeap::Name kind() const { return CollectedHeap::Abstract; }
+  virtual Name kind() const = 0;
 
   /**
    * Returns JNI error code JNI_ENOMEM if memory could not be allocated,
@@ -291,12 +289,6 @@
     return p == NULL || is_in_closed_subset(p);
   }
 
-#ifdef ASSERT
-  // Returns true if "p" is in the part of the
-  // heap being collected.
-  virtual bool is_in_partial_collection(const void *p) = 0;
-#endif
-
   // An object is scavengable if its location may move during a scavenge.
   // (A scavenge is a GC which is not a full GC.)
   virtual bool is_scavengable(const void *p) = 0;
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
index d002423..ac8c748 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
@@ -470,13 +470,9 @@
       fatal("Parallel gc not supported here.");
 #endif // INCLUDE_ALL_GCS
     } else {
-      // We do not call the non_clean_card_iterate_serial() version below because
-      // we want to clear the cards (which non_clean_card_iterate_serial() does not
-      // do for us): clear_cl here does the work of finding contiguous dirty ranges
-      // of cards to process and clear.
+      // clear_cl finds contiguous dirty ranges of cards to process and clear.
 
-      DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision(),
-                                                       cl->gen_boundary());
+      DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision(), cl->gen_boundary());
       ClearNoncleanCardWrapper clear_cl(dcto_cl, ct);
 
       clear_cl.do_MemRegion(mr);
@@ -484,46 +480,6 @@
   }
 }
 
-// The iterator itself is not MT-aware, but
-// MT-aware callers and closures can use this to
-// accomplish dirty card iteration in parallel. The
-// iterator itself does not clear the dirty cards, or
-// change their values in any manner.
-void CardTableModRefBS::non_clean_card_iterate_serial(MemRegion mr,
-                                                      MemRegionClosure* cl) {
-  bool is_par = (SharedHeap::heap()->n_par_threads() > 0);
-  assert(!is_par ||
-          (SharedHeap::heap()->n_par_threads() ==
-          SharedHeap::heap()->workers()->active_workers()), "Mismatch");
-  for (int i = 0; i < _cur_covered_regions; i++) {
-    MemRegion mri = mr.intersection(_covered[i]);
-    if (mri.word_size() > 0) {
-      jbyte* cur_entry = byte_for(mri.last());
-      jbyte* limit = byte_for(mri.start());
-      while (cur_entry >= limit) {
-        jbyte* next_entry = cur_entry - 1;
-        if (*cur_entry != clean_card) {
-          size_t non_clean_cards = 1;
-          // Should the next card be included in this range of dirty cards.
-          while (next_entry >= limit && *next_entry != clean_card) {
-            non_clean_cards++;
-            cur_entry = next_entry;
-            next_entry--;
-          }
-          // The memory region may not be on a card boundary.  So that
-          // objects beyond the end of the region are not processed, make
-          // cur_cards precise with regard to the end of the memory region.
-          MemRegion cur_cards(addr_for(cur_entry),
-                              non_clean_cards * card_size_in_words);
-          MemRegion dirty_region = cur_cards.intersection(mri);
-          cl->do_MemRegion(dirty_region);
-        }
-        cur_entry = next_entry;
-      }
-    }
-  }
-}
-
 void CardTableModRefBS::dirty_MemRegion(MemRegion mr) {
   assert((HeapWord*)align_size_down((uintptr_t)mr.start(), HeapWordSize) == mr.start(), "Unaligned start");
   assert((HeapWord*)align_size_up  ((uintptr_t)mr.end(),   HeapWordSize) == mr.end(),   "Unaligned end"  );
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
index f7cf9e6..97ce901 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
@@ -37,7 +37,7 @@
 // the head of "o" is dirtied, not necessarily the card containing the
 // modified field itself.  For object arrays, however, the barrier *is*
 // precise; only the card containing the modified element is dirtied.
-// Any MemRegionClosures used to scan dirty cards should take these
+// Closures used to scan dirty cards should take these
 // considerations into account.
 
 class Generation;
@@ -176,16 +176,7 @@
 
   // Iterate over the portion of the card-table which covers the given
   // region mr in the given space and apply cl to any dirty sub-regions
-  // of mr. Dirty cards are _not_ cleared by the iterator method itself,
-  // but closures may arrange to do so on their own should they so wish.
-  void non_clean_card_iterate_serial(MemRegion mr, MemRegionClosure* cl);
-
-  // A variant of the above that will operate in a parallel mode if
-  // worker threads are available, and clear the dirty cards as it
-  // processes them.
-  // XXX ??? MemRegionClosure above vs OopsInGenClosure below XXX
-  // XXX some new_dcto_cl's take OopClosure's, plus as above there are
-  // some MemRegionClosures. Clean this up everywhere. XXX
+  // of mr. Clears the dirty cards as they are processed.
   void non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr,
                                                 OopsInGenClosure* cl, CardTableRS* ct);
 
@@ -379,24 +370,6 @@
 
   // *** Card-table-RemSet-specific things.
 
-  // Invoke "cl.do_MemRegion" on a set of MemRegions that collectively
-  // includes all the modified cards (expressing each card as a
-  // MemRegion).  Thus, several modified cards may be lumped into one
-  // region.  The regions are non-overlapping, and are visited in
-  // *decreasing* address order.  (This order aids with imprecise card
-  // marking, where a dirty card may cause scanning, and summarization
-  // marking, of objects that extend onto subsequent cards.)
-  void mod_card_iterate(MemRegionClosure* cl) {
-    non_clean_card_iterate_serial(_whole_heap, cl);
-  }
-
-  // Like the "mod_cards_iterate" above, except only invokes the closure
-  // for cards within the MemRegion "mr" (which is required to be
-  // card-aligned and sized.)
-  void mod_card_iterate(MemRegion mr, MemRegionClosure* cl) {
-    non_clean_card_iterate_serial(mr, cl);
-  }
-
   static uintx ct_max_alignment_constraint();
 
   // Apply closure "cl" to the dirty cards containing some part of
diff --git a/hotspot/src/share/vm/memory/collectorPolicy.cpp b/hotspot/src/share/vm/memory/collectorPolicy.cpp
index d20c253..094e3c3 100644
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp
@@ -190,11 +190,12 @@
     _min_young_size(0),
     _initial_young_size(0),
     _max_young_size(0),
-    _gen_alignment(0),
     _min_old_size(0),
     _initial_old_size(0),
     _max_old_size(0),
-    _generations(NULL)
+    _gen_alignment(0),
+    _young_gen_spec(NULL),
+    _old_gen_spec(NULL)
 {}
 
 size_t GenCollectorPolicy::scale_by_NewRatio_aligned(size_t base_size) {
@@ -912,9 +913,8 @@
 }
 
 void MarkSweepPolicy::initialize_generations() {
-  _generations = NEW_C_HEAP_ARRAY(GenerationSpecPtr, number_of_generations(), mtGC);
-  _generations[0] = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size);
-  _generations[1] = new GenerationSpec(Generation::MarkSweepCompact, _initial_old_size, _max_old_size);
+  _young_gen_spec = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size, _gen_alignment);
+  _old_gen_spec   = new GenerationSpec(Generation::MarkSweepCompact, _initial_old_size, _max_old_size, _gen_alignment);
 }
 
 void MarkSweepPolicy::initialize_gc_policy_counters() {
diff --git a/hotspot/src/share/vm/memory/collectorPolicy.hpp b/hotspot/src/share/vm/memory/collectorPolicy.hpp
index 6f20be7..365a0eb 100644
--- a/hotspot/src/share/vm/memory/collectorPolicy.hpp
+++ b/hotspot/src/share/vm/memory/collectorPolicy.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -208,7 +208,8 @@
 };
 
 class GenCollectorPolicy : public CollectorPolicy {
-friend class TestGenCollectorPolicy;
+  friend class TestGenCollectorPolicy;
+  friend class VMStructs;
  protected:
   size_t _min_young_size;
   size_t _initial_young_size;
@@ -221,7 +222,8 @@
   // time. When using large pages they can differ.
   size_t _gen_alignment;
 
-  GenerationSpec **_generations;
+  GenerationSpec* _young_gen_spec;
+  GenerationSpec* _old_gen_spec;
 
   // Return true if an allocation should be attempted in the older generation
   // if it fails in the younger generation.  Return false, otherwise.
@@ -261,9 +263,14 @@
 
   int number_of_generations() { return 2; }
 
-  virtual GenerationSpec **generations() {
-    assert(_generations != NULL, "Sanity check");
-    return _generations;
+  GenerationSpec* young_gen_spec() const {
+    assert(_young_gen_spec != NULL, "_young_gen_spec should have been initialized");
+    return _young_gen_spec;
+  }
+
+  GenerationSpec* old_gen_spec() const {
+    assert(_old_gen_spec != NULL, "_old_gen_spec should have been initialized");
+    return _old_gen_spec;
   }
 
   virtual GenCollectorPolicy* as_generation_policy() { return this; }
diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp
index 0f5b223..e306632 100644
--- a/hotspot/src/share/vm/memory/defNewGeneration.cpp
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp
@@ -49,8 +49,6 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/stack.inline.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 //
 // DefNewGeneration functions.
 
@@ -137,7 +135,7 @@
   if (TraceScavenge) {
     ResourceMark rm;
     gclog_or_tty->print_cr("KlassScanClosure::do_klass " PTR_FORMAT ", %s, dirty: %s",
-                           klass,
+                           p2i(klass),
                            klass->external_name(),
                            klass->has_modified_oops() ? "true" : "false");
   }
@@ -380,7 +378,7 @@
 
   int next_level = level() + 1;
   GenCollectedHeap* gch = GenCollectedHeap::heap();
-  assert(next_level < gch->_n_gens,
+  assert(next_level < gch->n_gens(),
          "DefNewGeneration cannot be an oldest gen");
 
   Generation* old_gen = gch->old_gen();
diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
index 704291f..8b8114c 100644
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
@@ -78,7 +78,7 @@
 };
 
 GenCollectedHeap::GenCollectedHeap(GenCollectorPolicy *policy) :
-  SharedHeap(policy),
+  SharedHeap(),
   _rem_set(NULL),
   _gen_policy(policy),
   _process_strong_tasks(new SubTasksDone(GCH_PS_NumElements)),
@@ -90,7 +90,6 @@
 jint GenCollectedHeap::initialize() {
   CollectedHeap::pre_initialize();
 
-  int i;
   _n_gens = gen_policy()->number_of_generations();
   assert(_n_gens == 2, "There is no support for more than two generations");
 
@@ -101,16 +100,6 @@
   // HeapWordSize).
   guarantee(HeapWordSize == wordSize, "HeapWordSize must equal wordSize");
 
-  // The heap must be at least as aligned as generations.
-  size_t gen_alignment = Generation::GenGrain;
-
-  _gen_specs = gen_policy()->generations();
-
-  // Make sure the sizes are all aligned.
-  for (i = 0; i < _n_gens; i++) {
-    _gen_specs[i]->align(gen_alignment);
-  }
-
   // Allocate space for the heap.
 
   char* heap_address;
@@ -133,12 +122,12 @@
 
   _gch = this;
 
-  ReservedSpace young_rs = heap_rs.first_part(_gen_specs[0]->max_size(), false, false);
-  _young_gen = _gen_specs[0]->init(young_rs, 0, rem_set());
-  heap_rs = heap_rs.last_part(_gen_specs[0]->max_size());
+  ReservedSpace young_rs = heap_rs.first_part(gen_policy()->young_gen_spec()->max_size(), false, false);
+  _young_gen = gen_policy()->young_gen_spec()->init(young_rs, 0, rem_set());
+  heap_rs = heap_rs.last_part(gen_policy()->young_gen_spec()->max_size());
 
-  ReservedSpace old_rs = heap_rs.first_part(_gen_specs[1]->max_size(), false, false);
-  _old_gen = _gen_specs[1]->init(old_rs, 1, rem_set());
+  ReservedSpace old_rs = heap_rs.first_part(gen_policy()->old_gen_spec()->max_size(), false, false);
+  _old_gen = gen_policy()->old_gen_spec()->init(old_rs, 1, rem_set());
   clear_incremental_collection_failed();
 
 #if INCLUDE_ALL_GCS
@@ -155,21 +144,18 @@
 
 char* GenCollectedHeap::allocate(size_t alignment,
                                  ReservedSpace* heap_rs){
-  const char overflow_msg[] = "The size of the object heap + VM data exceeds "
-    "the maximum representable size";
-
   // Now figure out the total size.
-  size_t total_reserved = 0;
-  const size_t pageSize = UseLargePages ?
-      os::large_page_size() : os::vm_page_size();
-
+  const size_t pageSize = UseLargePages ? os::large_page_size() : os::vm_page_size();
   assert(alignment % pageSize == 0, "Must be");
 
-  for (int i = 0; i < _n_gens; i++) {
-    total_reserved += _gen_specs[i]->max_size();
-    if (total_reserved < _gen_specs[i]->max_size()) {
-      vm_exit_during_initialization(overflow_msg);
-    }
+  GenerationSpec* young_spec = gen_policy()->young_gen_spec();
+  GenerationSpec* old_spec = gen_policy()->old_gen_spec();
+
+  // Check for overflow.
+  size_t total_reserved = young_spec->max_size() + old_spec->max_size();
+  if (total_reserved < young_spec->max_size()) {
+    vm_exit_during_initialization("The size of the object heap + VM data exceeds "
+                                  "the maximum representable size");
   }
   assert(total_reserved % alignment == 0,
          err_msg("Gen size; total_reserved=" SIZE_FORMAT ", alignment="
@@ -586,7 +572,7 @@
 class AssertNonScavengableClosure: public OopClosure {
 public:
   virtual void do_oop(oop* p) {
-    assert(!Universe::heap()->is_in_partial_collection(*p),
+    assert(!GenCollectedHeap::heap()->is_in_partial_collection(*p),
       "Referent should not be scavengable.");  }
   virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
 };
@@ -603,7 +589,7 @@
   StrongRootsScope srs(this, activate_scope);
 
   // General roots.
-  assert(_strong_roots_parity != 0, "must have called prologue code");
+  assert(Threads::thread_claim_parity() != 0, "must have called prologue code");
   assert(code_roots != NULL, "code root closure should always be set");
   // _n_termination for _process_strong_tasks should be set up stream
   // in a method not running in a GC worker.  Otherwise the GC worker
@@ -1351,7 +1337,7 @@
   // back a time later than 'now'.
   jlong retVal = now - tolgc_cl.time();
   if (retVal < 0) {
-    NOT_PRODUCT(warning("time warp: "INT64_FORMAT, (int64_t) retVal);)
+    NOT_PRODUCT(warning("time warp: " JLONG_FORMAT, retVal);)
     return 0;
   }
   return retVal;
diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp
index d619377..a914327 100644
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp
@@ -67,8 +67,6 @@
   Generation* _young_gen;
   Generation* _old_gen;
 
-  GenerationSpec** _gen_specs;
-
   // The singleton Gen Remembered Set.
   GenRemSet* _rem_set;
 
@@ -141,12 +139,12 @@
   // Initialize ("weak") refs processing support
   virtual void ref_processing_init();
 
-  virtual CollectedHeap::Name kind() const {
+  virtual Name kind() const {
     return CollectedHeap::GenCollectedHeap;
   }
 
-  Generation* young_gen() { return _young_gen; }
-  Generation* old_gen()   { return _old_gen; }
+  Generation* young_gen() const { return _young_gen; }
+  Generation* old_gen()   const { return _old_gen; }
 
   // The generational collector policy.
   GenCollectorPolicy* gen_policy() const { return _gen_policy; }
@@ -217,7 +215,7 @@
   bool is_in_young(oop p);
 
 #ifdef ASSERT
-  virtual bool is_in_partial_collection(const void* p);
+  bool is_in_partial_collection(const void* p);
 #endif
 
   virtual bool is_scavengable(const void* addr) {
diff --git a/hotspot/src/share/vm/memory/generation.cpp b/hotspot/src/share/vm/memory/generation.cpp
index 6bed336..e27cb60 100644
--- a/hotspot/src/share/vm/memory/generation.cpp
+++ b/hotspot/src/share/vm/memory/generation.cpp
@@ -42,8 +42,6 @@
 #include "utilities/copy.hpp"
 #include "utilities/events.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 Generation::Generation(ReservedSpace rs, size_t initial_size, int level) :
   _level(level),
   _ref_processor(NULL) {
@@ -63,8 +61,8 @@
 
 GenerationSpec* Generation::spec() {
   GenCollectedHeap* gch = GenCollectedHeap::heap();
-  assert(0 <= level() && level() < gch->_n_gens, "Bad gen level");
-  return gch->_gen_specs[level()];
+  assert(level() == 0 || level() == 1, "Bad gen level");
+  return level() == 0 ? gch->gen_policy()->young_gen_spec() : gch->gen_policy()->old_gen_spec();
 }
 
 size_t Generation::max_capacity() const {
@@ -103,9 +101,9 @@
   st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
              capacity()/K, used()/K);
   st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")",
-              _virtual_space.low_boundary(),
-              _virtual_space.high(),
-              _virtual_space.high_boundary());
+              p2i(_virtual_space.low_boundary()),
+              p2i(_virtual_space.high()),
+              p2i(_virtual_space.high_boundary()));
 }
 
 void Generation::print_summary_info() { print_summary_info_on(tty); }
diff --git a/hotspot/src/share/vm/memory/generation.hpp b/hotspot/src/share/vm/memory/generation.hpp
index a2e15a0..650f54b 100644
--- a/hotspot/src/share/vm/memory/generation.hpp
+++ b/hotspot/src/share/vm/memory/generation.hpp
@@ -399,7 +399,7 @@
     // have to guard against non-monotonicity.
     NOT_PRODUCT(
       if (now < _time_of_last_gc) {
-        warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, (int64_t)_time_of_last_gc, (int64_t)now);
+        warning("time warp: " JLONG_FORMAT " to " JLONG_FORMAT, _time_of_last_gc, now);
       }
     )
     return _time_of_last_gc;
diff --git a/hotspot/src/share/vm/memory/generationSpec.hpp b/hotspot/src/share/vm/memory/generationSpec.hpp
index 58448a4..5c0e57e 100644
--- a/hotspot/src/share/vm/memory/generationSpec.hpp
+++ b/hotspot/src/share/vm/memory/generationSpec.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -39,11 +39,11 @@
   size_t           _max_size;
 
 public:
-  GenerationSpec(Generation::Name name, size_t init_size, size_t max_size) {
-    _name = name;
-    _init_size = init_size;
-    _max_size = max_size;
-  }
+  GenerationSpec(Generation::Name name, size_t init_size, size_t max_size, size_t alignment) :
+    _name(name),
+    _init_size(align_size_up(init_size, alignment)),
+    _max_size(align_size_up(max_size, alignment))
+  { }
 
   Generation* init(ReservedSpace rs, int level, GenRemSet* remset);
 
@@ -53,12 +53,6 @@
   void set_init_size(size_t size)      { _init_size = size; }
   size_t max_size()              const { return _max_size; }
   void set_max_size(size_t size)       { _max_size = size; }
-
-  // Alignment
-  void align(size_t alignment) {
-    set_init_size(align_size_up(init_size(), alignment));
-    set_max_size(align_size_up(max_size(), alignment));
-  }
 };
 
 typedef GenerationSpec* GenerationSpecPtr;
diff --git a/hotspot/src/share/vm/memory/heapInspection.cpp b/hotspot/src/share/vm/memory/heapInspection.cpp
index c4b5ba7..31ba78e 100644
--- a/hotspot/src/share/vm/memory/heapInspection.cpp
+++ b/hotspot/src/share/vm/memory/heapInspection.cpp
@@ -38,8 +38,6 @@
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #endif // INCLUDE_ALL_GCS
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 // HeapInspection
 
 inline KlassInfoEntry::~KlassInfoEntry() {
@@ -100,8 +98,8 @@
 
   // simplify the formatting (ILP32 vs LP64) - always cast the numbers to 64-bit
   st->print_cr(INT64_FORMAT_W(13) "  " UINT64_FORMAT_W(13) "  %s",
-               (jlong)  _instance_count,
-               (julong) _instance_words * HeapWordSize,
+               (int64_t)_instance_count,
+               (uint64_t)_instance_words * HeapWordSize,
                name());
 }
 
@@ -240,8 +238,8 @@
 
 void KlassInfoHisto::print_elements(outputStream* st) const {
   // simplify the formatting (ILP32 vs LP64) - store the sum in 64-bit
-  jlong total = 0;
-  julong totalw = 0;
+  int64_t total = 0;
+  uint64_t totalw = 0;
   for(int i=0; i < elements()->length(); i++) {
     st->print("%4d: ", i+1);
     elements()->at(i)->print_on(st);
@@ -451,7 +449,7 @@
   if (loader_oop == NULL) {
     st->print("null");
   } else {
-    st->print(INTPTR_FORMAT, klass->class_loader_data());
+    st->print(INTPTR_FORMAT, p2i(klass->class_loader_data()));
   }
 }
 
@@ -557,13 +555,13 @@
         }
 
         if (csv_format) {
-          st->print("%d,%d", e->index(), super_index);
+          st->print("%ld,%d", e->index(), super_index);
           for (int c=0; c<KlassSizeStats::_num_columns; c++) {
             if (selected[c]) {st->print("," JULONG_FORMAT, col_table[c]);}
           }
           st->print(",%s",e->name());
         } else {
-          st->print("%5d %5d", e->index(), super_index);
+          st->print("%5ld %5d", e->index(), super_index);
           for (int c=0; c<KlassSizeStats::_num_columns; c++) {
             if (selected[c]) {print_julong(st, width_table[c], col_table[c]);}
           }
diff --git a/hotspot/src/share/vm/memory/metachunk.cpp b/hotspot/src/share/vm/memory/metachunk.cpp
index 6cb6625..63d4cd1 100644
--- a/hotspot/src/share/vm/memory/metachunk.cpp
+++ b/hotspot/src/share/vm/memory/metachunk.cpp
@@ -28,8 +28,6 @@
 #include "utilities/copy.hpp"
 #include "utilities/debug.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 class VirtualSpaceNode;
 
 const size_t metadata_chunk_initialize = 0xf7f7f7f7;
@@ -92,7 +90,7 @@
   st->print_cr("Metachunk:"
                " bottom " PTR_FORMAT " top " PTR_FORMAT
                " end " PTR_FORMAT " size " SIZE_FORMAT,
-               bottom(), _top, end(), word_size());
+               p2i(bottom()), p2i(_top), p2i(end()), word_size());
   if (Verbose) {
     st->print_cr("    used " SIZE_FORMAT " free " SIZE_FORMAT,
                  used_word_size(), free_word_size());
diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp
index 8f7476d..280667d 100644
--- a/hotspot/src/share/vm/memory/metaspace.cpp
+++ b/hotspot/src/share/vm/memory/metaspace.cpp
@@ -49,8 +49,6 @@
 #include "utilities/debug.hpp"
 #include "utilities/macros.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > BlockTreeDictionary;
 typedef BinaryTreeDictionary<Metachunk, FreeList<Metachunk> > ChunkTreeDictionary;
 
@@ -346,7 +344,7 @@
   void inc_container_count();
   void dec_container_count();
 #ifdef ASSERT
-  uint container_count_slow();
+  uintx container_count_slow();
   void verify_container_count();
 #endif
 
@@ -388,7 +386,7 @@
 #define assert_is_ptr_aligned(ptr, alignment) \
   assert(is_ptr_aligned(ptr, alignment),      \
     err_msg(PTR_FORMAT " is not aligned to "  \
-      SIZE_FORMAT, ptr, alignment))
+      SIZE_FORMAT, p2i(ptr), alignment))
 
 #define assert_is_size_aligned(size, alignment) \
   assert(is_size_aligned(size, alignment),      \
@@ -463,8 +461,8 @@
 }
 
 #ifdef ASSERT
-uint VirtualSpaceNode::container_count_slow() {
-  uint count = 0;
+uintx VirtualSpaceNode::container_count_slow() {
+  uintx count = 0;
   Metachunk* chunk = first_chunk();
   Metachunk* invalid_chunk = (Metachunk*) top();
   while (chunk < invalid_chunk ) {
@@ -798,10 +796,7 @@
 void VirtualSpaceNode::inc_container_count() {
   assert_lock_strong(SpaceManager::expand_lock());
   _container_count++;
-  assert(_container_count == container_count_slow(),
-         err_msg("Inconsistency in container_count _container_count " SIZE_FORMAT
-                 " container_count_slow() " SIZE_FORMAT,
-                 _container_count, container_count_slow()));
+  DEBUG_ONLY(verify_container_count();)
 }
 
 void VirtualSpaceNode::dec_container_count() {
@@ -812,8 +807,8 @@
 #ifdef ASSERT
 void VirtualSpaceNode::verify_container_count() {
   assert(_container_count == container_count_slow(),
-    err_msg("Inconsistency in container_count _container_count " SIZE_FORMAT
-            " container_count_slow() " SIZE_FORMAT, _container_count, container_count_slow()));
+    err_msg("Inconsistency in container_count _container_count " UINTX_FORMAT
+            " container_count_slow() " UINTX_FORMAT, _container_count, container_count_slow()));
 }
 #endif
 
@@ -916,7 +911,7 @@
 
   if (!is_available(chunk_word_size)) {
     if (TraceMetadataChunkAllocation) {
-      gclog_or_tty->print("VirtualSpaceNode::take_from_committed() not available %d words ", chunk_word_size);
+      gclog_or_tty->print("VirtualSpaceNode::take_from_committed() not available " SIZE_FORMAT " words ", chunk_word_size);
       // Dump some information about the virtual space that is nearly full
       print_on(gclog_or_tty);
     }
@@ -989,7 +984,7 @@
 
     assert(reserved()->start() == (HeapWord*) _rs.base(),
       err_msg("Reserved start was not set properly " PTR_FORMAT
-        " != " PTR_FORMAT, reserved()->start(), _rs.base()));
+        " != " PTR_FORMAT, p2i(reserved()->start()), p2i(_rs.base())));
     assert(reserved()->word_size() == _rs.size() / BytesPerWord,
       err_msg("Reserved size was not set properly " SIZE_FORMAT
         " != " SIZE_FORMAT, reserved()->word_size(),
@@ -1003,13 +998,13 @@
   size_t used = used_words_in_vs();
   size_t capacity = capacity_words_in_vs();
   VirtualSpace* vs = virtual_space();
-  st->print_cr("   space @ " PTR_FORMAT " " SIZE_FORMAT "K, %3d%% used "
+  st->print_cr("   space @ " PTR_FORMAT " " SIZE_FORMAT "K, " SIZE_FORMAT_W(3) "%% used "
            "[" PTR_FORMAT ", " PTR_FORMAT ", "
            PTR_FORMAT ", " PTR_FORMAT ")",
-           vs, capacity / K,
+           p2i(vs), capacity / K,
            capacity == 0 ? 0 : used * 100 / capacity,
-           bottom(), top(), end(),
-           vs->high_boundary());
+           p2i(bottom()), p2i(top()), p2i(end()),
+           p2i(vs->high_boundary()));
 }
 
 #ifdef ASSERT
@@ -1812,7 +1807,7 @@
     if (TraceMetadataChunkAllocation && Verbose) {
       gclog_or_tty->print_cr("ChunkManager::free_chunks_get: free_list "
                              PTR_FORMAT " head " PTR_FORMAT " size " SIZE_FORMAT,
-                             free_list, chunk, chunk->word_size());
+                             p2i(free_list), p2i(chunk), chunk->word_size());
     }
   } else {
     chunk = humongous_dictionary()->get_chunk(
@@ -1872,7 +1867,7 @@
     }
     gclog_or_tty->print("ChunkManager::chunk_freelist_allocate: " PTR_FORMAT " chunk "
                         PTR_FORMAT "  size " SIZE_FORMAT " count " SIZE_FORMAT " ",
-                        this, chunk, chunk->word_size(), list_count);
+                        p2i(this), p2i(chunk), chunk->word_size(), list_count);
     locked_print_free_chunks(gclog_or_tty);
   }
 
@@ -2019,7 +2014,7 @@
   for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
     Metachunk* chunk = chunks_in_use(i);
     st->print("SpaceManager: %s " PTR_FORMAT,
-                 chunk_size_name(i), chunk);
+                 chunk_size_name(i), p2i(chunk));
     if (chunk != NULL) {
       st->print_cr(" free " SIZE_FORMAT,
                    chunk->free_word_size());
@@ -2130,8 +2125,8 @@
   for (ChunkIndex i = ZeroIndex;
        i < NumberOfInUseLists ;
        i = next_chunk_index(i) ) {
-    st->print_cr("  chunks_in_use " PTR_FORMAT " chunk size " PTR_FORMAT,
-                 chunks_in_use(i),
+    st->print_cr("  chunks_in_use " PTR_FORMAT " chunk size " SIZE_FORMAT,
+                 p2i(chunks_in_use(i)),
                  chunks_in_use(i) == NULL ? 0 : chunks_in_use(i)->word_size());
   }
   st->print_cr("    waste:  Small " SIZE_FORMAT " Medium " SIZE_FORMAT
@@ -2194,7 +2189,7 @@
   }
   _current_chunk = NULL;
   if (TraceMetadataChunkAllocation && Verbose) {
-    gclog_or_tty->print_cr("SpaceManager(): " PTR_FORMAT, this);
+    gclog_or_tty->print_cr("SpaceManager(): " PTR_FORMAT, p2i(this));
   }
 }
 
@@ -2238,7 +2233,7 @@
   dec_total_from_size_metrics();
 
   if (TraceMetadataChunkAllocation && Verbose) {
-    gclog_or_tty->print_cr("~SpaceManager(): " PTR_FORMAT, this);
+    gclog_or_tty->print_cr("~SpaceManager(): " PTR_FORMAT, p2i(this));
     locked_print_chunks_in_use_on(gclog_or_tty);
   }
 
@@ -2258,7 +2253,7 @@
 
   for (ChunkIndex i = ZeroIndex; i < HumongousIndex; i = next_chunk_index(i)) {
     if (TraceMetadataChunkAllocation && Verbose) {
-      gclog_or_tty->print_cr("returned %d %s chunks to freelist",
+      gclog_or_tty->print_cr("returned " SIZE_FORMAT " %s chunks to freelist",
                              sum_count_in_chunks_in_use(i),
                              chunk_size_name(i));
     }
@@ -2266,7 +2261,7 @@
     chunk_manager()->return_chunks(i, chunks);
     set_chunks_in_use(i, NULL);
     if (TraceMetadataChunkAllocation && Verbose) {
-      gclog_or_tty->print_cr("updated freelist count %d %s",
+      gclog_or_tty->print_cr("updated freelist count " SSIZE_FORMAT " %s",
                              chunk_manager()->free_chunks(i)->count(),
                              chunk_size_name(i));
     }
@@ -2279,7 +2274,7 @@
 
   // Humongous chunks
   if (TraceMetadataChunkAllocation && Verbose) {
-    gclog_or_tty->print_cr("returned %d %s humongous chunks to dictionary",
+    gclog_or_tty->print_cr("returned " SIZE_FORMAT " %s humongous chunks to dictionary",
                             sum_count_in_chunks_in_use(HumongousIndex),
                             chunk_size_name(HumongousIndex));
     gclog_or_tty->print("Humongous chunk dictionary: ");
@@ -2293,14 +2288,14 @@
 #endif
     if (TraceMetadataChunkAllocation && Verbose) {
       gclog_or_tty->print(PTR_FORMAT " (" SIZE_FORMAT ") ",
-                          humongous_chunks,
+                          p2i(humongous_chunks),
                           humongous_chunks->word_size());
     }
     assert(humongous_chunks->word_size() == (size_t)
            align_size_up(humongous_chunks->word_size(),
                              smallest_chunk_size()),
            err_msg("Humongous chunk size is wrong: word size " SIZE_FORMAT
-                   " granularity %d",
+                   " granularity " SIZE_FORMAT,
                    humongous_chunks->word_size(), smallest_chunk_size()));
     Metachunk* next_humongous_chunks = humongous_chunks->next();
     humongous_chunks->container()->dec_container_count();
@@ -2309,7 +2304,7 @@
   }
   if (TraceMetadataChunkAllocation && Verbose) {
     gclog_or_tty->cr();
-    gclog_or_tty->print_cr("updated dictionary count %d %s",
+    gclog_or_tty->print_cr("updated dictionary count " SIZE_FORMAT " %s",
                      chunk_manager()->humongous_dictionary()->total_count(),
                      chunk_size_name(HumongousIndex));
   }
@@ -2399,7 +2394,7 @@
 
   assert(new_chunk->is_empty(), "Not ready for reuse");
   if (TraceMetadataChunkAllocation && Verbose) {
-    gclog_or_tty->print("SpaceManager::add_chunk: %d) ",
+    gclog_or_tty->print("SpaceManager::add_chunk: " SIZE_FORMAT ") ",
                         sum_count_in_chunks_in_use());
     new_chunk->print_on(gclog_or_tty);
     chunk_manager()->locked_print_free_chunks(gclog_or_tty);
@@ -3097,7 +3092,7 @@
       metaspace_rs = ReservedSpace(compressed_class_space_size(),
                                    _reserve_alignment, large_pages);
       if (!metaspace_rs.is_reserved()) {
-        vm_exit_during_initialization(err_msg("Could not allocate metaspace: %d bytes",
+        vm_exit_during_initialization(err_msg("Could not allocate metaspace: " SIZE_FORMAT " bytes",
                                               compressed_class_space_size()));
       }
     }
@@ -3119,10 +3114,10 @@
   initialize_class_space(metaspace_rs);
 
   if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) {
-    gclog_or_tty->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: " SIZE_FORMAT,
-                            Universe::narrow_klass_base(), Universe::narrow_klass_shift());
+    gclog_or_tty->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: %d",
+                            p2i(Universe::narrow_klass_base()), Universe::narrow_klass_shift());
     gclog_or_tty->print_cr("Compressed class space size: " SIZE_FORMAT " Address: " PTR_FORMAT " Req Addr: " PTR_FORMAT,
-                           compressed_class_space_size(), metaspace_rs.base(), requested_addr);
+                           compressed_class_space_size(), p2i(metaspace_rs.base()), p2i(requested_addr));
   }
 }
 
@@ -3251,7 +3246,7 @@
       vm_exit_during_initialization("Unable to dump shared archive.",
           err_msg("Size of archive (" SIZE_FORMAT ") + compressed class space ("
                   SIZE_FORMAT ") == total (" SIZE_FORMAT ") is larger than compressed "
-                  "klass limit: " SIZE_FORMAT, cds_total, compressed_class_space_size(),
+                  "klass limit: " UINT64_FORMAT, cds_total, compressed_class_space_size(),
                   cds_total + compressed_class_space_size(), UnscaledClassSpaceMax));
     }
 
@@ -3262,7 +3257,7 @@
     Universe::set_narrow_klass_base((address)_space_list->current_virtual_space()->bottom());
     if (TraceMetavirtualspaceAllocation && Verbose) {
       gclog_or_tty->print_cr("Setting_narrow_klass_base to Address: " PTR_FORMAT,
-                             _space_list->current_virtual_space()->bottom());
+                             p2i(_space_list->current_virtual_space()->bottom()));
     }
 
     Universe::set_narrow_klass_shift(0);
@@ -3768,10 +3763,10 @@
 }
 
 void Metaspace::dump(outputStream* const out) const {
-  out->print_cr("\nVirtual space manager: " INTPTR_FORMAT, vsm());
+  out->print_cr("\nVirtual space manager: " INTPTR_FORMAT, p2i(vsm()));
   vsm()->dump(out);
   if (using_class_space()) {
-    out->print_cr("\nClass space manager: " INTPTR_FORMAT, class_vsm());
+    out->print_cr("\nClass space manager: " INTPTR_FORMAT, p2i(class_vsm()));
     class_vsm()->dump(out);
   }
 }
@@ -3932,13 +3927,13 @@
   assert(vsn.is_available(word_size), \
     err_msg(#word_size ": " PTR_FORMAT " bytes were not available in " \
             "VirtualSpaceNode [" PTR_FORMAT ", " PTR_FORMAT ")", \
-            (uintptr_t)(word_size * BytesPerWord), vsn.bottom(), vsn.end()));
+            (uintptr_t)(word_size * BytesPerWord), p2i(vsn.bottom()), p2i(vsn.end())));
 
 #define assert_is_available_negative(word_size) \
   assert(!vsn.is_available(word_size), \
     err_msg(#word_size ": " PTR_FORMAT " bytes should not be available in " \
             "VirtualSpaceNode [" PTR_FORMAT ", " PTR_FORMAT ")", \
-            (uintptr_t)(word_size * BytesPerWord), vsn.bottom(), vsn.end()));
+            (uintptr_t)(word_size * BytesPerWord), p2i(vsn.bottom()), p2i(vsn.end())));
 
   static void test_is_available_positive() {
     // Reserve some memory.
diff --git a/hotspot/src/share/vm/memory/referenceProcessor.cpp b/hotspot/src/share/vm/memory/referenceProcessor.cpp
index 1a011ce..8943a5e 100644
--- a/hotspot/src/share/vm/memory/referenceProcessor.cpp
+++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp
@@ -35,8 +35,6 @@
 #include "runtime/java.hpp"
 #include "runtime/jniHandles.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL;
 ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy      = NULL;
 bool             ReferenceProcessor::_pending_list_uses_discovered_field = false;
@@ -161,7 +159,7 @@
 
   NOT_PRODUCT(
   if (now < _soft_ref_timestamp_clock) {
-    warning("time warp: "INT64_FORMAT" to "INT64_FORMAT,
+    warning("time warp: " JLONG_FORMAT " to " JLONG_FORMAT,
             _soft_ref_timestamp_clock, now);
   }
   )
@@ -361,7 +359,7 @@
   // field.
   if (TraceReferenceGC && PrintGCDetails) {
     gclog_or_tty->print_cr("ReferenceProcessor::enqueue_discovered_reflist list "
-                           INTPTR_FORMAT, (address)refs_list.head());
+                           INTPTR_FORMAT, p2i(refs_list.head()));
   }
 
   oop obj = NULL;
@@ -375,7 +373,7 @@
       next_d = java_lang_ref_Reference::discovered(obj);
       if (TraceReferenceGC && PrintGCDetails) {
         gclog_or_tty->print_cr("        obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT,
-                               (void *)obj, (void *)next_d);
+                               p2i(obj), p2i(next_d));
       }
       assert(java_lang_ref_Reference::next(obj) == NULL,
              "Reference not active; should not be discovered");
@@ -402,7 +400,7 @@
       next_d = java_lang_ref_Reference::discovered(obj);
       if (TraceReferenceGC && PrintGCDetails) {
         gclog_or_tty->print_cr("        obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT,
-                               (void *)obj, (void *)next_d);
+                               p2i(obj), p2i(next_d));
       }
       assert(java_lang_ref_Reference::next(obj) == NULL,
              "The reference should not be enqueued");
@@ -565,7 +563,7 @@
         !policy->should_clear_reference(iter.obj(), _soft_ref_timestamp_clock)) {
       if (TraceReferenceGC) {
         gclog_or_tty->print_cr("Dropping reference (" INTPTR_FORMAT ": %s"  ") by policy",
-                               (void *)iter.obj(), iter.obj()->klass()->internal_name());
+                               p2i(iter.obj()), iter.obj()->klass()->internal_name());
       }
       // Remove Reference object from list
       iter.remove();
@@ -582,9 +580,9 @@
   complete_gc->do_void();
   NOT_PRODUCT(
     if (PrintGCDetails && TraceReferenceGC) {
-      gclog_or_tty->print_cr(" Dropped %d dead Refs out of %d "
-        "discovered Refs by policy, from list " INTPTR_FORMAT,
-        iter.removed(), iter.processed(), (address)refs_list.head());
+      gclog_or_tty->print_cr(" Dropped " SIZE_FORMAT " dead Refs out of " SIZE_FORMAT
+        " discovered Refs by policy, from list " INTPTR_FORMAT,
+        iter.removed(), iter.processed(), p2i(refs_list.head()));
     }
   )
 }
@@ -604,7 +602,7 @@
     if (iter.is_referent_alive()) {
       if (TraceReferenceGC) {
         gclog_or_tty->print_cr("Dropping strongly reachable reference (" INTPTR_FORMAT ": %s)",
-                               (void *)iter.obj(), iter.obj()->klass()->internal_name());
+                               p2i(iter.obj()), iter.obj()->klass()->internal_name());
       }
       // The referent is reachable after all.
       // Remove Reference object from list.
@@ -620,9 +618,9 @@
   }
   NOT_PRODUCT(
     if (PrintGCDetails && TraceReferenceGC && (iter.processed() > 0)) {
-      gclog_or_tty->print_cr(" Dropped %d active Refs out of %d "
-        "Refs in discovered list " INTPTR_FORMAT,
-        iter.removed(), iter.processed(), (address)refs_list.head());
+      gclog_or_tty->print_cr(" Dropped " SIZE_FORMAT " active Refs out of " SIZE_FORMAT
+        " Refs in discovered list " INTPTR_FORMAT,
+        iter.removed(), iter.processed(), p2i(refs_list.head()));
     }
   )
 }
@@ -659,9 +657,9 @@
   complete_gc->do_void();
   NOT_PRODUCT(
     if (PrintGCDetails && TraceReferenceGC && (iter.processed() > 0)) {
-      gclog_or_tty->print_cr(" Dropped %d active Refs out of %d "
-        "Refs in discovered list " INTPTR_FORMAT,
-        iter.removed(), iter.processed(), (address)refs_list.head());
+      gclog_or_tty->print_cr(" Dropped " SIZE_FORMAT " active Refs out of " SIZE_FORMAT
+        " Refs in discovered list " INTPTR_FORMAT,
+        iter.removed(), iter.processed(), p2i(refs_list.head()));
     }
   )
 }
@@ -678,7 +676,6 @@
   ResourceMark rm;
   DiscoveredListIterator iter(refs_list, keep_alive, is_alive);
   while (iter.has_next()) {
-    iter.update_discovered();
     iter.load_ptrs(DEBUG_ONLY(false /* allow_null_referent */));
     if (clear_referent) {
       // NULL out referent pointer
@@ -690,13 +687,11 @@
     if (TraceReferenceGC) {
       gclog_or_tty->print_cr("Adding %sreference (" INTPTR_FORMAT ": %s) as pending",
                              clear_referent ? "cleared " : "",
-                             (void *)iter.obj(), iter.obj()->klass()->internal_name());
+                             p2i(iter.obj()), iter.obj()->klass()->internal_name());
     }
     assert(iter.obj()->is_oop(UseConcMarkSweepGC), "Adding a bad reference");
     iter.next();
   }
-  // Remember to update the next pointer of the last ref.
-  iter.update_discovered();
   // Close the reachable set
   complete_gc->do_void();
 }
@@ -807,11 +802,11 @@
   for (uint i = 0; i < _max_num_q; ++i) {
     total_refs += ref_lists[i].length();
     if (TraceReferenceGC && PrintGCDetails) {
-      gclog_or_tty->print("%d ", ref_lists[i].length());
+      gclog_or_tty->print(SIZE_FORMAT " ", ref_lists[i].length());
     }
   }
   if (TraceReferenceGC && PrintGCDetails) {
-    gclog_or_tty->print_cr(" = %d", total_refs);
+    gclog_or_tty->print_cr(" = " SIZE_FORMAT, total_refs);
   }
   size_t avg_refs = total_refs / _num_q + 1;
   uint to_idx = 0;
@@ -877,11 +872,11 @@
   for (uint i = 0; i < _max_num_q; ++i) {
     balanced_total_refs += ref_lists[i].length();
     if (TraceReferenceGC && PrintGCDetails) {
-      gclog_or_tty->print("%d ", ref_lists[i].length());
+      gclog_or_tty->print(SIZE_FORMAT " ", ref_lists[i].length());
     }
   }
   if (TraceReferenceGC && PrintGCDetails) {
-    gclog_or_tty->print_cr(" = %d", balanced_total_refs);
+    gclog_or_tty->print_cr(" = " SIZE_FORMAT, balanced_total_refs);
     gclog_or_tty->flush();
   }
   assert(total_refs == balanced_total_refs, "Balancing was incomplete");
@@ -923,7 +918,7 @@
   size_t total_list_count = total_count(refs_lists);
 
   if (PrintReferenceGC && PrintGCDetails) {
-    gclog_or_tty->print(", %u refs", total_list_count);
+    gclog_or_tty->print(", " SIZE_FORMAT " refs", total_list_count);
   }
 
   // Phase 1 (soft refs only):
@@ -1016,7 +1011,7 @@
       ShouldNotReachHere();
   }
   if (TraceReferenceGC && PrintGCDetails) {
-    gclog_or_tty->print_cr("Thread %d gets list " INTPTR_FORMAT, id, list);
+    gclog_or_tty->print_cr("Thread %d gets list " INTPTR_FORMAT, id, p2i(list));
   }
   return list;
 }
@@ -1043,14 +1038,14 @@
 
     if (TraceReferenceGC) {
       gclog_or_tty->print_cr("Discovered reference (mt) (" INTPTR_FORMAT ": %s)",
-                             (void *)obj, obj->klass()->internal_name());
+                             p2i(obj), obj->klass()->internal_name());
     }
   } else {
     // If retest was non NULL, another thread beat us to it:
     // The reference has already been discovered...
     if (TraceReferenceGC) {
       gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)",
-                             (void *)obj, obj->klass()->internal_name());
+                             p2i(obj), obj->klass()->internal_name());
     }
   }
 }
@@ -1065,7 +1060,7 @@
   assert(da ? referent->is_oop() : referent->is_oop_or_null(),
          err_msg("Bad referent " INTPTR_FORMAT " found in Reference "
                  INTPTR_FORMAT " during %satomic discovery ",
-                 (void *)referent, (void *)obj, da ? "" : "non-"));
+                 p2i(referent), p2i(obj), da ? "" : "non-"));
 }
 #endif
 
@@ -1145,7 +1140,7 @@
     // The reference has already been discovered...
     if (TraceReferenceGC) {
       gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)",
-                             (void *)obj, obj->klass()->internal_name());
+                             p2i(obj), obj->klass()->internal_name());
     }
     if (RefDiscoveryPolicy == ReferentBasedDiscovery) {
       // assumes that an object is not processed twice;
@@ -1203,7 +1198,7 @@
 
     if (TraceReferenceGC) {
       gclog_or_tty->print_cr("Discovered reference (" INTPTR_FORMAT ": %s)",
-                                (void *)obj, obj->klass()->internal_name());
+                                p2i(obj), obj->klass()->internal_name());
     }
   }
   assert(obj->is_oop(), "Discovered a bad reference");
@@ -1314,7 +1309,7 @@
       // active; we need to trace and mark its cohort.
       if (TraceReferenceGC) {
         gclog_or_tty->print_cr("Precleaning Reference (" INTPTR_FORMAT ": %s)",
-                               (void *)iter.obj(), iter.obj()->klass()->internal_name());
+                               p2i(iter.obj()), iter.obj()->klass()->internal_name());
       }
       // Remove Reference object from list
       iter.remove();
@@ -1337,9 +1332,9 @@
 
   NOT_PRODUCT(
     if (PrintGCDetails && PrintReferenceGC && (iter.processed() > 0)) {
-      gclog_or_tty->print_cr(" Dropped %d Refs out of %d "
-        "Refs in discovered list " INTPTR_FORMAT,
-        iter.removed(), iter.processed(), (address)refs_list.head());
+      gclog_or_tty->print_cr(" Dropped " SIZE_FORMAT " Refs out of " SIZE_FORMAT
+        " Refs in discovered list " INTPTR_FORMAT,
+        iter.removed(), iter.processed(), p2i(refs_list.head()));
     }
   )
 }
diff --git a/hotspot/src/share/vm/memory/referenceProcessor.hpp b/hotspot/src/share/vm/memory/referenceProcessor.hpp
index 0600b27..6dd50e5 100644
--- a/hotspot/src/share/vm/memory/referenceProcessor.hpp
+++ b/hotspot/src/share/vm/memory/referenceProcessor.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -173,20 +173,6 @@
     }
   }
 
-  // Update the discovered field.
-  inline void update_discovered() {
-    // First _prev_next ref actually points into DiscoveredList (gross).
-    if (UseCompressedOops) {
-      if (!oopDesc::is_null(*(narrowOop*)_prev_next)) {
-        _keep_alive->do_oop((narrowOop*)_prev_next);
-      }
-    } else {
-      if (!oopDesc::is_null(*(oop*)_prev_next)) {
-        _keep_alive->do_oop((oop*)_prev_next);
-      }
-    }
-  }
-
   // NULL out referent pointer.
   void clear_referent();
 
diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp
index 27672c8..34424a6 100644
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp
@@ -35,14 +35,10 @@
 #include "utilities/copy.hpp"
 #include "utilities/workgroup.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 SharedHeap* SharedHeap::_sh;
 
-SharedHeap::SharedHeap(CollectorPolicy* policy_) :
+SharedHeap::SharedHeap() :
   CollectedHeap(),
-  _collector_policy(policy_),
-  _strong_roots_parity(0),
   _workers(NULL)
 {
   _sh = this;  // ch is static, should be set only once.
@@ -70,26 +66,20 @@
   _n_par_threads = t;
 }
 
-void SharedHeap::change_strong_roots_parity() {
-  // Also set the new collection parity.
-  assert(_strong_roots_parity >= 0 && _strong_roots_parity <= 2,
-         "Not in range.");
-  _strong_roots_parity++;
-  if (_strong_roots_parity == 3) _strong_roots_parity = 1;
-  assert(_strong_roots_parity >= 1 && _strong_roots_parity <= 2,
-         "Not in range.");
-}
-
 SharedHeap::StrongRootsScope::StrongRootsScope(SharedHeap* heap, bool activate)
   : MarkScope(activate), _sh(heap)
 {
   if (_active) {
-    _sh->change_strong_roots_parity();
+    Threads::change_thread_claim_parity();
     // Zero the claimed high water mark in the StringTable
     StringTable::clear_parallel_claimed_index();
   }
 }
 
+SharedHeap::StrongRootsScope::~StrongRootsScope() {
+  Threads::assert_all_threads_claimed();
+}
+
 void SharedHeap::set_barrier_set(BarrierSet* bs) {
   _barrier_set = bs;
   // Cached barrier set for fast access in oops
@@ -102,17 +92,3 @@
 }
 
 void SharedHeap::ref_processing_init() {}
-
-// Some utilities.
-void SharedHeap::print_size_transition(outputStream* out,
-                                       size_t bytes_before,
-                                       size_t bytes_after,
-                                       size_t capacity) {
-  out->print(" " SIZE_FORMAT "%s->" SIZE_FORMAT "%s(" SIZE_FORMAT "%s)",
-             byte_size_in_proper_unit(bytes_before),
-             proper_unit_for_byte_size(bytes_before),
-             byte_size_in_proper_unit(bytes_after),
-             proper_unit_for_byte_size(bytes_after),
-             byte_size_in_proper_unit(capacity),
-             proper_unit_for_byte_size(capacity));
-}
diff --git a/hotspot/src/share/vm/memory/sharedHeap.hpp b/hotspot/src/share/vm/memory/sharedHeap.hpp
index 8071752..e65ca85 100644
--- a/hotspot/src/share/vm/memory/sharedHeap.hpp
+++ b/hotspot/src/share/vm/memory/sharedHeap.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -110,19 +110,12 @@
   // set the static pointer "_sh" to that instance.
   static SharedHeap* _sh;
 
-  // A gc policy, controls global gc resource issues
-  CollectorPolicy *_collector_policy;
-
-  // See the discussion below, in the specification of the reader function
-  // for this variable.
-  int _strong_roots_parity;
-
   // If we're doing parallel GC, use this gang of threads.
   FlexibleWorkGang* _workers;
 
   // Full initialization is done in a concrete subtype's "initialize"
   // function.
-  SharedHeap(CollectorPolicy* policy_);
+  SharedHeap();
 
   // Returns true if the calling thread holds the heap lock,
   // or the calling thread is a par gc thread and the heap_lock is held
@@ -156,7 +149,10 @@
 
   bool no_gc_in_progress() { return !is_gc_active(); }
 
-  // Some collectors will perform "process_strong_roots" in parallel.
+  // Note, the below comment needs to be updated to reflect the changes
+  // introduced by JDK-8076225. This should be done as part of JDK-8076289.
+  //
+  //Some collectors will perform "process_strong_roots" in parallel.
   // Such a call will involve claiming some fine-grained tasks, such as
   // scanning of threads.  To make this process simpler, we provide the
   // "strong_roots_parity()" method.  Collectors that start parallel tasks
@@ -182,7 +178,6 @@
   //      task-claiming variables may be initialized, to indicate "never
   //      claimed".
  public:
-  int strong_roots_parity() { return _strong_roots_parity; }
 
   // Call these in sequential code around process_roots.
   // strong_roots_prologue calls change_strong_roots_parity, if
@@ -192,11 +187,10 @@
 
    public:
     StrongRootsScope(SharedHeap* heap, bool activate = true);
+    ~StrongRootsScope();
   };
-  friend class StrongRootsScope;
 
  private:
-  void change_strong_roots_parity();
 
  public:
   FlexibleWorkGang* workers() const { return _workers; }
@@ -214,16 +208,6 @@
   // Sets the number of parallel threads that will be doing tasks
   // (such as process roots) subsequently.
   virtual void set_par_threads(uint t);
-
-  //
-  // New methods from CollectedHeap
-  //
-
-  // Some utilities.
-  void print_size_transition(outputStream* out,
-                             size_t bytes_before,
-                             size_t bytes_after,
-                             size_t capacity);
 };
 
 #endif // SHARE_VM_MEMORY_SHAREDHEAP_HPP
diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp
index 6e9984f..d0fdd3c 100644
--- a/hotspot/src/share/vm/memory/space.cpp
+++ b/hotspot/src/share/vm/memory/space.cpp
@@ -44,8 +44,6 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 HeapWord* DirtyCardToOopClosure::get_actual_top(HeapWord* top,
                                                 HeapWord* top_obj) {
   if (top_obj != NULL) {
@@ -456,20 +454,20 @@
 void Space::print_on(outputStream* st) const {
   print_short_on(st);
   st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ")",
-                bottom(), end());
+                p2i(bottom()), p2i(end()));
 }
 
 void ContiguousSpace::print_on(outputStream* st) const {
   print_short_on(st);
   st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")",
-                bottom(), top(), end());
+                p2i(bottom()), p2i(top()), p2i(end()));
 }
 
 void OffsetTableContigSpace::print_on(outputStream* st) const {
   print_short_on(st);
   st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", "
                 INTPTR_FORMAT ", " INTPTR_FORMAT ")",
-              bottom(), top(), _offsets.threshold(), end());
+              p2i(bottom()), p2i(top()), p2i(_offsets.threshold()), p2i(end()));
 }
 
 void ContiguousSpace::verify() const {
@@ -592,7 +590,7 @@
 HeapWord* ContiguousSpace::block_start_const(const void* p) const {
   assert(MemRegion(bottom(), end()).contains(p),
          err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
-                  p, bottom(), end()));
+                  p2i(p), p2i(bottom()), p2i(end())));
   if (p >= top()) {
     return top();
   } else {
@@ -603,7 +601,7 @@
       cur += oop(cur)->size();
     }
     assert(oop(last)->is_oop(),
-           err_msg(PTR_FORMAT " should be an object start", last));
+           err_msg(PTR_FORMAT " should be an object start", p2i(last)));
     return last;
   }
 }
@@ -611,15 +609,15 @@
 size_t ContiguousSpace::block_size(const HeapWord* p) const {
   assert(MemRegion(bottom(), end()).contains(p),
          err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
-                  p, bottom(), end()));
+                  p2i(p), p2i(bottom()), p2i(end())));
   HeapWord* current_top = top();
   assert(p <= current_top,
          err_msg("p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT,
-                  p, current_top));
+                  p2i(p), p2i(current_top)));
   assert(p == current_top || oop(p)->is_oop(),
          err_msg("p (" PTR_FORMAT ") is not a block start - "
                  "current_top: " PTR_FORMAT ", is_oop: %s",
-                 p, current_top, BOOL_TO_STR(oop(p)->is_oop())));
+                 p2i(p), p2i(current_top), BOOL_TO_STR(oop(p)->is_oop())));
   if (p < current_top) {
     return oop(p)->size();
   } else {
diff --git a/hotspot/src/share/vm/memory/space.inline.hpp b/hotspot/src/share/vm/memory/space.inline.hpp
index 6adfc57..ccb8152 100644
--- a/hotspot/src/share/vm/memory/space.inline.hpp
+++ b/hotspot/src/share/vm/memory/space.inline.hpp
@@ -214,7 +214,7 @@
       assert(space->block_is_obj(q), "should be at block boundaries, and should be looking at objs");
 
       // point all the oops to the new location
-      size_t size = oop(q)->adjust_pointers();
+      size_t size = MarkSweep::adjust_pointers(oop(q));
       size = space->adjust_obj_size(size);
 
       q += size;
@@ -238,7 +238,7 @@
     if (oop(q)->is_gc_marked()) {
       // q is alive
       // point all the oops to the new location
-      size_t size = oop(q)->adjust_pointers();
+      size_t size = MarkSweep::adjust_pointers(oop(q));
       size = space->adjust_obj_size(size);
       debug_only(prev_q = q);
       q += size;
diff --git a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp
index 0603343..177d638 100644
--- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp
+++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp
@@ -31,8 +31,6 @@
 #include "runtime/thread.inline.hpp"
 #include "utilities/copy.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 // Thread-Local Edens support
 
 // static member initialization
@@ -154,7 +152,7 @@
   if (PrintTLAB && Verbose) {
     gclog_or_tty->print("TLAB new size: thread: " INTPTR_FORMAT " [id: %2d]"
                         " refills %d  alloc: %8.6f desired_size: " SIZE_FORMAT " -> " SIZE_FORMAT "\n",
-                        myThread(), myThread()->osthread()->thread_id(),
+                        p2i(myThread()), myThread()->osthread()->thread_id(),
                         _target_refills, _allocation_fraction.average(), desired_size(), aligned_new_size);
   }
   set_desired_size(aligned_new_size);
@@ -263,7 +261,7 @@
                       " slow allocs: %d  refill waste: " SIZE_FORMAT "B"
                       " alloc:%8.5f %8.0fKB refills: %d waste %4.1f%% gc: %dB"
                       " slow: %dB fast: %dB\n",
-                      tag, thrd, thrd->osthread()->thread_id(),
+                      tag, p2i(thrd), thrd->osthread()->thread_id(),
                       _desired_size / (K / HeapWordSize),
                       _slow_allocations, _refill_waste_limit * HeapWordSize,
                       _allocation_fraction.average(),
diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp
index 6c55aed..75f4f96 100644
--- a/hotspot/src/share/vm/memory/universe.cpp
+++ b/hotspot/src/share/vm/memory/universe.cpp
@@ -84,8 +84,6 @@
 #include "classfile/sharedClassUtil.hpp"
 #endif
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 // Known objects
 Klass* Universe::_boolArrayKlassObj                 = NULL;
 Klass* Universe::_byteArrayKlassObj                 = NULL;
@@ -792,12 +790,12 @@
 void Universe::print_compressed_oops_mode() {
   tty->cr();
   tty->print("heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB",
-              Universe::heap()->base(), Universe::heap()->reserved_region().byte_size()/M);
+              p2i(Universe::heap()->base()), Universe::heap()->reserved_region().byte_size()/M);
 
   tty->print(", Compressed Oops mode: %s", narrow_oop_mode_to_string(narrow_oop_mode()));
 
   if (Universe::narrow_oop_base() != 0) {
-    tty->print(": " PTR_FORMAT, Universe::narrow_oop_base());
+    tty->print(": " PTR_FORMAT, p2i(Universe::narrow_oop_base()));
   }
 
   if (Universe::narrow_oop_shift() != 0) {
diff --git a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp
index f49e376..cf2eec9 100644
--- a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -42,7 +42,6 @@
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/parNew/parOopClosures.inline.hpp"
 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
-#include "oops/oop.pcgc.inline.hpp"
 #endif // INCLUDE_ALL_GCS
 
 // Macro to define InstanceClassLoaderKlass::oop_oop_iterate for virtual/nonvirtual for
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index 8d62afe..f7ac70e 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -74,7 +74,6 @@
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp"
 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
-#include "oops/oop.pcgc.inline.hpp"
 #endif // INCLUDE_ALL_GCS
 #ifdef COMPILER1
 #include "c1/c1_Compiler.hpp"
diff --git a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp
index 73d6e43..191f1b8 100644
--- a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -47,7 +47,6 @@
 #include "gc_implementation/parNew/parOopClosures.inline.hpp"
 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
-#include "oops/oop.pcgc.inline.hpp"
 #endif // INCLUDE_ALL_GCS
 
 int InstanceMirrorKlass::_offset_of_static_fields = 0;
diff --git a/hotspot/src/share/vm/oops/instanceRefKlass.cpp b/hotspot/src/share/vm/oops/instanceRefKlass.cpp
index 12804db..bf3cfa3 100644
--- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,6 @@
 #include "gc_implementation/parNew/parOopClosures.inline.hpp"
 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
-#include "oops/oop.pcgc.inline.hpp"
 #endif // INCLUDE_ALL_GCS
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
diff --git a/hotspot/src/share/vm/oops/objArrayKlass.cpp b/hotspot/src/share/vm/oops/objArrayKlass.cpp
index 8c2670c..ceaabf9 100644
--- a/hotspot/src/share/vm/oops/objArrayKlass.cpp
+++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp
@@ -55,7 +55,6 @@
 #include "gc_implementation/parallelScavenge/psCompactionManager.hpp"
 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
-#include "oops/oop.pcgc.inline.hpp"
 #endif // INCLUDE_ALL_GCS
 
 ObjArrayKlass* ObjArrayKlass::allocate(ClassLoaderData* loader_data, int n, KlassHandle klass_handle, Symbol* name, TRAPS) {
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index 7d6596d..544903d9 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -3183,6 +3183,7 @@
 int         Threads::_number_of_threads = 0;
 int         Threads::_number_of_non_daemon_threads = 0;
 int         Threads::_return_code = 0;
+int         Threads::_thread_claim_parity = 0;
 size_t      JavaThread::_stack_size_at_create = 0;
 #ifdef ASSERT
 bool        Threads::_vm_complete = false;
@@ -3217,7 +3218,6 @@
   // If CompilerThreads ever become non-JavaThreads, add them here
 }
 
-
 void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
   TraceTime timer("Initialize java.lang classes", TraceStartupTime);
 
@@ -4046,6 +4046,26 @@
   VMThread::vm_thread()->oops_do(f, cld_f, cf);
 }
 
+void Threads::change_thread_claim_parity() {
+  // Set the new claim parity.
+  assert(_thread_claim_parity >= 0 && _thread_claim_parity <= 2,
+         "Not in range.");
+  _thread_claim_parity++;
+  if (_thread_claim_parity == 3) _thread_claim_parity = 1;
+  assert(_thread_claim_parity >= 1 && _thread_claim_parity <= 2,
+         "Not in range.");
+}
+
+#ifndef PRODUCT
+void Threads::assert_all_threads_claimed() {
+  ALL_JAVA_THREADS(p) {
+    const int thread_parity = p->oops_do_parity();
+    assert((thread_parity == _thread_claim_parity),
+        err_msg("Thread " PTR_FORMAT " has incorrect parity %d != %d", p2i(p), thread_parity, _thread_claim_parity));
+  }
+}
+#endif // PRODUCT
+
 void Threads::possibly_parallel_oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) {
   // Introduce a mechanism allowing parallel threads to claim threads as
   // root groups.  Overhead should be small enough to use all the time,
@@ -4060,7 +4080,7 @@
   assert(!is_par ||
          (SharedHeap::heap()->n_par_threads() ==
          SharedHeap::heap()->workers()->active_workers()), "Mismatch");
-  int cp = SharedHeap::heap()->strong_roots_parity();
+  int cp = Threads::thread_claim_parity();
   ALL_JAVA_THREADS(p) {
     if (p->claim_oops_do(is_par, cp)) {
       p->oops_do(f, cld_f, cf);
diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp
index 9c6a7c7..2744281 100644
--- a/hotspot/src/share/vm/runtime/thread.hpp
+++ b/hotspot/src/share/vm/runtime/thread.hpp
@@ -551,6 +551,7 @@
   Monitor* owned_locks() const                   { return _owned_locks;          }
   bool owns_locks() const                        { return owned_locks() != NULL; }
   bool owns_locks_but_compiled_lock() const;
+  int oops_do_parity() const                     { return _oops_do_parity; }
 
   // Deadlock detection
   bool allow_allocation()                        { return _allow_allocation_count == 0; }
@@ -1855,6 +1856,7 @@
   static int         _number_of_threads;
   static int         _number_of_non_daemon_threads;
   static int         _return_code;
+  static int         _thread_claim_parity;
 #ifdef ASSERT
   static bool        _vm_complete;
 #endif
@@ -1884,9 +1886,10 @@
   // Does not include JNI_VERSION_1_1
   static jboolean is_supported_jni_version(jint version);
 
-  // Garbage collection
-  static void follow_other_roots(void f(oop*));
+  static int thread_claim_parity() { return _thread_claim_parity; }
+  static void change_thread_claim_parity();
 
+  static void assert_all_threads_claimed() PRODUCT_RETURN;
   // Apply "f->do_oop" to all root oops in all threads.
   // This version may only be called by sequential code.
   static void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf);
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index 727d3ac..f7561b6 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -527,11 +527,11 @@
   nonstatic_field(CollectedHeap,               _defer_initial_card_mark,                      bool)                                  \
   nonstatic_field(CollectedHeap,               _is_gc_active,                                 bool)                                  \
   nonstatic_field(CollectedHeap,               _total_collections,                            unsigned int)                          \
+                                                                                                                                     \
   nonstatic_field(CompactibleSpace,            _compaction_top,                               HeapWord*)                             \
   nonstatic_field(CompactibleSpace,            _first_dead,                                   HeapWord*)                             \
   nonstatic_field(CompactibleSpace,            _end_of_live,                                  HeapWord*)                             \
                                                                                                                                      \
-                                                                                                                                     \
   nonstatic_field(ContiguousSpace,             _top,                                          HeapWord*)                             \
   nonstatic_field(ContiguousSpace,             _concurrent_iteration_safe_limit,              HeapWord*)                             \
   nonstatic_field(ContiguousSpace,             _saved_mark_word,                              HeapWord*)                             \
@@ -559,7 +559,9 @@
   nonstatic_field(GenCollectedHeap,            _young_gen,                                    Generation*)                           \
   nonstatic_field(GenCollectedHeap,            _old_gen,                                      Generation*)                           \
  nonstatic_field(GenCollectedHeap,             _n_gens,                                       int)                                   \
-  nonstatic_field(GenCollectedHeap,            _gen_specs,                                    GenerationSpec**)                      \
+                                                                                                                                     \
+  nonstatic_field(GenCollectorPolicy,          _young_gen_spec,                               GenerationSpec*)                       \
+  nonstatic_field(GenCollectorPolicy,          _old_gen_spec,                                 GenerationSpec*)                       \
                                                                                                                                      \
   nonstatic_field(HeapWord,                    i,                                             char*)                                 \
                                                                                                                                      \
@@ -1505,6 +1507,7 @@
            declare_type(DefNewGeneration,             Generation)         \
            declare_type(CardGeneration,               Generation)         \
            declare_type(TenuredGeneration,            CardGeneration)     \
+  declare_toplevel_type(GenCollectorPolicy)                               \
   declare_toplevel_type(Space)                                            \
   declare_toplevel_type(BitMap)                                           \
            declare_type(CompactibleSpace,             Space)              \
@@ -2250,9 +2253,9 @@
                                                                           \
   declare_constant(CardTableRS::youngergen_card)                          \
                                                                           \
-  declare_constant(CollectedHeap::Abstract)                               \
-  declare_constant(CollectedHeap::SharedHeap)                             \
   declare_constant(CollectedHeap::GenCollectedHeap)                       \
+  declare_constant(CollectedHeap::ParallelScavengeHeap)                   \
+  declare_constant(CollectedHeap::G1CollectedHeap)                        \
                                                                           \
   declare_constant(GenCollectedHeap::max_gens)                            \
                                                                           \
diff --git a/hotspot/src/share/vm/services/memoryService.cpp b/hotspot/src/share/vm/services/memoryService.cpp
index 794f462..89e57af 100644
--- a/hotspot/src/share/vm/services/memoryService.cpp
+++ b/hotspot/src/share/vm/services/memoryService.cpp
@@ -130,8 +130,7 @@
 
   GenCollectorPolicy* gen_policy = policy->as_generation_policy();
   if (gen_policy != NULL) {
-    GenerationSpec** specs = gen_policy->generations();
-    Generation::Name kind = specs[0]->name();
+    Generation::Name kind = gen_policy->young_gen_spec()->name();
     switch (kind) {
       case Generation::DefNew:
         _minor_gc_manager = MemoryManager::get_copy_memory_manager();
diff --git a/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java b/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java
new file mode 100644
index 0000000..f645576
--- /dev/null
+++ b/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test TestDynamicNumberOfGCThreads
+ * @bug 8017462
+ * @summary Ensure that UseDynamicNumberOfGCThreads runs
+ * @requires vm.gc=="null"
+ * @key gc
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.ProcessTools;
+import com.oracle.java.testlibrary.OutputAnalyzer;
+
+public class TestDynamicNumberOfGCThreads {
+  public static void main(String[] args) throws Exception {
+
+    testDynamicNumberOfGCThreads("UseConcMarkSweepGC");
+
+    testDynamicNumberOfGCThreads("UseG1GC");
+
+    testDynamicNumberOfGCThreads("UseParallelGC");
+  }
+
+  private static void verifyDynamicNumberOfGCThreads(OutputAnalyzer output) {
+    output.shouldContain("new_active_workers");
+    output.shouldHaveExitValue(0);
+  }
+
+  private static void testDynamicNumberOfGCThreads(String gcFlag) throws Exception {
+    // UseDynamicNumberOfGCThreads and TraceDynamicGCThreads enabled
+    ProcessBuilder pb_enabled =
+      ProcessTools.createJavaProcessBuilder("-XX:+" + gcFlag, "-Xmx10M", "-XX:+PrintGCDetails",  "-XX:+UseDynamicNumberOfGCThreads", "-XX:+TraceDynamicGCThreads", GCTest.class.getName());
+    verifyDynamicNumberOfGCThreads(new OutputAnalyzer(pb_enabled.start()));
+  }
+
+  static class GCTest {
+    private static byte[] garbage;
+    public static void main(String [] args) {
+      System.out.println("Creating garbage");
+      // create 128MB of garbage. This should result in at least one GC
+      for (int i = 0; i < 1024; i++) {
+        garbage = new byte[128 * 1024];
+      }
+      System.out.println("Done");
+    }
+  }
+}
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index a71188f..a771efc 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -301,3 +301,4 @@
 139092a10dedd32bc1155e40c67a6ef682e39873 jdk9-b56
 2c417f7d7b0dc98e887474884aa39f974894f0c2 jdk9-b57
 270fb9a2dcb5ff3ef95da6d529fa35187026af0a jdk9-b58
+a1a9d943446911a4a0f74f0d082c32094af944ae jdk9-b59
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 262b4f7..28dbe7d 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -304,3 +304,4 @@
 b4f913b48e699980bd11fe19cce134d0adb4c31c jdk9-b56
 17c4241395e97312bd75e7acd693ffcdd41ae993 jdk9-b57
 1e06b36bb396c0495e0774f1c6b0356d03847659 jdk9-b58
+8a9ebae410bc388668fc203e559b5407bde757eb jdk9-b59
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ClassFactory.java b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ClassFactory.java
index 4a766d3..7bdffc4 100644
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ClassFactory.java
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ClassFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,8 +30,6 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.ref.WeakReference;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import java.util.Map;
 import java.util.WeakHashMap;
 import java.util.logging.Level;
@@ -87,25 +85,19 @@
         if(consRef!=null)
             cons = consRef.get();
         if(cons==null) {
-            cons = AccessController.doPrivileged(new PrivilegedAction<Constructor<T>>() {
-                @Override
-                public Constructor<T> run() {
-                    try {
-                        return clazz.getDeclaredConstructor(emptyClass);
-                    } catch (NoSuchMethodException e) {
-                        logger.log(Level.INFO,"No default constructor found on "+clazz,e);
-                        NoSuchMethodError exp;
-                        if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) {
-                            exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS
-                                                                .format(clazz.getName()));
-                        } else {
-                            exp = new NoSuchMethodError(e.getMessage());
-                        }
-                        exp.initCause(e);
-                        throw exp;
-                    }
+            try {
+                cons = clazz.getDeclaredConstructor(emptyClass);
+            } catch (NoSuchMethodException e) {
+                logger.log(Level.INFO,"No default constructor found on "+clazz,e);
+                NoSuchMethodError exp;
+                if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) {
+                    exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS.format(clazz.getName()));
+                } else {
+                    exp = new NoSuchMethodError(e.getMessage());
                 }
-            });
+                exp.initCause(e);
+                throw exp;
+            }
 
             int classMod = clazz.getModifiers();
 
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEMessage.java b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEMessage.java
index 93339f0..1204ff5 100644
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEMessage.java
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEMessage.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,18 @@
 
 package com.sun.xml.internal.org.jvnet.mimepull;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.nio.ByteBuffer;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -40,19 +46,21 @@
  *
  * @author Jitendra Kotamraju
  */
-public class MIMEMessage {
+public class MIMEMessage implements Closeable {
+
     private static final Logger LOGGER = Logger.getLogger(MIMEMessage.class.getName());
 
     MIMEConfig config;
 
     private final InputStream in;
-    private final List<MIMEPart> partsList;
-    private final Map<String, MIMEPart> partsMap;
     private final Iterator<MIMEEvent> it;
     private boolean parsed;     // true when entire message is parsed
     private MIMEPart currentPart;
     private int currentIndex;
 
+    private final List<MIMEPart> partsList = new ArrayList<MIMEPart>();
+    private final Map<String, MIMEPart> partsMap = new HashMap<String, MIMEPart>();
+
     /**
      * @see MIMEMessage(InputStream, String, MIMEConfig)
      */
@@ -64,9 +72,9 @@
      * Creates a MIME message from the content's stream. The content stream
      * is closed when EOF is reached.
      *
-     * @param in MIME message stream
+     * @param in       MIME message stream
      * @param boundary the separator for parts(pass it without --)
-     * @param config various configuration parameters
+     * @param config   various configuration parameters
      */
     public MIMEMessage(InputStream in, String boundary, MIMEConfig config) {
         this.in = in;
@@ -74,8 +82,6 @@
         MIMEParser parser = new MIMEParser(in, boundary, config);
         it = parser.iterator();
 
-        partsList = new ArrayList<MIMEPart>();
-        partsMap = new HashMap<String, MIMEPart>();
         if (config.isParseEagerly()) {
             parseAll();
         }
@@ -108,14 +114,14 @@
         LOGGER.log(Level.FINE, "index={0}", index);
         MIMEPart part = (index < partsList.size()) ? partsList.get(index) : null;
         if (parsed && part == null) {
-            throw new MIMEParsingException("There is no "+index+" attachment part ");
+            throw new MIMEParsingException("There is no " + index + " attachment part ");
         }
         if (part == null) {
             // Parsing will done lazily and will be driven by reading the part
             part = new MIMEPart(this);
             partsList.add(index, part);
         }
-        LOGGER.log(Level.FINE, "Got attachment at index={0} attachment={1}", new Object[]{index, part});
+        LOGGER.log(Level.FINE, "Got attachment at index={0} attachment={1}", new Object[] {index, part});
         return part;
     }
 
@@ -132,14 +138,14 @@
         LOGGER.log(Level.FINE, "Content-ID={0}", contentId);
         MIMEPart part = getDecodedCidPart(contentId);
         if (parsed && part == null) {
-            throw new MIMEParsingException("There is no attachment part with Content-ID = "+contentId);
+            throw new MIMEParsingException("There is no attachment part with Content-ID = " + contentId);
         }
         if (part == null) {
             // Parsing is done lazily and is driven by reading the part
             part = new MIMEPart(this, contentId);
             partsMap.put(contentId, part);
         }
-        LOGGER.log(Level.FINE, "Got attachment for Content-ID={0} attachment={1}", new Object[]{contentId, part});
+        LOGGER.log(Level.FINE, "Got attachment for Content-ID={0} attachment={1}", new Object[] {contentId, part});
         return part;
     }
 
@@ -151,7 +157,7 @@
                 try {
                     String tempCid = URLDecoder.decode(cid, "utf-8");
                     part = partsMap.get(tempCid);
-                } catch(UnsupportedEncodingException ue) {
+                } catch (UnsupportedEncodingException ue) {
                     // Ignore it
                 }
             }
@@ -159,22 +165,43 @@
         return part;
     }
 
-
     /**
      * Parses the whole MIME message eagerly
      */
     public final void parseAll() {
-        while(makeProgress()) {
+        while (makeProgress()) {
             // Nothing to do
         }
     }
 
+    /**
+     * Closes all parsed {@link com.sun.xml.internal.org.jvnet.mimepull.MIMEPart parts}.
+     * This method is safe to call even if parsing of message failed.
+     * <p/>
+     * Does not throw {@link com.sun.xml.internal.org.jvnet.mimepull.MIMEParsingException} if an
+     * error occurred during closing a MIME part. The exception (if any) is
+     * still logged.
+     */
+    @Override
+    public void close() {
+        close(partsList);
+        close(partsMap.values());
+    }
+
+    private void close(final Collection<MIMEPart> parts) {
+        for (final MIMEPart part : parts) {
+            try {
+                part.close();
+            } catch (final MIMEParsingException closeError) {
+                LOGGER.log(Level.FINE, "Exception during closing MIME part", closeError);
+            }
+        }
+    }
 
     /**
      * Parses the MIME message in a pull fashion.
      *
-     * @return
-     *      false if the parsing is completed.
+     * @return false if the parsing is completed.
      */
     public synchronized boolean makeProgress() {
         if (!it.hasNext()) {
@@ -183,23 +210,23 @@
 
         MIMEEvent event = it.next();
 
-        switch(event.getEventType()) {
-            case START_MESSAGE :
+        switch (event.getEventType()) {
+            case START_MESSAGE:
                 LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.START_MESSAGE);
                 break;
 
-            case START_PART :
+            case START_PART:
                 LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.START_PART);
                 break;
 
-            case HEADERS :
+            case HEADERS:
                 LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.HEADERS);
-                MIMEEvent.Headers headers = (MIMEEvent.Headers)event;
+                MIMEEvent.Headers headers = (MIMEEvent.Headers) event;
                 InternetHeaders ih = headers.getHeaders();
                 List<String> cids = ih.getHeader("content-id");
-                String cid = (cids != null) ? cids.get(0) : currentIndex+"";
-                if (cid.length() > 2 && cid.charAt(0)=='<') {
-                    cid = cid.substring(1,cid.length()-1);
+                String cid = (cids != null) ? cids.get(0) : currentIndex + "";
+                if (cid.length() > 2 && cid.charAt(0) == '<') {
+                    cid = cid.substring(1, cid.length() - 1);
                 }
                 MIMEPart listPart = (currentIndex < partsList.size()) ? partsList.get(currentIndex) : null;
                 MIMEPart mapPart = getDecodedCidPart(cid);
@@ -219,31 +246,31 @@
                 currentPart.setHeaders(ih);
                 break;
 
-            case CONTENT :
+            case CONTENT:
                 LOGGER.log(Level.FINER, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.CONTENT);
-                MIMEEvent.Content content = (MIMEEvent.Content)event;
+                MIMEEvent.Content content = (MIMEEvent.Content) event;
                 ByteBuffer buf = content.getData();
                 currentPart.addBody(buf);
                 break;
 
-            case END_PART :
+            case END_PART:
                 LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.END_PART);
                 currentPart.doneParsing();
                 ++currentIndex;
                 break;
 
-            case END_MESSAGE :
+            case END_MESSAGE:
                 LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.END_MESSAGE);
                 parsed = true;
                 try {
                     in.close();
-                } catch(IOException ioe) {
+                } catch (IOException ioe) {
                     throw new MIMEParsingException(ioe);
                 }
                 break;
 
-            default :
-                throw new MIMEParsingException("Unknown Parser state = "+event.getEventType());
+            default:
+                throw new MIMEParsingException("Unknown Parser state = " + event.getEventType());
         }
         return true;
     }
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEPart.java b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEPart.java
index 88a6e0b..cbe4b44 100644
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEPart.java
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEPart.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 
 package com.sun.xml.internal.org.jvnet.mimepull;
 
+import java.io.Closeable;
 import java.io.File;
 import java.io.InputStream;
 import java.nio.ByteBuffer;
@@ -42,10 +43,11 @@
  *
  * @author Jitendra Kotamraju, Martin Grebac
  */
-public class MIMEPart {
+public class MIMEPart implements Closeable {
 
     private static final Logger LOGGER = Logger.getLogger(MIMEPart.class.getName());
 
+    private volatile boolean closed;
     private volatile InternetHeaders headers;
     private volatile String contentId;
     private String contentType;
@@ -55,6 +57,8 @@
     final MIMEMessage msg;
     private final DataHead dataHead;
 
+    private final Object lock = new Object();
+
     MIMEPart(MIMEMessage msg) {
         this.msg = msg;
         this.dataHead = new DataHead(this);
@@ -91,8 +95,16 @@
      * the temp file that is used to serve this part's content). After
      * calling this, one shouldn't call {@link #read()} or {@link #readOnce()}
      */
+    @Override
     public void close() {
-        dataHead.close();
+        if (!closed) {
+            synchronized (lock) {
+                if (!closed) {
+                    dataHead.close();
+                    closed = true;
+                }
+            }
+        }
     }
 
     /**
@@ -242,6 +254,15 @@
         this.contentTransferEncoding = cte;
     }
 
+    /**
+     * Return {@code true} if this part has already been closed, {@code false} otherwise.
+     *
+     * @return {@code true} if this part has already been closed, {@code false} otherwise.
+     */
+    public boolean isClosed() {
+        return closed;
+    }
+
     @Override
     public String toString() {
         return "Part="+contentId+":"+contentTransferEncoding;
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java
index 912b9ca..5413ac4 100644
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -84,9 +84,6 @@
                 if (LOGGER.isLoggable(Level.FINE)) {
                     LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile);
                 }
-                // delete the temp file when VM exits as a last resort for file clean up
-                tempFile.deleteOnExit();
-                if (LOGGER.isLoggable(Level.FINE)) {LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile);}
                 dataHead.dataFile = new DataFile(tempFile);
             } catch (IOException ioe) {
                 throw new MIMEParsingException(ioe);
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java
index 78dd65d..18ff819 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 
 package javax.xml.bind;
 
-import java.util.Iterator;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
@@ -34,15 +33,13 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.URL;
+import java.security.AccessController;
 import java.util.Map;
 import java.util.Properties;
 import java.util.StringTokenizer;
 import java.util.logging.ConsoleHandler;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import java.security.AccessController;
-
-import static javax.xml.bind.JAXBContext.JAXB_CONTEXT_FACTORY;
 
 
 /**
@@ -55,7 +52,24 @@
  * @see JAXBContext
  */
 class ContextFinder {
+
+    /**
+     * When JAXB is in J2SE, rt.jar has to have a JAXB implementation.
+     * However, rt.jar cannot have META-INF/services/javax.xml.bind.JAXBContext
+     * because if it has, it will take precedence over any file that applications have
+     * in their jar files.
+     *
+     * <p>
+     * When the user bundles his own JAXB implementation, we'd like to use it, and we
+     * want the platform default to be used only when there's no other JAXB provider.
+     *
+     * <p>
+     * For this reason, we have to hard-code the class name into the API.
+     */
+    private static final String PLATFORM_DEFAULT_FACTORY_CLASS = "com.sun.xml.internal.bind.v2.ContextFactory";
+
     private static final Logger logger;
+
     static {
         logger = Logger.getLogger("javax.xml.bind");
         try {
@@ -72,7 +86,7 @@
                 // to honor what other frameworks
                 // have done on configurations.
             }
-        } catch(Throwable t) {
+        } catch (Throwable t) {
             // just to be extra safe. in particular System.getProperty may throw
             // SecurityException.
         }
@@ -84,15 +98,15 @@
      */
     private static void handleInvocationTargetException(InvocationTargetException x) throws JAXBException {
         Throwable t = x.getTargetException();
-        if( t != null ) {
-            if( t instanceof JAXBException )
+        if (t != null) {
+            if (t instanceof JAXBException)
                 // one of our exceptions, just re-throw
-                throw (JAXBException)t;
-            if( t instanceof RuntimeException )
+                throw (JAXBException) t;
+            if (t instanceof RuntimeException)
                 // avoid wrapping exceptions unnecessarily
-                throw (RuntimeException)t;
-            if( t instanceof Error )
-                throw (Error)t;
+                throw (RuntimeException) t;
+            if (t instanceof Error)
+                throw (Error) t;
         }
     }
 
@@ -121,18 +135,17 @@
     /**
      * Create an instance of a class using the specified ClassLoader
      */
-    static JAXBContext newInstance( String contextPath,
-                               String className,
-                               ClassLoader classLoader,
-                               Map properties )
-        throws JAXBException {
+    static JAXBContext newInstance(String contextPath,
+                                   String className,
+                                   ClassLoader classLoader,
+                                   Map properties) throws JAXBException {
+
         try {
-            Class spFactory = safeLoadClass(className,classLoader);
+            Class spFactory = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader);
             return newInstance(contextPath, spFactory, classLoader, properties);
         } catch (ClassNotFoundException x) {
-            throw new JAXBException(
-                Messages.format( Messages.PROVIDER_NOT_FOUND, className ),
-                x);
+            throw new JAXBException(Messages.format(Messages.PROVIDER_NOT_FOUND, className), x);
+
         } catch (RuntimeException x) {
             // avoid wrapping RuntimeException to JAXBException,
             // because it indicates a bug in this code.
@@ -142,18 +155,12 @@
             // reflection.  Root element collisions detected in the call to
             // createContext() are reported as JAXBExceptions - just re-throw it
             // some other type of exception - just wrap it
-            throw new JAXBException(
-                Messages.format( Messages.COULD_NOT_INSTANTIATE, className, x ),
-                x);
+            throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, className, x), x);
         }
     }
 
-    static JAXBContext newInstance( String contextPath,
-                               Class spFactory,
-                               ClassLoader classLoader,
-                               Map properties )
-        throws JAXBException
-    {
+    static JAXBContext newInstance(String contextPath, Class spFactory, ClassLoader classLoader, Map properties) throws JAXBException {
+
         try {
             /*
              * javax.xml.bind.context.factory points to a class which has a
@@ -166,35 +173,35 @@
             // first check the method that takes Map as the third parameter.
             // this is added in 2.0.
             try {
-                Method m = spFactory.getMethod("createContext",String.class,ClassLoader.class,Map.class);
+                Method m = spFactory.getMethod("createContext", String.class, ClassLoader.class, Map.class);
                 // any failure in invoking this method would be considered fatal
-                context = m.invoke(null,contextPath,classLoader,properties);
+                context = m.invoke(null, contextPath, classLoader, properties);
             } catch (NoSuchMethodException e) {
                 // it's not an error for the provider not to have this method.
             }
 
-            if(context==null) {
+            if (context == null) {
                 // try the old method that doesn't take properties. compatible with 1.0.
                 // it is an error for an implementation not to have both forms of the createContext method.
-                Method m = spFactory.getMethod("createContext",String.class,ClassLoader.class);
+                Method m = spFactory.getMethod("createContext", String.class, ClassLoader.class);
                 // any failure in invoking this method would be considered fatal
-                context = m.invoke(null,contextPath,classLoader);
+                context = m.invoke(null, contextPath, classLoader);
             }
 
-            if(!(context instanceof JAXBContext)) {
+            if (!(context instanceof JAXBContext)) {
                 // the cast would fail, so generate an exception with a nice message
                 throw handleClassCastException(context.getClass(), JAXBContext.class);
             }
-            return (JAXBContext)context;
+            return (JAXBContext) context;
         } catch (InvocationTargetException x) {
             handleInvocationTargetException(x);
             // for other exceptions, wrap the internal target exception
             // with a JAXBException
             Throwable e = x;
-            if(x.getTargetException()!=null)
+            if (x.getTargetException() != null)
                 e = x.getTargetException();
 
-            throw new JAXBException( Messages.format( Messages.COULD_NOT_INSTANTIATE, spFactory, e ), e );
+            throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, spFactory, e), e);
         } catch (RuntimeException x) {
             // avoid wrapping RuntimeException to JAXBException,
             // because it indicates a bug in this code.
@@ -204,29 +211,23 @@
             // reflection.  Root element collisions detected in the call to
             // createContext() are reported as JAXBExceptions - just re-throw it
             // some other type of exception - just wrap it
-            throw new JAXBException(
-                Messages.format( Messages.COULD_NOT_INSTANTIATE, spFactory, x ),
-                x);
+            throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, spFactory, x), x);
         }
     }
 
-
     /**
      * Create an instance of a class using the thread context ClassLoader
      */
-    static JAXBContext newInstance(
-                              Class[] classes,
-                              Map properties,
-                              String className) throws JAXBException {
-        ClassLoader cl = getContextClassLoader();
+    static JAXBContext newInstance(Class[] classes, Map properties, String className) throws JAXBException {
+
         Class spi;
         try {
-            spi = safeLoadClass(className,cl);
+            spi = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, getContextClassLoader());
         } catch (ClassNotFoundException e) {
             throw new JAXBException(e);
         }
 
-        if(logger.isLoggable(Level.FINE)) {
+        if (logger.isLoggable(Level.FINE)) {
             // extra check to avoid costly which operation if not logged
             logger.log(Level.FINE, "loaded {0} from {1}", new Object[]{className, which(spi)});
         }
@@ -237,19 +238,16 @@
     static JAXBContext newInstance(Class[] classes,
                                    Map properties,
                                    Class spFactory) throws JAXBException {
-        Method m;
         try {
-            m = spFactory.getMethod("createContext", Class[].class, Map.class);
-        } catch (NoSuchMethodException e) {
-            throw new JAXBException(e);
-        }
-        try {
+            Method m = spFactory.getMethod("createContext", Class[].class, Map.class);
             Object context = m.invoke(null, classes, properties);
-            if(!(context instanceof JAXBContext)) {
+            if (!(context instanceof JAXBContext)) {
                 // the cast would fail, so generate an exception with a nice message
                 throw handleClassCastException(context.getClass(), JAXBContext.class);
             }
-            return (JAXBContext)context;
+            return (JAXBContext) context;
+        } catch (NoSuchMethodException e) {
+            throw new JAXBException(e);
         } catch (IllegalAccessException e) {
             throw new JAXBException(e);
         } catch (InvocationTargetException e) {
@@ -263,241 +261,139 @@
         }
     }
 
-    static JAXBContext find(String factoryId, String contextPath, ClassLoader classLoader, Map properties ) throws JAXBException {
+    static JAXBContext find(String factoryId, String contextPath, ClassLoader classLoader, Map properties) throws JAXBException {
 
         // TODO: do we want/need another layer of searching in $java.home/lib/jaxb.properties like JAXP?
 
-        final String jaxbContextFQCN = JAXBContext.class.getName();
-
-        // search context path for jaxb.properties first
-        StringBuilder propFileName;
-        StringTokenizer packages = new StringTokenizer( contextPath, ":" );
-        String factoryClassName;
-
-        if(!packages.hasMoreTokens())
+        StringTokenizer packages = new StringTokenizer(contextPath, ":");
+        if (!packages.hasMoreTokens()) {
             // no context is specified
             throw new JAXBException(Messages.format(Messages.NO_PACKAGE_IN_CONTEXTPATH));
+        }
 
-
+        // search for jaxb.properties in the class loader of each class first
         logger.fine("Searching jaxb.properties");
-
-        while( packages.hasMoreTokens() ) {
-            String packageName = packages.nextToken(":").replace('.','/');
+        while (packages.hasMoreTokens()) {
             // com.acme.foo - > com/acme/foo/jaxb.properties
-             propFileName = new StringBuilder().append(packageName).append("/jaxb.properties");
-
-            Properties props = loadJAXBProperties( classLoader, propFileName.toString() );
-            if (props != null) {
-                if (props.containsKey(factoryId)) {
-                    factoryClassName = props.getProperty(factoryId);
-                    return newInstance( contextPath, factoryClassName, classLoader, properties );
-                } else {
-                    throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, factoryId));
-                }
-            }
+            String className = classNameFromPackageProperties(factoryId, classLoader, packages.nextToken(":").replace('.', '/'));
+            if (className != null) return newInstance(contextPath, className, classLoader, properties);
         }
 
-        logger.fine("Searching the system property");
+        String factoryName = classNameFromSystemProperties();
+        if (factoryName != null) return newInstance(contextPath, factoryName, classLoader, properties);
 
-        // search for a system property second (javax.xml.bind.JAXBContext)
-        factoryClassName = AccessController.doPrivileged(new GetPropertyAction(JAXBContext.JAXB_CONTEXT_FACTORY));
-        if(  factoryClassName != null ) {
-            return newInstance( contextPath, factoryClassName, classLoader, properties );
-        } else { // leave this here to assure compatibility
-            factoryClassName = AccessController.doPrivileged(new GetPropertyAction(jaxbContextFQCN));
-            if(  factoryClassName != null ) {
-                return newInstance( contextPath, factoryClassName, classLoader, properties );
-            }
+        Class ctxFactory = (Class) ServiceLoaderUtil.lookupUsingOSGiServiceLoader("javax.xml.bind.JAXBContext", logger);
+        if (ctxFactory != null) {
+            return newInstance(contextPath, ctxFactory, classLoader, properties);
         }
 
-        // OSGi search
-        Class jaxbContext = lookupJaxbContextUsingOsgiServiceLoader();
-        if (jaxbContext != null) {
-            logger.fine("OSGi environment detected");
-            return newInstance(contextPath, jaxbContext, classLoader, properties);
-        }
+        // TODO: SPEC change required! This is supposed to be!
+        // JAXBContext obj = firstByServiceLoader(JAXBContext.class, EXCEPTION_HANDLER);
+        // if (obj != null) return obj;
 
-        logger.fine("Searching META-INF/services");
-        // search META-INF services next
-        BufferedReader r = null;
-        try {
-            final StringBuilder resource = new StringBuilder().append("META-INF/services/").append(jaxbContextFQCN);
-            final InputStream resourceStream =
-                    classLoader.getResourceAsStream(resource.toString());
-
-            if (resourceStream != null) {
-                r = new BufferedReader(new InputStreamReader(resourceStream, "UTF-8"));
-                factoryClassName = r.readLine();
-                if (factoryClassName != null) {
-                    factoryClassName = factoryClassName.trim();
-                }
-                r.close();
-                return newInstance(contextPath, factoryClassName, classLoader, properties);
-            } else {
-                logger.log(Level.FINE, "Unable to load:{0}", resource.toString());
-            }
-        } catch (UnsupportedEncodingException e) {
-            // should never happen
-            throw new JAXBException(e);
-        } catch (IOException e) {
-            throw new JAXBException(e);
-        } finally {
-            try {
-                if (r != null) {
-                    r.close();
-                }
-            } catch (IOException ex) {
-                Logger.getLogger(ContextFinder.class.getName()).log(Level.SEVERE, null, ex);
-            }
-        }
+        // TODO: Deprecated - SPEC change required!
+        factoryName = firstByServiceLoaderDeprecated(JAXBContext.class, classLoader);
+        if (factoryName != null) return newInstance(contextPath, factoryName, classLoader, properties);
 
         // else no provider found
         logger.fine("Trying to create the platform default provider");
         return newInstance(contextPath, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader, properties);
     }
 
-    static JAXBContext find( Class[] classes, Map properties ) throws JAXBException {
-
-        final String jaxbContextFQCN = JAXBContext.class.getName();
-        String factoryClassName;
+    static JAXBContext find(Class[] classes, Map properties) throws JAXBException {
 
         // search for jaxb.properties in the class loader of each class first
+        logger.fine("Searching jaxb.properties");
         for (final Class c : classes) {
             // this classloader is used only to load jaxb.properties, so doing this should be safe.
-            ClassLoader classLoader = getClassClassLoader(c);
-            Package pkg = c.getPackage();
-            if(pkg==null)
-                continue;       // this is possible for primitives, arrays, and classes that are loaded by poorly implemented ClassLoaders
-            String packageName = pkg.getName().replace('.', '/');
+            if (c.getPackage() == null) continue;       // this is possible for primitives, arrays, and classes that are loaded by poorly implemented ClassLoaders
 
             // TODO: do we want to optimize away searching the same package?  org.Foo, org.Bar, com.Baz
-            //       classes from the same package might come from different class loades, so it might be a bad idea
-
+            // classes from the same package might come from different class loades, so it might be a bad idea
             // TODO: it's easier to look things up from the class
             // c.getResourceAsStream("jaxb.properties");
 
-            // build the resource name and use the property loader code
-            String resourceName = packageName+"/jaxb.properties";
-            logger.log(Level.FINE, "Trying to locate {0}", resourceName);
-            Properties props = loadJAXBProperties(classLoader, resourceName);
-            if (props == null) {
-                logger.fine("  not found");
-            } else {
-                logger.fine("  found");
-                if (props.containsKey(JAXB_CONTEXT_FACTORY)) {
-                    // trim() seems redundant, but adding to satisfy customer complaint
-                    factoryClassName = props.getProperty(JAXB_CONTEXT_FACTORY).trim();
-                    return newInstance(classes, properties, factoryClassName);
-                } else {
-                    throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, JAXB_CONTEXT_FACTORY));
-                }
-            }
+            String className = classNameFromPackageProperties(JAXBContext.JAXB_CONTEXT_FACTORY, getClassClassLoader(c), c.getPackage().getName().replace('.', '/'));
+            if (className != null) return newInstance(classes, properties, className);
         }
 
-        // search for a system property second (javax.xml.bind.JAXBContext)
-        logger.log(Level.FINE, "Checking system property {0}", JAXBContext.JAXB_CONTEXT_FACTORY);
-        factoryClassName = AccessController.doPrivileged(new GetPropertyAction(JAXBContext.JAXB_CONTEXT_FACTORY));
-        if (factoryClassName != null) {
-            logger.log(Level.FINE, "  found {0}", factoryClassName);
-            return newInstance( classes, properties, factoryClassName );
-        } else { // leave it here for compatibility reasons
-            logger.fine("  not found");
-            logger.log(Level.FINE, "Checking system property {0}", jaxbContextFQCN);
-            factoryClassName = AccessController.doPrivileged(new GetPropertyAction(jaxbContextFQCN));
-            if (factoryClassName != null) {
-                logger.log(Level.FINE, "  found {0}", factoryClassName);
-                return newInstance( classes, properties, factoryClassName );
-            } else {
-                logger.fine("  not found");
-            }
+        String factoryName = classNameFromSystemProperties();
+        if (factoryName != null) return newInstance(classes, properties, factoryName);
+
+        Class ctxFactoryClass = (Class) ServiceLoaderUtil.lookupUsingOSGiServiceLoader("javax.xml.bind.JAXBContext", logger);
+        if (ctxFactoryClass != null) {
+            return newInstance(classes, properties, ctxFactoryClass);
         }
 
-        // OSGi search
-        Class jaxbContext = lookupJaxbContextUsingOsgiServiceLoader();
-        if (jaxbContext != null) {
-            logger.fine("OSGi environment detected");
-            return newInstance(classes, properties, jaxbContext);
-        }
+        // TODO: to be removed - deprecated!!! Requires SPEC change!!!
+        String className = firstByServiceLoaderDeprecated(JAXBContext.class, getContextClassLoader());
+        if (className != null) return newInstance(classes, properties, className);
 
-        // search META-INF services next
-        logger.fine("Checking META-INF/services");
-        BufferedReader r = null;
-        try {
-            final String resource = new StringBuilder("META-INF/services/").append(jaxbContextFQCN).toString();
-            ClassLoader classLoader = getContextClassLoader();
-            URL resourceURL;
-            if(classLoader==null)
-                resourceURL = ClassLoader.getSystemResource(resource);
-            else
-                resourceURL = classLoader.getResource(resource);
-
-            if (resourceURL != null) {
-                logger.log(Level.FINE, "Reading {0}", resourceURL);
-                r = new BufferedReader(new InputStreamReader(resourceURL.openStream(), "UTF-8"));
-                factoryClassName = r.readLine();
-                if (factoryClassName != null) {
-                    factoryClassName = factoryClassName.trim();
-                }
-                return newInstance(classes, properties, factoryClassName);
-            } else {
-                logger.log(Level.FINE, "Unable to find: {0}", resource);
-            }
-        } catch (UnsupportedEncodingException e) {
-            // should never happen
-            throw new JAXBException(e);
-        } catch (IOException e) {
-            throw new JAXBException(e);
-        } finally {
-            if (r != null) {
-                try {
-                    r.close();
-                } catch (IOException ex) {
-                    logger.log(Level.FINE, "Unable to close stream", ex);
-                }
-            }
-        }
+        //    // TODO: supposed to be:
+        //    obj = firstByServiceLoader(JAXBContext.class, EXCEPTION_HANDLER);
+        //    if (obj != null) return obj;
 
         // else no provider found
         logger.fine("Trying to create the platform default provider");
         return newInstance(classes, properties, PLATFORM_DEFAULT_FACTORY_CLASS);
     }
 
-    private static Class lookupJaxbContextUsingOsgiServiceLoader() {
-        try {
-            // Use reflection to avoid having any dependency on ServiceLoader class
-            Class target = Class.forName("com.sun.org.glassfish.hk2.osgiresourcelocator.ServiceLoader");
-            Method m = target.getMethod("lookupProviderClasses", Class.class);
-            Iterator iter = ((Iterable) m.invoke(null, JAXBContext.class)).iterator();
-            return iter.hasNext() ? (Class)iter.next() : null;
-        } catch(Exception e) {
-            logger.log(Level.FINE, "Unable to find from OSGi: javax.xml.bind.JAXBContext");
-            return null;
+
+    private static String classNameFromPackageProperties(String factoryId, ClassLoader classLoader, String packageName) throws JAXBException {
+        String resourceName = packageName + "/jaxb.properties";
+        logger.log(Level.FINE, "Trying to locate {0}", resourceName);
+        Properties props = loadJAXBProperties(classLoader, resourceName);
+        if (props != null) {
+            if (props.containsKey(factoryId)) {
+                return props.getProperty(factoryId);
+            } else {
+                throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, factoryId));
+            }
         }
+        return null;
     }
 
-    private static Properties loadJAXBProperties( ClassLoader classLoader,
-                                                  String propFileName )
-        throws JAXBException {
+    private static String classNameFromSystemProperties() throws JAXBException {
+        logger.log(Level.FINE, "Checking system property {0}", JAXBContext.JAXB_CONTEXT_FACTORY);
+        // search for a system property second (javax.xml.bind.JAXBContext)
+        String factoryClassName = AccessController.doPrivileged(new GetPropertyAction(JAXBContext.JAXB_CONTEXT_FACTORY));
+        if (factoryClassName != null) {
+            logger.log(Level.FINE, "  found {0}", factoryClassName);
+            return factoryClassName;
+        } else { // leave this here to assure compatibility
+            logger.fine("  not found");
+            logger.log(Level.FINE, "Checking system property {0}", JAXBContext.class.getName());
+            factoryClassName = AccessController.doPrivileged(new GetPropertyAction(JAXBContext.class.getName()));
+            if (factoryClassName != null) {
+                logger.log(Level.FINE, "  found {0}", factoryClassName);
+                return factoryClassName;
+            } else {
+                logger.fine("  not found");
+            }
+        }
+        return null;
+    }
+
+    private static Properties loadJAXBProperties(ClassLoader classLoader, String propFileName) throws JAXBException {
 
         Properties props = null;
-
         try {
             URL url;
-            if(classLoader==null)
+            if (classLoader == null)
                 url = ClassLoader.getSystemResource(propFileName);
             else
-                url = classLoader.getResource( propFileName );
+                url = classLoader.getResource(propFileName);
 
-            if( url != null ) {
+            if (url != null) {
                 logger.log(Level.FINE, "loading props from {0}", url);
                 props = new Properties();
                 InputStream is = url.openStream();
-                props.load( is );
+                props.load(is);
                 is.close();
             }
-        } catch( IOException ioe ) {
-            logger.log(Level.FINE,"Unable to load "+propFileName,ioe);
-            throw new JAXBException( ioe.toString(), ioe );
+        } catch (IOException ioe) {
+            logger.log(Level.FINE, "Unable to load " + propFileName, ioe);
+            throw new JAXBException(ioe.toString(), ioe);
         }
 
         return props;
@@ -520,7 +416,7 @@
 
         String classnameAsResource = clazz.getName().replace('.', '/') + ".class";
 
-        if(loader == null) {
+        if (loader == null) {
             loader = getSystemClassLoader();
         }
 
@@ -543,50 +439,7 @@
         return which(clazz, getClassClassLoader(clazz));
     }
 
-    /**
-     * When JAXB is in J2SE, rt.jar has to have a JAXB implementation.
-     * However, rt.jar cannot have META-INF/services/javax.xml.bind.JAXBContext
-     * because if it has, it will take precedence over any file that applications have
-     * in their jar files.
-     *
-     * <p>
-     * When the user bundles his own JAXB implementation, we'd like to use it, and we
-     * want the platform default to be used only when there's no other JAXB provider.
-     *
-     * <p>
-     * For this reason, we have to hard-code the class name into the API.
-     */
-    private static final String PLATFORM_DEFAULT_FACTORY_CLASS = "com.sun.xml.internal.bind.v2.ContextFactory";
-
-    /**
-     * Loads the class, provided that the calling thread has an access to the class being loaded.
-     */
-    private static Class safeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
-       logger.log(Level.FINE, "Trying to load {0}", className);
-       try {
-          // make sure that the current thread has an access to the package of the given name.
-          SecurityManager s = System.getSecurityManager();
-          if (s != null) {
-              int i = className.lastIndexOf('.');
-              if (i != -1) {
-                  s.checkPackageAccess(className.substring(0,i));
-              }
-          }
-
-          if (classLoader == null) {
-              return Class.forName(className);
-          } else {
-              return classLoader.loadClass(className);
-          }
-       } catch (SecurityException se) {
-           // anyone can access the platform default factory class without permission
-           if (PLATFORM_DEFAULT_FACTORY_CLASS.equals(className)) {
-              return Class.forName(className);
-           }
-           throw se;
-       }
-    }
-
+    @SuppressWarnings("unchecked")
     private static ClassLoader getContextClassLoader() {
         if (System.getSecurityManager() == null) {
             return Thread.currentThread().getContextClassLoader();
@@ -600,6 +453,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     private static ClassLoader getClassClassLoader(final Class c) {
         if (System.getSecurityManager() == null) {
             return c.getClassLoader();
@@ -626,4 +480,50 @@
         }
     }
 
+    // TODO: to be removed - SPEC change required
+    //    ServiceLoaderUtil.firstByServiceLoaderDeprecated should be used instead.
+    @Deprecated
+    static String firstByServiceLoaderDeprecated(Class spiClass, ClassLoader classLoader) throws JAXBException {
+        final String jaxbContextFQCN = spiClass.getName();
+
+        logger.fine("Searching META-INF/services");
+
+        // search META-INF services next
+        BufferedReader r = null;
+        final String resource = new StringBuilder().append("META-INF/services/").append(jaxbContextFQCN).toString();
+        try {
+            final InputStream resourceStream =
+                    (classLoader == null) ?
+                            ClassLoader.getSystemResourceAsStream(resource) :
+                            classLoader.getResourceAsStream(resource);
+
+            if (resourceStream != null) {
+                r = new BufferedReader(new InputStreamReader(resourceStream, "UTF-8"));
+                String factoryClassName = r.readLine();
+                if (factoryClassName != null) {
+                    factoryClassName = factoryClassName.trim();
+                }
+                r.close();
+                logger.log(Level.FINE, "Configured factorty class:{0}", factoryClassName);
+                return factoryClassName;
+            } else {
+                logger.log(Level.FINE, "Unable to load:{0}", resource);
+                return null;
+            }
+        } catch (UnsupportedEncodingException e) {
+            // should never happen
+            throw new JAXBException(e);
+        } catch (IOException e) {
+            throw new JAXBException(e);
+        } finally {
+            try {
+                if (r != null) {
+                    r.close();
+                }
+            } catch (IOException ex) {
+                logger.log(Level.SEVERE, "Unable to close resource: " + resource, ex);
+            }
+        }
+    }
+
 }
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBContext.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBContext.java
index 6f43545..d5dc7bc 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBContext.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBContext.java
@@ -63,10 +63,10 @@
  * <i><B>SPEC REQUIREMENT:</B> the provider must supply an implementation
  * class containing the following method signatures:</i>
  *
- * <pre>
- * public static JAXBContext createContext( String contextPath, ClassLoader classLoader, Map&lt;String,Object&gt; properties ) throws JAXBException
- * public static JAXBContext createContext( Class[] classes, Map&lt;String,Object&gt; properties ) throws JAXBException
- * </pre>
+ * <pre>{@code
+ * public static JAXBContext createContext( String contextPath, ClassLoader classLoader, Map<String,Object> properties ) throws JAXBException
+ * public static JAXBContext createContext( Class[] classes, Map<String,Object> properties ) throws JAXBException
+ * }</pre>
  *
  * <p><i>
  * The following JAXB 1.0 requirement is only required for schema to
@@ -352,7 +352,7 @@
      * <p>
      * To maintain compatibility with JAXB 1.0 schema to java
      * interface/implementation binding, enabled by schema customization
-     * <tt>&lt;jaxb:globalBindings valueClass="false"&gt;</tt>,
+     * <tt>{@literal <jaxb:globalBindings valueClass="false">}</tt>,
      * the JAXB provider will ensure that each package on the context path
      * has a <tt>jaxb.properties</tt> file which contains a value for the
      * <tt>javax.xml.bind.context.factory</tt> property and that all values
@@ -526,7 +526,7 @@
      * Not only the new context will recognize all the classes specified,
      * but it will also recognize any classes that are directly/indirectly
      * referenced statically from the specified classes. Subclasses of
-     * referenced classes nor <tt>&#64;XmlTransient</tt> referenced classes
+     * referenced classes nor <tt>@XmlTransient</tt> referenced classes
      * are not registered with JAXBContext.
      *
      * For example, in the following Java code, if you do
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBIntrospector.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBIntrospector.java
index ad897ae..36e23b9 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBIntrospector.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBIntrospector.java
@@ -74,7 +74,7 @@
      *
      * <p>Convenience method to abstract whether working with either
      *    a javax.xml.bind.JAXBElement instance or an instance of
-     *    <tt>&#64;XmlRootElement</tt> annotated Java class.</p>
+     *    <tt>@XmlRootElement</tt> annotated Java class.</p>
      *
      * @param jaxbElement  object that #isElement(Object) returns true.
      *
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/SchemaOutputResolver.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/SchemaOutputResolver.java
index 0e36f72..1d89d74 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/SchemaOutputResolver.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/SchemaOutputResolver.java
@@ -70,11 +70,11 @@
      *
      *      If the {@link Result} object has a system ID, it must be an
      *      absolute system ID. Those system IDs are relativized by the caller and used
-     *      for &lt;xs:import&gt; statements.
+     *      for {@literal <xs:import>} statements.
      *
      *      If the {@link Result} object does not have a system ID, a schema
      *      for the namespace URI is generated but it won't be explicitly
-     *      &lt;xs:import&gt;ed from other schemas.
+     *      {@literal <xs:import>}ed from other schemas.
      *
      *      If {@code null} is returned, the schema generation for this
      *      namespace URI will be skipped.
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ServiceLoaderUtil.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ServiceLoaderUtil.java
new file mode 100644
index 0000000..159a7c1
--- /dev/null
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ServiceLoaderUtil.java
@@ -0,0 +1,192 @@
+/*
+ * 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 javax.xml.bind;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.ServiceLoader;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Shared ServiceLoader/FactoryFinder Utils shared among SAAJ, JAXB and JAXWS
+ * - this class must be duplicated to all those projects, but it's
+ * basically generic code and we want to have it everywhere same.
+ *
+ * @author Miroslav.Kos@oracle.com
+ */
+class ServiceLoaderUtil {
+
+    private static final String OSGI_SERVICE_LOADER_CLASS_NAME = "com.sun.org.glassfish.hk2.osgiresourcelocator.ServiceLoader";
+    private static final String OSGI_SERVICE_LOADER_METHOD_NAME = "lookupProviderClasses";
+
+    static <P> P firstByServiceLoader(Class<P> spiClass, Logger logger) {
+        // service discovery
+        ServiceLoader<P> serviceLoader = ServiceLoader.load(spiClass);
+        for (P impl : serviceLoader) {
+            logger.fine("ServiceProvider loading Facility used; returning object [" + impl.getClass().getName() + "]");
+            return impl;
+        }
+        return null;
+    }
+
+    static boolean isOsgi(Logger logger) {
+        try {
+            Class.forName(OSGI_SERVICE_LOADER_CLASS_NAME);
+            return true;
+        } catch (ClassNotFoundException ignored) {
+            logger.log(Level.FINE, "OSGi classes not found, OSGi not available.", ignored);
+        }
+        return false;
+    }
+
+    static Object lookupUsingOSGiServiceLoader(String factoryId, Logger logger) {
+        try {
+            // Use reflection to avoid having any dependendcy on ServiceLoader class
+            Class serviceClass = Class.forName(factoryId);
+            Class target = Class.forName(OSGI_SERVICE_LOADER_CLASS_NAME);
+            Method m = target.getMethod(OSGI_SERVICE_LOADER_METHOD_NAME, Class.class);
+            Iterator iter = ((Iterable) m.invoke(null, serviceClass)).iterator();
+            if (iter.hasNext()) {
+                Object next = iter.next();
+                logger.fine("Found implementation using OSGi facility; returning object [" + next.getClass().getName() + "].");
+                return next;
+            } else {
+                return null;
+            }
+        } catch (Exception ignored) {
+            logger.log(Level.FINE, "Unable to find from OSGi: [" + factoryId + "]", ignored);
+            return null;
+        }
+    }
+
+    static String propertyFileLookup(final String configFullPath, final String factoryId) throws IOException {
+        File f = new File(configFullPath);
+        String factoryClassName = null;
+        if (f.exists()) {
+            Properties props = new Properties();
+            FileInputStream stream = null;
+            try {
+                stream = new FileInputStream(f);
+                props.load(stream);
+                factoryClassName = props.getProperty(factoryId);
+            } finally {
+                if (stream != null) {
+                    try {
+                        stream.close();
+                    } catch (IOException ignored) {
+                    }
+                }
+            }
+        }
+        return factoryClassName;
+    }
+
+    static void checkPackageAccess(String className) {
+        // make sure that the current thread has an access to the package of the given name.
+        SecurityManager s = System.getSecurityManager();
+        if (s != null) {
+            int i = className.lastIndexOf('.');
+            if (i != -1) {
+                s.checkPackageAccess(className.substring(0, i));
+            }
+        }
+    }
+
+    static Class nullSafeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
+        if (classLoader == null) {
+            return Class.forName(className);
+        } else {
+            return classLoader.loadClass(className);
+        }
+    }
+
+    /**
+     * Returns instance of required class. It checks package access (security) unless it is defaultClassname. It means if you
+     * are trying to instantiate default implementation (fallback), pass the class name to both first and second parameter.
+     *
+     * @param className          class to be instantiated
+     * @param isDefaultClassname says whether default implementation class
+     * @param handler            exception handler - necessary for wrapping exceptions and logging
+     * @param <T>                Type of exception being thrown (necessary to distinguish between Runtime and checked exceptions)
+     * @return instantiated object or throws Runtime/checked exception, depending on ExceptionHandler's type
+     * @throws T
+     */
+    static <T extends Exception> Object newInstance(String className, String defaultImplClassName, final ExceptionHandler<T> handler) throws T {
+        try {
+            return safeLoadClass(className, defaultImplClassName, contextClassLoader(handler)).newInstance();
+        } catch (ClassNotFoundException x) {
+            throw handler.createException(x, "Provider " + className + " not found");
+        } catch (Exception x) {
+            throw handler.createException(x, "Provider " + className + " could not be instantiated: " + x);
+        }
+    }
+
+    static Class safeLoadClass(String className, String defaultImplClassName, ClassLoader classLoader) throws ClassNotFoundException {
+        try {
+            checkPackageAccess(className);
+        } catch (SecurityException se) {
+            // anyone can access the platform default factory class without permission
+            if (defaultImplClassName != null && defaultImplClassName.equals(className)) {
+                return Class.forName(className);
+            }
+            // not platform default implementation ...
+            throw se;
+        }
+        return nullSafeLoadClass(className, classLoader);
+    }
+
+    static String getJavaHomeLibConfigPath(String filename) {
+        String javah = AccessController.doPrivileged(new PrivilegedAction<String>() {
+            @Override
+            public String run() {
+                return System.getProperty("java.home");
+            }
+        });
+        return javah + File.separator + "lib" + File.separator + filename;
+    }
+
+    static ClassLoader contextClassLoader(ExceptionHandler exceptionHandler) throws Exception {
+        try {
+            return Thread.currentThread().getContextClassLoader();
+        } catch (Exception x) {
+            throw exceptionHandler.createException(x, x.toString());
+        }
+    }
+
+    static abstract class ExceptionHandler<T extends Exception> {
+
+        public abstract T createException(Throwable throwable, String message);
+
+    }
+
+}
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Unmarshaller.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Unmarshaller.java
index d966659..fa183ad 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Unmarshaller.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Unmarshaller.java
@@ -73,12 +73,12 @@
  * Unmarshalling from a StringBuffer using a
  * <tt>javax.xml.transform.stream.StreamSource</tt>:
  * <blockquote>
- *    <pre>
+ *    <pre>{@code
  *       JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
  *       Unmarshaller u = jc.createUnmarshaller();
- *       StringBuffer xmlStr = new StringBuffer( "&lt;?xml version=&quot;1.0&quot;?&gt;..." );
+ *       StringBuffer xmlStr = new StringBuffer( "<?xml version="1.0"?>..." );
  *       Object o = u.unmarshal( new StreamSource( new StringReader( xmlStr.toString() ) ) );
- *    </pre>
+ *    }</pre>
  * </blockquote>
  *
  * <p>
@@ -238,7 +238,7 @@
  * to a JAXB mapped class by {@link JAXBContext}, that the root
  * element's <tt>xsi:type</tt> attribute takes
  * precedence over the unmarshal methods <tt>declaredType</tt> parameter.
- * These methods always return a <tt>JAXBElement&lt;declaredType&gt;</tt>
+ * These methods always return a <tt>{@literal JAXBElement<declaredType>}</tt>
  * instance. The table below shows how the properties of the returned JAXBElement
  * instance are set.
  *
@@ -281,21 +281,21 @@
  * <p>
  * Unmarshal by declaredType from a <tt>org.w3c.dom.Node</tt>:
  * <blockquote>
- *    <pre>
+ *    <pre>{@code
  *       Schema fragment for example
- *       &lt;xs:schema&gt;
- *          &lt;xs:complexType name="FooType"&gt;...&lt;\xs:complexType&gt;
- *          &lt;!-- global element declaration "PurchaseOrder" --&gt;
- *          &lt;xs:element name="PurchaseOrder"&gt;
- *              &lt;xs:complexType&gt;
- *                 &lt;xs:sequence&gt;
- *                    &lt;!-- local element declaration "foo" --&gt;
- *                    &lt;xs:element name="foo" type="FooType"/&gt;
+ *       <xs:schema>
+ *          <xs:complexType name="FooType">...<\xs:complexType>
+ *          <!-- global element declaration "PurchaseOrder" -->
+ *          <xs:element name="PurchaseOrder">
+ *              <xs:complexType>
+ *                 <xs:sequence>
+ *                    <!-- local element declaration "foo" -->
+ *                    <xs:element name="foo" type="FooType"/>
  *                    ...
- *                 &lt;/xs:sequence&gt;
- *              &lt;/xs:complexType&gt;
- *          &lt;/xs:element&gt;
- *       &lt;/xs:schema&gt;
+ *                 </xs:sequence>
+ *              </xs:complexType>
+ *          </xs:element>
+ *       </xs:schema>
  *
  *       JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
  *       Unmarshaller u = jc.createUnmarshaller();
@@ -308,8 +308,8 @@
  *                                  // local element declaration in schema.
  *
  *       // FooType is the JAXB mapping of the type of local element declaration foo.
- *       JAXBElement&lt;FooType&gt; foo = u.unmarshal( fooSubtree, FooType.class);
- *    </pre>
+ *       JAXBElement<FooType> foo = u.unmarshal( fooSubtree, FooType.class);
+ *    }</pre>
  * </blockquote>
  *
  * <p>
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAnyElement.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAnyElement.java
index 0fcd2dc..ce76369 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAnyElement.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAnyElement.java
@@ -94,15 +94,15 @@
  * <h2>Schema To Java example</h2>
  *
  * The following schema would produce the following Java class:
- * <pre>
- * &lt;xs:complexType name="foo"&gt;
- *   &lt;xs:sequence&gt;
- *     &lt;xs:element name="a" type="xs:int" /&gt;
- *     &lt;xs:element name="b" type="xs:int" /&gt;
- *     &lt;xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /&gt;
- *   &lt;/xs:sequence&gt;
- * &lt;/xs:complexType&gt;
- * </pre>
+ * <pre>{@code
+ * <xs:complexType name="foo">
+ *   <xs:sequence>
+ *     <xs:element name="a" type="xs:int" />
+ *     <xs:element name="b" type="xs:int" />
+ *     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ *   </xs:sequence>
+ * </xs:complexType>
+ * }</pre>
  *
  * <pre>
  * class Foo {
@@ -115,30 +115,30 @@
  *
  * It can unmarshal instances like
  *
- * <pre>
- * &lt;foo xmlns:e="extra"&gt;
- *   &lt;a&gt;1&lt;/a&gt;
- *   &lt;e:other /&gt;  // this will be bound to DOM, because unmarshalling is orderless
- *   &lt;b&gt;3&lt;/b&gt;
- *   &lt;e:other /&gt;
- *   &lt;c&gt;5&lt;/c&gt;     // this will be bound to DOM, because the annotation doesn't remember namespaces.
- * &lt;/foo&gt;
- * </pre>
+ * <pre>{@code
+ * <foo xmlns:e="extra">
+ *   <a>1</a>
+ *   <e:other />  // this will be bound to DOM, because unmarshalling is orderless
+ *   <b>3</b>
+ *   <e:other />
+ *   <c>5</c>     // this will be bound to DOM, because the annotation doesn't remember namespaces.
+ * </foo>
+ * }</pre>
  *
  *
  *
  * The following schema would produce the following Java class:
- * <pre>
- * &lt;xs:complexType name="bar"&gt;
- *   &lt;xs:complexContent&gt;
- *   &lt;xs:extension base="foo"&gt;
- *     &lt;xs:sequence&gt;
- *       &lt;xs:element name="c" type="xs:int" /&gt;
- *       &lt;xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /&gt;
- *     &lt;/xs:sequence&gt;
- *   &lt;/xs:extension&gt;
- * &lt;/xs:complexType&gt;
- * </pre>
+ * <pre>{@code
+ * <xs:complexType name="bar">
+ *   <xs:complexContent>
+ *   <xs:extension base="foo">
+ *     <xs:sequence>
+ *       <xs:element name="c" type="xs:int" />
+ *       <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ *     </xs:sequence>
+ *   </xs:extension>
+ * </xs:complexType>
+ * }</pre>
  *
  * <pre>
  * class Bar extends Foo {
@@ -150,16 +150,16 @@
  *
  * It can unmarshal instances like
  *
- * <pre>
- * &lt;bar xmlns:e="extra"&gt;
- *   &lt;a&gt;1&lt;/a&gt;
- *   &lt;e:other /&gt;  // this will be bound to DOM, because unmarshalling is orderless
- *   &lt;b&gt;3&lt;/b&gt;
- *   &lt;e:other /&gt;
- *   &lt;c&gt;5&lt;/c&gt;     // this now goes to Bar.c
- *   &lt;e:other /&gt;  // this will go to Foo.any
- * &lt;/bar&gt;
- * </pre>
+ * <pre>{@code
+ * <bar xmlns:e="extra">
+ *   <a>1</a>
+ *   <e:other />  // this will be bound to DOM, because unmarshalling is orderless
+ *   <b>3</b>
+ *   <e:other />
+ *   <c>5</c>     // this now goes to Bar.c
+ *   <e:other />  // this will go to Foo.any
+ * </bar>
+ * }</pre>
  *
  *
  *
@@ -171,15 +171,15 @@
  *
  * <p>
  * The following schema would produce the following Java class:
- * <pre>
- * &lt;xs:complexType name="foo"&gt;
- *   &lt;xs:choice maxOccurs="unbounded" minOccurs="0"&gt;
- *     &lt;xs:element name="a" type="xs:int" /&gt;
- *     &lt;xs:element name="b" type="xs:int" /&gt;
- *     &lt;xs:any namespace="##other" processContents="lax" /&gt;
- *   &lt;/xs:choice&gt;
- * &lt;/xs:complexType&gt;
- * </pre>
+ * <pre>{@code
+ * <xs:complexType name="foo">
+ *   <xs:choice maxOccurs="unbounded" minOccurs="0">
+ *     <xs:element name="a" type="xs:int" />
+ *     <xs:element name="b" type="xs:int" />
+ *     <xs:any namespace="##other" processContents="lax" />
+ *   </xs:choice>
+ * </xs:complexType>
+ * }</pre>
  *
  * <pre>
  * class Foo {
@@ -204,11 +204,11 @@
  * It can unmarshal instances like
  *
  * <pre>
- * &lt;foo xmlns:e="extra"&gt;
- *   &lt;a&gt;1&lt;/a&gt;     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
- *   &lt;e:other /&gt;  // this will unmarshal to a DOM {@link Element}.
- *   &lt;b&gt;3&lt;/b&gt;     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
- * &lt;/foo&gt;
+ *{@code <foo xmlns:e="extra">}
+ *{@code   <a>1</a>}     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
+ *{@code   <e:other />}  // this will unmarshal to a DOM {@link Element}.
+ *{@code   <b>3</b>}     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
+ *{@code </foo>}
  * </pre>
  *
  *
@@ -225,11 +225,11 @@
  * }
  * </pre>
  * then the following document will unmarshal like this:
- * <pre>
- * &lt;foo&gt;
- *   &lt;unknown /&gt;
- *   &lt;foo /&gt;
- * &lt;/foo&gt;
+ * <pre>{@code
+ * <foo>
+ *   <unknown />
+ *   <foo />
+ * </foo>
  *
  * Foo foo = unmarshal();
  * // 1 for 'unknown', another for 'foo'
@@ -239,7 +239,7 @@
  * // because of lax=true, the 'foo' element eagerly
  * // unmarshals to a Foo object.
  * assert foo.others[1] instanceof Foo;
- * </pre>
+ * }</pre>
  *
  * @author Kohsuke Kawaguchi
  * @since 1.6, JAXB 2.0
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttachmentRef.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttachmentRef.java
index 92d8e91..a658a08 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttachmentRef.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttachmentRef.java
@@ -51,16 +51,16 @@
  * }
  * </pre>
  * The above code maps to the following XML:
- * <pre>
- * &lt;xs:element name="foo" xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd"&gt;
- *   &lt;xs:complexType&gt;
- *     &lt;xs:sequence&gt;
- *       &lt;xs:element name="body" type="ref:swaRef" minOccurs="0" /&gt;
- *     &lt;/xs:sequence&gt;
- *     &lt;xs:attribute name="data" type="ref:swaRef" use="optional" /&gt;
- *   &lt;/xs:complexType&gt;
- * &lt;/xs:element&gt;
- * </pre>
+ * <pre>{@code
+ * <xs:element name="foo" xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd">
+ *   <xs:complexType>
+ *     <xs:sequence>
+ *       <xs:element name="body" type="ref:swaRef" minOccurs="0" />
+ *     </xs:sequence>
+ *     <xs:attribute name="data" type="ref:swaRef" use="optional" />
+ *   </xs:complexType>
+ * </xs:element>
+ * }</pre>
  *
  * <p>
  * The above binding supports WS-I AP 1.0 <a href="http://www.ws-i.org/Profiles/AttachmentsProfile-1.0-2004-08-24.html#Referencing_Attachments_from_the_SOAP_Envelope">WS-I Attachments Profile Version 1.0.</a>
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttribute.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttribute.java
index 8e36758..713c5c0 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttribute.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttribute.java
@@ -89,14 +89,15 @@
  *         public java.math.BigDecimal getPrice() {...} ;
  *         public void setPrice(java.math.BigDecimal ) {...};
  *     }
+ * {@code
  *
- *     &lt;!-- Example: XML Schema fragment --&gt;
- *     &lt;xs:complexType name="USPrice"&gt;
- *       &lt;xs:sequence&gt;
- *       &lt;/xs:sequence&gt;
- *       &lt;xs:attribute name="price" type="xs:decimal"/&gt;
- *     &lt;/xs:complexType&gt;
- * </pre>
+ *     <!-- Example: XML Schema fragment -->
+ *     <xs:complexType name="USPrice">
+ *       <xs:sequence>
+ *       </xs:sequence>
+ *       <xs:attribute name="price" type="xs:decimal"/>
+ *     </xs:complexType>
+ * }</pre>
  *
  * <p> <b>Example 2: </b>Map a JavaBean property to an XML attribute with anonymous type.</p>
  * See Example 7 in @{@link XmlType}.
@@ -108,17 +109,18 @@
  *         ...
  *         &#64;XmlAttribute List&lt;Integer&gt; items;
  *     }
+ * {@code
  *
- *     &lt;!-- Example: XML Schema fragment --&gt;
- *     &lt;xs:complexType name="foo"&gt;
+ *     <!-- Example: XML Schema fragment -->
+ *     <xs:complexType name="foo">
  *       ...
- *       &lt;xs:attribute name="items"&gt;
- *         &lt;xs:simpleType&gt;
- *           &lt;xs:list itemType="xs:int"/&gt;
- *         &lt;/xs:simpleType&gt;
- *     &lt;/xs:complexType&gt;
+ *       <xs:attribute name="items">
+ *         <xs:simpleType>
+ *           <xs:list itemType="xs:int"/>
+ *         </xs:simpleType>
+ *     </xs:complexType>
  *
- * </pre>
+ * }</pre>
  * @author Sekhar Vajjhala, Sun Microsystems, Inc.
  * @see XmlType
  * @since 1.6, JAXB 2.0
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElement.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElement.java
index 3d7c89d..8f2d881 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElement.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElement.java
@@ -82,14 +82,15 @@
  *         &#64;XmlElement(name="itemprice")
  *         public java.math.BigDecimal price;
  *     }
+ * {@code
  *
- *     &lt;!-- Example: Local XML Schema element --&gt;
- *     &lt;xs:complexType name="USPrice"/&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="itemprice" type="xs:decimal" minOccurs="0"/&gt;
- *       &lt;/sequence&gt;
- *     &lt;/xs:complexType&gt;
- *   </pre>
+ *     <!-- Example: Local XML Schema element -->
+ *     <xs:complexType name="USPrice"/>
+ *       <xs:sequence>
+ *         <xs:element name="itemprice" type="xs:decimal" minOccurs="0"/>
+ *       </sequence>
+ *     </xs:complexType>
+ *   }</pre>
  * <p>
  *
  * <b> Example 2: </b> Map a field to a nillable element.
@@ -100,14 +101,15 @@
  *         &#64;XmlElement(nillable=true)
  *         public java.math.BigDecimal price;
  *     }
+ * {@code
  *
- *     &lt;!-- Example: Local XML Schema element --&gt;
- *     &lt;xs:complexType name="USPrice"&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="price" type="xs:decimal" nillable="true" minOccurs="0"/&gt;
- *       &lt;/sequence&gt;
- *     &lt;/xs:complexType&gt;
- *   </pre>
+ *     <!-- Example: Local XML Schema element -->
+ *     <xs:complexType name="USPrice">
+ *       <xs:sequence>
+ *         <xs:element name="price" type="xs:decimal" nillable="true" minOccurs="0"/>
+ *       </sequence>
+ *     </xs:complexType>
+ *   }</pre>
  * <p>
  * <b> Example 3: </b> Map a field to a nillable, required element.
  *   <pre>
@@ -117,14 +119,15 @@
  *         &#64;XmlElement(nillable=true, required=true)
  *         public java.math.BigDecimal price;
  *     }
+ * {@code
  *
- *     &lt;!-- Example: Local XML Schema element --&gt;
- *     &lt;xs:complexType name="USPrice"&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="price" type="xs:decimal" nillable="true" minOccurs="1"/&gt;
- *       &lt;/sequence&gt;
- *     &lt;/xs:complexType&gt;
- *   </pre>
+ *     <!-- Example: Local XML Schema element -->
+ *     <xs:complexType name="USPrice">
+ *       <xs:sequence>
+ *         <xs:element name="price" type="xs:decimal" nillable="true" minOccurs="1"/>
+ *       </sequence>
+ *     </xs:complexType>
+ *   }</pre>
  *
  * <p> <b>Example 4: </b>Map a JavaBean property to an XML element
  * with anonymous type.</p>
@@ -179,7 +182,7 @@
      *  the enclosing class.
      *
      *  <li>
-     *  Otherwise &#39;&#39; (which produces unqualified element in the default
+     *  Otherwise {@literal ''} (which produces unqualified element in the default
      *  namespace.
      * </ol>
      */
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementDecl.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementDecl.java
index 6920957..6d791e9 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementDecl.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementDecl.java
@@ -65,21 +65,22 @@
  *         JAXBElement&lt;String&gt; createFoo(String s) { ... }
  *     }
  * </pre>
- * <pre>
- *     &lt;!-- XML input --&gt;
- *       &lt;foo&gt;string&lt;/foo&gt;
+ * <pre> {@code
+ *
+ *     <!-- XML input -->
+ *     <foo>string</foo>
  *
  *     // Example: code fragment corresponding to XML input
- *     JAXBElement&lt;String&gt; o =
- *     (JAXBElement&lt;String&gt;)unmarshaller.unmarshal(aboveDocument);
+ *     JAXBElement<String> o =
+ *     (JAXBElement<String>)unmarshaller.unmarshal(aboveDocument);
  *     // print JAXBElement instance to show values
  *     System.out.println(o.getName());   // prints  "{}foo"
  *     System.out.println(o.getValue());  // prints  "string"
  *     System.out.println(o.getValue().getClass()); // prints "java.lang.String"
  *
- *     &lt;!-- Example: XML schema definition --&gt;
- *     &lt;xs:element name="foo" type="xs:string"/&gt;
- * </pre>
+ *     <!-- Example: XML schema definition -->
+ *     <xs:element name="foo" type="xs:string"/>
+ * }</pre>
  *
  * <p><b>Example 2: </b> Element declaration with non local scope
  * <p>
@@ -90,18 +91,18 @@
  * The following example may be replaced in a future revision of
  * this javadoc.
  *
- * <pre>
- *     &lt;!-- Example: XML schema definition --&gt;
- *     &lt;xs:schema&gt;
- *       &lt;xs:complexType name="pea"&gt;
- *         &lt;xs:choice maxOccurs="unbounded"&gt;
- *           &lt;xs:element name="foo" type="xs:string"/&gt;
- *           &lt;xs:element name="bar" type="xs:string"/&gt;
- *         &lt;/xs:choice&gt;
- *       &lt;/xs:complexType&gt;
- *       &lt;xs:element name="foo" type="xs:int"/&gt;
- *     &lt;/xs:schema&gt;
- * </pre>
+ * <pre>{@code
+ *     <!-- Example: XML schema definition -->
+ *     <xs:schema>
+ *       <xs:complexType name="pea">
+ *         <xs:choice maxOccurs="unbounded">
+ *           <xs:element name="foo" type="xs:string"/>
+ *           <xs:element name="bar" type="xs:string"/>
+ *         </xs:choice>
+ *       </xs:complexType>
+ *       <xs:element name="foo" type="xs:int"/>
+ *     </xs:schema>
+ * }</pre>
  * <pre>
  *     // Example: expected default binding
  *     class Pea {
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementRef.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementRef.java
index 9f99ca3..b420d7b 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementRef.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementRef.java
@@ -56,10 +56,10 @@
  * support for substitution groups using an <i>element property</i>,
  * (section 5.5.5, "Element Property" of JAXB 2.0 specification). An
  * element property method signature is of the form:
- * <pre>
- *     public void setTerm(JAXBElement&lt;? extends Operator&gt;);
- *     public JAXBElement&lt;? extends Operator&gt; getTerm();
- * </pre>
+ * <pre>{@code
+ *     public void setTerm(JAXBElement<? extends Operator>);
+ *     public JAXBElement<? extends Operator> getTerm();
+ * }</pre>
  * <p>
  * An element factory method annotated with  {@link XmlElementDecl} is
  * used to create a <tt>JAXBElement</tt> instance, containing an XML
@@ -121,19 +121,20 @@
  *     class JavacTask extends Task {
  *         ...
  *     }
+ * {@code
  *
- *     &lt;!-- XML Schema fragment --&gt;
- *     &lt;xs:element name="target" type="Target"&gt;
- *     &lt;xs:complexType name="Target"&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:choice maxOccurs="unbounded"&gt;
- *           &lt;xs:element ref="jar"&gt;
- *           &lt;xs:element ref="javac"&gt;
- *         &lt;/xs:choice&gt;
- *       &lt;/xs:sequence&gt;
- *     &lt;/xs:complexType&gt;
+ *     <!-- XML Schema fragment -->
+ *     <xs:element name="target" type="Target">
+ *     <xs:complexType name="Target">
+ *       <xs:sequence>
+ *         <xs:choice maxOccurs="unbounded">
+ *           <xs:element ref="jar">
+ *           <xs:element ref="javac">
+ *         </xs:choice>
+ *       </xs:sequence>
+ *     </xs:complexType>
  *
- * </pre>
+ * }</pre>
  * <p>
  * Thus the following code fragment:
  * <pre>
@@ -143,16 +144,16 @@
  *     marshal(target);
  * </pre>
  * will produce the following XML output:
- * <pre>
- *     &lt;target&gt;
- *       &lt;jar&gt;
+ * <pre>{@code
+ *     <target>
+ *       <jar>
  *         ....
- *       &lt;/jar&gt;
- *       &lt;javac&gt;
+ *       </jar>
+ *       <javac>
  *         ....
- *       &lt;/javac&gt;
- *     &lt;/target&gt;
- * </pre>
+ *       </javac>
+ *     </target>
+ * }</pre>
  * <p>
  * It is not an error to have a class that extends <tt>Task</tt>
  * that doesn't have {@link XmlRootElement}. But they can't show up in an
@@ -207,11 +208,11 @@
  *     marshal(m);
  * </pre>
  * will produce the following XML output:
- * <pre>
- *     &lt;math&gt;
- *       &lt;add&gt;...&lt;/add&gt;
- *     &lt;/math&gt;
- * </pre>
+ * <pre>{@code
+ *     <math>
+ *       <add>...</add>
+ *     </math>
+ * }</pre>
  *
  *
  * @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems,Inc. </li><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li></ul>
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementWrapper.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementWrapper.java
index fc7d09c..69f5041 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementWrapper.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementWrapper.java
@@ -39,21 +39,21 @@
  * XML element around collections. The annotation therefore supports
  * two forms of serialization shown below.
  *
- * <pre>
+ * <pre>{@code
  *    //Example: code fragment
  *      int[] names;
  *
  *    // XML Serialization Form 1 (Unwrapped collection)
- *    &lt;names&gt; ... &lt;/names&gt;
- *    &lt;names&gt; ... &lt;/names&gt;
+ *    <names> ... </names>
+ *    <names> ... </names>
  *
  *    // XML Serialization Form 2 ( Wrapped collection )
- *    &lt;wrapperElement&gt;
- *       &lt;names&gt; value-of-item &lt;/names&gt;
- *       &lt;names&gt; value-of-item &lt;/names&gt;
+ *    <wrapperElement>
+ *       <names> value-of-item </names>
+ *       <names> value-of-item </names>
  *       ....
- *    &lt;/wrapperElement&gt;
- * </pre>
+ *    </wrapperElement>
+ * }</pre>
  *
  * <p> The two serialized XML forms allow a null collection to be
  * represented either by absence or presence of an element with a
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElements.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElements.java
index e15bb1e..fb64513 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElements.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElements.java
@@ -44,7 +44,7 @@
  * &#64;XmlElements({ @XmlElement(...),@XmlElement(...) })
  * </pre>
  *
- * <p>The <tt>@XmlElements</tt> annnotation can be used with the
+ * <p>The <tt>@XmlElements</tt> annotation can be used with the
  * following program elements: </p>
  * <ul>
  *   <li> a JavaBean property </li>
@@ -78,28 +78,29 @@
  *        &#64;XmlElements(
  *            &#64;XmlElement(name="A", type=Integer.class),
  *            &#64;XmlElement(name="B", type=Float.class)
- *         }
+ *         )
  *         public List items;
  *    }
+ * {@code
  *
- *    &lt;!-- XML Representation for a List of {1,2.5}
- *            XML output is not wrapped using another element --&gt;
+ *    <!-- XML Representation for a List of {1,2.5}
+ *            XML output is not wrapped using another element -->
  *    ...
- *    &lt;A&gt; 1 &lt;/A&gt;
- *    &lt;B&gt; 2.5 &lt;/B&gt;
+ *    <A> 1 </A>
+ *    <B> 2.5 </B>
  *    ...
  *
- *    &lt;!-- XML Schema fragment --&gt;
- *    &lt;xs:complexType name="Foo"&gt;
- *      &lt;xs:sequence&gt;
- *        &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
- *          &lt;xs:element name="A" type="xs:int"/&gt;
- *          &lt;xs:element name="B" type="xs:float"/&gt;
- *        &lt;xs:choice&gt;
- *      &lt;/xs:sequence&gt;
- *    &lt;/xs:complexType&gt;
+ *    <!-- XML Schema fragment -->
+ *    <xs:complexType name="Foo">
+ *      <xs:sequence>
+ *        <xs:choice minOccurs="0" maxOccurs="unbounded">
+ *          <xs:element name="A" type="xs:int"/>
+ *          <xs:element name="B" type="xs:float"/>
+ *        <xs:choice>
+ *      </xs:sequence>
+ *    </xs:complexType>
  *
- * </pre>
+ * }</pre>
  *
  * <p><b>Example 2:</b> Map to a list of elements wrapped with another element
  * </p>
@@ -114,21 +115,22 @@
  *        }
  *        public List items;
  *    }
+ * {@code
  *
- *    &lt;!-- XML Schema fragment --&gt;
- *    &lt;xs:complexType name="Foo"&gt;
- *      &lt;xs:sequence&gt;
- *        &lt;xs:element name="bar"&gt;
- *          &lt;xs:complexType&gt;
- *            &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
- *              &lt;xs:element name="A" type="xs:int"/&gt;
- *              &lt;xs:element name="B" type="xs:float"/&gt;
- *            &lt;/xs:choice&gt;
- *          &lt;/xs:complexType&gt;
- *        &lt;/xs:element&gt;
- *      &lt;/xs:sequence&gt;
- *    &lt;/xs:complexType&gt;
- * </pre>
+ *    <!-- XML Schema fragment -->
+ *    <xs:complexType name="Foo">
+ *      <xs:sequence>
+ *        <xs:element name="bar">
+ *          <xs:complexType>
+ *            <xs:choice minOccurs="0" maxOccurs="unbounded">
+ *              <xs:element name="A" type="xs:int"/>
+ *              <xs:element name="B" type="xs:float"/>
+ *            </xs:choice>
+ *          </xs:complexType>
+ *        </xs:element>
+ *      </xs:sequence>
+ *    </xs:complexType>
+ * }</pre>
  *
  * <p><b>Example 3:</b> Change element name based on type using an adapter.
  * </p>
@@ -145,21 +147,22 @@
  *    &#64;XmlType abstract class P {...}
  *    &#64;XmlType(name="PX") class PX extends P {...}
  *    &#64;XmlType(name="PY") class PY extends P {...}
+ * {@code
  *
- *    &lt;!-- XML Schema fragment --&gt;
- *    &lt;xs:complexType name="Foo"&gt;
- *      &lt;xs:sequence&gt;
- *        &lt;xs:element name="bar"&gt;
- *          &lt;xs:complexType&gt;
- *            &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
- *              &lt;xs:element name="A" type="PX"/&gt;
- *              &lt;xs:element name="B" type="PY"/&gt;
- *            &lt;/xs:choice&gt;
- *          &lt;/xs:complexType&gt;
- *        &lt;/xs:element&gt;
- *      &lt;/xs:sequence&gt;
- *    &lt;/xs:complexType&gt;
- * </pre>
+ *    <!-- XML Schema fragment -->
+ *    <xs:complexType name="Foo">
+ *      <xs:sequence>
+ *        <xs:element name="bar">
+ *          <xs:complexType>
+ *            <xs:choice minOccurs="0" maxOccurs="unbounded">
+ *              <xs:element name="A" type="PX"/>
+ *              <xs:element name="B" type="PY"/>
+ *            </xs:choice>
+ *          </xs:complexType>
+ *        </xs:element>
+ *      </xs:sequence>
+ *    </xs:complexType>
+ * }</pre>
  *
  * @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li></ul>
  * @see XmlElement
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlEnumValue.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlEnumValue.java
index bcdebcb..fc29ac0 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlEnumValue.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlEnumValue.java
@@ -56,23 +56,24 @@
  * <p> In the absence of this annotation, {@link Enum#name()} is used
  * as the XML representation.
  *
- * <p> <b>Example 1: </b>Map enum constant name -&gt; enumeration facet</p>
+ * <p> <b>Example 1: </b>Map enum constant name {@literal ->} enumeration facet</p>
  * <pre>
  *     //Example: Code fragment
  *     &#64;XmlEnum(String.class)
  *     public enum Card { CLUBS, DIAMONDS, HEARTS, SPADES }
+ * {@code
  *
- *     &lt;!-- Example: XML Schema fragment --&gt;
- *     &lt;xs:simpleType name="Card"&gt;
- *       &lt;xs:restriction base="xs:string"/&gt;
- *         &lt;xs:enumeration value="CLUBS"/&gt;
- *         &lt;xs:enumeration value="DIAMONDS"/&gt;
- *         &lt;xs:enumeration value="HEARTS"/&gt;
- *         &lt;xs:enumeration value="SPADES"/&gt;
- *     &lt;/xs:simpleType&gt;
- * </pre>
+ *     <!-- Example: XML Schema fragment -->
+ *     <xs:simpleType name="Card">
+ *       <xs:restriction base="xs:string"/>
+ *         <xs:enumeration value="CLUBS"/>
+ *         <xs:enumeration value="DIAMONDS"/>
+ *         <xs:enumeration value="HEARTS"/>
+ *         <xs:enumeration value="SPADES"/>
+ *     </xs:simpleType>
+ * }</pre>
  *
- * <p><b>Example 2: </b>Map enum constant name(value) -&gt; enumeration facet </p>
+ * <p><b>Example 2: </b>Map enum constant name(value) {@literal ->} enumeration facet </p>
  * <pre>
  *     //Example: code fragment
  *     &#64;XmlType
@@ -82,19 +83,20 @@
  *         &#64;XmlEnumValue("5") NICKEL(5),
  *         &#64;XmlEnumValue("10") DIME(10),
  *         &#64;XmlEnumValue("25") QUARTER(25) }
+ * {@code
  *
- *     &lt;!-- Example: XML Schema fragment --&gt;
- *     &lt;xs:simpleType name="Coin"&gt;
- *       &lt;xs:restriction base="xs:int"&gt;
- *         &lt;xs:enumeration value="1"/&gt;
- *         &lt;xs:enumeration value="5"/&gt;
- *         &lt;xs:enumeration value="10"/&gt;
- *         &lt;xs:enumeration value="25"/&gt;
- *       &lt;/xs:restriction&gt;
- *     &lt;/xs:simpleType&gt;
- * </pre>
+ *     <!-- Example: XML Schema fragment -->
+ *     <xs:simpleType name="Coin">
+ *       <xs:restriction base="xs:int">
+ *         <xs:enumeration value="1"/>
+ *         <xs:enumeration value="5"/>
+ *         <xs:enumeration value="10"/>
+ *         <xs:enumeration value="25"/>
+ *       </xs:restriction>
+ *     </xs:simpleType>
+ * }</pre>
  *
- * <p><b>Example 3: </b>Map enum constant name -&gt; enumeration facet </p>
+ * <p><b>Example 3: </b>Map enum constant name {@literal ->} enumeration facet </p>
  *
  * <pre>
  *     //Code fragment
@@ -104,15 +106,16 @@
  *         &#64;XmlEnumValue("1") ONE,
  *         &#64;XmlEnumValue("2") TWO;
  *     }
+ * {@code
  *
- *     &lt;!-- Example: XML Schema fragment --&gt;
- *     &lt;xs:simpleType name="Code"&gt;
- *       &lt;xs:restriction base="xs:int"&gt;
- *         &lt;xs:enumeration value="1"/&gt;
- *         &lt;xs:enumeration value="2"/&gt;
- *       &lt;/xs:restriction&gt;
- *     &lt;/xs:simpleType&gt;
- * </pre>
+ *     <!-- Example: XML Schema fragment -->
+ *     <xs:simpleType name="Code">
+ *       <xs:restriction base="xs:int">
+ *         <xs:enumeration value="1"/>
+ *         <xs:enumeration value="2"/>
+ *       </xs:restriction>
+ *     </xs:simpleType>
+ * }</pre>
  *
  * @since 1.6, JAXB 2.0
  */
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlID.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlID.java
index 441dc5d..52d0360 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlID.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlID.java
@@ -73,17 +73,18 @@
  *        public void setCustomerID(String id);
  *        .... other properties not shown
  *    }
+ * {@code
  *
- *    &lt;!-- Example: XML Schema fragment --&gt;
- *    &lt;xs:complexType name="Customer"&gt;
- *      &lt;xs:complexContent&gt;
- *        &lt;xs:sequence&gt;
+ *    <!-- Example: XML Schema fragment -->
+ *    <xs:complexType name="Customer">
+ *      <xs:complexContent>
+ *        <xs:sequence>
  *          ....
- *        &lt;/xs:sequence&gt;
- *        &lt;xs:attribute name="customerID" type="xs:ID"/&gt;
- *      &lt;/xs:complexContent&gt;
- *    &lt;/xs:complexType&gt;
- * </pre>
+ *        </xs:sequence>
+ *        <xs:attribute name="customerID" type="xs:ID"/>
+ *      </xs:complexContent>
+ *    </xs:complexType>
+ * }</pre>
  *
  * @author Sekhar Vajjhala, Sun Microsystems, Inc.
  * @see XmlIDREF
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlIDREF.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlIDREF.java
index 2ad6841..503f936 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlIDREF.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlIDREF.java
@@ -37,7 +37,7 @@
  * <p>
  * To preserve referential integrity of an object graph across XML
  * serialization followed by a XML deserialization, requires an object
- * reference to be marshalled by reference or containment
+ * reference to be marshaled by reference or containment
  * appropriately. Annotations <tt>&#64;XmlID</tt> and <tt>&#64;XmlIDREF</tt>
  * together allow a customized mapping of a JavaBean property's
  * type by containment or reference.
@@ -82,18 +82,19 @@
  *       public void setCustomer(Customer customer);
  *       ....
  *    }
+ * {@code
  *
- *   &lt;!-- Example: XML Schema fragment --&gt;
- *   &lt;xs:complexType name="Shipping"&gt;
- *     &lt;xs:complexContent&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="customer" type="xs:IDREF"/&gt;
+ *   <!-- Example: XML Schema fragment -->
+ *   <xs:complexType name="Shipping">
+ *     <xs:complexContent>
+ *       <xs:sequence>
+ *         <xs:element name="customer" type="xs:IDREF"/>
  *         ....
- *       &lt;/xs:sequence&gt;
- *     &lt;/xs:complexContent&gt;
- *   &lt;/xs:complexType&gt;
+ *       </xs:sequence>
+ *     </xs:complexContent>
+ *   </xs:complexType>
  *
- * </pre>
+ * }</pre>
  *
  *
  * <p><b>Example 2: </b> The following is a complete example of
@@ -142,64 +143,65 @@
  *       // maps reference to Invoice by containment by default.
  *       public Invoice getInvoice();
  *   }
+ * {@code
  *
- *   &lt;!-- XML Schema mapping for above code frament --&gt;
+ *   <!-- XML Schema mapping for above code frament -->
  *
- *   &lt;xs:complexType name="Invoice"&gt;
- *     &lt;xs:complexContent&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="customer" type="xs:IDREF"/&gt;
+ *   <xs:complexType name="Invoice">
+ *     <xs:complexContent>
+ *       <xs:sequence>
+ *         <xs:element name="customer" type="xs:IDREF"/>
  *         ....
- *       &lt;/xs:sequence&gt;
- *     &lt;/xs:complexContent&gt;
- *   &lt;/xs:complexType&gt;
+ *       </xs:sequence>
+ *     </xs:complexContent>
+ *   </xs:complexType>
  *
- *   &lt;xs:complexType name="Shipping"&gt;
- *     &lt;xs:complexContent&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="customer" type="xs:IDREF"/&gt;
+ *   <xs:complexType name="Shipping">
+ *     <xs:complexContent>
+ *       <xs:sequence>
+ *         <xs:element name="customer" type="xs:IDREF"/>
  *         ....
- *       &lt;/xs:sequence&gt;
- *     &lt;/xs:complexContent&gt;
- *   &lt;/xs:complexType&gt;
+ *       </xs:sequence>
+ *     </xs:complexContent>
+ *   </xs:complexType>
  *
- *   &lt;xs:complexType name="Customer"&gt;
- *     &lt;xs:complexContent&gt;
- *       &lt;xs:sequence&gt;
+ *   <xs:complexType name="Customer">
+ *     <xs:complexContent>
+ *       <xs:sequence>
  *         ....
- *       &lt;/xs:sequence&gt;
- *       &lt;xs:attribute name="CustomerID" type="xs:ID"/&gt;
- *     &lt;/xs:complexContent&gt;
- *   &lt;/xs:complexType&gt;
+ *       </xs:sequence>
+ *       <xs:attribute name="CustomerID" type="xs:ID"/>
+ *     </xs:complexContent>
+ *   </xs:complexType>
  *
- *   &lt;xs:complexType name="CustomerData"&gt;
- *     &lt;xs:complexContent&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="customer" type="xs:Customer"/&gt;
- *         &lt;xs:element name="shipping" type="xs:Shipping"/&gt;
- *         &lt;xs:element name="invoice"  type="xs:Invoice"/&gt;
- *       &lt;/xs:sequence&gt;
- *     &lt;/xs:complexContent&gt;
- *   &lt;/xs:complexType&gt;
+ *   <xs:complexType name="CustomerData">
+ *     <xs:complexContent>
+ *       <xs:sequence>
+ *         <xs:element name="customer" type="xs:Customer"/>
+ *         <xs:element name="shipping" type="xs:Shipping"/>
+ *         <xs:element name="invoice"  type="xs:Invoice"/>
+ *       </xs:sequence>
+ *     </xs:complexContent>
+ *   </xs:complexType>
  *
- *   &lt;xs:element name"customerData" type="xs:CustomerData"/&gt;
+ *   <xs:element name"customerData" type="xs:CustomerData"/>
  *
- *   &lt;!-- Instance document conforming to the above XML Schema --&gt;
- *    &lt;customerData&gt;
- *       &lt;customer customerID="Alice"&gt;
+ *   <!-- Instance document conforming to the above XML Schema -->
+ *    <customerData>
+ *       <customer customerID="Alice">
  *           ....
- *       &lt;/customer&gt;
+ *       </customer>
  *
- *       &lt;shipping customer="Alice"&gt;
+ *       <shipping customer="Alice">
  *           ....
- *       &lt;/shipping&gt;
+ *       </shipping>
  *
- *       &lt;invoice customer="Alice"&gt;
+ *       <invoice customer="Alice">
  *           ....
- *       &lt;/invoice&gt;
- *   &lt;/customerData&gt;
+ *       </invoice>
+ *   </customerData>
  *
- * </pre>
+ * }</pre>
  *
  * <p><b>Example 3: </b> Mapping List to repeating element of type IDREF
  * <pre>
@@ -209,16 +211,17 @@
  *         &#64;XmlElement(name="Alice")
  *             public List customers;
  *     }
+ * {@code
  *
- *     &lt;!-- XML schema fragment --&gt;
- *     &lt;xs:complexType name="Shipping"&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
- *           &lt;xs:element name="Alice" type="xs:IDREF"/&gt;
- *         &lt;/xs:choice&gt;
- *       &lt;/xs:sequence&gt;
- *     &lt;/xs:complexType&gt;
- * </pre>
+ *     <!-- XML schema fragment -->
+ *     <xs:complexType name="Shipping">
+ *       <xs:sequence>
+ *         <xs:choice minOccurs="0" maxOccurs="unbounded">
+ *           <xs:element name="Alice" type="xs:IDREF"/>
+ *         </xs:choice>
+ *       </xs:sequence>
+ *     </xs:complexType>
+ * }</pre>
  *
  * <p><b>Example 4: </b> Mapping a List to a list of elements of type IDREF.
  * <pre>
@@ -230,17 +233,18 @@
  *              &#64;XmlElement(name="John", type="InternationalCustomer.class")
  *         public List customers;
  *     }
+ * {@code
  *
- *     &lt;!-- XML Schema fragment --&gt;
- *     &lt;xs:complexType name="Shipping"&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
- *           &lt;xs:element name="Alice" type="xs:IDREF"/&gt;
- *           &lt;xs:element name="John" type="xs:IDREF"/&gt;
- *         &lt;/xs:choice&gt;
- *       &lt;/xs:sequence&gt;
- *     &lt;/xs:complexType&gt;
- * </pre>
+ *     <!-- XML Schema fragment -->
+ *     <xs:complexType name="Shipping">
+ *       <xs:sequence>
+ *         <xs:choice minOccurs="0" maxOccurs="unbounded">
+ *           <xs:element name="Alice" type="xs:IDREF"/>
+ *           <xs:element name="John" type="xs:IDREF"/>
+ *         </xs:choice>
+ *       </xs:sequence>
+ *     </xs:complexType>
+ * }</pre>
  * @author Sekhar Vajjhala, Sun Microsystems, Inc.
  * @see XmlID
  * @since 1.6, JAXB 2.0
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlList.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlList.java
index 9bd81d0..675fbb4 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlList.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlList.java
@@ -59,12 +59,12 @@
  *
  * would produce XML like this:
  *
- * <pre>
- * &lt;foo&gt;
- *   &lt;data&gt;abc&lt;/data&gt;
- *   &lt;data&gt;def&lt;/data&gt;
- * &lt;/foo&gt;
- * </pre>
+ * <pre>{@code
+ * <foo>
+ *   <data>abc</data>
+ *   <data>def</data>
+ * </foo>
+ * }</pre>
  *
  * &#64;XmlList annotation, on the other hand, allows multiple values to be
  * represented as whitespace-separated tokens in a single element. For example,
@@ -80,11 +80,11 @@
  *
  * the above code will produce XML like this:
  *
- * <pre>
- * &lt;foo&gt;
- *   &lt;data&gt;abc def&lt;/data&gt;
- * &lt;/foo&gt;
- * </pre>
+ * <pre>{@code
+ * <foo>
+ *   <data>abc def</data>
+ * </foo>
+ * }</pre>
  *
  * <p>This annotation can be used with the following annotations:
  *        {@link XmlElement},
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlMixed.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlMixed.java
index 83c5da6..87d160d 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlMixed.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlMixed.java
@@ -56,32 +56,33 @@
  * </ul>
  *
  * Below is an example of binding and creation of mixed content.
- * <pre>
- *  &lt;!-- schema fragment having  mixed content --&gt;
- *  &lt;xs:complexType name="letterBody" mixed="true"&gt;
- *    &lt;xs:sequence&gt;
- *      &lt;xs:element name="name" type="xs:string"/&gt;
- *      &lt;xs:element name="quantity" type="xs:positiveInteger"/&gt;
- *      &lt;xs:element name="productName" type="xs:string"/&gt;
- *      &lt;!-- etc. --&gt;
- *    &lt;/xs:sequence&gt;
- *  &lt;/xs:complexType&gt;
- *  &lt;xs:element name="letterBody" type="letterBody"/&gt;
+ * <pre>{@code
+ *
+ *  <!-- schema fragment having  mixed content -->
+ *  <xs:complexType name="letterBody" mixed="true">
+ *    <xs:sequence>
+ *      <xs:element name="name" type="xs:string"/>
+ *      <xs:element name="quantity" type="xs:positiveInteger"/>
+ *      <xs:element name="productName" type="xs:string"/>
+ *      <!-- etc. -->
+ *    </xs:sequence>
+ *  </xs:complexType>
+ *  <xs:element name="letterBody" type="letterBody"/>
  *
  * // Schema-derived Java code:
  * // (Only annotations relevant to mixed content are shown below,
- * //  others are ommitted.)
+ * //  others are omitted.)
  * import java.math.BigInteger;
  * public class ObjectFactory {
  *      // element instance factories
- *      JAXBElement&lt;LetterBody&gt; createLetterBody(LetterBody value);
- *      JAXBElement&lt;String&gt;     createLetterBodyName(String value);
- *      JAXBElement&lt;BigInteger&gt; createLetterBodyQuantity(BigInteger value);
- *      JAXBElement&lt;String&gt;     createLetterBodyProductName(String value);
+ *      JAXBElement<LetterBody> createLetterBody(LetterBody value);
+ *      JAXBElement<String>     createLetterBodyName(String value);
+ *      JAXBElement<BigInteger> createLetterBodyQuantity(BigInteger value);
+ *      JAXBElement<String>     createLetterBodyProductName(String value);
  *      // type instance factory
  *      LetterBody createLetterBody();
  * }
- * </pre>
+ * }</pre>
  * <pre>
  * public class LetterBody {
  *      // Mixed content can contain instances of Element classes
@@ -96,17 +97,17 @@
  * }
  * </pre>
  * The following is an XML instance document with mixed content
- * <pre>
- * &lt;letterBody&gt;
- * Dear Mr.&lt;name&gt;Robert Smith&lt;/name&gt;
- * Your order of &lt;quantity&gt;1&lt;/quantity&gt; &lt;productName&gt;Baby
- * Monitor&lt;/productName&gt; shipped from our warehouse. ....
- * &lt;/letterBody&gt;
- * </pre>
+ * <pre>{@code
+ * <letterBody>
+ * Dear Mr.<name>Robert Smith</name>
+ * Your order of <quantity>1</quantity> <productName>Baby
+ * Monitor</productName> shipped from our warehouse. ....
+ * </letterBody>
+ * }</pre>
  * that can be constructed using following JAXB API calls.
- * <pre>
+ * <pre>{@code
  * LetterBody lb = ObjectFactory.createLetterBody();
- * JAXBElement&lt;LetterBody&gt; lbe = ObjectFactory.createLetterBody(lb);
+ * JAXBElement<LetterBody> lbe = ObjectFactory.createLetterBody(lb);
  * List gcl = lb.getContent();  //add mixed content to general content property.
  * gcl.add("Dear Mr.");  // add text information item as a String.
  *
@@ -119,7 +120,7 @@
  *                      createLetterBodyQuantity(new BigInteger("1")));
  * gcl.add(ObjectFactory.createLetterBodyProductName("Baby Monitor"));
  * gcl.add("shipped from our warehouse");  // add text information item
- * </pre>
+ * }</pre>
  *
  * <p>See "Package Specification" in javax.xml.bind.package javadoc for
  * additional common information.</p>
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlRootElement.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlRootElement.java
index b84e71b..fbbf2f6 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlRootElement.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlRootElement.java
@@ -73,28 +73,30 @@
  *     marshal( new Point(3,5), System.out);
  * </pre>
  *
- * <pre>
- *     &lt;!-- Example: XML output --&gt;
- *     &lt;point&gt;
- *       &lt;x&gt; 3 &lt;/x&gt;
- *       &lt;y&gt; 5 &lt;/y&gt;
- *     &lt;/point&gt;
- * </pre>
+ * <pre>{@code
+ *
+ *     <!-- Example: XML output -->
+ *     <point>
+ *       <x> 3 </x>
+ *       <y> 5 </y>
+ *     </point>
+ * }</pre>
  *
  * The annotation causes an global element declaration to be produced
  * in the schema. The global element declaration is associated with
  * the XML schema type to which the class is mapped.
  *
- * <pre>
- *     &lt;!-- Example: XML schema definition --&gt;
- *     &lt;xs:element name="point" type="point"/&gt;
- *     &lt;xs:complexType name="point"&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="x" type="xs:int"/&gt;
- *         &lt;xs:element name="y" type="xs:int"/&gt;
- *       &lt;/xs:sequence&gt;
- *     &lt;/xs:complexType&gt;
- * </pre>
+ * <pre>{@code
+ *
+ *     <!-- Example: XML schema definition -->
+ *     <xs:element name="point" type="point"/>
+ *     <xs:complexType name="point">
+ *       <xs:sequence>
+ *         <xs:element name="x" type="xs:int"/>
+ *         <xs:element name="y" type="xs:int"/>
+ *       </xs:sequence>
+ *     </xs:complexType>
+ * }</pre>
  *
  * <p>
  *
@@ -113,27 +115,28 @@
  *
  *     //Example: Code fragment corresponding to XML output *
  *     marshal( new Point3D(3,5,0), System.out );
+ * {@code
  *
- *     &lt;!-- Example: XML output --&gt;
- *     &lt;!-- The element name is point3D not point --&gt;
- *     &lt;point3D&gt;
- *       &lt;x&gt;3&lt;/x&gt;
- *       &lt;y&gt;5&lt;/y&gt;
- *       &lt;z&gt;0&lt;/z&gt;
- *     &lt;/point3D&gt;
+ *     <!-- Example: XML output -->
+ *     <!-- The element name is point3D not point -->
+ *     <point3D>
+ *       <x>3</x>
+ *       <y>5</y>
+ *       <z>0</z>
+ *     </point3D>
  *
- *     &lt;!-- Example: XML schema definition --&gt;
- *     &lt;xs:element name="point3D" type="point3D"/&gt;
- *     &lt;xs:complexType name="point3D"&gt;
- *       &lt;xs:complexContent&gt;
- *         &lt;xs:extension base="point"&gt;
- *           &lt;xs:sequence&gt;
- *             &lt;xs:element name="z" type="xs:int"/&gt;
- *           &lt;/xs:sequence&gt;
- *         &lt;/xs:extension&gt;
- *       &lt;/xs:complexContent&gt;
- *     &lt;/xs:complexType&gt;
- * </pre>
+ *     <!-- Example: XML schema definition -->
+ *     <xs:element name="point3D" type="point3D"/>
+ *     <xs:complexType name="point3D">
+ *       <xs:complexContent>
+ *         <xs:extension base="point">
+ *           <xs:sequence>
+ *             <xs:element name="z" type="xs:int"/>
+ *           </xs:sequence>
+ *         </xs:extension>
+ *       </xs:complexContent>
+ *     </xs:complexType>
+ * }</pre>
  *
  * <b>Example 3: </b> Associate a global element with XML Schema type
  * to which the class is mapped.
@@ -144,15 +147,16 @@
  *         &#64;XmlElement
  *         public java.math.BigDecimal price;
  *     }
+ * {@code
  *
- *     &lt;!-- Example: XML schema definition --&gt;
- *     &lt;xs:element name="PriceElement" type="USPrice"/&gt;
- *     &lt;xs:complexType name="USPrice"&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="price" type="xs:decimal"/&gt;
- *       &lt;/sequence&gt;
- *     &lt;/xs:complexType&gt;
- * </pre>
+ *     <!-- Example: XML schema definition -->
+ *     <xs:element name="PriceElement" type="USPrice"/>
+ *     <xs:complexType name="USPrice">
+ *       <xs:sequence>
+ *         <xs:element name="price" type="xs:decimal"/>
+ *       </sequence>
+ *     </xs:complexType>
+ * }</pre>
  *
  * @author Sekhar Vajjhala, Sun Microsystems, Inc.
  * @since 1.6, JAXB 2.0
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchema.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchema.java
index 6d25d57..db25ef0 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchema.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchema.java
@@ -63,16 +63,17 @@
  *    &#64;javax.xml.bind.annotation.XmlSchema (
  *      namespace = "http://www.example.com/MYPO1"
  *    )
+ * {@code
  *
- *    &lt;!-- XML Schema fragment --&gt;
- *    &lt;schema
+ *    <!-- XML Schema fragment -->
+ *    <schema
  *      xmlns=...
  *      xmlns:po=....
  *      targetNamespace="http://www.example.com/MYPO1"
- *    &gt;
- *    &lt;!-- prefixes generated by default are implementation
- *            depedenent --&gt;
- * </pre>
+ *    >
+ *    <!-- prefixes generated by default are implementation
+ *            depedenent -->
+ * }</pre>
  *
  * <p><b>Example 2:</b> Customize namespace prefix, namespace URI
  * mapping</p>
@@ -86,16 +87,17 @@
  *
  *        &#64;javax.xml.bind.annotation.XmlNs(prefix="xs",
  *                   namespaceURI="http://www.w3.org/2001/XMLSchema")
- *      )
+ *      }
  *    )
+ * {@code
  *
- *    &lt;!-- XML Schema fragment --&gt;
- *    &lt;schema
+ *    <!-- XML Schema fragment -->
+ *    <schema
  *        xmlns:xs="http://www.w3.org/2001/XMLSchema"
  *        xmlns:po="http://www.example.com/PO1"
- *        targetNamespace="http://www.example.com/PO1"&gt;
+ *        targetNamespace="http://www.example.com/PO1">
  *
- * </pre>
+ * }</pre>
  *
  * <p><b>Example 3:</b> Customize elementFormDefault</p>
  * <pre>
@@ -103,14 +105,15 @@
  *      elementFormDefault=XmlNsForm.UNQUALIFIED
  *      ...
  *    )
+ * {@code
  *
- *    &lt;!-- XML Schema fragment --&gt;
- *    &lt;schema
+ *    <!-- XML Schema fragment -->
+ *    <schema
  *        xmlns="http://www.w3.org/2001/XMLSchema"
  *        xmlns:po="http://www.example.com/PO1"
- *        elementFormDefault="unqualified"&gt;
+ *        elementFormDefault="unqualified">
  *
- * </pre>
+ * }</pre>
 
  * @author Sekhar Vajjhala, Sun Microsystems, Inc.
  * @since 1.6, JAXB 2.0
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchemaType.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchemaType.java
index a25b291..a1d2859 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchemaType.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchemaType.java
@@ -65,14 +65,15 @@
  *         &#64;XmlSchemaType(name="date")
  *         public XMLGregorianCalendar date;
  *     }
+ * {@code
  *
- *     &lt;!-- Example: Local XML Schema element --&gt;
- *     &lt;xs:complexType name="USPrice"/&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="date" type="xs:date"/&gt;
- *       &lt;/sequence&gt;
- *     &lt;/xs:complexType&gt;
- * </pre>
+ *     <!-- Example: Local XML Schema element -->
+ *     <xs:complexType name="USPrice"/>
+ *       <xs:sequence>
+ *         <xs:element name="date" type="xs:date"/>
+ *       </sequence>
+ *     </xs:complexType>
+ * }</pre>
  *
  * <p> <b> Example 2: </b> Customize mapping of XMLGregorianCalendar at package
  *     level </p>
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlTransient.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlTransient.java
index 055e90e..b3394d5 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlTransient.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlTransient.java
@@ -78,14 +78,15 @@
  *       String setName() {..};
  *   }
  *
+ * {@code
  *
- *   &lt;!-- Example: XML Schema fragment --&gt;
- *   &lt;xs:complexType name="USAddress"&gt;
- *     &lt;xs:sequence&gt;
- *       &lt;xs:element name="name" type="xs:string"/&gt;
- *     &lt;/xs:sequence&gt;
- *   &lt;/xs:complexType&gt;
- * </pre>
+ *   <!-- Example: XML Schema fragment -->
+ *   <xs:complexType name="USAddress">
+ *     <xs:sequence>
+ *       <xs:element name="name" type="xs:string"/>
+ *     </xs:sequence>
+ *   </xs:complexType>
+ * }</pre>
  *
  * @author Sekhar Vajjhala, Sun Microsystems, Inc.
  * @since 1.6, JAXB 2.0
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java
index 42e7139..f20d405 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java
@@ -112,7 +112,7 @@
  * The following table shows the mapping of the class to a XML Schema
  * complex type or simple type. The notational symbols used in the table are:
  * <ul>
- *   <li> -&gt;    : represents a mapping </li>
+ *   <li> {@literal ->}    : represents a mapping </li>
  *   <li> [x]+  : one or more occurances of x </li>
  *   <li> [ <tt>@XmlValue</tt> property ]: JavaBean property annotated with
  *         <tt>@XmlValue</tt></li>
@@ -132,7 +132,7 @@
  *       <tr valign="top">
  *         <td>Class</td>
  *         <td>{}</td>
- *         <td>[property]+ -&gt; elements</td>
+ *         <td>[property]+ {@literal ->} elements</td>
  *         <td>complexcontent<br>xs:all</td>
  *         <td> </td>
  *       </tr>
@@ -140,7 +140,7 @@
  *       <tr valign="top">
  *         <td>Class</td>
  *         <td>non empty</td>
- *         <td>[property]+ -&gt; elements</td>
+ *         <td>[property]+ {@literal ->} elements</td>
  *         <td>complexcontent<br>xs:sequence</td>
  *         <td> </td>
  *       </tr>
@@ -148,7 +148,7 @@
  *       <tr valign="top">
  *         <td>Class</td>
  *         <td>X</td>
- *         <td>no property -&gt; element</td>
+ *         <td>no property {@literal ->} element</td>
  *         <td>complexcontent<br>empty sequence</td>
  *         <td> </td>
  *       </tr>
@@ -156,7 +156,7 @@
  *       <tr valign="top">
  *         <td>Class</td>
  *         <td>X</td>
- *         <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> [property]+ -&gt; attributes</td>
+ *         <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> [property]+ {@literal ->} attributes</td>
  *         <td>simplecontent</td>
  *         <td> </td>
  *       </tr>
@@ -164,7 +164,7 @@
  *       <tr valign="top">
  *         <td>Class</td>
  *         <td>X</td>
- *         <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> no properties -&gt; attribute</td>
+ *         <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> no properties {@literal ->} attribute</td>
  *         <td> </td>
  *         <td>simpletype</td>
  *       </tr>
@@ -208,35 +208,37 @@
  *     java.math.BigDecimal getZip() {..};
  *     void setZip(java.math.BigDecimal) {..};
  *   }
+ * {@code
  *
- *   &lt;!-- XML Schema mapping for USAddress --&gt;
- *   &lt;xs:complexType name="USAddress"&gt;
- *     &lt;xs:sequence&gt;
- *       &lt;xs:element name="street" type="xs:string"/&gt;
- *       &lt;xs:element name="city" type="xs:string"/&gt;
- *       &lt;xs:element name="state" type="xs:string"/&gt;
- *       &lt;xs:element name="zip" type="xs:decimal"/&gt;
- *       &lt;xs:element name="name" type="xs:string"/&gt;
- *     &lt;/xs:all&gt;
- *   &lt;/xs:complexType&gt;
- * </pre>
+ *   <!-- XML Schema mapping for USAddress -->
+ *   <xs:complexType name="USAddress">
+ *     <xs:sequence>
+ *       <xs:element name="street" type="xs:string"/>
+ *       <xs:element name="city" type="xs:string"/>
+ *       <xs:element name="state" type="xs:string"/>
+ *       <xs:element name="zip" type="xs:decimal"/>
+ *       <xs:element name="name" type="xs:string"/>
+ *     </xs:all>
+ *   </xs:complexType>
+ * }</pre>
  * <p> <b> Example 2: </b> Map a class to a complex type with
  *     xs:all </p>
  * <pre>
  * &#64;XmlType(propOrder={})
  * public class USAddress { ...}
+ * {@code
  *
- * &lt;!-- XML Schema mapping for USAddress --&gt;
- * &lt;xs:complexType name="USAddress"&gt;
- *   &lt;xs:all&gt;
- *     &lt;xs:element name="name" type="xs:string"/&gt;
- *     &lt;xs:element name="street" type="xs:string"/&gt;
- *     &lt;xs:element name="city" type="xs:string"/&gt;
- *     &lt;xs:element name="state" type="xs:string"/&gt;
- *     &lt;xs:element name="zip" type="xs:decimal"/&gt;
- *   &lt;/xs:sequence&gt;
- * &lt;/xs:complexType&gt;
- *</pre>
+ * <!-- XML Schema mapping for USAddress -->
+ * <xs:complexType name="USAddress">
+ *   <xs:all>
+ *     <xs:element name="name" type="xs:string"/>
+ *     <xs:element name="street" type="xs:string"/>
+ *     <xs:element name="city" type="xs:string"/>
+ *     <xs:element name="state" type="xs:string"/>
+ *     <xs:element name="zip" type="xs:decimal"/>
+ *   </xs:sequence>
+ * </xs:complexType>
+ *}</pre>
  * <p> <b> Example 3: </b> Map a class to a global element with an
  * anonymous type.
  * </p>
@@ -244,20 +246,21 @@
  *   &#64;XmlRootElement
  *   &#64;XmlType(name="")
  *   public class USAddress { ...}
+ * {@code
  *
- *   &lt;!-- XML Schema mapping for USAddress --&gt;
- *   &lt;xs:element name="USAddress"&gt;
- *     &lt;xs:complexType&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="name" type="xs:string"/&gt;
- *         &lt;xs:element name="street" type="xs:string"/&gt;
- *         &lt;xs:element name="city" type="xs:string"/&gt;
- *         &lt;xs:element name="state" type="xs:string"/&gt;
- *         &lt;xs:element name="zip" type="xs:decimal"/&gt;
- *       &lt;/xs:sequence&gt;
- *     &lt;/xs:complexType&gt;
- *   &lt;/xs:element&gt;
- * </pre>
+ *   <!-- XML Schema mapping for USAddress -->
+ *   <xs:element name="USAddress">
+ *     <xs:complexType>
+ *       <xs:sequence>
+ *         <xs:element name="name" type="xs:string"/>
+ *         <xs:element name="street" type="xs:string"/>
+ *         <xs:element name="city" type="xs:string"/>
+ *         <xs:element name="state" type="xs:string"/>
+ *         <xs:element name="zip" type="xs:decimal"/>
+ *       </xs:sequence>
+ *     </xs:complexType>
+ *   </xs:element>
+ * }</pre>
  *
  * <p> <b> Example 4: </b> Map a property to a local element with
  * anonymous type.
@@ -271,22 +274,23 @@
  *   &#64;XmlType(name="")
  *   public class USAddress { ... }
  *   }
+ * {@code
  *
- *   &lt;!-- XML Schema mapping for USAddress --&gt;
- *   &lt;xs:complexType name="Invoice"&gt;
- *     &lt;xs:sequence&gt;
- *       &lt;xs:element name="addr"&gt;
- *         &lt;xs:complexType&gt;
- *           &lt;xs:element name="name", type="xs:string"/&gt;
- *           &lt;xs:element name="city", type="xs:string"/&gt;
- *           &lt;xs:element name="city" type="xs:string"/&gt;
- *           &lt;xs:element name="state" type="xs:string"/&gt;
- *           &lt;xs:element name="zip" type="xs:decimal"/&gt;
- *         &lt;/xs:complexType&gt;
+ *   <!-- XML Schema mapping for USAddress -->
+ *   <xs:complexType name="Invoice">
+ *     <xs:sequence>
+ *       <xs:element name="addr">
+ *         <xs:complexType>
+ *           <xs:element name="name", type="xs:string"/>
+ *           <xs:element name="city", type="xs:string"/>
+ *           <xs:element name="city" type="xs:string"/>
+ *           <xs:element name="state" type="xs:string"/>
+ *           <xs:element name="zip" type="xs:decimal"/>
+ *         </xs:complexType>
  *       ...
- *     &lt;/xs:sequence&gt;
- *   &lt;/xs:complexType&gt;
- * </pre>
+ *     </xs:sequence>
+ *   </xs:complexType>
+ * }</pre>
  *
  * <p> <b> Example 5: </b> Map a property to an attribute with
  * anonymous type.
@@ -306,19 +310,20 @@
  *         &#64;XmlValue
  *         public java.math.BigDecimal price;
  *     }
+ * {@code
  *
- *     &lt;!-- Example: XML Schema fragment --&gt;
- *     &lt;xs:complexType name="Item"&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="name" type="xs:string"/&gt;
- *         &lt;xs:attribute name="price"&gt;
- *           &lt;xs:simpleType&gt;
- *             &lt;xs:restriction base="xs:decimal"/&gt;
- *           &lt;/xs:simpleType&gt;
- *         &lt;/xs:attribute&gt;
- *       &lt;/xs:sequence&gt;
- *     &lt;/xs:complexType&gt;
- * </pre>
+ *     <!-- Example: XML Schema fragment -->
+ *     <xs:complexType name="Item">
+ *       <xs:sequence>
+ *         <xs:element name="name" type="xs:string"/>
+ *         <xs:attribute name="price">
+ *           <xs:simpleType>
+ *             <xs:restriction base="xs:decimal"/>
+ *           </xs:simpleType>
+ *         </xs:attribute>
+ *       </xs:sequence>
+ *     </xs:complexType>
+ * }</pre>
  *
  *  <p> <b> Example 6: </b> Define a factoryClass and factoryMethod
  *
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlValue.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlValue.java
index 1ab1085..675305b 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlValue.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlValue.java
@@ -87,13 +87,14 @@
  *         &#64;XmlValue
  *         public java.math.BigDecimal price;
  *     }
+ * {@code
  *
- *     &lt;!-- Example 1: XML Schema fragment --&gt;
- *     &lt;xs:simpleType name="USPrice"&gt;
- *       &lt;xs:restriction base="xs:decimal"/&gt;
- *     &lt;/xs:simpleType&gt;
+ *     <!-- Example 1: XML Schema fragment -->
+ *     <xs:simpleType name="USPrice">
+ *       <xs:restriction base="xs:decimal"/>
+ *     </xs:simpleType>
  *
- *   </pre>
+ * }</pre>
  *
  * <p><b> Example 2: </b> Map a class to XML Schema complexType with
  *        with simpleContent.</p>
@@ -108,17 +109,18 @@
  *       &#64;XmlAttribute
  *       public String currency;
  *   }
+ * {@code
  *
- *   &lt;!-- Example 2: XML Schema fragment --&gt;
- *   &lt;xs:complexType name="InternationalPrice"&gt;
- *     &lt;xs:simpleContent&gt;
- *       &lt;xs:extension base="xs:decimal"&gt;
- *         &lt;xs:attribute name="currency" type="xs:string"/&gt;
- *       &lt;/xs:extension&gt;
- *     &lt;/xs:simpleContent&gt;
- *   &lt;/xs:complexType&gt;
+ *   <!-- Example 2: XML Schema fragment -->
+ *   <xs:complexType name="InternationalPrice">
+ *     <xs:simpleContent>
+ *       <xs:extension base="xs:decimal">
+ *         <xs:attribute name="currency" type="xs:string"/>
+ *       </xs:extension>
+ *     </xs:simpleContent>
+ *   </xs:complexType>
  *
- *   </pre>
+ * }</pre>
  *
  * @author Sekhar Vajjhala, Sun Microsystems, Inc.
  * @see XmlType
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java
index 9a58965..38865a0 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  *
  * <p>
  * This adapter removes leading and trailing whitespaces, then truncate any
- * sequnce of tab, CR, LF, and SP by a single whitespace character ' '.
+ * sequence of tab, CR, LF, and SP by a single whitespace character ' '.
  *
  * @author Kohsuke Kawaguchi
  * @since 1.6, JAXB 2.0
@@ -41,7 +41,7 @@
     /**
      * Removes leading and trailing whitespaces of the string
      * given as the parameter, then truncate any
-     * sequnce of tab, CR, LF, and SP by a single whitespace character ' '.
+     * sequence of tab, CR, LF, and SP by a single whitespace character ' '.
      */
     public String unmarshal(String text) {
         if(text==null)  return null;        // be defensive
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlAdapter.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlAdapter.java
index 4a50081..3c5bd42 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlAdapter.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlAdapter.java
@@ -75,35 +75,35 @@
  *
  * <p> <b> Step 1: </b> Determine the desired XML representation for HashMap.
  *
- * <pre>
- *     &lt;hashmap&gt;
- *         &lt;entry key="id123"&gt;this is a value&lt;/entry&gt;
- *         &lt;entry key="id312"&gt;this is another value&lt;/entry&gt;
+ * <pre>{@code
+ *     <hashmap>
+ *         <entry key="id123">this is a value</entry>
+ *         <entry key="id312">this is another value</entry>
  *         ...
- *       &lt;/hashmap&gt;
- * </pre>
+ *     </hashmap>
+ * }</pre>
  *
  * <p> <b> Step 2: </b> Determine the schema definition that the
  * desired XML representation shown above should follow.
  *
- * <pre>
+ * <pre>{@code
  *
- *     &lt;xs:complexType name="myHashMapType"&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="entry" type="myHashMapEntryType"
- *                        minOccurs = "0" maxOccurs="unbounded"/&gt;
- *       &lt;/xs:sequence&gt;
- *     &lt;/xs:complexType&gt;
+ *     <xs:complexType name="myHashMapType">
+ *       <xs:sequence>
+ *         <xs:element name="entry" type="myHashMapEntryType"
+ *                        minOccurs = "0" maxOccurs="unbounded"/>
+ *       </xs:sequence>
+ *     </xs:complexType>
  *
- *     &lt;xs:complexType name="myHashMapEntryType"&gt;
- *       &lt;xs:simpleContent&gt;
- *         &lt;xs:extension base="xs:string"&gt;
- *           &lt;xs:attribute name="key" type="xs:int"/&gt;
- *         &lt;/xs:extension&gt;
- *       &lt;/xs:simpleContent&gt;
- *     &lt;/xs:complexType&gt;
+ *     <xs:complexType name="myHashMapEntryType">
+ *       <xs:simpleContent>
+ *         <xs:extension base="xs:string">
+ *           <xs:attribute name="key" type="xs:int"/>
+ *         </xs:extension>
+ *       </xs:simpleContent>
+ *     </xs:complexType>
  *
- * </pre>
+ * }</pre>
  *
  * <p> <b> Step 3: </b> Write value types that can generate the above
  * schema definition.
@@ -125,11 +125,11 @@
  * <p> <b> Step 4: </b> Write the adapter that adapts the value type,
  * MyHashMapType to a bound type, HashMap, used by the application.
  *
- * <pre>
+ * <pre>{@code
  *     public final class MyHashMapAdapter extends
- *                        XmlAdapter&lt;MyHashMapType,HashMap&gt; { ... }
+ *                        XmlAdapter<MyHashMapType,HashMap> { ... }
  *
- * </pre>
+ * }</pre>
  *
  * <p> <b> Step 5: </b> Use the adapter.
  *
@@ -143,13 +143,13 @@
  *
  * The above code fragment will map to the following schema:
  *
- * <pre>
- *     &lt;xs:complexType name="Foo"&gt;
- *       &lt;xs:sequence&gt;
- *         &lt;xs:element name="hashmap" type="myHashMapType"&gt;
- *       &lt;/xs:sequence&gt;
- *     &lt;/xs:complexType&gt;
- * </pre>
+ * <pre>{@code
+ *     <xs:complexType name="Foo">
+ *       <xs:sequence>
+ *         <xs:element name="hashmap" type="myHashMapType">
+ *       </xs:sequence>
+ *     </xs:complexType>
+ * }</pre>
  *
  * @param <BoundType>
  *      The type that JAXB doesn't know how to handle. An adapter is written
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java
index 6cebcf8..2f1ee03 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
  * &#64;XmlJavaTypeAdapters ({ @XmlJavaTypeAdapter(...),@XmlJavaTypeAdapter(...) })
  * </pre>
  *
- * <p>The <tt>@XmlJavaTypeAdapters</tt> annnotation is useful for
+ * <p>The <tt>@XmlJavaTypeAdapters</tt> annotation is useful for
  * defining {@link XmlJavaTypeAdapter} annotations for different types
  * at the package level.
  *
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/addressing/EPRHeader.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/addressing/EPRHeader.java
index 3c73af0..642dee1 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/addressing/EPRHeader.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/addressing/EPRHeader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,7 +119,7 @@
             epr.writeTo(localName, w);
             w.flush();
             ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-            DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
+            DocumentBuilderFactory fac = XmlUtil.newDocumentBuilderFactory(false);
             fac.setNamespaceAware(true);
             Node eprNode = fac.newDocumentBuilder().parse(bais).getDocumentElement();
             Node eprNodeToAdd = header.getOwnerDocument().importNode(eprNode, true);
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/message/stream/StreamHeader.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/message/stream/StreamHeader.java
index 6415f13..ae268e2 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/message/stream/StreamHeader.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/message/stream/StreamHeader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -194,7 +194,7 @@
             // TODO what about in-scope namespaces
             // Not very efficient consider implementing a stream buffer
             // processor that produces a DOM node from the buffer.
-            TransformerFactory tf = XmlUtil.newTransformerFactory();
+            TransformerFactory tf = XmlUtil.newTransformerFactory(true);
             Transformer t = tf.newTransformer();
             XMLStreamBufferSource source = new XMLStreamBufferSource(_mark);
             DOMResult result = new DOMResult();
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java
index 86d3646..84047b6 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,9 @@
 //TODO DOMHeader DOMMessage SAAJMessage StatefulInstanceResolver
 import com.sun.xml.internal.bind.unmarshaller.DOMScanner;
 
+//TODO MtomCodec
+import com.sun.xml.internal.bind.v2.runtime.output.Encoded;
+
 //TODO ExceptionBean
 import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;
 
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/DOMUtil.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/DOMUtil.java
index e5f8cb7..47fb059 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/DOMUtil.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/DOMUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,7 +56,7 @@
         synchronized (DOMUtil.class) {
             if (db == null) {
                 try {
-                    DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory();
+                    DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(true);
                     dbf.setNamespaceAware(true);
                     db = dbf.newDocumentBuilder();
                 } catch (ParserConfigurationException e) {
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java
index 6241299..9a86410 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -92,7 +92,7 @@
         super(next);
         this.binding = binding;
         feature = binding.getFeature(SchemaValidationFeature.class);
-        sf = allowExternalAccess(SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI), "file", false);
+        sf = allowExternalAccess(SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI), "all", false);
     }
 
     protected AbstractSchemaValidationTube(AbstractSchemaValidationTube that, TubeCloner cloner) {
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties
index b18bbc7..8cc250f 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 # questions.
 #
 
-build-id=2.2.11-b150127.1410
-build-version=JAX-WS RI 2.2.11-b150127.1410
+build-id=2.2.11-b150402.1412
+build-version=JAX-WS RI 2.2.11-b150402.1412
 major-version=2.2.11
-svn-revision=28121d09ed8ac02b76788709ccb4cdb66e03bbfa
+svn-revision=f923291dedcf386c5f408263984a99d7cedf0012
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XMLStreamReaderToXMLStreamWriter.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XMLStreamReaderToXMLStreamWriter.java
index 14ad974..d30bb8a 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XMLStreamReaderToXMLStreamWriter.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XMLStreamReaderToXMLStreamWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -187,14 +187,11 @@
 
     protected void handleStartElement() throws XMLStreamException {
         String nsUri = in.getNamespaceURI();
-        if(nsUri==null)
-            out.writeStartElement(in.getLocalName());
-        else
-            out.writeStartElement(
-                fixNull(in.getPrefix()),
-                in.getLocalName(),
-                nsUri
-            );
+        out.writeStartElement(
+            fixNull(in.getPrefix()),
+            in.getLocalName(),
+            fixNull(nsUri)
+        );
 
         // start namespace bindings
         int nsCount = in.getNamespaceCount();
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java
index 10ad608..18d7fcd 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -231,7 +231,7 @@
     static final ContextClassloaderLocal<SAXParserFactory> saxParserFactory = new ContextClassloaderLocal<SAXParserFactory>() {
         @Override
         protected SAXParserFactory initialValue() throws Exception {
-            SAXParserFactory factory = SAXParserFactory.newInstance();
+            SAXParserFactory factory = newSAXParserFactory(true);
             factory.setNamespaceAware(true);
             return factory;
         }
@@ -371,57 +371,49 @@
         }
     };
 
-    public static DocumentBuilderFactory newDocumentBuilderFactory() {
-        return newDocumentBuilderFactory(true);
-    }
-
-    public static DocumentBuilderFactory newDocumentBuilderFactory(boolean secureXmlProcessing) {
+    public static DocumentBuilderFactory newDocumentBuilderFactory(boolean disableSecurity) {
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         try {
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessing));
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
         } catch (ParserConfigurationException e) {
             LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
         }
         return factory;
     }
 
-    public static TransformerFactory newTransformerFactory(boolean secureXmlProcessingEnabled) {
+    public static TransformerFactory newTransformerFactory(boolean disableSecurity) {
         TransformerFactory factory = TransformerFactory.newInstance();
         try {
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled));
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
         } catch (TransformerConfigurationException e) {
             LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
         }
         return factory;
     }
 
-    public static TransformerFactory newTransformerFactory() {
-        return newTransformerFactory(true);
-    }
-
-    public static SAXParserFactory newSAXParserFactory(boolean secureXmlProcessingEnabled) {
+    public static SAXParserFactory newSAXParserFactory(boolean disableSecurity) {
         SAXParserFactory factory = SAXParserFactory.newInstance();
         try {
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled));
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
         } catch (Exception e) {
             LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
         }
         return factory;
     }
 
-    public static XPathFactory newXPathFactory(boolean secureXmlProcessingEnabled) {
+    public static XPathFactory newXPathFactory(boolean disableSecurity) {
         XPathFactory factory = XPathFactory.newInstance();
         try {
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled));
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
         } catch (XPathFactoryConfigurationException e) {
             LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
         }
         return factory;
     }
 
-    public static XMLInputFactory newXMLInputFactory(boolean secureXmlProcessingEnabled)  {
+    public static XMLInputFactory newXMLInputFactory(boolean disableSecurity)  {
         XMLInputFactory factory = XMLInputFactory.newInstance();
-        if (isXMLSecurityDisabled(secureXmlProcessingEnabled)) {
+        if (xmlSecurityDisabled(disableSecurity)) {
             // TODO-Miran: are those apppropriate defaults?
             factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
             factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
@@ -429,14 +421,14 @@
         return factory;
     }
 
-    private static boolean isXMLSecurityDisabled(boolean runtimeDisabled) {
+    private static boolean xmlSecurityDisabled(boolean runtimeDisabled) {
         return XML_SECURITY_DISABLED || runtimeDisabled;
     }
 
-    public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) {
+    public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecurity) {
 
         // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied
-        if (isXMLSecurityDisabled(disableSecureProcessing)) {
+        if (xmlSecurityDisabled(disableSecurity)) {
             if (LOGGER.isLoggable(Level.FINE)) {
                 LOGGER.log(Level.FINE, "Xml Security disabled, no JAXP xsd external access configuration necessary.");
             }
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties
index 427db1f..19f062a 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -30,10 +30,10 @@
     Non-existent directory: {0}
 
 VERSION = \
-        schemagen 2.2.12-b150126.1924
+        schemagen 2.2.12-b150331.1824
 
 FULLVERSION = \
-        schemagen full version "2.2.12-b150126.1924"
+        schemagen full version "2.2.12-b150331.1824"
 
 USAGE = \
 Usage: schemagen [-options ...] <java files> \n\
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties
index 435ed71..1de04cc 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Nicht vorhandenes Verzeichnis: {0}
 
-VERSION = schemagen 2.2.12-b150126.1924
+VERSION = schemagen 2.2.12-b150331.1824
 
-FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.12-b150126.1924"
+FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.12-b150331.1824"
 
 USAGE = Verwendung: schemagen [-options ...] <java files> \nOptionen: \n\\ \\ \\ \\ -d <path>             : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp <path>            : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath <path>     : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding <encoding>  : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode <file>       : Generiert Episodendatei f\u00FCr separate Kompilierung\n\\ \\ \\ \\ -version              : Zeigt Versionsinformation an\n\\ \\ \\ \\ -fullversion          : Zeigt vollst\u00E4ndige Versionsinformationen an\n\\ \\ \\ \\ -help                 : Zeigt diese Verwendungsmeldung an
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties
index c6d5aad..015e45a 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Directorio no existente: {0}
 
-VERSION = schemagen 2.2.12-b150126.1924
+VERSION = schemagen 2.2.12-b150331.1824
 
-FULLVERSION = versi\u00F3n completa de schemagen "2.2.12-b150126.1924"
+FULLVERSION = versi\u00F3n completa de schemagen "2.2.12-b150331.1824"
 
 USAGE = Sintaxis: schemagen [-options ...] <archivos java> \nOpciones: \n\\ \\ \\ \\ -d <ruta de acceso>             : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp <ruta de acceso>            : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding <codificaci\u00F3n>  : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode <archivo>       : genera un archivo de episodio para una compilaci\u00F3n diferente\n\\ \\ \\ \\ -version              : muestra la informaci\u00F3n de la versi\u00F3n\n\\ \\ \\ \\ -fullversion          : muestra la informaci\u00F3n completa de la versi\u00F3n\n\\ \\ \\ \\ -help                 : muestra este mensaje de sintaxis
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties
index 756a947..a006426 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = R\u00E9pertoire {0} inexistant
 
-VERSION = schemagen 2.2.12-b150126.1924
+VERSION = schemagen 2.2.12-b150331.1824
 
-FULLVERSION = version compl\u00E8te de schemagen "2.2.12-b150126.1924"
+FULLVERSION = version compl\u00E8te de schemagen "2.2.12-b150331.1824"
 
 USAGE = Syntaxe : schemagen [-options ...] <java files> \nOptions : \n\ \ \ \ -d <path> : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding <encoding> : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode <file> : g\u00E9n\u00E9rez un fichier d'\u00E9pisode pour la compilation s\u00E9par\u00E9e\n\ \ \ \ -version : affichez les informations de version\n\ \ \ \ -fullversion : affichez les informations compl\u00E8tes de version\n\ \ \ \ -help : affichez ce message de syntaxe
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties
index 992b68e..ca32feb 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Directory non esistente: {0}
 
-VERSION = schemagen 2.2.12-b150126.1924
+VERSION = schemagen 2.2.12-b150331.1824
 
-FULLVERSION = versione completa schemagen "2.2.12-b150126.1924"
+FULLVERSION = versione completa schemagen "2.2.12-b150331.1824"
 
 USAGE = Uso: schemagen [-options ...] <java files> \nOpzioni: \n\ \ \ \ -d <path>             : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp <path>            : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath <path>     : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding <encoding>  : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode <file>       : genera il file di episodio per la compilazione separata\n\ \ \ \ -version              : visualizza le informazioni sulla versione\n\ \ \ \ -fullversion          : visualizza le informazioni sulla versione completa\n\ \ \ \ -help                 : visualizza questo messaggio sull'uso
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties
index bf3e933..28f152f 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0}
 
-VERSION = schemagen 2.2.12-b150126.1924
+VERSION = schemagen 2.2.12-b150331.1824
 
-FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150126.1924"
+FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150331.1824"
 
 USAGE = \u4F7F\u7528\u65B9\u6CD5: schemagen [-options ...] <java files> \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d <path>             : \u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -cp <path>            : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -classpath <path>     : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -encoding <encoding>  : \u6CE8\u91C8\u51E6\u7406/javac\u547C\u51FA\u3057\u306B\u4F7F\u7528\u3059\u308B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -episode <file>       : \u30B3\u30F3\u30D1\u30A4\u30EB\u3054\u3068\u306B\u30A8\u30D4\u30BD\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\n\ \ \ \ -version              : \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -fullversion          : \u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -help                 : \u3053\u306E\u4F7F\u7528\u4F8B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u307E\u3059
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties
index 31ba0ab..1f7cd2e 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uB514\uB809\uD1A0\uB9AC: {0}
 
-VERSION = schemagen 2.2.12-b150126.1924
+VERSION = schemagen 2.2.12-b150331.1824
 
-FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.12-b150126.1924"
+FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.12-b150331.1824"
 
 USAGE = \uC0AC\uC6A9\uBC95: schemagen [-options ...] <java files> \n\uC635\uC158: \n\ \ \ \ -d <path>             : \uD504\uB85C\uC138\uC11C \uBC0F javac\uC5D0\uC11C \uC0DD\uC131\uD55C \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uBC30\uCE58\uD560 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -cp <path>            : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath <path>     : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding <encoding>  : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode <file>       : \uBCC4\uB3C4 \uCEF4\uD30C\uC77C\uC744 \uC704\uD574 episode \uD30C\uC77C\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ \ \ -version              : \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -fullversion          : \uC815\uC2DD \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -help                 : \uC774 \uC0AC\uC6A9\uBC95 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties
index c2f4155..0596527 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Diret\u00F3rio n\u00E3o existente: {0}
 
-VERSION = gera\u00E7\u00E3o do esquema 2.2.12-b150126.1924
+VERSION = gera\u00E7\u00E3o do esquema 2.2.12-b150331.1824
 
-FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.12-b150126.1924"
+FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.12-b150331.1824"
 
 USAGE = Uso: gera\u00E7\u00E3o do esquema [-options ...] <java files> \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d <path>             : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp <path>            : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath <path>     : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding <encoding>  : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode <file>       : gerar arquivo do epis\u00F3dio para compila\u00E7\u00E3o separada\n\\ \\ \\ \\ -version              : exibir informa\u00E7\u00F5es da vers\u00E3o\n\\ \\ \\ \\ -fullversion          : exibir informa\u00E7\u00F5es da vers\u00E3o completa\n\\ \\ \\ \\ -help                 : exibir esta mensagem de uso
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties
index cec0651..3d78067 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u5F55: {0}
 
-VERSION = schemagen 2.2.12-b150126.1924
+VERSION = schemagen 2.2.12-b150331.1824
 
-FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924"
+FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824"
 
 USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9009\u9879: \n\ \ \ \ -d <path>             : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp <path>            : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath <path>     : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding <encoding>  : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode <file>       : \u751F\u6210\u7247\u6BB5\u6587\u4EF6\u4EE5\u4F9B\u5355\u72EC\u7F16\u8BD1\n\ \ \ \ -version              : \u663E\u793A\u7248\u672C\u4FE1\u606F\n\ \ \ \ -fullversion          : \u663E\u793A\u5B8C\u6574\u7684\u7248\u672C\u4FE1\u606F\n\ \ \ \ -help                 : \u663E\u793A\u6B64\u7528\u6CD5\u6D88\u606F
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties
index 938aef7..1ded744 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u9304: {0}
 
-VERSION = schemagen 2.2.12-b150126.1924
+VERSION = schemagen 2.2.12-b150331.1824
 
-FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924"
+FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824"
 
 USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9078\u9805: \n\\ \\ \\ \\ -d <path>             : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp <path>            : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath <path>     : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding <encoding>  : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode <file>       : \u7522\u751F\u7368\u7ACB\u7DE8\u8B6F\u7684\u4E8B\u4EF6 (episode) \u6A94\u6848\n\\ \\ \\ \\ -version              : \u986F\u793A\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -fullversion          : \u986F\u793A\u5B8C\u6574\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -help                 : \u986F\u793A\u6B64\u7528\u6CD5\u8A0A\u606F
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java
index 47d62d8..6a3eec7 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -158,7 +158,12 @@
         while (cl != null) {
             if (cl instanceof URLClassLoader) {
                 for (URL url : ((URLClassLoader) cl).getURLs()) {
-                    appendPath(cp, url.getPath());
+                    try {
+                        appendPath(cp,new File(url.toURI()).getPath());
+                    } catch(URISyntaxException ex) {
+                        /*If the URL is not properly formated - skip it*/
+                        LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
+                    }
                 }
             }
             cl = cl.getParent();
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/SchemaGenerator.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/SchemaGenerator.java
index a15b145..2a8b5989 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/SchemaGenerator.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/SchemaGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,6 @@
  * questions.
  */
 
-
-
 package com.sun.tools.internal.jxc.ap;
 
 import com.sun.tools.internal.jxc.api.JXC;
@@ -89,12 +87,12 @@
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
         final ErrorReceiverImpl errorListener = new ErrorReceiverImpl(processingEnv);
 
-        List<Reference> classes = new ArrayList<Reference>();
+        List<Reference> classesToBeBound = new ArrayList<Reference>();
         // simply ignore all the interface definitions,
         // so that users won't have to manually exclude interfaces, which is silly.
-        filterClass(classes, roundEnv.getRootElements());
+        filterClass(classesToBeBound, roundEnv.getRootElements());
 
-        J2SJAXBModel model = JXC.createJavaCompiler().bind(classes, Collections.<QName, Reference>emptyMap(), null, processingEnv);
+        J2SJAXBModel model = JXC.createJavaCompiler().bind(classesToBeBound, Collections.<QName, Reference>emptyMap(), null, processingEnv);
         if (model == null)
             return false; // error
 
@@ -133,11 +131,17 @@
         return false;
     }
 
-    private void filterClass(List<Reference> classes, Collection<? extends Element> elements) {
+    /**
+     * Filter classes (note that enum is kind of class) from elements tree
+     * @param result list of found classes
+     * @param elements tree to be filtered
+     */
+    private void filterClass(List<Reference> result, Collection<? extends Element> elements) {
         for (Element element : elements) {
-            if (element.getKind().equals(ElementKind.CLASS) || element.getKind().equals(ElementKind.ENUM)) {
-                classes.add(new Reference((TypeElement) element, processingEnv));
-                filterClass(classes, ElementFilter.typesIn(element.getEnclosedElements()));
+            final ElementKind kind = element.getKind();
+            if (ElementKind.CLASS.equals(kind) || ElementKind.ENUM.equals(kind)) {
+                result.add(new Reference((TypeElement) element, processingEnv));
+                filterClass(result, ElementFilter.typesIn(element.getEnclosedElements()));
             }
         }
     }
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/model/nav/ApNavigator.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/model/nav/ApNavigator.java
index 803d329..359bfc4 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/model/nav/ApNavigator.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/model/nav/ApNavigator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,12 @@
 import com.sun.source.util.Trees;
 import com.sun.xml.internal.bind.v2.model.nav.Navigator;
 import com.sun.xml.internal.bind.v2.runtime.Location;
-
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import javax.annotation.processing.ProcessingEnvironment;
 import javax.lang.model.element.AnnotationMirror;
 import javax.lang.model.element.Element;
@@ -52,12 +57,6 @@
 import javax.lang.model.util.Elements;
 import javax.lang.model.util.SimpleTypeVisitor6;
 import javax.lang.model.util.Types;
-import java.lang.annotation.Annotation;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
 
 /**
  * {@link Navigator} implementation for annotation processing.
@@ -241,7 +240,7 @@
 
     public VariableElement[] getEnumConstants(TypeElement clazz) {
         List<? extends Element> elements = env.getElementUtils().getAllMembers(clazz);
-        Collection<VariableElement> constants = new HashSet<VariableElement>();
+        Collection<VariableElement> constants = new ArrayList<VariableElement>();
         for (Element element : elements) {
             if (element.getKind().equals(ElementKind.ENUM_CONSTANT)) {
                 constants.add((VariableElement) element);
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties
index fd88f7f..de29303 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -171,20 +171,20 @@
 Driver.FailedToGenerateCode = \
         Failed to produce code.
 
-# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
+# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
 Driver.FilePrologComment = \
-        This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150126.1924 \n\
+        This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150331.1824 \n\
         See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\
         Any modifications to this file will be lost upon recompilation of the source schema. \n\
         Generated on: {0} \n
 
 Driver.Version = \
-        xjc 2.2.12-b150126.1924
+        xjc 2.2.12-b150331.1824
 
 Driver.FullVersion = \
-        xjc full version "2.2.12-b150126.1924"
+        xjc full version "2.2.12-b150331.1824"
 
-Driver.BuildID = 2.2.12-b150126.1924
+Driver.BuildID = 2.2.12-b150331.1824
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties
index 97271e9..6c30fbf 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Code konnte nicht erzeugt werden.
 
-# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150126.1924 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
+# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150331.1824 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
 
-Driver.Version = xjc 2.2.12-b150126.1924
+Driver.Version = xjc 2.2.12-b150331.1824
 
-Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.12-b150126.1924"
+Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.12-b150331.1824"
 
-Driver.BuildID = 2.2.12-b150126.1924
+Driver.BuildID = 2.2.12-b150331.1824
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties
index eadb52f..0ad71a4 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Fallo al producir c\u00f3digo.
 
-# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.12-b150126.1924 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
+# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.12-b150331.1824 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
 
-Driver.Version = xjc 2.2.12-b150126.1924
+Driver.Version = xjc 2.2.12-b150331.1824
 
-Driver.FullVersion = versi\u00F3n completa de xjc "2.2.12-b150126.1924"
+Driver.FullVersion = versi\u00F3n completa de xjc "2.2.12-b150331.1824"
 
-Driver.BuildID = 2.2.12-b150126.1924
+Driver.BuildID = 2.2.12-b150331.1824
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties
index dd19a16..dab1310 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Echec de la production du code.
 
-# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.12-b150126.1924 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
+# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.12-b150331.1824 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
 
-Driver.Version = xjc 2.2.12-b150126.1924
+Driver.Version = xjc 2.2.12-b150331.1824
 
-Driver.FullVersion = version compl\u00E8te xjc "2.2.12-b150126.1924"
+Driver.FullVersion = version compl\u00E8te xjc "2.2.12-b150331.1824"
 
-Driver.BuildID = 2.2.12-b150126.1924
+Driver.BuildID = 2.2.12-b150331.1824
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties
index f259cb3..32b7221 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Produzione del codice non riuscita.
 
-# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.12-b150126.1924 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
+# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.12-b150331.1824 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
 
-Driver.Version = xjc 2.2.12-b150126.1924
+Driver.Version = xjc 2.2.12-b150331.1824
 
-Driver.FullVersion = versione completa xjc "2.2.12-b150126.1924"
+Driver.FullVersion = versione completa xjc "2.2.12-b150331.1824"
 
-Driver.BuildID = 2.2.12-b150126.1924
+Driver.BuildID = 2.2.12-b150331.1824
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties
index 9674081..366edb4 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = \u30b3\u30fc\u30c9\u306e\u751f\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
 
-# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.12-b150126.1924\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
+# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.12-b150331.1824\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
 
-Driver.Version = xjc 2.2.12-b150126.1924
+Driver.Version = xjc 2.2.12-b150331.1824
 
-Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150126.1924"
+Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150331.1824"
 
-Driver.BuildID = 2.2.12-b150126.1924
+Driver.BuildID = 2.2.12-b150331.1824
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties
index 3715185..ffb08b6 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = \ucf54\ub4dc \uc0dd\uc131\uc744 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.
 
-# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.12-b150126.1924 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
+# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.12-b150331.1824 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
 
-Driver.Version = XJC 2.2.12-b150126.1924
+Driver.Version = XJC 2.2.12-b150331.1824
 
-Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.12-b150126.1924"
+Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.12-b150331.1824"
 
-Driver.BuildID = 2.2.12-b150126.1924
+Driver.BuildID = 2.2.12-b150331.1824
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties
index 9f44278b..5712dda 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Falha ao produzir o c\u00f3digo.
 
-# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.12-b150126.1924 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
+# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.12-b150331.1824 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
 
-Driver.Version = xjc 2.2.12-b150126.1924
+Driver.Version = xjc 2.2.12-b150331.1824
 
-Driver.FullVersion = vers\u00E3o completa de xjc "2.2.12-b150126.1924"
+Driver.FullVersion = vers\u00E3o completa de xjc "2.2.12-b150331.1824"
 
-Driver.BuildID = 2.2.12-b150126.1924
+Driver.BuildID = 2.2.12-b150331.1824
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties
index 11276a8..b5f2d8a 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = \u65e0\u6cd5\u751f\u6210\u4ee3\u7801\u3002
 
-# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.12-b150126.1924 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
+# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.12-b150331.1824 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
 
-Driver.Version = xjc 2.2.12-b150126.1924
+Driver.Version = xjc 2.2.12-b150331.1824
 
-Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924"
+Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824"
 
-Driver.BuildID = 2.2.12-b150126.1924
+Driver.BuildID = 2.2.12-b150331.1824
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties
index 27227f5..d722fc1 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = \u7121\u6cd5\u7522\u751f\u7a0b\u5f0f\u78bc.
 
-# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150126.1924 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
+# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150331.1824 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
 
-Driver.Version = xjc 2.2.12-b150126.1924
+Driver.Version = xjc 2.2.12-b150331.1824
 
-Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924"
+Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824"
 
-Driver.BuildID = 2.2.12-b150126.1924
+Driver.BuildID = 2.2.12-b150331.1824
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/addon/code_injector/PluginImpl.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/addon/code_injector/PluginImpl.java
index 626e972..2d82bab 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/addon/code_injector/PluginImpl.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/addon/code_injector/PluginImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,15 @@
 
 package com.sun.tools.internal.xjc.addon.code_injector;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
+import com.sun.istack.internal.NotNull;
 import com.sun.tools.internal.xjc.Options;
 import com.sun.tools.internal.xjc.Plugin;
 import com.sun.tools.internal.xjc.model.CPluginCustomization;
-import com.sun.tools.internal.xjc.outline.ClassOutline;
+import com.sun.tools.internal.xjc.outline.CustomizableOutline;
 import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.tools.internal.xjc.util.DOMUtils;
 
@@ -54,7 +56,7 @@
     }
 
     public boolean isCustomizationTagName(String nsUri, String localName) {
-        return nsUri.equals(Const.NS) && localName.equals("code");
+        return Const.NS.equals(nsUri) && "code".equals(localName);
     }
 
     public String getUsage() {
@@ -62,9 +64,15 @@
     }
 
     // meat of the processing
-    public boolean run(Outline model, Options opt, ErrorHandler errorHandler) {
-        for( ClassOutline co : model.getClasses() ) {
-            CPluginCustomization c = co.target.getCustomizations().find(Const.NS,"code");
+    public boolean run(@NotNull Outline model, Options opt, ErrorHandler errorHandler) {
+        checkAndInject(model.getClasses());
+        checkAndInject(model.getEnums());
+        return true;
+    }
+
+    private static void checkAndInject(Collection<? extends CustomizableOutline> outlines) {
+        for (CustomizableOutline co : outlines) {
+            CPluginCustomization c = co.getTarget().getCustomizations().find(Const.NS, "code");
             if(c==null)
                 continue;   // no customization --- nothing to inject here
 
@@ -74,9 +82,7 @@
             String codeFragment = DOMUtils.getElementText(c.element);
 
             // inject the specified code fragment into the implementation class.
-            co.implClass.direct(codeFragment);
+            co.getImplClass().direct(codeFragment);
         }
-
-        return true;
     }
 }
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ClassOutline.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ClassOutline.java
index 1b6e1b6..dde38ae 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ClassOutline.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ClassOutline.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 import com.sun.codemodel.internal.JClass;
 import com.sun.codemodel.internal.JDefinedClass;
 import com.sun.tools.internal.xjc.model.CClassInfo;
+import com.sun.tools.internal.xjc.model.CCustomizable;
 import com.sun.tools.internal.xjc.model.CPropertyInfo;
 import com.sun.istack.internal.NotNull;
 
@@ -44,7 +45,7 @@
  *
  * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
  */
-public abstract class ClassOutline {
+public abstract class ClassOutline implements CustomizableOutline {
 
     /**
      * A {@link Outline} that encloses all the class outlines.
@@ -122,4 +123,14 @@
         if(s==null)     return null;
         return parent().getClazz(s);
     }
+
+    @Override
+    public JDefinedClass getImplClass() {
+        return implClass;
+    }
+
+    @Override
+    public CCustomizable getTarget() {
+        return target;
+    }
 }
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/CustomizableOutline.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/CustomizableOutline.java
new file mode 100644
index 0000000..79c223d
--- /dev/null
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/CustomizableOutline.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.internal.xjc.outline;
+
+import com.sun.codemodel.internal.JDefinedClass;
+import com.sun.istack.internal.NotNull;
+import com.sun.tools.internal.xjc.model.CCustomizable;
+
+/**
+ * This interface describes that outline class could be customized.
+ * It provides the bound info from {@link CCustomizable} target. And
+ * customization output - implementation class.
+ *
+ * @author yaroska
+ * @since 2.2.12
+ */
+public interface CustomizableOutline {
+
+    /**
+     * Provides bound information about customizable target.
+     * @return customizable target
+     */
+    @NotNull CCustomizable getTarget();
+
+    /**
+     * Provides customization output.
+     * @return Implementation class
+     */
+    @NotNull JDefinedClass getImplClass();
+}
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ElementOutline.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ElementOutline.java
index 34609aa..72d7687 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ElementOutline.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ElementOutline.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package com.sun.tools.internal.xjc.outline;
 
 import com.sun.codemodel.internal.JDefinedClass;
+import com.sun.tools.internal.xjc.model.CCustomizable;
 import com.sun.tools.internal.xjc.model.CElementInfo;
 
 /**
@@ -39,7 +40,7 @@
  *
  * @author Kohsuke Kawaguchi
  */
-public abstract class ElementOutline {
+public abstract class ElementOutline implements CustomizableOutline {
 
     /**
      * A {@link Outline} that encloses all the class outlines.
@@ -69,4 +70,14 @@
         this.target = target;
         this.implClass = implClass;
     }
+
+    @Override
+    public CCustomizable getTarget() {
+        return target;
+    }
+
+    @Override
+    public JDefinedClass getImplClass() {
+        return implClass;
+    }
 }
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/EnumOutline.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/EnumOutline.java
index 9ac6b7a..ae48a72 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/EnumOutline.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/EnumOutline.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 import java.util.List;
 
 import com.sun.codemodel.internal.JDefinedClass;
+import com.sun.tools.internal.xjc.model.CCustomizable;
 import com.sun.tools.internal.xjc.model.CEnumLeafInfo;
 import com.sun.istack.internal.NotNull;
 
@@ -40,7 +41,7 @@
  *
  * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
  */
-public abstract class EnumOutline {
+public abstract class EnumOutline implements CustomizableOutline {
 
     /**
      * This {@link EnumOutline} holds information about this {@link CEnumLeafInfo}.
@@ -74,4 +75,14 @@
         this.target = target;
         this.clazz = clazz;
     }
+
+    @Override
+    public JDefinedClass getImplClass() {
+        return clazz;
+    }
+
+    @Override
+    public CCustomizable getTarget() {
+        return target;
+    }
 }
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties
index b18bbc7..8cc250f 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 # questions.
 #
 
-build-id=2.2.11-b150127.1410
-build-version=JAX-WS RI 2.2.11-b150127.1410
+build-id=2.2.11-b150402.1412
+build-version=JAX-WS RI 2.2.11-b150402.1412
 major-version=2.2.11
-svn-revision=28121d09ed8ac02b76788709ccb4cdb66e03bbfa
+svn-revision=f923291dedcf386c5f408263984a99d7cedf0012
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java
index aabf257..ee1582e 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 
 package com.sun.tools.internal.ws.wsdl.document.soap;
 
+import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+
 import javax.xml.namespace.QName;
 
 /**
@@ -35,9 +37,7 @@
 public interface SOAPConstants {
 
     // namespace URIs
-    public static final String URI_ENVELOPE =
-        "http://schemas.xmlsoap.org/soap/envelope/";
-
+    public static final String URI_ENVELOPE = SOAPNamespaceConstants.ENVELOPE;
     public static final String NS_WSDL_SOAP =
         "http://schemas.xmlsoap.org/wsdl/soap/";
     public static final String NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java
index c153cce..d216e6f 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,7 @@
     private static final ContextClassloaderLocal<XPathFactory> xpf = new ContextClassloaderLocal<XPathFactory>() {
         @Override
         protected XPathFactory initialValue() throws Exception {
-            return XPathFactory.newInstance();
+            return XmlUtil.newXPathFactory(true);
         }
     };
     /**
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java
index 0f12222..6801dd9f 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,10 +25,10 @@
 
 package com.sun.tools.internal.ws.wsdl.parser;
 
+import com.sun.tools.internal.ws.util.xml.XmlUtil;
 import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
 import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
 import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext;
-import com.sun.tools.internal.ws.util.xml.XmlUtil;
 import com.sun.tools.internal.ws.wsdl.document.*;
 import com.sun.tools.internal.ws.wsdl.document.jaxws.CustomName;
 import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBinding;
@@ -57,7 +57,7 @@
     private static final ContextClassloaderLocal<XPathFactory> xpf = new ContextClassloaderLocal<XPathFactory>() {
         @Override
         protected XPathFactory initialValue() throws Exception {
-            return XPathFactory.newInstance();
+            return XmlUtil.newXPathFactory(false);
         }
     };
 
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 0a8ca67..0b95573 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -301,3 +301,4 @@
 7969f7b6465e47ce4afa77670ca600b04c1d746c jdk9-b56
 c76339e86ea7da5d9ac7856f3fae9ef73eef04a2 jdk9-b57
 36fc65e80d811ee43aedfc69284224b86a403662 jdk9-b58
+48ee960f29df93a9b2a895621321358a86909086 jdk9-b59
diff --git a/jdk/make/lib/Lib-java.management.gmk b/jdk/make/lib/Lib-java.management.gmk
index 9f4435d..e0e6f1d 100644
--- a/jdk/make/lib/Lib-java.management.gmk
+++ b/jdk/make/lib/Lib-java.management.gmk
@@ -38,6 +38,11 @@
     $(LIBJAVA_HEADER_FLAGS) \
     #
 
+# In (at least) VS2013 and later, -DPSAPI_VERSION=1 is needed to generate
+# a binary that is compatible with windows versions older than 7/2008R2.
+# See MSDN documentation for GetProcessMemoryInfo for more information.
+BUILD_LIBMANAGEMENT_CFLAGS += -DPSAPI_VERSION=1
+
 BUILD_LIBMANAGEMENT_EXCLUDES :=
 
 ifneq ($(OPENJDK_TARGET_OS), solaris)
diff --git a/jdk/src/java.base/share/classes/java/util/BitSet.java b/jdk/src/java.base/share/classes/java/util/BitSet.java
index 901a5a7..f444072 100644
--- a/jdk/src/java.base/share/classes/java/util/BitSet.java
+++ b/jdk/src/java.base/share/classes/java/util/BitSet.java
@@ -1229,7 +1229,7 @@
             public int nextInt() {
                 if (next != -1) {
                     int ret = next;
-                    next = nextSetBit(next+1);
+                    next = (next == Integer.MAX_VALUE) ? -1 : nextSetBit(next+1);
                     return ret;
                 } else {
                     throw new NoSuchElementException();
diff --git a/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java b/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java
index b61e334..aa93bcb 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java
@@ -481,6 +481,8 @@
                     }
                     break;
                 case EXTID_NTFS:
+                    if (sz < 32) // reserved  4 bytes + tag 2 bytes + size 2 bytes
+                        break;   // m[a|c]time 24 bytes
                     int pos = off + 4;               // reserved 4 bytes
                     if (get16(extra, pos) !=  0x0001 || get16(extra, pos + 2) != 24)
                         break;
diff --git a/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java b/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java
index 691ce46..9c8bc81 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java
@@ -25,7 +25,11 @@
 
 package javax.crypto;
 
-import java.io.*;
+import java.io.InputStream;
+import java.io.FilterInputStream;
+import java.io.IOException;
+import javax.crypto.BadPaddingException;
+import javax.crypto.IllegalBlockSizeException;
 
 /**
  * A CipherInputStream is composed of an InputStream and a Cipher so
@@ -88,8 +92,6 @@
     private int ofinish = 0;
     // stream status
     private boolean closed = false;
-    // The stream has been read from.  False if the stream has never been read.
-    private boolean read = false;
 
     /**
      * private convenience function.
@@ -101,11 +103,15 @@
      * return (ofinish-ostart) (we have this many bytes for you)
      * return 0 (no data now, but could have more later)
      * return -1 (absolutely no more data)
+     *
+     * Note:  Exceptions are only thrown after the stream is completely read.
+     * For AEAD ciphers a read() of any length will internally cause the
+     * whole stream to be read fully and verify the authentication tag before
+     * returning decrypted data or exceptions.
      */
     private int getMoreData() throws IOException {
         if (done) return -1;
         int readin = input.read(ibuffer);
-        read = true;
         if (readin == -1) {
             done = true;
             try {
@@ -301,17 +307,16 @@
 
         closed = true;
         input.close();
-        try {
-            // throw away the unprocessed data
-            if (!done) {
+
+        // Throw away the unprocessed data and throw no crypto exceptions.
+        // AEAD ciphers are fully readed before closing.  Any authentication
+        // exceptions would occur while reading.
+        if (!done) {
+            try {
                 cipher.doFinal();
             }
-        }
-        catch (BadPaddingException | IllegalBlockSizeException ex) {
-            /* If no data has been read from the stream to be en/decrypted,
-               we supress any exceptions, and close quietly. */
-            if (read) {
-                throw new IOException(ex);
+            catch (BadPaddingException | IllegalBlockSizeException ex) {
+                // Catch exceptions as the rest of the stream is unused.
             }
         }
         ostart = 0;
diff --git a/jdk/src/java.base/share/classes/javax/security/auth/Policy.java b/jdk/src/java.base/share/classes/javax/security/auth/Policy.java
index 2463102..6ed9a4e 100644
--- a/jdk/src/java.base/share/classes/javax/security/auth/Policy.java
+++ b/jdk/src/java.base/share/classes/javax/security/auth/Policy.java
@@ -322,7 +322,7 @@
      *                  in conjunction with the provided
      *                  {@code CodeSource}, determines the Permissions
      *                  returned by this method.  This parameter
-     *                  may be {@code null}. <p>
+     *                  may be {@code null}.
      *
      * @param cs the code specified by its {@code CodeSource}
      *                  that determines, in conjunction with the provided
diff --git a/jdk/src/java.base/share/classes/javax/security/auth/login/LoginContext.java b/jdk/src/java.base/share/classes/javax/security/auth/login/LoginContext.java
index d86a914..e266c47 100644
--- a/jdk/src/java.base/share/classes/javax/security/auth/login/LoginContext.java
+++ b/jdk/src/java.base/share/classes/javax/security/auth/login/LoginContext.java
@@ -25,18 +25,18 @@
 
 package javax.security.auth.login;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import java.util.LinkedList;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Map;
 import java.util.HashMap;
 import java.text.MessageFormat;
 import javax.security.auth.Subject;
 import javax.security.auth.AuthPermission;
 import javax.security.auth.callback.*;
-import java.security.AccessController;
+import javax.security.auth.spi.LoginModule;
 import java.security.AccessControlContext;
+import java.util.ServiceLoader;
+
 import sun.security.util.PendingException;
 import sun.security.util.ResourcesMgr;
 
@@ -192,7 +192,6 @@
  */
 public class LoginContext {
 
-    private static final String INIT_METHOD             = "initialize";
     private static final String LOGIN_METHOD            = "login";
     private static final String COMMIT_METHOD           = "commit";
     private static final String ABORT_METHOD            = "abort";
@@ -210,7 +209,6 @@
     private AccessControlContext creatorAcc = null;  // customized config only
     private ModuleInfo[] moduleStack;
     private ClassLoader contextClassLoader = null;
-    private static final Class<?>[] PARAMS = { };
 
     // state saved in the event a user-specified asynchronous exception
     // was specified and thrown
@@ -678,64 +676,64 @@
         for (int i = moduleIndex; i < moduleStack.length; i++, moduleIndex++) {
             try {
 
-                int mIndex = 0;
-                Method[] methods = null;
+                if (moduleStack[i].module == null) {
 
-                if (moduleStack[i].module != null) {
-                    methods = moduleStack[i].module.getClass().getMethods();
-                } else {
-
-                    // instantiate the LoginModule
+                    // locate and instantiate the LoginModule
                     //
-                    // Allow any object to be a LoginModule as long as it
-                    // conforms to the interface.
-                    Class<?> c = Class.forName(
-                                moduleStack[i].entry.getLoginModuleName(),
-                                true,
-                                contextClassLoader);
-
-                    Constructor<?> constructor = c.getConstructor(PARAMS);
-                    Object[] args = { };
-                    moduleStack[i].module = constructor.newInstance(args);
-
-                    // call the LoginModule's initialize method
-                    methods = moduleStack[i].module.getClass().getMethods();
-                    for (mIndex = 0; mIndex < methods.length; mIndex++) {
-                        if (methods[mIndex].getName().equals(INIT_METHOD)) {
+                    String name = moduleStack[i].entry.getLoginModuleName();
+                    ServiceLoader<LoginModule> sc = AccessController.doPrivileged(
+                            (PrivilegedAction<ServiceLoader<LoginModule>>)
+                                    () -> ServiceLoader.load(
+                                        LoginModule.class, contextClassLoader));
+                    for (LoginModule m: sc) {
+                        if (m.getClass().getName().equals(name)) {
+                            moduleStack[i].module = m;
+                            if (debug != null) {
+                                debug.println(name + " loaded as a service");
+                            }
                             break;
                         }
                     }
 
-                    Object[] initArgs = {subject,
-                                        callbackHandler,
-                                        state,
-                                        moduleStack[i].entry.getOptions() };
+                    if (moduleStack[i].module == null) {
+                        try {
+                            moduleStack[i].module = (LoginModule) Class.forName(
+                                    name, false, contextClassLoader).newInstance();
+                            if (debug != null) {
+                                debug.println(name + " loaded via reflection");
+                            }
+                        } catch (ClassNotFoundException e) {
+                            throw new LoginException("No LoginModule found for "
+                                    + name);
+                        }
+                    }
+
                     // invoke the LoginModule initialize method
-                    //
-                    // Throws ArrayIndexOutOfBoundsException if no such
-                    // method defined.  May improve to use LoginException in
-                    // the future.
-                    methods[mIndex].invoke(moduleStack[i].module, initArgs);
+                    moduleStack[i].module.initialize(subject,
+                            callbackHandler,
+                            state,
+                            moduleStack[i].entry.getOptions());
                 }
 
                 // find the requested method in the LoginModule
-                for (mIndex = 0; mIndex < methods.length; mIndex++) {
-                    if (methods[mIndex].getName().equals(methodName)) {
+                boolean status;
+                switch (methodName) {
+                    case LOGIN_METHOD:
+                        status = moduleStack[i].module.login();
                         break;
-                    }
+                    case COMMIT_METHOD:
+                        status = moduleStack[i].module.commit();
+                        break;
+                    case LOGOUT_METHOD:
+                        status = moduleStack[i].module.logout();
+                        break;
+                    case ABORT_METHOD:
+                        status = moduleStack[i].module.abort();
+                        break;
+                    default:
+                        throw new AssertionError("Unknown method " + methodName);
                 }
 
-                // set up the arguments to be passed to the LoginModule method
-                Object[] args = { };
-
-                // invoke the LoginModule method
-                //
-                // Throws ArrayIndexOutOfBoundsException if no such
-                // method defined.  May improve to use LoginException in
-                // the future.
-                boolean status = ((Boolean)methods[mIndex].invoke
-                                (moduleStack[i].module, args)).booleanValue();
-
                 if (status == true) {
 
                     // if SUFFICIENT, return if no prior REQUIRED errors
@@ -760,31 +758,12 @@
                     if (debug != null)
                         debug.println(methodName + " ignored");
                 }
-
-            } catch (NoSuchMethodException nsme) {
-                MessageFormat form = new MessageFormat(ResourcesMgr.getString
-                        ("unable.to.instantiate.LoginModule.module.because.it.does.not.provide.a.no.argument.constructor"));
-                Object[] source = {moduleStack[i].entry.getLoginModuleName()};
-                throwException(null, new LoginException(form.format(source)));
-            } catch (InstantiationException ie) {
-                throwException(null, new LoginException(ResourcesMgr.getString
-                        ("unable.to.instantiate.LoginModule.") +
-                        ie.getMessage()));
-            } catch (ClassNotFoundException cnfe) {
-                throwException(null, new LoginException(ResourcesMgr.getString
-                        ("unable.to.find.LoginModule.class.") +
-                        cnfe.getMessage()));
-            } catch (IllegalAccessException iae) {
-                throwException(null, new LoginException(ResourcesMgr.getString
-                        ("unable.to.access.LoginModule.") +
-                        iae.getMessage()));
-            } catch (InvocationTargetException ite) {
+            } catch (Exception ite) {
 
                 // failure cases
-
                 LoginException le;
 
-                if (ite.getCause() instanceof PendingException &&
+                if (ite instanceof PendingException &&
                     methodName.equals(LOGIN_METHOD)) {
 
                     // XXX
@@ -808,13 +787,13 @@
                     // the only time that is not true is in this case -
                     // do not call throwException here.
 
-                    throw (PendingException)ite.getCause();
+                    throw (PendingException)ite;
 
-                } else if (ite.getCause() instanceof LoginException) {
+                } else if (ite instanceof LoginException) {
 
-                    le = (LoginException)ite.getCause();
+                    le = (LoginException)ite;
 
-                } else if (ite.getCause() instanceof SecurityException) {
+                } else if (ite instanceof SecurityException) {
 
                     // do not want privacy leak
                     // (e.g., sensitive file path in exception msg)
@@ -826,14 +805,14 @@
                             ("original security exception with detail msg " +
                             "replaced by new exception with empty detail msg");
                         debug.println("original security exception: " +
-                                ite.getCause().toString());
+                                ite.toString());
                     }
                 } else {
 
                     // capture an unexpected LoginModule exception
                     java.io.StringWriter sw = new java.io.StringWriter();
-                    ite.getCause().printStackTrace
-                                                (new java.io.PrintWriter(sw));
+                    ite.printStackTrace
+                            (new java.io.PrintWriter(sw));
                     sw.flush();
                     le = new LoginException(sw.toString());
                 }
@@ -938,9 +917,9 @@
      */
     private static class ModuleInfo {
         AppConfigurationEntry entry;
-        Object module;
+        LoginModule module;
 
-        ModuleInfo(AppConfigurationEntry newEntry, Object newModule) {
+        ModuleInfo(AppConfigurationEntry newEntry, LoginModule newModule) {
             this.entry = newEntry;
             this.module = newModule;
         }
diff --git a/jdk/src/java.base/share/classes/javax/security/auth/spi/LoginModule.java b/jdk/src/java.base/share/classes/javax/security/auth/spi/LoginModule.java
index 871bbbc..3206b5a 100644
--- a/jdk/src/java.base/share/classes/javax/security/auth/spi/LoginModule.java
+++ b/jdk/src/java.base/share/classes/javax/security/auth/spi/LoginModule.java
@@ -32,10 +32,9 @@
 import java.util.Map;
 
 /**
- * <p> {@code LoginModule} describes the interface
- * implemented by authentication technology providers.  LoginModules
- * are plugged in under applications to provide a particular type of
- * authentication.
+ * <p> Service-provider interface for authentication technology providers.
+ * LoginModules are plugged in under applications to provide a particular
+ * type of authentication.
  *
  * <p> While applications write to the {@code LoginContext} API,
  * authentication technology providers implement the
diff --git a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSContext.java b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSContext.java
index 8c55da5..63336da 100644
--- a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSContext.java
+++ b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,7 +104,7 @@
  * operations on the <code>GSSContext</code> object are presented,
  * including: object instantiation, setting of desired flags, context
  * establishment, query of actual context flags, per-message operations on
- * application data, and finally context deletion.<p>
+ * application data, and finally context deletion.
  *
  * <pre>
  *    // Create a context using default credentials
@@ -209,7 +209,7 @@
      * Some mechanism providers might require that the caller be granted
      * permission to initiate a security context. A failed permission check
      * might cause a {@link java.lang.SecurityException SecurityException}
-     * to be thrown from this method.<p>
+     * to be thrown from this method.
      *
      * @return a byte[] containing the token to be sent to the
      * peer. <code>null</code> indicates that no token is generated.
@@ -276,7 +276,7 @@
      * to be thrown from this method.<p>
      *
      * The following example code demonstrates how this method might be
-     * used:<p>
+     * used:
      * <pre>
      *     InputStream is ...
      *     OutputStream os ...
@@ -346,7 +346,7 @@
      * to be thrown from this method.<p>
      *
      * The following example code demonstrates how this method might be
-     * used:<p>
+     * used:
      * <pre>
      *     byte[] inToken;
      *     byte[] outToken;
@@ -423,7 +423,7 @@
      * to be thrown from this method.<p>
      *
      * The following example code demonstrates how this method might be
-     * used:<p>
+     * used:
      * <pre>
      *     InputStream is ...
      *     OutputStream os ...
@@ -510,7 +510,7 @@
      * GSS-API implementations are recommended but not required to detect
      * invalid QOP values when <code>getWrapSizeLimit</code> is called.
      * This routine guarantees only a maximum message size, not the
-     * availability of specific QOP values for message protection.<p>
+     * availability of specific QOP values for message protection.
      *
      * @param qop the level of protection wrap will be asked to provide.
      * @param confReq <code>true</code> if wrap will be asked to provide
@@ -595,7 +595,7 @@
      *
      * Since some application-level protocols may wish to use tokens
      * emitted by wrap to provide "secure framing", implementations should
-     * support the wrapping of zero-length messages.<p>
+     * support the wrapping of zero-length messages.
      *
      * @param inStream an InputStream containing the application data to be
      * protected. All of the data that is available in
@@ -630,7 +630,7 @@
      *
      * Since some application-level protocols may wish to use tokens
      * emitted by wrap to provide "secure framing", implementations should
-     * support the wrapping and unwrapping of zero-length messages.<p>
+     * support the wrapping and unwrapping of zero-length messages.
      *
      * @param inBuf a byte array containing the wrap token received from
      * peer.
@@ -679,7 +679,7 @@
      *
      * Other than the possible blocking behavior described above, this
      * method is equivalent to the byte array based {@link #unwrap(byte[],
-     * int, int, MessageProp) unwrap} method.<p>
+     * int, int, MessageProp) unwrap} method.
      *
      * @param inStream an InputStream that contains the wrap token generated
      * by the peer.
@@ -827,7 +827,7 @@
      *
      * Other than the possible blocking behavior described above, this
      * method is equivalent to the byte array based {@link #verifyMIC(byte[],
-     * int, int, byte[], int, int, MessageProp) verifyMIC} method.<p>
+     * int, int, byte[], int, int, MessageProp) verifyMIC} method.
      *
      * @param tokStream an InputStream containing the token generated by the
      * peer's getMIC method.
@@ -913,7 +913,7 @@
      * might require mutual authentication even if the application
      * doesn't. Therefore, the application should check to see if the
      * request was honored with the {@link #getMutualAuthState()
-     * getMutualAuthState} method.<p>
+     * getMutualAuthState} method.
      *
      * @param state a boolean value indicating whether mutual
      * authentication should be used or not.
@@ -943,7 +943,7 @@
      * MessageProp#isOldToken() MessageProp.isOldToken} methods will return
      * valid results for the <code>MessageProp</code> object that is passed
      * in to the <code>unwrap</code> method or the <code>verifyMIC</code>
-     * method.<p>
+     * method.
      *
      * @param state a boolean value indicating whether replay detection
      * should be enabled over the established context or not.
@@ -975,7 +975,7 @@
      * {@link MessageProp#isGapToken() MessageProp.isGapToken} methods will return
      * valid results for the <code>MessageProp</code> object that is passed
      * in to the <code>unwrap</code> method or the <code>verifyMIC</code>
-     * method.<p>
+     * method.
      *
      * @param state a boolean value indicating whether sequence checking
      * should be enabled over the established context or not.
@@ -1001,7 +1001,7 @@
      * delegation must not be used, then the mechanism will honor the
      * request and delegation will not occur. This is an exception
      * to the general rule that a mechanism may enable a service even if it
-     * is not requested.<p>
+     * is not requested.
      *
      * @param state a boolean value indicating whether the credentials
      * should be delegated or not.
@@ -1021,7 +1021,7 @@
      *
      * Not all mechanisms support anonymity for the initiator. Therefore, the
      * application should check to see if the request was honored with the
-     * {@link #getAnonymityState() getAnonymityState} method.<p>
+     * {@link #getAnonymityState() getAnonymityState} method.
      *
      * @param state a boolean value indicating if the initiator should
      * be authenticated to the acceptor as an anonymous principal.
@@ -1048,7 +1048,7 @@
      * object that is passed in to the <code>wrap</code> method.<p>
      *
      * Enabling confidentiality will also automatically enable
-     * integrity.<p>
+     * integrity.
      *
      * @param state a boolean value indicating whether confidentiality
      * should be enabled or not.
@@ -1075,7 +1075,7 @@
      * the {@link #getIntegState() getIntegState} method.<p>
      *
      * Disabling integrity will also automatically disable
-     * confidentiality.<p>
+     * confidentiality.
      *
      * @param state a boolean value indicating whether integrity
      * should be enabled or not.
@@ -1095,7 +1095,7 @@
      *
      * The actual lifetime of the context will depend on the capabilities of
      * the underlying mechanism and the application should call the {@link
-     * #getLifetime() getLifetime} method to determine this.<p>
+     * #getLifetime() getLifetime} method to determine this.
      *
      * @param lifetime the desired context lifetime in seconds. Use
      * <code>INDEFINITE_LIFETIME</code> to request an indefinite lifetime
@@ -1133,7 +1133,7 @@
      * initiator requests that delegation not be allowed the {@link
      * #requestCredDeleg(boolean) requestCredDeleg} method will honor that
      * request and this method will return <code>false</code> on the
-     * initiator's side from that point onwards. <p>
+     * initiator's side from that point onwards.
      *
      * @return true if delegation is enabled, false otherwise.
      * @see #requestCredDeleg(boolean)
@@ -1147,7 +1147,7 @@
      * called only after context establishment is complete. An initiator
      * that requests mutual authentication can call this method after
      * context completion and dispose the context if its request was not
-     * honored.<p>
+     * honored.
      *
      * @return true if mutual authentication is enabled, false otherwise.
      * @see #requestMutualAuth(boolean)
@@ -1161,7 +1161,7 @@
      * definitive answer this method must be called only after context
      * establishment is complete. An initiator that requests replay
      * detection can call this method after context completion and
-     * dispose the context if its request was not honored.<p>
+     * dispose the context if its request was not honored.
      *
      * @return true if replay detection is enabled, false otherwise.
      * @see #requestReplayDet(boolean)
@@ -1175,7 +1175,7 @@
      * definitive answer this method must be called only after context
      * establishment is complete. An initiator that requests sequence
      * checking can call this method after context completion and
-     * dispose the context if its request was not honored.<p>
+     * dispose the context if its request was not honored.
      *
      * @return true if sequence checking is enabled, false otherwise.
      * @see #requestSequenceDet(boolean)
@@ -1195,7 +1195,7 @@
      * should be sent to the peer or the context aborted.</strong> On the
      * acceptor side, a call to this method determines if any of the tokens
      * processed by <code>acceptSecContext</code> thus far have divulged
-     * the identity of the initiator.<p>
+     * the identity of the initiator.
      *
      * @return true if the context initiator is still anonymous, false
      * otherwise.
@@ -1235,7 +1235,7 @@
      * #isProtReady() isProtReady} or {@link #isEstablished()
      * isEstablished} return <code>true</code>. If this method returns
      * <code>true</code>, so will {@link #getIntegState()
-     * getIntegState}<p>
+     * getIntegState}
      *
      * @return true if confidentiality services are available, false
      * otherwise.
@@ -1250,7 +1250,7 @@
      * #isProtReady() isProtReady} or {@link #isEstablished()
      * isEstablished} return <code>true</code>. This method will always
      * return <code>true</code> if {@link #getConfState() getConfState}
-     * returns true.<p>
+     * returns true.
      *
      * @return true if integrity services are available, false otherwise.
      * @see #requestInteg(boolean)
@@ -1262,7 +1262,7 @@
      * context is. It can be called by both the context initiator and the
      * context acceptor, but for a definitive answer it should be called
      * only after {@link #isEstablished() isEstablished} returns
-     * true.<p>
+     * true.
      *
      * @return the remaining lifetime in seconds
      * @see #requestLifetime(int)
diff --git a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSCredential.java b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSCredential.java
index fbe379e..115ee74 100644
--- a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSCredential.java
+++ b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSCredential.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@
  *
  * This example code demonstrates the creation of a GSSCredential
  * implementation for a specific entity, querying of its fields, and its
- * release when it is no longer needed:<p>
+ * release when it is no longer needed:
  * <pre>
  *    GSSManager manager = GSSManager.getInstance();
  *
diff --git a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSException.java b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSException.java
index cfde0e5..ed7e3ad 100644
--- a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSException.java
+++ b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
  * mechanism implementation is responsible for setting appropriate minor
  * status codes when throwing this exception.  Aside from delivering the
  * numeric error codes to the caller, this class performs the mapping from
- * their numeric values to textual representations. <p>
+ * their numeric values to textual representations.
  *
  * @author Mayank Upadhyay
  * @since 1.4
diff --git a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSManager.java b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSManager.java
index 3bf99e4..f9ae3ef 100644
--- a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSManager.java
+++ b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,7 @@
  * of this and recover cleanly by catching the exception.<p>
  *
  * It is envisioned that there will be three most common ways in which
- * providers will be used:<p>
+ * providers will be used:
  * <ol>
  * <li> The application does not care about what provider is used (the
  * default case).
@@ -87,7 +87,7 @@
  * the <code>addProviderAtFront</code> method on a GSSManager that has
  * already created an object.<p>
  *
- *  Here is some sample code showing how the GSSManager might be used: <p>
+ *  Here is some sample code showing how the GSSManager might be used:
  * <pre>
  *     GSSManager manager = GSSManager.getInstance();
  *
@@ -116,7 +116,7 @@
  *                                                GSSContext.DEFAULT_LIFETIME);
  * </pre><p>
  *
- * The server side might use the following variation of this source:<p>
+ * The server side might use the following variation of this source:
  *
  * <pre>
  *     // Acquire credentials for the server
@@ -387,7 +387,7 @@
      * Non-default values for lifetime cannot always be honored by the
      * underlying mechanisms, thus applications should be prepared to call
      * {@link GSSCredential#getRemainingLifetime() getRemainingLifetime}
-     * on the returned credential.<p>
+     * on the returned credential.
      *
      * @param name the name of the principal for whom this credential is to be
      * acquired.  Use <code>null</code> to specify the default principal.
@@ -442,7 +442,7 @@
      * Non-default values for lifetime cannot always be honored by the
      * underlying mechanisms, thus applications should be prepared to call
      * {@link GSSCredential#getRemainingLifetime() getRemainingLifetime}
-     * on the returned credential.<p>
+     * on the returned credential.
      *
      * @param name the name of the principal for whom this credential is to
      * be acquired.  Use <code>null</code> to specify the default
@@ -492,7 +492,7 @@
      * Non-default values for lifetime cannot always be honored by the
      * underlying mechanism, thus applications should be prepared to call
      * {@link GSSContext#getLifetime() getLifetime} on the returned
-     * context.<p>
+     * context.
      *
      * @param peer the name of the target peer.
      * @param mech the Oid of the desired mechanism.  Use <code>null</code>
@@ -610,7 +610,7 @@
      * operation is unavailable.<p>
      *
      * Suppose an application desired that the provider A always be checked
-     * first when any mechanism is needed, it would call:<p>
+     * first when any mechanism is needed, it would call:
      * <pre>
      *         GSSManager mgr = GSSManager.getInstance();
      *         // mgr may at this point have its own pre-configured list
@@ -621,7 +621,7 @@
      * </pre>
      * Now if it also desired that the mechanism of Oid m1 always be
      * obtained from the provider B before the previously set A was checked,
-     * it would call:<p>
+     * it would call:
      * <pre>
      *         mgr.addProviderAtFront(B, m1);
      * </pre>
@@ -632,7 +632,7 @@
      * directly.<p>
      *
      * Suppose at a later time the following call is made to the same
-     * GSSManager instance:<p>
+     * GSSManager instance:
      * <pre>
      *         mgr.addProviderAtFront(B, null)
      * </pre>
@@ -684,14 +684,14 @@
      * Suppose an application desired that when a mechanism of Oid m1 is
      * needed the system default providers always be checked first, and only
      * when they do not support m1 should a provider A be checked. It would
-     * then make the call:<p>
+     * then make the call:
      * <pre>
      *         GSSManager mgr = GSSManager.getInstance();
      *         mgr.addProviderAtEnd(A, m1);
      * </pre>
      * Now, if it also desired that for all mechanisms the provider B be
      * checked after all configured providers have been checked, it would
-     * then call:<p>
+     * then call:
      * <pre>
      *         mgr.addProviderAtEnd(B, null);
      * </pre>
@@ -699,7 +699,7 @@
      * null)}.<p>
      *
      * Suppose at a later time the following call is made to the same
-     * GSSManager instance:<p>
+     * GSSManager instance:
      * <pre>
      *         mgr.addProviderAtEnd(B, m2)
      * </pre>
@@ -708,7 +708,7 @@
      * request is made for the already existing pairs of (A, m1) or (B,
      * null).<p>
      *
-     * Please note, however, that the following call:<p>
+     * Please note, however, that the following call:
      * <pre>
      *         mgr.addProviderAtEnd(A, null)
      * </pre>
diff --git a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSName.java b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSName.java
index 580ab39..185a6c2 100644
--- a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSName.java
+++ b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSName.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
  * The code below creates a <code>GSSName</code>, converts it to an MN, performs a
  * comparison, obtains a printable representation of the name, exports it
  * to a byte array and then re-imports to obtain a
- * new <code>GSSName</code>.<p>
+ * new <code>GSSName</code>.
  * <pre>
  *      GSSManager manager = GSSManager.getInstance();
  *
@@ -236,7 +236,8 @@
      * method {@link GSSManager#createName(byte[], Oid)
      * GSSManager.createName} and specifying the NT_EXPORT_NAME as the name
      * type object identifier. The resulting <code>GSSName</code> name will
-     * also be a MN.<p>
+     * also be a MN.
+     *
      * @return a byte[] containing the exported name. RFC 2743 defines the
      * "Mechanism-Independent Exported Name Object Format" for these bytes.
      *
diff --git a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/MessageProp.java b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/MessageProp.java
index 2f776eb..8568f57 100644
--- a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/MessageProp.java
+++ b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/MessageProp.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
  * <code>false</code>.  Upon return from these methods, this object will also
  * contain any supplementary status values applicable to the processed
  * token.  The supplementary status values can indicate old tokens, out
- * of sequence tokens, gap tokens or duplicate tokens.<p>
+ * of sequence tokens, gap tokens or duplicate tokens.
  *
  * @see GSSContext#wrap
  * @see GSSContext#unwrap
diff --git a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/package.html b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/package.html
index 1dc1ec4..2049a26 100644
--- a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/package.html
+++ b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/package.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
 This code is free software; you can redistribute it and/or modify it
@@ -55,10 +55,10 @@
 
     The GSS-API does not perform any communication with the peer. It merely 
     produces tokens that the application must somehow transport to the
-    other end.<p>
+    other end.
 
 <h3>Credential Acquisition</h3>
-<a name=useSubjectCredsOnly>
+<a name=useSubjectCredsOnly></a>
     The GSS-API itself does not dictate how an underlying mechanism
     obtains the credentials that are needed for authentication. It is
     assumed that prior to calling the GSS-API, these credentials are
@@ -97,7 +97,6 @@
     the provider is free to use any credentials cache of its choice. Such
     a credential cache might be a disk cache, an in-memory cache, or even
     just the current Subject itself.
-</a>
 
 <h2>Related Documentation</h2>
 <p>
diff --git a/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/JImageTask.java b/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/JImageTask.java
index 9bb2163..6e7e29e 100644
--- a/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/JImageTask.java
+++ b/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/JImageTask.java
@@ -269,11 +269,11 @@
                         return 0L;
                     }
 
-                    String name = pathString.substring(chop).replace('\\','/');
-
                     File file = path.toFile();
 
                     if (file.isFile()) {
+                        String name = pathString.substring(chop).replace(File.separatorChar, '/');
+
                         if (options.verbose) {
                             log.println(name);
                         }
@@ -310,7 +310,7 @@
                 for (File file : files) {
                     try {
                         Path path = file.toPath();
-                        String name = path.toString();
+                        String name = path.toString().replace(File.separatorChar, '/');
 
                         if (name.endsWith(MODULES_ENTRY) || name.endsWith(PACKAGES_ENTRY)) {
                             for (String line: Files.readAllLines(path)) {
diff --git a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java
index d5cd4cf..17acf26 100644
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java
@@ -2271,6 +2271,8 @@
                     }
                     break;
                 case EXTID_NTFS:
+                    if (sz < 32)
+                        break;
                     pos += 4;    // reserved 4 bytes
                     if (SH(extra, pos) !=  0x0001)
                         break;
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 95b60e7..6b21149 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -251,6 +251,64 @@
 # 8026393
 sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java      generic-all
 
+# 8077138: Some PKCS11 tests fail because NSS library is not initialized
+sun/security/pkcs11/Cipher/ReinitCipher.java                    windows-all
+sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java           windows-all
+sun/security/pkcs11/Cipher/TestRSACipher.java                   windows-all
+sun/security/pkcs11/Cipher/TestRSACipherWrap.java               windows-all
+sun/security/pkcs11/Cipher/TestRawRSACipher.java                windows-all
+sun/security/pkcs11/Cipher/TestSymmCiphers.java                 windows-all
+sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java            windows-all
+sun/security/pkcs11/KeyAgreement/TestDH.java                    windows-all
+sun/security/pkcs11/KeyAgreement/TestInterop.java               windows-all
+sun/security/pkcs11/KeyAgreement/TestShort.java                 windows-all
+sun/security/pkcs11/KeyGenerator/DESParity.java                 windows-all
+sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java          windows-all
+sun/security/pkcs11/KeyPairGenerator/TestDH2048.java            windows-all
+sun/security/pkcs11/KeyStore/SecretKeysBasic.sh                 windows-all
+sun/security/pkcs11/Mac/MacKAT.java                             windows-all
+sun/security/pkcs11/Mac/MacSameTest.java                        windows-all
+sun/security/pkcs11/Mac/ReinitMac.java                          windows-all
+sun/security/pkcs11/MessageDigest/ByteBuffers.java              windows-all
+sun/security/pkcs11/MessageDigest/DigestKAT.java                windows-all
+sun/security/pkcs11/MessageDigest/ReinitDigest.java             windows-all
+sun/security/pkcs11/MessageDigest/TestCloning.java              windows-all
+sun/security/pkcs11/Provider/ConfigQuotedString.sh              windows-all
+sun/security/pkcs11/Provider/Login.sh                           windows-all
+sun/security/pkcs11/SampleTest.java                             windows-all
+sun/security/pkcs11/Secmod/AddPrivateKey.java                   windows-all
+sun/security/pkcs11/Secmod/AddTrustedCert.java                  windows-all
+sun/security/pkcs11/Secmod/Crypto.java                          windows-all
+sun/security/pkcs11/Secmod/GetPrivateKey.java                   windows-all
+sun/security/pkcs11/Secmod/JksSetPrivateKey.java                windows-all
+sun/security/pkcs11/SecureRandom/Basic.java                     windows-all
+sun/security/pkcs11/SecureRandom/TestDeserialization.java       windows-all
+sun/security/pkcs11/Serialize/SerializeProvider.java            windows-all
+sun/security/pkcs11/Signature/ByteBuffers.java                  windows-all
+sun/security/pkcs11/Signature/ReinitSignature.java              windows-all
+sun/security/pkcs11/Signature/TestDSA.java                      windows-all
+sun/security/pkcs11/Signature/TestDSAKeyLength.java             windows-all
+sun/security/pkcs11/Signature/TestRSAKeyLength.java             windows-all
+sun/security/pkcs11/ec/ReadCertificates.java                    windows-all
+sun/security/pkcs11/ec/ReadPKCS12.java                          windows-all
+sun/security/pkcs11/ec/TestCurves.java                          windows-all
+sun/security/pkcs11/ec/TestECDH.java                            windows-all
+sun/security/pkcs11/ec/TestECDH2.java                           windows-all
+sun/security/pkcs11/ec/TestECDSA.java                           windows-all
+sun/security/pkcs11/ec/TestECDSA2.java                          windows-all
+sun/security/pkcs11/ec/TestECGenSpec.java                       windows-all
+sun/security/pkcs11/rsa/KeyWrap.java                            windows-all
+sun/security/pkcs11/rsa/TestCACerts.java                        windows-all
+sun/security/pkcs11/rsa/TestKeyFactory.java                     windows-all
+sun/security/pkcs11/rsa/TestKeyPairGenerator.java               windows-all
+sun/security/pkcs11/rsa/TestSignatures.java                     windows-all
+sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java            windows-all
+sun/security/pkcs11/tls/TestKeyMaterial.java                    windows-all
+sun/security/pkcs11/tls/TestLeadingZeroesP11.java               windows-all
+sun/security/pkcs11/tls/TestMasterSecret.java                   windows-all
+sun/security/pkcs11/tls/TestPRF.java                            windows-all
+sun/security/pkcs11/tls/TestPremaster.java                      windows-all
+
 ############################################################################
 
 # jdk_sound
diff --git a/jdk/test/java/util/BitSet/BitSetStreamTest.java b/jdk/test/java/util/BitSet/BitSetStreamTest.java
index 394f3ac..d4e2d8d 100644
--- a/jdk/test/java/util/BitSet/BitSetStreamTest.java
+++ b/jdk/test/java/util/BitSet/BitSetStreamTest.java
@@ -43,7 +43,7 @@
 /**
  * @test
  * @summary test BitSet stream
- * @bug 8012645
+ * @bug 8012645 8076442
  * @run testng BitSetStreamTest
  */
 public class BitSetStreamTest {
@@ -70,6 +70,7 @@
         { "step 5", IntStream.range(0, 255).map(f -> f * 5) },
         { "step 7", IntStream.range(0, 255).map(f -> f * 7) },
         { "1, 10, 100, 1000", IntStream.of(1, 10, 100, 1000) },
+        { "max int", IntStream.of(Integer.MAX_VALUE) },
         { "25 fibs", IntStream.generate(new Fibs()).limit(25) }
     };
 
@@ -106,6 +107,8 @@
         for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
             assertTrue(it.hasNext());
             assertEquals(it.nextInt(), i);
+            if (i == Integer.MAX_VALUE)
+                break; // or (i+1) would overflow
         }
         assertFalse(it.hasNext());
     }
diff --git a/jdk/test/java/util/zip/TestExtraTime.java b/jdk/test/java/util/zip/TestExtraTime.java
index 20d9e36..666121c 100644
--- a/jdk/test/java/util/zip/TestExtraTime.java
+++ b/jdk/test/java/util/zip/TestExtraTime.java
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4759491 6303183 7012868 8015666 8023713 8068790
+ * @bug 4759491 6303183 7012868 8015666 8023713 8068790 8076641
  * @summary Test ZOS and ZIS timestamp in extra field correctly
  */
 
@@ -40,7 +40,6 @@
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
 
-
 public class TestExtraTime {
 
     public static void main(String[] args) throws Throwable{
@@ -71,6 +70,7 @@
         }
 
         testNullHandling();
+        testTagOnlyHandling();
         testTimeConversions();
     }
 
@@ -208,4 +208,42 @@
             }
         }
     }
+
+    static void check(ZipEntry ze, byte[] extra) {
+        if (extra != null) {
+            byte[] extra1 = ze.getExtra();
+            if (extra1 == null || extra1.length < extra.length ||
+                !Arrays.equals(Arrays.copyOfRange(extra1,
+                                                  extra1.length - extra.length,
+                                                  extra1.length),
+                               extra)) {
+                throw new RuntimeException("Timestamp: storing extra field failed!");
+            }
+        }
+    }
+
+    static void testTagOnlyHandling() throws Throwable {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        byte[] extra = new byte[] { 0x0a, 0, 4, 0, 0, 0, 0, 0 };
+        try (ZipOutputStream zos = new ZipOutputStream(baos)) {
+            ZipEntry ze = new ZipEntry("TestExtraTime.java");
+            ze.setExtra(extra);
+            zos.putNextEntry(ze);
+            zos.write(new byte[] { 1,2 ,3, 4});
+        }
+        try (ZipInputStream zis = new ZipInputStream(
+                 new ByteArrayInputStream(baos.toByteArray()))) {
+            ZipEntry ze = zis.getNextEntry();
+            check(ze, extra);
+        }
+        Path zpath = Paths.get(System.getProperty("test.dir", "."),
+                               "TestExtraTime.zip");
+        Files.copy(new ByteArrayInputStream(baos.toByteArray()), zpath);
+        try (ZipFile zf = new ZipFile(zpath.toFile())) {
+            ZipEntry ze = zf.getEntry("TestExtraTime.java");
+            check(ze, extra);
+        } finally {
+            Files.delete(zpath);
+        }
+    }
 }
diff --git a/jdk/test/javax/crypto/Cipher/CipherInputStreamExceptions.java b/jdk/test/javax/crypto/Cipher/CipherInputStreamExceptions.java
new file mode 100644
index 0000000..783967a
--- /dev/null
+++ b/jdk/test/javax/crypto/Cipher/CipherInputStreamExceptions.java
@@ -0,0 +1,415 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8064546
+ * @summary Throw exceptions during reading but not closing of a
+ * CipherInputStream:
+ * - Make sure authenticated algorithms continue to throwing exceptions
+ *   when the authentication tag fails verification.
+ * - Make sure other algorithms do not throw exceptions when the stream
+ *   calls close() and only throw when read() errors.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.lang.Exception;
+import java.lang.RuntimeException;
+import java.lang.Throwable;
+import java.security.AlgorithmParameters;
+import javax.crypto.AEADBadTagException;
+import javax.crypto.Cipher;
+import javax.crypto.CipherInputStream;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import javax.crypto.spec.GCMParameterSpec;
+
+public class CipherInputStreamExceptions {
+
+    static SecretKeySpec key = new SecretKeySpec(new byte[16], "AES");
+    static GCMParameterSpec gcmspec = new GCMParameterSpec(128, new byte[16]);
+    static IvParameterSpec iv = new IvParameterSpec(new byte[16]);
+    static boolean failure = false;
+
+    /* Full read stream, check that getMoreData() is throwing an exception
+     * This test
+     *   1) Encrypt 100 bytes with AES/GCM/PKCS5Padding
+     *   2) Changes the last byte to invalidate the authetication tag.
+     *   3) Fully reads CipherInputStream to decrypt the message and closes
+     */
+
+    static void gcm_AEADBadTag() throws Exception {
+        Cipher c;
+        byte[] read = new byte[200];
+
+        System.out.println("Running gcm_AEADBadTag");
+
+        // Encrypt 100 bytes with AES/GCM/PKCS5Padding
+        byte[] ct = encryptedText("GCM", 100);
+        // Corrupt the encrypted message
+        ct = corruptGCM(ct);
+        // Create stream for decryption
+        CipherInputStream in = getStream("GCM", ct);
+
+        try {
+            int size = in.read(read);
+            throw new RuntimeException("Fail: CipherInputStream.read() " +
+                    "returned " + size + " and didn't throw an exception.");
+        } catch (IOException e) {
+            Throwable ec = e.getCause();
+            if (ec instanceof AEADBadTagException) {
+                System.out.println("  Pass.");
+            } else {
+                System.out.println("  Fail: " + ec.getMessage());
+                throw new RuntimeException(ec);
+            }
+        } finally {
+            in.close();
+        }
+    }
+
+    /* Short read stream,
+     * This test
+     *   1) Encrypt 100 bytes with AES/GCM/PKCS5Padding
+     *   2) Reads 100 bytes from stream to decrypt the message and closes
+     *   3) Make sure no value is returned by read()
+     *   4) Make sure no exception is thrown
+     */
+
+    static void gcm_shortReadAEAD() throws Exception {
+        Cipher c;
+        byte[] read = new byte[100];
+
+        System.out.println("Running gcm_shortReadAEAD");
+
+        byte[] pt = new byte[600];
+        pt[0] = 1;
+        // Encrypt provided 600 bytes with AES/GCM/PKCS5Padding
+        byte[] ct = encryptedText("GCM", pt);
+        // Create stream for decryption
+        CipherInputStream in = getStream("GCM", ct);
+
+        int size = 0;
+        try {
+            size = in.read(read);
+            in.close();
+            if (read.length != 100) {
+                throw new RuntimeException("Fail: read size = " + read.length +
+                        "should be 100.");
+            }
+            if (read[0] != 1) {
+                throw new RuntimeException("Fail: The decrypted text does " +
+                        "not match the plaintext: '" + read[0] +"'");
+            }
+        } catch (IOException e) {
+            System.out.println("  Fail: " + e.getMessage());
+            throw new RuntimeException(e.getCause());
+        }
+        System.out.println("  Pass.");
+    }
+
+    /*
+     * Verify doFinal() exception is suppressed when input stream is not
+     * read before it is closed.
+     * This test:
+     *   1) Encrypt 100 bytes with AES/GCM/PKCS5Padding
+     *   2) Changes the last byte to invalidate the authetication tag.
+     *   3) Opens a CipherInputStream and the closes it. Never reads from it.
+     *
+     * There should be no exception thrown.
+     */
+    static void gcm_suppressUnreadCorrupt() throws Exception {
+        Cipher c;
+        byte[] read = new byte[200];
+
+        System.out.println("Running supressUnreadCorrupt test");
+
+        // Encrypt 100 bytes with AES/GCM/PKCS5Padding
+        byte[] ct = encryptedText("GCM", 100);
+        // Corrupt the encrypted message
+        ct = corruptGCM(ct);
+        // Create stream for decryption
+        CipherInputStream in = getStream("GCM", ct);
+
+        try {
+            in.close();
+            System.out.println("  Pass.");
+        } catch (IOException e) {
+            System.out.println("  Fail: " + e.getMessage());
+            throw new RuntimeException(e.getCause());
+        }
+    }
+
+    /*
+     * Verify noexception thrown when 1 byte is read from a GCM stream
+     * and then closed
+     * This test:
+     *   1) Encrypt 100 bytes with AES/GCM/PKCS5Padding
+     *   2) Read one byte from the stream, expect no exception thrown.
+     *   4) Close stream,expect no exception thrown.
+     */
+    static void gcm_oneReadByte() throws Exception {
+
+        System.out.println("Running gcm_oneReadByte test");
+
+        // Encrypt 100 bytes with AES/GCM/PKCS5Padding
+        byte[] ct = encryptedText("GCM", 100);
+        // Create stream for decryption
+        CipherInputStream in = getStream("GCM", ct);
+
+        try {
+            in.read();
+            System.out.println("  Pass.");
+        } catch (Exception e) {
+            System.out.println("  Fail: " + e.getMessage());
+            throw new RuntimeException(e.getCause());
+        }
+    }
+
+    /*
+     * Verify exception thrown when 1 byte is read from a corrupted GCM stream
+     * and then closed
+     * This test:
+     *   1) Encrypt 100 bytes with AES/GCM/PKCS5Padding
+     *   2) Changes the last byte to invalidate the authetication tag.
+     *   3) Read one byte from the stream, expect exception thrown.
+     *   4) Close stream,expect no exception thrown.
+     */
+    static void gcm_oneReadByteCorrupt() throws Exception {
+
+        System.out.println("Running gcm_oneReadByteCorrupt test");
+
+        // Encrypt 100 bytes with AES/GCM/PKCS5Padding
+        byte[] ct = encryptedText("GCM", 100);
+        // Corrupt the encrypted message
+        ct = corruptGCM(ct);
+        // Create stream for decryption
+        CipherInputStream in = getStream("GCM", ct);
+
+        try {
+            in.read();
+            System.out.println("  Fail. No exception thrown.");
+        } catch (IOException e) {
+            Throwable ec = e.getCause();
+            if (ec instanceof AEADBadTagException) {
+                System.out.println("  Pass.");
+            } else {
+                System.out.println("  Fail: " + ec.getMessage());
+                throw new RuntimeException(ec);
+            }
+        }
+    }
+
+    /* Check that close() does not throw an exception with full message in
+     * CipherInputStream's ibuffer.
+     * This test:
+     *   1) Encrypts a 97 byte message with AES/CBC/PKCS5Padding
+     *   2) Create a stream that sends 96 bytes.
+     *   3) Read stream once,
+     *   4) Close and expect no exception
+     */
+
+    static void cbc_shortStream() throws Exception {
+        Cipher c;
+        AlgorithmParameters params;
+        byte[] read = new byte[200];
+
+        System.out.println("Running cbc_shortStream");
+
+        // Encrypt 97 byte with AES/CBC/PKCS5Padding
+        byte[] ct = encryptedText("CBC", 97);
+        // Create stream with only 96 bytes of encrypted data
+        CipherInputStream in = getStream("CBC", ct, 96);
+
+        try {
+            int size = in.read(read);
+            in.close();
+            if (size != 80) {
+                throw new RuntimeException("Fail: CipherInputStream.read() " +
+                        "returned " + size + ". Should have been 80");
+            }
+            System.out.println("  Pass.");
+        } catch (IOException e) {
+            System.out.println("  Fail:  " + e.getMessage());
+            throw new RuntimeException(e.getCause());
+        }
+    }
+
+    /* Check that close() does not throw an exception when the whole message is
+     * inside the internal buffer (ibuffer) in CipherInputStream and we read
+     * one byte and close the stream.
+     * This test:
+     *   1) Encrypts a 400 byte message with AES/CBC/PKCS5Padding
+     *   2) Read one byte from the stream
+     *   3) Close and expect no exception
+     */
+
+    static void cbc_shortRead400() throws Exception {
+        System.out.println("Running cbc_shortRead400");
+
+        // Encrypt 400 byte with AES/CBC/PKCS5Padding
+        byte[] ct = encryptedText("CBC", 400);
+        // Create stream with encrypted data
+        CipherInputStream in = getStream("CBC", ct);
+
+        try {
+            in.read();
+            in.close();
+            System.out.println("  Pass.");
+        } catch (IOException e) {
+            System.out.println("  Fail:  " + e.getMessage());
+            throw new RuntimeException(e.getCause());
+        }
+    }
+
+    /* Check that close() does not throw an exception when the  inside the
+     * internal buffer (ibuffer) in CipherInputStream does not contain the
+     * whole message.
+     * This test:
+     *   1) Encrypts a 600 byte message with AES/CBC/PKCS5Padding
+     *   2) Read one byte from the stream
+     *   3) Close and expect no exception
+     */
+
+    static void cbc_shortRead600() throws Exception {
+        System.out.println("Running cbc_shortRead600");
+
+        // Encrypt 600 byte with AES/CBC/PKCS5Padding
+        byte[] ct = encryptedText("CBC", 600);
+        // Create stream with encrypted data
+        CipherInputStream in = getStream("CBC", ct);
+
+        try {
+            in.read();
+            in.close();
+            System.out.println("  Pass.");
+        } catch (IOException e) {
+            System.out.println("  Fail:  " + e.getMessage());
+            throw new RuntimeException(e.getCause());
+        }
+    }
+
+    /* Check that exception is thrown when message is fully read
+     * This test:
+     *   1) Encrypts a 96 byte message with AES/CBC/PKCS5Padding
+     *   2) Create a stream that sends 95 bytes.
+     *   3) Read stream to the end
+     *   4) Expect IllegalBlockSizeException thrown
+     */
+
+    static void cbc_readAllIllegalBlockSize() throws Exception {
+        byte[] read = new byte[200];
+
+        System.out.println("Running cbc_readAllIllegalBlockSize test");
+
+        // Encrypt 96 byte with AES/CBC/PKCS5Padding
+        byte[] ct = encryptedText("CBC", 96);
+        // Create a stream with only 95 bytes of encrypted data
+        CipherInputStream in = getStream("CBC", ct, 95);
+
+        try {
+            int s, size = 0;
+            while ((s = in.read(read)) != -1) {
+                size += s;
+            }
+            throw new RuntimeException("Fail: No IllegalBlockSizeException. " +
+                    "CipherInputStream.read() returned " + size);
+
+        } catch (IOException e) {
+            Throwable ec = e.getCause();
+            if (ec instanceof IllegalBlockSizeException) {
+                System.out.println("  Pass.");
+            } else {
+                System.out.println("  Fail: " + ec.getMessage());
+                throw new RuntimeException(ec);
+            }
+        }
+    }
+
+    /* Generic method to create encrypted text */
+    static byte[] encryptedText(String mode, int length) throws Exception{
+        return encryptedText(mode, new byte[length]);
+    }
+
+    /* Generic method to create encrypted text */
+    static byte[] encryptedText(String mode, byte[] pt) throws Exception{
+        Cipher c;
+        if (mode.compareTo("GCM") == 0) {
+            c = Cipher.getInstance("AES/GCM/PKCS5Padding", "SunJCE");
+            c.init(Cipher.ENCRYPT_MODE, key, gcmspec);
+        } else if (mode.compareTo("CBC") == 0) {
+            c = Cipher.getInstance("AES/CBC/PKCS5Padding", "SunJCE");
+            c.init(Cipher.ENCRYPT_MODE, key, iv);
+        } else {
+            return null;
+        }
+
+        return c.doFinal(pt);
+    }
+
+    /* Generic method to get a properly setup CipherInputStream */
+    static CipherInputStream getStream(String mode, byte[] ct) throws Exception {
+        return getStream(mode, ct, ct.length);
+    }
+
+    /* Generic method to get a properly setup CipherInputStream */
+    static CipherInputStream getStream(String mode, byte[] ct, int length)
+            throws Exception {
+        Cipher c;
+
+        if (mode.compareTo("GCM") == 0) {
+            c = Cipher.getInstance("AES/GCM/PKCS5Padding", "SunJCE");
+            c.init(Cipher.DECRYPT_MODE, key, gcmspec);
+        } else if (mode.compareTo("CBC") == 0) {
+            c = Cipher.getInstance("AES/CBC/PKCS5Padding", "SunJCE");
+            c.init(Cipher.DECRYPT_MODE, key, iv);
+        } else {
+            return null;
+        }
+
+        return new CipherInputStream(new ByteArrayInputStream(ct, 0, length), c);
+
+    }
+
+    /* Generic method for corrupting a GCM message.  Change the last
+     * byte on of the authentication tag
+     */
+    static byte[] corruptGCM(byte[] ct) {
+        ct[ct.length - 1] = (byte) (ct[ct.length - 1] + 1);
+        return ct;
+    }
+
+    public static void main(String[] args) throws Exception {
+        gcm_AEADBadTag();
+        gcm_shortReadAEAD();
+        gcm_suppressUnreadCorrupt();
+        gcm_oneReadByte();
+        gcm_oneReadByteCorrupt();
+        cbc_shortStream();
+        cbc_shortRead400();
+        cbc_shortRead600();
+        cbc_readAllIllegalBlockSize();
+    }
+}
diff --git a/jdk/test/javax/security/auth/spi/FirstLoginModule.java b/jdk/test/javax/security/auth/spi/FirstLoginModule.java
new file mode 100644
index 0000000..60112ae
--- /dev/null
+++ b/jdk/test/javax/security/auth/spi/FirstLoginModule.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+import java.util.Map;
+
+public class FirstLoginModule implements LoginModule {
+
+    @Override
+    public void initialize(Subject subject, CallbackHandler callbackHandler,
+            Map<String, ?> sharedState, Map<String, ?> options) {
+        // Nothing
+    }
+
+    @Override
+    public boolean login() throws LoginException {
+        return true;
+    }
+
+    @Override
+    public boolean commit() throws LoginException {
+        return true;
+    }
+
+    @Override
+    public boolean abort() throws LoginException {
+        return true;
+    }
+
+    @Override
+    public boolean logout() throws LoginException {
+        return true;
+    }
+}
diff --git a/jdk/test/javax/security/auth/spi/Loader.java b/jdk/test/javax/security/auth/spi/Loader.java
new file mode 100644
index 0000000..e2bac97d
--- /dev/null
+++ b/jdk/test/javax/security/auth/spi/Loader.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.security.auth.login.LoginContext;
+import java.io.File;
+
+/*
+ * @test
+ * @bug 8047789
+ * @summary auth.login.LoginContext needs to be updated to work with modules
+ * @build FirstLoginModule SecondLoginModule
+ * @run main/othervm Loader
+ */
+public class Loader {
+
+    public static void main(String[] args) throws Exception {
+
+        System.setProperty("java.security.auth.login.config",
+                new File(System.getProperty("test.src"), "sl.conf").toString());
+        LoginContext lc = new LoginContext("me");
+
+        if (SecondLoginModule.isLoaded) {
+            throw new Exception();
+        }
+
+        lc.login();
+
+        // Although only FirstLoginModule is specified in the JAAS login
+        // config file, LoginContext will first create all LoginModule
+        // implementations that are registered as services, which include
+        // SecondLoginModule.
+        if (!SecondLoginModule.isLoaded) {
+            throw new Exception();
+        }
+    }
+}
diff --git a/jdk/test/javax/security/auth/spi/META-INF/services/javax.security.auth.spi.LoginModule b/jdk/test/javax/security/auth/spi/META-INF/services/javax.security.auth.spi.LoginModule
new file mode 100644
index 0000000..b618924
--- /dev/null
+++ b/jdk/test/javax/security/auth/spi/META-INF/services/javax.security.auth.spi.LoginModule
@@ -0,0 +1 @@
+SecondLoginModule
diff --git a/jdk/test/javax/security/auth/spi/SecondLoginModule.java b/jdk/test/javax/security/auth/spi/SecondLoginModule.java
new file mode 100644
index 0000000..c6c8587
--- /dev/null
+++ b/jdk/test/javax/security/auth/spi/SecondLoginModule.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+import java.util.Map;
+
+public class SecondLoginModule implements LoginModule {
+
+    public static boolean isLoaded;
+
+    public SecondLoginModule() {
+        isLoaded = true;
+    }
+
+    @Override
+    public void initialize(Subject subject, CallbackHandler callbackHandler,
+            Map<String, ?> sharedState, Map<String, ?> options) {
+        // Nothing
+    }
+
+    @Override
+    public boolean login() throws LoginException {
+        return true;
+    }
+
+    @Override
+    public boolean commit() throws LoginException {
+        return true;
+    }
+
+    @Override
+    public boolean abort() throws LoginException {
+        return true;
+    }
+
+    @Override
+    public boolean logout() throws LoginException {
+        return true;
+    }
+}
diff --git a/jdk/test/javax/security/auth/spi/sl.conf b/jdk/test/javax/security/auth/spi/sl.conf
new file mode 100644
index 0000000..e14400e
--- /dev/null
+++ b/jdk/test/javax/security/auth/spi/sl.conf
@@ -0,0 +1,3 @@
+me {
+   FirstLoginModule required;
+};
diff --git a/jdk/test/jdk/internal/jimage/JImageTest.java b/jdk/test/jdk/internal/jimage/JImageTest.java
new file mode 100644
index 0000000..51c0bfd
--- /dev/null
+++ b/jdk/test/jdk/internal/jimage/JImageTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @summary Test to see if jimage tool extracts and recreates correctly.
+ * @run main/timeout=360 JImageTest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import jdk.testlibrary.ProcessTools;
+
+
+/**
+ * Basic test for jimage tool.
+ */
+public class JImageTest {
+    private static void jimage(String... jimageArgs) throws Exception {
+        ArrayList<String> args = new ArrayList<>();
+        args.add("-ms8m");
+        args.add("jdk.tools.jimage.Main");
+        args.addAll(Arrays.asList(jimageArgs));
+
+        ProcessBuilder builder = ProcessTools.createJavaProcessBuilder(args.toArray(new String[args.size()]));
+        int res = builder.inheritIO().start().waitFor();
+
+        if (res != 0) {
+            throw new RuntimeException("JImageTest tool FAILED");
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        final String JAVA_HOME = System.getProperty("java.home");
+        Path jimagePath = Paths.get(JAVA_HOME, "bin", "jimage");
+        Path bootimagePath = Paths.get(JAVA_HOME, "lib", "modules", "bootmodules.jimage");
+
+        if (Files.exists(jimagePath) && Files.exists(bootimagePath)) {
+            String jimage = jimagePath.toAbsolutePath().toString();
+            String bootimage = bootimagePath.toAbsolutePath().toString();
+            String extractDir = Paths.get(".", "extract").toAbsolutePath().toString();
+            String recreateImage = Paths.get(".", "recreate.jimage").toAbsolutePath().toString();
+
+            jimage("extract", "--dir", extractDir, bootimage);
+            jimage("recreate", "--dir", extractDir, recreateImage);
+
+            System.out.println("Test successful");
+         } else {
+            System.out.println("Test skipped, no module image");
+         }
+
+    }
+}
diff --git a/langtools/.hgtags b/langtools/.hgtags
index 3793d46..c7a5d99 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -301,3 +301,4 @@
 5ee7bba6ef41447f921184e8522da36734aec089 jdk9-b56
 ec977a00cecbf0007b0fa26c7af2852d57a79cad jdk9-b57
 07ce89fec30165a2f1212047bd23b30086ed1e74 jdk9-b58
+a598534d277e170a0bbf177bd54d9d179245532b jdk9-b59
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java
index 35174e9..ddd7a88 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java
@@ -696,7 +696,8 @@
     @DefinedBy(Api.COMPILER_TREE)
     public TypeMirror getTypeMirror(TreePath path) {
         Tree t = path.getLeaf();
-        return ((JCTree)t).type;
+        Type ty = ((JCTree)t).type;
+        return ty == null ? null : ty.stripMetadataIfNeeded();
     }
 
     @DefinedBy(Api.COMPILER_TREE)
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
index 4080225..a2abf1b 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,8 @@
 
 package com.sun.tools.javac.code;
 
-import java.io.*;
+import java.io.IOException;
+import java.io.File;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Map;
@@ -38,16 +39,15 @@
 import javax.tools.StandardJavaFileManager;
 
 import com.sun.tools.javac.code.Scope.WriteableScope;
-import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.Completer;
 import com.sun.tools.javac.code.Symbol.CompletionFailure;
 import com.sun.tools.javac.code.Symbol.PackageSymbol;
 import com.sun.tools.javac.code.Symbol.TypeSymbol;
 import com.sun.tools.javac.comp.Annotate;
+import com.sun.tools.javac.comp.Enter;
 import com.sun.tools.javac.file.JRTIndex;
 import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
 import com.sun.tools.javac.jvm.ClassReader;
 import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.javac.util.*;
@@ -75,7 +75,7 @@
 
     ClassReader reader;
 
-    Annotate annotate;
+    private final Annotate annotate;
 
     /** Switch: verbose output.
      */
@@ -272,18 +272,13 @@
             try {
                 ClassSymbol c = (ClassSymbol) sym;
                 dependencies.push(c, CompletionCause.CLASS_READER);
+                annotate.blockAnnotations();
                 c.members_field = new Scope.ErrorScope(c); // make sure it's always defined
-                annotate.enterStart();
-                try {
-                    completeOwners(c.owner);
-                    completeEnclosing(c);
-                } finally {
-                    // The flush needs to happen only after annotations
-                    // are filled in.
-                    annotate.enterDoneWithoutFlush();
-                }
+                completeOwners(c.owner);
+                completeEnclosing(c);
                 fillIn(c);
             } finally {
+                annotate.unblockAnnotationsNoFlush();
                 dependencies.pop();
             }
         } else if (sym.kind == PCK) {
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java
index e4b88fa..d19cda6 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,11 @@
 import javax.lang.model.element.*;
 import javax.tools.JavaFileObject;
 
+import com.sun.tools.javac.code.Attribute.Compound;
+import com.sun.tools.javac.code.TypeAnnotations.AnnotationType;
+import com.sun.tools.javac.code.TypeMetadata.Entry;
+import com.sun.tools.javac.comp.Annotate.AnnotationTypeCompleter;
+import com.sun.tools.javac.comp.Annotate.AnnotationTypeMetadata;
 import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.comp.Attr;
@@ -738,6 +743,13 @@
             return list;
         }
 
+        public AnnotationTypeMetadata getAnnotationTypeMetadata() {
+            Assert.error("Only on ClassSymbol");
+            return null; //unreachable
+        }
+
+        public boolean isAnnotationType() { return false; }
+
         @Override
         public <R, P> R accept(Symbol.Visitor<R, P> v, P p) {
             return v.visitTypeSymbol(this, p);
@@ -958,6 +970,9 @@
          */
         public Pool pool;
 
+        /** the annotation metadata attached to this class */
+        private AnnotationTypeMetadata annotationTypeMetadata;
+
         public ClassSymbol(long flags, Name name, Type type, Symbol owner) {
             super(TYP, flags, name, type, owner);
             this.members_field = null;
@@ -966,6 +981,7 @@
             this.sourcefile = null;
             this.classfile = null;
             this.pool = null;
+            this.annotationTypeMetadata = AnnotationTypeMetadata.notAnAnnotationType();
         }
 
         public ClassSymbol(long flags, Name name, Symbol owner) {
@@ -1202,8 +1218,24 @@
                 t.all_interfaces_field = null;
             }
             metadata = null;
+            annotationTypeMetadata = AnnotationTypeMetadata.notAnAnnotationType();
         }
 
+        @Override
+        public AnnotationTypeMetadata getAnnotationTypeMetadata() {
+            return annotationTypeMetadata;
+        }
+
+        @Override
+        public boolean isAnnotationType() {
+            return (flags_field & Flags.ANNOTATION) != 0;
+        }
+
+        public void setAnnotationTypeMetadata(AnnotationTypeMetadata a) {
+            Assert.checkNonNull(a);
+            Assert.check(!annotationTypeMetadata.isMetadataForAnnotationType());
+            this.annotationTypeMetadata = a;
+        }
     }
 
 
@@ -1360,7 +1392,7 @@
         /** The names of the parameters */
         public List<Name> savedParameterNames;
 
-        /** For an attribute field accessor, its default value if any.
+        /** For an annotation type element, its default value if any.
          *  The value is null if none appeared in the method
          *  declaration.
          */
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java
index e2d3208..ad9e629 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
 import javax.lang.model.type.*;
 
 import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.Types.MapVisitor;
+import com.sun.tools.javac.code.TypeMetadata.Entry;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.DefinedBy.Api;
 import static com.sun.tools.javac.code.BoundKind.*;
@@ -87,11 +87,10 @@
         return metadata;
     }
 
-    public TypeMetadata.Element getMetadataOfKind(final TypeMetadata.Element.Kind kind) {
+    public Entry getMetadataOfKind(final Entry.Kind kind) {
         return metadata != null ? metadata.get(kind) : null;
     }
 
-
     /** Constant type: no type at all. */
     public static final JCNoType noType = new JCNoType() {
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
@@ -238,7 +237,12 @@
             List<Type> typarams = t.getTypeArguments();
             List<Type> typarams1 = visit(typarams, s);
             if (outer1 == outer && typarams1 == typarams) return t;
-            else return new ClassType(outer1, typarams1, t.tsym, t.metadata);
+            else return new ClassType(outer1, typarams1, t.tsym, t.metadata) {
+                @Override
+                protected boolean needsStripping() {
+                    return true;
+                }
+            };
         }
 
         @Override
@@ -249,7 +253,12 @@
             if (t == wt.type)
                 return wt;
             else
-                return new WildcardType(t, wt.kind, wt.tsym, wt.bound, wt.metadata);
+                return new WildcardType(t, wt.kind, wt.tsym, wt.bound, wt.metadata) {
+                    @Override
+                    protected boolean needsStripping() {
+                        return true;
+                    }
+                };
         }
 
         @Override
@@ -257,7 +266,12 @@
             Type elemtype = t.elemtype;
             Type elemtype1 = visit(elemtype, s);
             if (elemtype1 == elemtype) return t;
-            else return new ArrayType(elemtype1, t.tsym, t.metadata);
+            else return new ArrayType(elemtype1, t.tsym, t.metadata) {
+                @Override
+                protected boolean needsStripping() {
+                    return true;
+                }
+            };
         }
 
         @Override
@@ -271,7 +285,12 @@
             if (argtypes1 == argtypes &&
                 restype1 == restype &&
                 thrown1 == thrown) return t;
-            else return new MethodType(argtypes1, restype1, thrown1, t.tsym);
+            else return new MethodType(argtypes1, restype1, thrown1, t.tsym) {
+                @Override
+                protected boolean needsStripping() {
+                    return true;
+                }
+            };
         }
 
         @Override
@@ -313,38 +332,78 @@
     }
 
     /**
-     * Create a new type with exactly the given metadata.  The
-     * argument is guaranteed to always be non-empty, and should have
-     * already been copied/combined with the current type's metadata.
-     * This is used internally by other methods.
-     *
+     * Returns the original version of this type, before metadata were added. This routine is meant
+     * for internal use only (i.e. {@link Type#equalsIgnoreMetadata(Type)}, {@link Type#stripMetadata});
+     * it should not be used outside this class.
      */
-    public abstract Type clone(TypeMetadata md);
-
-    public Type combineMetadata(final TypeMetadata.Element md) {
-        return clone(metadata.combine(md));
+    protected Type typeNoMetadata() {
+        return metadata == TypeMetadata.EMPTY ? this : baseType();
     }
 
+    /**
+     * Create a new copy of this type but with the specified TypeMetadata.
+     */
+    public abstract Type cloneWithMetadata(TypeMetadata metadata);
+
+    /**
+     * Does this type require annotation stripping for API clients?
+     */
+    protected boolean needsStripping() {
+        return false;
+    }
+
+    /**
+     * Strip all metadata associated with this type - this could return a new clone of the type.
+     * This routine is only used to present the correct annotated types back to the users when types
+     * are accessed through compiler APIs; it should not be used anywhere in the compiler internals
+     * as doing so might result in performance penalties.
+     */
+    public Type stripMetadataIfNeeded() {
+        return needsStripping() ?
+                accept(stripMetadata, null) :
+                this;
+    }
+    //where
+        private final static TypeMapping<Void> stripMetadata = new TypeMapping<Void>() {
+            @Override
+            public Type visitClassType(ClassType t, Void aVoid) {
+                return super.visitClassType((ClassType)t.typeNoMetadata(), aVoid);
+            }
+
+            @Override
+            public Type visitArrayType(ArrayType t, Void aVoid) {
+                return super.visitArrayType((ArrayType)t.typeNoMetadata(), aVoid);
+            }
+
+            @Override
+            public Type visitTypeVar(TypeVar t, Void aVoid) {
+                return super.visitTypeVar((TypeVar)t.typeNoMetadata(), aVoid);
+            }
+
+            @Override
+            public Type visitWildcardType(WildcardType wt, Void aVoid) {
+                return super.visitWildcardType((WildcardType)wt.typeNoMetadata(), aVoid);
+            }
+        };
+
     public Type annotatedType(final List<Attribute.TypeCompound> annos) {
-        final TypeMetadata.Element annoMetadata = new TypeMetadata.Annotations(annos);
-        return combineMetadata(annoMetadata);
+        final Entry annoMetadata = new TypeMetadata.Annotations(annos);
+        return cloneWithMetadata(metadata.combine(annoMetadata));
     }
 
     public boolean isAnnotated() {
         final TypeMetadata.Annotations metadata =
-            (TypeMetadata.Annotations)getMetadataOfKind(TypeMetadata.Element.Kind.ANNOTATIONS);
+            (TypeMetadata.Annotations)getMetadataOfKind(Entry.Kind.ANNOTATIONS);
 
         return null != metadata && !metadata.getAnnotations().isEmpty();
     }
 
-    private static final List<Attribute.TypeCompound> noAnnotations = List.nil();
-
     @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public List<Attribute.TypeCompound> getAnnotationMirrors() {
         final TypeMetadata.Annotations metadata =
-            (TypeMetadata.Annotations)getMetadataOfKind(TypeMetadata.Element.Kind.ANNOTATIONS);
+            (TypeMetadata.Annotations)getMetadataOfKind(Entry.Kind.ANNOTATIONS);
 
-        return metadata == null ? noAnnotations : metadata.getAnnotations();
+        return metadata == null ? List.nil() : metadata.getAnnotations();
     }
 
 
@@ -431,13 +490,15 @@
     }
 
     /**
-     * This method is analogous to isSameType, but weaker, since we
-     * never complete classes. Where isSameType would complete a
-     * class, equals assumes that the two types are different.
+     * Override this method with care. For most Type instances this should behave as ==.
      */
     @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean equals(Object t) {
-        return super.equals(t);
+        return this == t;
+    }
+
+    public boolean equalsIgnoreMetadata(Type t) {
+        return typeNoMetadata().equals(t.typeNoMetadata());
     }
 
     @Override @DefinedBy(Api.LANGUAGE_MODEL)
@@ -547,7 +608,7 @@
      * Does this type contain occurrences of type t?
      */
     public boolean contains(Type t) {
-        return t == this;
+        return t.equalsIgnoreMetadata(this);
     }
 
     public static boolean contains(List<Type> ts, Type t) {
@@ -615,19 +676,21 @@
         TypeTag tag;
 
         public JCPrimitiveType(TypeTag tag, TypeSymbol tsym) {
-            this(tag, tsym, TypeMetadata.empty);
+            this(tag, tsym, TypeMetadata.EMPTY);
         }
 
-        private JCPrimitiveType(TypeTag tag, TypeSymbol tsym,
-                                TypeMetadata metadata) {
+        private JCPrimitiveType(TypeTag tag, TypeSymbol tsym, TypeMetadata metadata) {
             super(tsym, metadata);
             this.tag = tag;
             Assert.check(tag.isPrimitive);
         }
 
         @Override
-        public JCPrimitiveType clone(TypeMetadata md) {
-            return new JCPrimitiveType(tag, tsym, md);
+        public JCPrimitiveType cloneWithMetadata(TypeMetadata md) {
+            return new JCPrimitiveType(tag, tsym, md) {
+                @Override
+                public Type baseType() { return JCPrimitiveType.this.baseType(); }
+            };
         }
 
         @Override
@@ -740,7 +803,7 @@
         }
 
         public WildcardType(Type type, BoundKind kind, TypeSymbol tsym) {
-            this(type, kind, tsym, null, TypeMetadata.empty);
+            this(type, kind, tsym, null, TypeMetadata.EMPTY);
         }
 
         public WildcardType(Type type, BoundKind kind, TypeSymbol tsym,
@@ -750,7 +813,7 @@
 
         public WildcardType(Type type, BoundKind kind, TypeSymbol tsym,
                             TypeVar bound) {
-            this(type, kind, tsym, bound, TypeMetadata.empty);
+            this(type, kind, tsym, bound, TypeMetadata.EMPTY);
         }
 
         public WildcardType(Type type, BoundKind kind, TypeSymbol tsym,
@@ -762,8 +825,11 @@
         }
 
         @Override
-        public WildcardType clone(TypeMetadata md) {
-            return new WildcardType(type, kind, tsym, bound, md);
+        public WildcardType cloneWithMetadata(TypeMetadata md) {
+            return new WildcardType(type, kind, tsym, bound, md) {
+                @Override
+                public Type baseType() { return WildcardType.this.baseType(); }
+            };
         }
 
         @Override
@@ -883,7 +949,7 @@
         public List<Type> all_interfaces_field;
 
         public ClassType(Type outer, List<Type> typarams, TypeSymbol tsym) {
-            this(outer, typarams, tsym, TypeMetadata.empty);
+            this(outer, typarams, tsym, TypeMetadata.EMPTY);
         }
 
         public ClassType(Type outer, List<Type> typarams, TypeSymbol tsym,
@@ -897,13 +963,11 @@
         }
 
         @Override
-        public ClassType clone(TypeMetadata md) {
-            final ClassType out =
-                new ClassType(outer_field, typarams_field, tsym, md);
-            out.allparams_field = allparams_field;
-            out.supertype_field = supertype_field;
-            out.interfaces_field = interfaces_field;
-            return out;
+        public ClassType cloneWithMetadata(TypeMetadata md) {
+            return new ClassType(outer_field, typarams_field, tsym, md) {
+                @Override
+                public Type baseType() { return ClassType.this.baseType(); }
+            };
         }
 
         @Override
@@ -935,14 +999,16 @@
         @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             StringBuilder buf = new StringBuilder();
-            appendAnnotationsString(buf);
             if (getEnclosingType().hasTag(CLASS) && tsym.owner.kind == TYP) {
                 buf.append(getEnclosingType().toString());
                 buf.append(".");
+                appendAnnotationsString(buf);
                 buf.append(className(tsym, false));
             } else {
+                appendAnnotationsString(buf);
                 buf.append(className(tsym, true));
             }
+
             if (getTypeArguments().nonEmpty()) {
                 buf.append('<');
                 buf.append(getTypeArguments().toString());
@@ -1050,7 +1116,7 @@
 
         public boolean contains(Type elem) {
             return
-                elem == this
+                elem.equalsIgnoreMetadata(this)
                 || (isParameterized()
                     && (getEnclosingType().contains(elem) || contains(getTypeArguments(), elem)))
                 || (isCompound()
@@ -1073,10 +1139,6 @@
     }
 
     public static class ErasedClassType extends ClassType {
-        public ErasedClassType(Type outer, TypeSymbol tsym) {
-            super(outer, List.<Type>nil(), tsym);
-        }
-
         public ErasedClassType(Type outer, TypeSymbol tsym,
                                TypeMetadata metadata) {
             super(outer, List.<Type>nil(), tsym, metadata);
@@ -1104,7 +1166,7 @@
         }
 
         @Override
-        public UnionClassType clone(TypeMetadata md) {
+        public UnionClassType cloneWithMetadata(TypeMetadata md) {
             throw new AssertionError("Cannot add metadata to a union type");
         }
 
@@ -1155,7 +1217,7 @@
         }
 
         @Override
-        public IntersectionClassType clone(TypeMetadata md) {
+        public IntersectionClassType cloneWithMetadata(TypeMetadata md) {
             throw new AssertionError("Cannot add metadata to an intersection type");
         }
 
@@ -1196,7 +1258,7 @@
         public Type elemtype;
 
         public ArrayType(Type elemtype, TypeSymbol arrayClass) {
-            this(elemtype, arrayClass, TypeMetadata.empty);
+            this(elemtype, arrayClass, TypeMetadata.EMPTY);
         }
 
         public ArrayType(Type elemtype, TypeSymbol arrayClass,
@@ -1205,9 +1267,18 @@
             this.elemtype = elemtype;
         }
 
+        public ArrayType(ArrayType that) {
+            //note: type metadata is deliberately shared here, as we want side-effects from annotation
+            //processing to flow from original array to the cloned array.
+            this(that.elemtype, that.tsym, that.getMetadata());
+        }
+
         @Override
-        public ArrayType clone(TypeMetadata md) {
-            return new ArrayType(elemtype, tsym, md);
+        public ArrayType cloneWithMetadata(TypeMetadata md) {
+            return new ArrayType(elemtype, tsym, md) {
+                @Override
+                public Type baseType() { return ArrayType.this.baseType(); }
+            };
         }
 
         @Override
@@ -1228,12 +1299,15 @@
             return sb.toString();
         }
 
-        @DefinedBy(Api.LANGUAGE_MODEL)
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public boolean equals(Object obj) {
-            return
-                this == obj ||
-                (obj instanceof ArrayType &&
-                 this.elemtype.equals(((ArrayType)obj).elemtype));
+            if (obj instanceof ArrayType) {
+                ArrayType that = (ArrayType)obj;
+                return this == that ||
+                        elemtype.equals(that.elemtype);
+            }
+
+            return false;
         }
 
         @DefinedBy(Api.LANGUAGE_MODEL)
@@ -1279,7 +1353,7 @@
         }
 
         public boolean contains(Type elem) {
-            return elem == this || elemtype.contains(elem);
+            return elem.equalsIgnoreMetadata(this) || elemtype.contains(elem);
         }
 
         public void complete() {
@@ -1318,14 +1392,14 @@
                           TypeSymbol methodClass) {
             // Presently no way to refer to a method type directly, so
             // we cannot put type annotations on it.
-            super(methodClass, TypeMetadata.empty);
+            super(methodClass, TypeMetadata.EMPTY);
             this.argtypes = argtypes;
             this.restype = restype;
             this.thrown = thrown;
         }
 
         @Override
-        public MethodType clone(TypeMetadata md) {
+        public MethodType cloneWithMetadata(TypeMetadata md) {
             throw new AssertionError("Cannot add metadata to a method type");
         }
 
@@ -1370,7 +1444,7 @@
         }
 
         public boolean contains(Type elem) {
-            return elem == this || contains(argtypes, elem) || restype.contains(elem) || contains(thrown, elem);
+            return elem.equalsIgnoreMetadata(this) || contains(argtypes, elem) || restype.contains(elem) || contains(thrown, elem);
         }
 
         public MethodType asMethodType() { return this; }
@@ -1408,11 +1482,11 @@
 
         PackageType(TypeSymbol tsym) {
             // Package types cannot be annotated
-            super(tsym, TypeMetadata.empty);
+            super(tsym, TypeMetadata.EMPTY);
         }
 
         @Override
-        public PackageType clone(TypeMetadata md) {
+        public PackageType cloneWithMetadata(TypeMetadata md) {
             throw new AssertionError("Cannot add metadata to a package type");
         }
 
@@ -1464,14 +1538,14 @@
         public Type lower;
 
         public TypeVar(Name name, Symbol owner, Type lower) {
-            super(null, TypeMetadata.empty);
+            super(null, TypeMetadata.EMPTY);
             tsym = new TypeVariableSymbol(0, name, this, owner);
-            this.bound = bound;
+            this.bound = null;
             this.lower = lower;
         }
 
         public TypeVar(TypeSymbol tsym, Type bound, Type lower) {
-            this(tsym, bound, lower, TypeMetadata.empty);
+            this(tsym, bound, lower, TypeMetadata.EMPTY);
         }
 
         public TypeVar(TypeSymbol tsym, Type bound, Type lower,
@@ -1482,8 +1556,11 @@
         }
 
         @Override
-        public TypeVar clone(TypeMetadata md) {
-            return new TypeVar(tsym, bound, lower, md);
+        public TypeVar cloneWithMetadata(TypeMetadata md) {
+            return new TypeVar(tsym, bound, lower, md) {
+                @Override
+                public Type baseType() { return TypeVar.this.baseType(); }
+            };
         }
 
         @Override
@@ -1566,8 +1643,11 @@
         }
 
         @Override
-        public CapturedType clone(TypeMetadata md) {
-            return new CapturedType(tsym, bound, bound, lower, wildcard, md);
+        public CapturedType cloneWithMetadata(TypeMetadata md) {
+            return new CapturedType(tsym, bound, bound, lower, wildcard, md) {
+                @Override
+                public Type baseType() { return CapturedType.this.baseType(); }
+            };
         }
 
         @Override
@@ -1597,7 +1677,7 @@
         public TypeTag tag;
 
         public DelegatedType(TypeTag tag, Type qtype) {
-            this(tag, qtype, TypeMetadata.empty);
+            this(tag, qtype, TypeMetadata.EMPTY);
         }
 
         public DelegatedType(TypeTag tag, Type qtype,
@@ -1635,7 +1715,7 @@
         }
 
         @Override
-        public ForAll clone(TypeMetadata md) {
+        public ForAll cloneWithMetadata(TypeMetadata md) {
             throw new AssertionError("Cannot add metadata to a forall type");
         }
 
@@ -1785,7 +1865,7 @@
         }
 
         @Override
-        public UndetVar clone(TypeMetadata md) {
+        public UndetVar cloneWithMetadata(TypeMetadata md) {
             throw new AssertionError("Cannot add metadata to an UndetVar type");
         }
 
@@ -1940,11 +2020,11 @@
             // Need to use List.nil(), because JCNoType constructor
             // gets called in static initializers in Type, where
             // noAnnotations is also defined.
-            super(null, TypeMetadata.empty);
+            super(null, TypeMetadata.EMPTY);
         }
 
         @Override
-        public JCNoType clone(TypeMetadata md) {
+        public JCNoType cloneWithMetadata(TypeMetadata md) {
             throw new AssertionError("Cannot add metadata to a JCNoType");
         }
 
@@ -1973,11 +2053,11 @@
 
         public JCVoidType() {
             // Void cannot be annotated
-            super(null, TypeMetadata.empty);
+            super(null, TypeMetadata.EMPTY);
         }
 
         @Override
-        public JCVoidType clone(TypeMetadata md) {
+        public JCVoidType cloneWithMetadata(TypeMetadata md) {
             throw new AssertionError("Cannot add metadata to a void type");
         }
 
@@ -2008,11 +2088,11 @@
     static class BottomType extends Type implements NullType {
         public BottomType() {
             // Bottom is a synthesized internal type, so it cannot be annotated
-            super(null, TypeMetadata.empty);
+            super(null, TypeMetadata.EMPTY);
         }
 
         @Override
-        public BottomType clone(TypeMetadata md) {
+        public BottomType cloneWithMetadata(TypeMetadata md) {
             throw new AssertionError("Cannot add metadata to a bottom type");
         }
 
@@ -2077,8 +2157,11 @@
         }
 
         @Override
-        public ErrorType clone(TypeMetadata md) {
-            return new ErrorType(originalType, tsym, md);
+        public ErrorType cloneWithMetadata(TypeMetadata md) {
+            return new ErrorType(originalType, tsym, md) {
+                @Override
+                public Type baseType() { return ErrorType.this.baseType(); }
+            };
         }
 
         @Override
@@ -2145,11 +2228,11 @@
         public UnknownType() {
             // Unknown is a synthesized internal type, so it cannot be
             // annotated.
-            super(null, TypeMetadata.empty);
+            super(null, TypeMetadata.EMPTY);
         }
 
         @Override
-        public UnknownType clone(TypeMetadata md) {
+        public UnknownType cloneWithMetadata(TypeMetadata md) {
             throw new AssertionError("Cannot add metadata to an unknown type");
         }
 
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java
index d3aecdb..3d1c6b5 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,14 +118,10 @@
 
     public static final List<TypePathEntry> emptyPath = List.nil();
 
-    // NOTE: All of these will be converted to final fields eventually.
-
     public final TargetType type;
 
     // For generic/array types.
 
-    // This field is in the process of being made final.  Do not
-    // introduce new mutations.
     public List<TypePathEntry> location;
 
     // Tree position.
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
index d7a03ee..1bc0210 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 
 import javax.tools.JavaFileObject;
 
+import com.sun.tools.javac.code.Attribute.Array;
 import com.sun.tools.javac.code.Attribute.TypeCompound;
 import com.sun.tools.javac.code.Type.ArrayType;
 import com.sun.tools.javac.code.Type.CapturedType;
@@ -47,8 +48,8 @@
 import com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntryKind;
 import com.sun.tools.javac.code.Symbol.VarSymbol;
 import com.sun.tools.javac.code.Symbol.MethodSymbol;
+import com.sun.tools.javac.code.TypeMetadata.Entry.Kind;
 import com.sun.tools.javac.comp.Annotate;
-import com.sun.tools.javac.comp.Annotate.Worker;
 import com.sun.tools.javac.comp.Attr;
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Env;
@@ -71,7 +72,6 @@
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.Names;
-import com.sun.tools.javac.util.Options;
 
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 
@@ -105,7 +105,6 @@
         syms = Symtab.instance(context);
         annotate = Annotate.instance(context);
         attr = Attr.instance(context);
-        Options options = Options.instance(context);
     }
 
     /**
@@ -113,12 +112,9 @@
      * determine the correct positions for type annotations.
      * This version only visits types in signatures and should be
      * called from MemberEnter.
-     * The method takes the Annotate object as parameter and
-     * adds an Annotate.Worker to the correct Annotate queue for
-     * later processing.
      */
     public void organizeTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) {
-        annotate.afterRepeated( new Worker() {
+        annotate.afterTypes(new Runnable() {
             @Override
             public void run() {
                 JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
@@ -129,11 +125,11 @@
                     log.useSource(oldSource);
                 }
             }
-        } );
+        });
     }
 
     public void validateTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) {
-        annotate.validate(new Worker() { //validate annotations
+        annotate.validate(new Runnable() { //validate annotations
             @Override
             public void run() {
                 JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
@@ -144,7 +140,7 @@
                     log.useSource(oldSource);
                 }
             }
-        } );
+        });
     }
 
     /**
@@ -155,101 +151,106 @@
         new TypeAnnotationPositions(false).scan(tree);
     }
 
-    public enum AnnotationType { DECLARATION, TYPE, BOTH }
+    public enum AnnotationType { DECLARATION, TYPE, NONE, BOTH }
+
+    public List<Attribute> annotationTargets(Attribute.Compound anno) {
+        Attribute.Compound atTarget = anno.type.tsym.getAnnotationTypeMetadata().getTarget();
+        if (atTarget == null) {
+            return null;
+        }
+
+        Attribute atValue = atTarget.member(names.value);
+        if (!(atValue instanceof Attribute.Array)) {
+            return null;
+        }
+
+        List<Attribute> targets = ((Array)atValue).getValue();
+        if (targets.stream().anyMatch(a -> !(a instanceof Attribute.Enum))) {
+            return null;
+        }
+
+        return targets;
+    }
 
     /**
      * Determine whether an annotation is a declaration annotation,
      * a type annotation, or both.
      */
-    public AnnotationType annotationType(Attribute.Compound a, Symbol s) {
-        Attribute.Compound atTarget =
-            a.type.tsym.attribute(syms.annotationTargetType.tsym);
-        if (atTarget == null) {
-            return inferTargetMetaInfo(a, s);
-        }
-        Attribute atValue = atTarget.member(names.value);
-        if (!(atValue instanceof Attribute.Array)) {
-            Assert.error("annotationType(): bad @Target argument " + atValue +
-                    " (" + atValue.getClass() + ")");
-            return AnnotationType.DECLARATION; // error recovery
-        }
-        Attribute.Array arr = (Attribute.Array) atValue;
-        boolean isDecl = false, isType = false;
-        for (Attribute app : arr.values) {
-            if (!(app instanceof Attribute.Enum)) {
-                Assert.error("annotationType(): unrecognized Attribute kind " + app +
-                        " (" + app.getClass() + ")");
-                isDecl = true;
-                continue;
-            }
-            Attribute.Enum e = (Attribute.Enum) app;
-            if (e.value.name == names.TYPE) {
-                if (s.kind == TYP)
-                    isDecl = true;
-            } else if (e.value.name == names.FIELD) {
-                if (s.kind == VAR &&
-                        s.owner.kind != MTH)
-                    isDecl = true;
-            } else if (e.value.name == names.METHOD) {
-                if (s.kind == MTH &&
-                        !s.isConstructor())
-                    isDecl = true;
-            } else if (e.value.name == names.PARAMETER) {
-                if (s.kind == VAR &&
-                        s.owner.kind == MTH &&
-                        (s.flags() & Flags.PARAMETER) != 0)
-                    isDecl = true;
-            } else if (e.value.name == names.CONSTRUCTOR) {
-                if (s.kind == MTH &&
-                        s.isConstructor())
-                    isDecl = true;
-            } else if (e.value.name == names.LOCAL_VARIABLE) {
-                if (s.kind == VAR &&
-                        s.owner.kind == MTH &&
-                        (s.flags() & Flags.PARAMETER) == 0)
-                    isDecl = true;
-            } else if (e.value.name == names.ANNOTATION_TYPE) {
-                if (s.kind == TYP &&
-                        (s.flags() & Flags.ANNOTATION) != 0)
-                    isDecl = true;
-            } else if (e.value.name == names.PACKAGE) {
-                if (s.kind == PCK)
-                    isDecl = true;
-            } else if (e.value.name == names.TYPE_USE) {
-                if (s.kind == TYP ||
-                        s.kind == VAR ||
-                        (s.kind == MTH && !s.isConstructor() &&
-                        !s.type.getReturnType().hasTag(TypeTag.VOID)) ||
-                        (s.kind == MTH && s.isConstructor()))
-                    isType = true;
-            } else if (e.value.name == names.TYPE_PARAMETER) {
-                /* Irrelevant in this case */
-                // TYPE_PARAMETER doesn't aid in distinguishing between
-                // Type annotations and declaration annotations on an
-                // Element
-            } else {
-                Assert.error("annotationType(): unrecognized Attribute name " + e.value.name +
-                        " (" + e.value.name.getClass() + ")");
-                isDecl = true;
-            }
-        }
-        if (isDecl && isType) {
+    public AnnotationType annotationTargetType(Attribute.Compound a, Symbol s) {
+        List<Attribute> targets = annotationTargets(a);
+        return (targets == null) ?
+                AnnotationType.DECLARATION :
+                targets.stream()
+                        .map(attr -> targetToAnnotationType(attr, s))
+                        .reduce(AnnotationType.NONE, this::combineAnnotationType);
+    }
+
+    private AnnotationType combineAnnotationType(AnnotationType at1, AnnotationType at2) {
+        if (at1 == AnnotationType.NONE) {
+            return at2;
+        } else if (at2 == AnnotationType.NONE) {
+            return at1;
+        } else if (at1 != at2) {
             return AnnotationType.BOTH;
-        } else if (isType) {
-            return AnnotationType.TYPE;
         } else {
+            return at1;
+        }
+    }
+
+    private AnnotationType targetToAnnotationType(Attribute a, Symbol s) {
+        Attribute.Enum e = (Attribute.Enum)a;
+        if (e.value.name == names.TYPE) {
+            if (s.kind == TYP)
+                return AnnotationType.DECLARATION;
+        } else if (e.value.name == names.FIELD) {
+            if (s.kind == VAR &&
+                    s.owner.kind != MTH)
+                return AnnotationType.DECLARATION;
+        } else if (e.value.name == names.METHOD) {
+            if (s.kind == MTH &&
+                    !s.isConstructor())
+                return AnnotationType.DECLARATION;
+        } else if (e.value.name == names.PARAMETER) {
+            if (s.kind == VAR &&
+                    s.owner.kind == MTH &&
+                    (s.flags() & Flags.PARAMETER) != 0)
+                return AnnotationType.DECLARATION;
+        } else if (e.value.name == names.CONSTRUCTOR) {
+            if (s.kind == MTH &&
+                    s.isConstructor())
+                return AnnotationType.DECLARATION;
+        } else if (e.value.name == names.LOCAL_VARIABLE) {
+            if (s.kind == VAR &&
+                    s.owner.kind == MTH &&
+                    (s.flags() & Flags.PARAMETER) == 0)
+                return AnnotationType.DECLARATION;
+        } else if (e.value.name == names.ANNOTATION_TYPE) {
+            if (s.kind == TYP &&
+                    (s.flags() & Flags.ANNOTATION) != 0)
+                return AnnotationType.DECLARATION;
+        } else if (e.value.name == names.PACKAGE) {
+            if (s.kind == PCK)
+                return AnnotationType.DECLARATION;
+        } else if (e.value.name == names.TYPE_USE) {
+            if (s.kind == TYP ||
+                    s.kind == VAR ||
+                    (s.kind == MTH && !s.isConstructor() &&
+                    !s.type.getReturnType().hasTag(TypeTag.VOID)) ||
+                    (s.kind == MTH && s.isConstructor()))
+                return AnnotationType.TYPE;
+        } else if (e.value.name == names.TYPE_PARAMETER) {
+            /* Irrelevant in this case */
+            // TYPE_PARAMETER doesn't aid in distinguishing between
+            // Type annotations and declaration annotations on an
+            // Element
+        } else {
+            Assert.error("annotationTargetType(): unrecognized Attribute name " + e.value.name +
+                    " (" + e.value.name.getClass() + ")");
             return AnnotationType.DECLARATION;
         }
+        return AnnotationType.NONE;
     }
 
-    /** Infer the target annotation kind, if none is give.
-     * We only infer declaration annotations.
-     */
-    private static AnnotationType inferTargetMetaInfo(Attribute.Compound a, Symbol s) {
-        return AnnotationType.DECLARATION;
-    }
-
-
     private class TypeAnnotationPositions extends TreeScanner {
 
         private final boolean sigOnly;
@@ -262,18 +263,29 @@
          * When traversing the AST we keep the "frames" of visited
          * trees in order to determine the position of annotations.
          */
-        private ListBuffer<JCTree> frames = new ListBuffer<>();
+        private List<JCTree> frames = List.nil();
 
-        protected void push(JCTree t) { frames = frames.prepend(t); }
-        protected JCTree pop() { return frames.next(); }
+        protected void push(JCTree t) {
+            frames = frames.prepend(t);
+        }
+        protected JCTree pop() {
+            JCTree t = frames.head;
+            frames = frames.tail;
+            return t;
+            }
         // could this be frames.elems.tail.head?
-        private JCTree peek2() { return frames.toList().tail.head; }
+        private JCTree peek2() {
+            return frames.tail.head;
+        }
 
         @Override
         public void scan(JCTree tree) {
             push(tree);
-            super.scan(tree);
-            pop();
+            try {
+                super.scan(tree);
+            } finally {
+                pop();
+            }
         }
 
         /**
@@ -283,41 +295,44 @@
          * we never build an JCAnnotatedType. This step finds these
          * annotations and marks them as if they were part of the type.
          */
-        private void separateAnnotationsKinds(JCTree typetree, Type type, Symbol sym,
-                TypeAnnotationPosition pos) {
-            List<Attribute.Compound> annotations = sym.getRawAttributes();
+        private void separateAnnotationsKinds(JCTree typetree, Type type,
+                                              Symbol sym, TypeAnnotationPosition pos)
+        {
+            List<Attribute.Compound> allAnnotations = sym.getRawAttributes();
             ListBuffer<Attribute.Compound> declAnnos = new ListBuffer<>();
             ListBuffer<Attribute.TypeCompound> typeAnnos = new ListBuffer<>();
             ListBuffer<Attribute.TypeCompound> onlyTypeAnnos = new ListBuffer<>();
 
-            for (Attribute.Compound a : annotations) {
-                switch (annotationType(a, sym)) {
-                case DECLARATION:
-                    declAnnos.append(a);
-                    break;
-                case BOTH: {
-                    declAnnos.append(a);
-                    Attribute.TypeCompound ta = toTypeCompound(a, pos);
-                    typeAnnos.append(ta);
-                    break;
-                }
-                case TYPE: {
-                    Attribute.TypeCompound ta = toTypeCompound(a, pos);
-                    typeAnnos.append(ta);
-                    // Also keep track which annotations are only type annotations
-                    onlyTypeAnnos.append(ta);
-                    break;
-                }
+            for (Attribute.Compound a : allAnnotations) {
+                switch (annotationTargetType(a, sym)) {
+                    case DECLARATION:
+                        declAnnos.append(a);
+                        break;
+                    case BOTH: {
+                        declAnnos.append(a);
+                        Attribute.TypeCompound ta = toTypeCompound(a, pos);
+                        typeAnnos.append(ta);
+                        break;
+                    }
+                    case TYPE: {
+                        Attribute.TypeCompound ta = toTypeCompound(a, pos);
+                        typeAnnos.append(ta);
+                        // Also keep track which annotations are only type annotations
+                        onlyTypeAnnos.append(ta);
+                        break;
+                    }
                 }
             }
 
-            sym.resetAnnotations();
-            sym.setDeclarationAttributes(declAnnos.toList());
-
+            // If we have no type annotations we are done for this Symbol
             if (typeAnnos.isEmpty()) {
                 return;
             }
 
+            // Reset decl annotations to the set {all - type only}
+            sym.resetAnnotations();
+            sym.setDeclarationAttributes(declAnnos.toList());
+
             List<Attribute.TypeCompound> typeAnnotations = typeAnnos.toList();
 
             if (type == null) {
@@ -328,7 +343,7 @@
 
                 // Declaration annotations are always allowed on constructor returns.
                 // Therefore, use typeAnnotations instead of onlyTypeAnnos.
-                type = typeWithAnnotations(typetree, type, typeAnnotations, typeAnnotations);
+                typeWithAnnotations(typetree, type, typeAnnotations, typeAnnotations, pos);
                 // Note that we don't use the result, the call to
                 // typeWithAnnotations side-effects the type annotation positions.
                 // This is important for constructors of nested classes.
@@ -336,8 +351,8 @@
                 return;
             }
 
-            // type is non-null and annotations are added to that type
-            type = typeWithAnnotations(typetree, type, typeAnnotations, onlyTypeAnnos.toList());
+            // type is non-null, add type annotations from declaration context to the type
+            type = typeWithAnnotations(typetree, type, typeAnnotations, onlyTypeAnnos.toList(), pos);
 
             if (sym.getKind() == ElementKind.METHOD) {
                 sym.type.asMethodType().restype = type;
@@ -390,59 +405,23 @@
         // Note that it is assumed that all annotations share the same position.
         private Type typeWithAnnotations(final JCTree typetree, final Type type,
                 final List<Attribute.TypeCompound> annotations,
-                final List<Attribute.TypeCompound> onlyTypeAnnotations) {
-            //System.err.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s, onlyTypeAnnotations: %s)%n",
-            //         typetree, type, annotations, onlyTypeAnnotations);
+                final List<Attribute.TypeCompound> onlyTypeAnnotations,
+                final TypeAnnotationPosition pos)
+        {
             if (annotations.isEmpty()) {
                 return type;
             }
-            if (type.hasTag(TypeTag.ARRAY)) {
-                Type.ArrayType arType = (Type.ArrayType) type;
-                Type.ArrayType tomodify = new Type.ArrayType(null, arType.tsym);
-                Type toreturn;
-                if (type.isAnnotated()) {
-                    toreturn = tomodify.annotatedType(type.getAnnotationMirrors());
-                } else {
-                    toreturn = tomodify;
-                }
 
-                JCArrayTypeTree arTree = arrayTypeTree(typetree);
+            if (type.hasTag(TypeTag.ARRAY))
+                return rewriteArrayType((ArrayType)type, annotations, pos);
 
-                ListBuffer<TypePathEntry> depth = new ListBuffer<>();
-                depth = depth.append(TypePathEntry.ARRAY);
-                while (arType.elemtype.hasTag(TypeTag.ARRAY)) {
-                    if (arType.elemtype.isAnnotated()) {
-                        Type aelemtype = arType.elemtype;
-                        arType = (Type.ArrayType) aelemtype;
-                        ArrayType prevToMod = tomodify;
-                        tomodify = new Type.ArrayType(null, arType.tsym);
-                        prevToMod.elemtype = tomodify.annotatedType(arType.elemtype.getAnnotationMirrors());
-                    } else {
-                        arType = (Type.ArrayType) arType.elemtype;
-                        tomodify.elemtype = new Type.ArrayType(null, arType.tsym);
-                        tomodify = (Type.ArrayType) tomodify.elemtype;
-                    }
-                    arTree = arrayTypeTree(arTree.elemtype);
-                    depth = depth.append(TypePathEntry.ARRAY);
-                }
-                Type arelemType = typeWithAnnotations(arTree.elemtype, arType.elemtype, annotations, onlyTypeAnnotations);
-                tomodify.elemtype = arelemType;
-                {
-                    // All annotations share the same position; modify the first one.
-                    Attribute.TypeCompound a = annotations.get(0);
-                    TypeAnnotationPosition p = a.position;
-                    p.location = p.location.prependList(depth.toList());
-                }
-                typetree.type = toreturn;
-                return toreturn;
-            } else if (type.hasTag(TypeTag.TYPEVAR)) {
-                // Nothing to do for type variables.
-                return type;
+            if (type.hasTag(TypeTag.TYPEVAR)) {
+                return type.annotatedType(onlyTypeAnnotations);
             } else if (type.getKind() == TypeKind.UNION) {
                 // There is a TypeKind, but no TypeTag.
-                JCTypeUnion tutree = (JCTypeUnion) typetree;
+                JCTypeUnion tutree = (JCTypeUnion)typetree;
                 JCExpression fst = tutree.alternatives.get(0);
-                Type res = typeWithAnnotations(fst, fst.type, annotations, onlyTypeAnnotations);
+                Type res = typeWithAnnotations(fst, fst.type, annotations, onlyTypeAnnotations, pos);
                 fst.type = res;
                 // TODO: do we want to set res as first element in uct.alternatives?
                 // UnionClassType uct = (com.sun.tools.javac.code.Type.UnionClassType)type;
@@ -459,8 +438,8 @@
                         enclTy.getKind() != TypeKind.NONE &&
                         enclTy.getKind() != TypeKind.ERROR &&
                         (enclTr.getKind() == JCTree.Kind.MEMBER_SELECT ||
-                         enclTr.getKind() == JCTree.Kind.PARAMETERIZED_TYPE ||
-                         enclTr.getKind() == JCTree.Kind.ANNOTATED_TYPE)) {
+                                enclTr.getKind() == JCTree.Kind.PARAMETERIZED_TYPE ||
+                                enclTr.getKind() == JCTree.Kind.ANNOTATED_TYPE)) {
                     // Iterate also over the type tree, not just the type: the type is already
                     // completely resolved and we cannot distinguish where the annotation
                     // belongs for a nested type.
@@ -483,20 +462,20 @@
                 if (enclTy != null &&
                         enclTy.hasTag(TypeTag.NONE)) {
                     switch (onlyTypeAnnotations.size()) {
-                    case 0:
-                        // Don't issue an error if all type annotations are
-                        // also declaration annotations.
-                        // If the annotations are also declaration annotations, they are
-                        // illegal as type annotations but might be legal as declaration annotations.
-                        // The normal declaration annotation checks make sure that the use is valid.
-                        break;
-                    case 1:
-                        log.error(typetree.pos(), "cant.type.annotate.scoping.1",
-                                onlyTypeAnnotations);
-                        break;
-                    default:
-                        log.error(typetree.pos(), "cant.type.annotate.scoping",
-                                onlyTypeAnnotations);
+                        case 0:
+                            // Don't issue an error if all type annotations are
+                            // also declaration annotations.
+                            // If the annotations are also declaration annotations, they are
+                            // illegal as type annotations but might be legal as declaration annotations.
+                            // The normal declaration annotation checks make sure that the use is valid.
+                            break;
+                        case 1:
+                            log.error(typetree.pos(), "cant.type.annotate.scoping.1",
+                                    onlyTypeAnnotations);
+                            break;
+                        default:
+                            log.error(typetree.pos(), "cant.type.annotate.scoping",
+                                    onlyTypeAnnotations);
                     }
                     return type;
                 }
@@ -539,15 +518,62 @@
             }
         }
 
-        private JCArrayTypeTree arrayTypeTree(JCTree typetree) {
-            if (typetree.getKind() == JCTree.Kind.ARRAY_TYPE) {
-                return (JCArrayTypeTree) typetree;
-            } else if (typetree.getKind() == JCTree.Kind.ANNOTATED_TYPE) {
-                return (JCArrayTypeTree) ((JCAnnotatedType)typetree).underlyingType;
-            } else {
-                Assert.error("Could not determine array type from type tree: " + typetree);
-                return null;
+        /**
+         * Create a copy of the {@code Type type} with the help of the Tree for a type
+         * {@code JCTree typetree} inserting all type annotations in {@code annotations} to the
+         * innermost array component type.
+         *
+         * SIDE EFFECT: Update position for the annotations to be {@code pos}.
+         */
+        private Type rewriteArrayType(ArrayType type, List<TypeCompound> annotations, TypeAnnotationPosition pos) {
+            ArrayType tomodify = new ArrayType(type);
+            ArrayType res = tomodify;
+
+            List<TypePathEntry> loc = List.nil();
+
+            // peel one and update loc
+            Type tmpType = type.elemtype;
+            loc = loc.prepend(TypePathEntry.ARRAY);
+
+            while (tmpType.hasTag(TypeTag.ARRAY)) {
+                ArrayType arr = (ArrayType)tmpType;
+
+                // Update last type with new element type
+                ArrayType tmp = new ArrayType(arr);
+                tomodify.elemtype = tmp;
+                tomodify = tmp;
+
+                tmpType = arr.elemtype;
+                loc = loc.prepend(TypePathEntry.ARRAY);
             }
+
+            // Fix innermost element type
+            Type elemType;
+            if (tmpType.getMetadata() != null) {
+                List<TypeCompound> tcs;
+                if (tmpType.getAnnotationMirrors().isEmpty()) {
+                    tcs = annotations;
+                } else {
+                    // Special case, lets prepend
+                    tcs =  annotations.appendList(tmpType.getAnnotationMirrors());
+                }
+                elemType = tmpType.cloneWithMetadata(tmpType
+                        .getMetadata()
+                        .without(Kind.ANNOTATIONS)
+                        .combine(new TypeMetadata.Annotations(tcs)));
+            } else {
+                elemType = tmpType.cloneWithMetadata(new TypeMetadata(new TypeMetadata.Annotations(annotations)));
+            }
+            tomodify.elemtype = elemType;
+
+            // Update positions
+            for (TypeCompound tc : annotations) {
+                if (tc.position == null)
+                    tc.position = pos;
+                tc.position.location = loc;
+            }
+
+            return res;
         }
 
         /** Return a copy of the first type that only differs by
@@ -569,7 +595,6 @@
         private Type typeWithAnnotations(final Type type,
                 final Type stopAt,
                 final List<Attribute.TypeCompound> annotations) {
-            //System.err.println("typeWithAnnotations " + type + " " + annotations + " stopAt " + stopAt);
             Visitor<Type, List<TypeCompound>> visitor =
                     new Type.Visitor<Type, List<Attribute.TypeCompound>>() {
                 @Override
@@ -660,20 +685,14 @@
         /* This is the beginning of the second part of organizing
          * type annotations: determine the type annotation positions.
          */
-
-        // This method is considered deprecated, and will be removed
-        // in the near future.  Don't use it for anything new.
         private TypeAnnotationPosition
             resolveFrame(JCTree tree,
                          JCTree frame,
                          List<JCTree> path,
                          JCLambda currentLambda,
                          int outer_type_index,
-                         ListBuffer<TypePathEntry> location) {
-            /*
-            System.out.println("Resolving tree: " + tree + " kind: " + tree.getKind());
-            System.out.println("    Framing tree: " + frame + " kind: " + frame.getKind());
-            */
+                         ListBuffer<TypePathEntry> location)
+        {
 
             // Note that p.offset is set in
             // com.sun.tools.javac.jvm.Gen.setTypeAnnotationPositions(int)
@@ -695,20 +714,17 @@
                     if (frameNewClass.def != null) {
                         // Special handling for anonymous class instantiations
                         final JCClassDecl frameClassDecl = frameNewClass.def;
-                        if (frameClassDecl.extending == tree) {
-                            return TypeAnnotationPosition
-                                .classExtends(location.toList(), currentLambda,
-                                              frame.pos);
-                        } else if (frameClassDecl.implementing.contains(tree)) {
+                        if (frameClassDecl.implementing.contains(tree)) {
                             final int type_index =
                                 frameClassDecl.implementing.indexOf(tree);
                             return TypeAnnotationPosition
                                 .classExtends(location.toList(), currentLambda,
                                               type_index, frame.pos);
                         } else {
-                            // In contrast to CLASS below, typarams cannot occur here.
-                            throw new AssertionError("Could not determine position of tree " + tree +
-                                                     " within frame " + frame);
+                            //for encl.new @TA Clazz(), tree may be different from frameClassDecl.extending
+                            return TypeAnnotationPosition
+                                .classExtends(location.toList(), currentLambda,
+                                              frame.pos);
                         }
                     } else if (frameNewClass.typeargs.contains(tree)) {
                         final int type_index =
@@ -1120,29 +1136,31 @@
                     // Nothing to do for separateAnnotationsKinds if
                     // there are no annotations of either kind.
                     // TODO: make sure there are no declaration annotations.
-                    final TypeAnnotationPosition pos =
-                        TypeAnnotationPosition.methodReceiver(tree.recvparam.vartype.pos);
-                    separateAnnotationsKinds(tree.recvparam.vartype,
-                                             tree.recvparam.sym.type,
-                                             tree.recvparam.sym, pos);
+                    final TypeAnnotationPosition pos = TypeAnnotationPosition.methodReceiver(tree.recvparam.vartype.pos);
+                    push(tree.recvparam);
+                    try {
+                        separateAnnotationsKinds(tree.recvparam.vartype, tree.recvparam.sym.type, tree.recvparam.sym, pos);
+                    } finally {
+                        pop();
+                    }
                 }
                 int i = 0;
                 for (JCVariableDecl param : tree.params) {
                     if (!param.mods.annotations.isEmpty()) {
                         // Nothing to do for separateAnnotationsKinds if
                         // there are no annotations of either kind.
-                        final TypeAnnotationPosition pos =
-                            TypeAnnotationPosition.methodParameter(i, param.vartype.pos);
-                        separateAnnotationsKinds(param.vartype,
-                                                 param.sym.type,
-                                                 param.sym, pos);
+                        final TypeAnnotationPosition pos = TypeAnnotationPosition.methodParameter(i, param.vartype.pos);
+                        push(param);
+                        try {
+                            separateAnnotationsKinds(param.vartype, param.sym.type, param.sym, pos);
+                        } finally {
+                            pop();
+                        }
                     }
                     ++i;
                 }
             }
 
-            push(tree);
-            // super.visitMethodDef(tree);
             if (sigOnly) {
                 scan(tree.mods);
                 scan(tree.restype);
@@ -1154,7 +1172,6 @@
                 scan(tree.defaultValue);
                 scan(tree.body);
             }
-            pop();
         }
 
         /* Store a reference to the current lambda expression, to
@@ -1172,18 +1189,20 @@
                     if (!param.mods.annotations.isEmpty()) {
                         // Nothing to do for separateAnnotationsKinds if
                         // there are no annotations of either kind.
-                        final TypeAnnotationPosition pos =
-                            TypeAnnotationPosition.methodParameter(tree, i,
-                                                                   param.vartype.pos);
-                        separateAnnotationsKinds(param.vartype, param.sym.type, param.sym, pos);
+                        final TypeAnnotationPosition pos =  TypeAnnotationPosition
+                                .methodParameter(tree, i, param.vartype.pos);
+                        push(param);
+                        try {
+                            separateAnnotationsKinds(param.vartype, param.sym.type, param.sym, pos);
+                        } finally {
+                            pop();
+                        }
                     }
                     ++i;
                 }
 
-                push(tree);
                 scan(tree.body);
                 scan(tree.params);
-                pop();
             } finally {
                 currentLambda = prevLambda;
             }
@@ -1227,17 +1246,14 @@
                 // No type annotations can occur here.
             } else {
                 // There is nothing else in a variable declaration that needs separation.
-                Assert.error("Unhandled variable kind: " + tree + " of kind: " + tree.sym.getKind());
+                Assert.error("Unhandled variable kind");
             }
 
-            push(tree);
-            // super.visitVarDef(tree);
             scan(tree.mods);
             scan(tree.vartype);
             if (!sigOnly) {
                 scan(tree.init);
             }
-            pop();
         }
 
         @Override
@@ -1363,31 +1379,37 @@
             scan(tree.elems);
         }
 
-        private void findPosition(JCTree tree, JCTree frame, List<JCAnnotation> annotations) {
+
+        private void findTypeCompoundPosition(JCTree tree, JCTree frame, List<Attribute.TypeCompound> annotations) {
             if (!annotations.isEmpty()) {
-                /*
-                System.err.println("Finding pos for: " + annotations);
-                System.err.println("    tree: " + tree + " kind: " + tree.getKind());
-                System.err.println("    frame: " + frame + " kind: " + frame.getKind());
-                */
                 final TypeAnnotationPosition p =
-                    resolveFrame(tree, frame, frames.toList(), currentLambda, 0,
-                                 new ListBuffer<TypePathEntry>());
+                        resolveFrame(tree, frame, frames, currentLambda, 0, new ListBuffer<>());
+                for (TypeCompound tc : annotations)
+                    tc.position = p;
+            }
+        }
+
+        private void findPosition(JCTree tree, JCTree frame, List<JCAnnotation> annotations) {
+            if (!annotations.isEmpty())
+            {
+                final TypeAnnotationPosition p =
+                    resolveFrame(tree, frame, frames, currentLambda, 0, new ListBuffer<>());
+
                 setTypeAnnotationPos(annotations, p);
             }
         }
 
-        private void setTypeAnnotationPos(List<JCAnnotation> annotations,
-                TypeAnnotationPosition position) {
+        private void setTypeAnnotationPos(List<JCAnnotation> annotations, TypeAnnotationPosition position)
+        {
+            // attribute might be null during DeferredAttr;
+            // we will be back later.
             for (JCAnnotation anno : annotations) {
-                // attribute might be null during DeferredAttr;
-                // we will be back later.
-                if (anno.attribute != null) {
+                if (anno.attribute != null)
                     ((Attribute.TypeCompound) anno.attribute).position = position;
-                }
             }
         }
 
+
         @Override
         public String toString() {
             return super.toString() + ": sigOnly: " + sigOnly;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeMetadata.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeMetadata.java
index 22e821e..71aefc3 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeMetadata.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeMetadata.java
@@ -30,46 +30,63 @@
 import com.sun.tools.javac.util.List;
 import java.util.EnumMap;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Set;
 
 /**
- * A super-interface for all type metadata elements.  Metadata classes
- * can be created for any metadata on types with the following
- * properties:
+ * TypeMetadata is essentially an immutable {@code EnumMap<Entry.Kind, <? extends Entry>>}
  *
- * <ul>
- * <li>They have a default value (preferably empty)</li>
- * <li>The field is usually the default value</li>
- * <li>Different values of the field are visible, and denote distinct
- *     types</li>
- * </ul>
+ * A metadata class represented by a subtype of Entry can express a property on a Type instance.
+ * Thers should be at most one instance of an Entry per Entry.Kind on any given Type instance.
+ *
+ * Metadata classes of a specific kind are responsible for how they combine themselvs.
+ *
+ * @implNote {@code Entry:combine} need not be commutative.
  */
 public class TypeMetadata {
+    public static final TypeMetadata EMPTY = new TypeMetadata();
 
-    public static final TypeMetadata empty = new TypeMetadata();
-    private final EnumMap<TypeMetadata.Element.Kind, TypeMetadata.Element> contents;
+    private final EnumMap<Entry.Kind, Entry> contents;
 
+    /**
+     * Create a new empty TypeMetadata map.
+     */
     private TypeMetadata() {
-        contents = new EnumMap<Element.Kind, Element>(Element.Kind.class);
+        contents = new EnumMap<>(Entry.Kind.class);
     }
 
-    public TypeMetadata(final Element elem) {
+    /**
+     * Create a new TypeMetadata map containing the Entry {@code elem}.
+     *
+     * @param elem the sole contents of this map
+     */
+    public TypeMetadata(Entry elem) {
         this();
+        Assert.checkNonNull(elem);
         contents.put(elem.kind(), elem);
     }
 
-    public TypeMetadata(final TypeMetadata other) {
+    /**
+     * Creates a copy of TypeMetadata {@code other} with a shallow copy the other's metadata contents.
+     *
+     * @param other the TypeMetadata to copy contents from.
+     */
+    public TypeMetadata(TypeMetadata other) {
+        Assert.checkNonNull(other);
         contents = other.contents.clone();
     }
 
-    public TypeMetadata copy() {
-        return new TypeMetadata(this);
-    }
+    /**
+     * Return a copy of this TypeMetadata with the metadata entry for {@code elem.kind()} combined
+     * with {@code elem}.
+     *
+     * @param elem the new value
+     * @return a new TypeMetadata updated with {@code Entry elem}
+     */
+    public TypeMetadata combine(Entry elem) {
+        Assert.checkNonNull(elem);
 
-    public TypeMetadata combine(final Element elem) {
-        final TypeMetadata out = new TypeMetadata(this);
-        final Element.Kind key = elem.kind();
+        TypeMetadata out = new TypeMetadata(this);
+        Entry.Kind key = elem.kind();
         if (contents.containsKey(key)) {
             out.add(key, this.contents.get(key).combine(elem));
         } else {
@@ -78,17 +95,26 @@
         return out;
     }
 
-    public TypeMetadata combine(final TypeMetadata other) {
-        final TypeMetadata out = new TypeMetadata();
-        final Set<Element.Kind> keys = new HashSet<>(this.contents.keySet());
+    /**
+     * Return a copy of this TypeMetadata with the metadata entry for all kinds from {@code other}
+     * combined with the same kind from this.
+     *
+     * @param other the TypeMetadata to combine with this
+     * @return a new TypeMetadata updated with all entries from {@code other}
+     */
+    public TypeMetadata combineAll(TypeMetadata other) {
+        Assert.checkNonNull(other);
+
+        TypeMetadata out = new TypeMetadata();
+        Set<Entry.Kind> keys = new HashSet<>(contents.keySet());
         keys.addAll(other.contents.keySet());
 
-        for(final Element.Kind key : keys) {
-            if (this.contents.containsKey(key)) {
+        for(Entry.Kind key : keys) {
+            if (contents.containsKey(key)) {
                 if (other.contents.containsKey(key)) {
-                    out.add(key, this.contents.get(key).combine(other.contents.get(key)));
+                    out.add(key, contents.get(key).combine(other.contents.get(key)));
                 } else {
-                    out.add(key, this.contents.get(key));
+                    out.add(key, contents.get(key));
                 }
             } else if (other.contents.containsKey(key)) {
                 out.add(key, other.contents.get(key));
@@ -97,26 +123,35 @@
         return out;
     }
 
-    public Element get(final Element.Kind kind) {
+    /**
+     * Return a TypeMetadata with the metadata entry for {@code kind} removed.
+     *
+     * This may be the same instance or a new TypeMetadata.
+     *
+     * @param kind the {@code Kind} to remove metadata for
+     * @return a new TypeMetadata without {@code Kind kind}
+     */
+    public TypeMetadata without(Entry.Kind kind) {
+        if (this == EMPTY || contents.get(kind) == null)
+            return this;
+
+        TypeMetadata out = new TypeMetadata(this);
+        out.contents.remove(kind);
+        return out.contents.isEmpty() ? EMPTY : out;
+    }
+
+    public Entry get(Entry.Kind kind) {
         return contents.get(kind);
     }
 
-    public boolean isEmpty() {
-        return contents.isEmpty();
-    }
-
-    private void add(final Element.Kind kind, final Element elem) {
+    private void add(Entry.Kind kind, Entry elem) {
         contents.put(kind, elem);
     }
 
-    private void addAll(final Map<? extends Element.Kind,? extends Element> m) {
-        contents.putAll(m);
-    }
-
-    public interface Element {
+    public interface Entry {
 
         public enum Kind {
-            ANNOTATIONS;
+            ANNOTATIONS
         }
 
         /**
@@ -131,16 +166,18 @@
          * @param other The metadata with which to combine this one.
          * @return The combined metadata.
          */
-        public Element combine(Element other);
+        public Entry combine(Entry other);
     }
 
     /**
      * A type metadata object holding type annotations.
      */
-    public static class Annotations implements Element {
-        private final List<Attribute.TypeCompound> annos;
+    public static class Annotations implements Entry {
+        private List<Attribute.TypeCompound> annos;
 
-        public Annotations(final List<Attribute.TypeCompound> annos) {
+        public static final List<Attribute.TypeCompound> TO_BE_SET = List.nil();
+
+        public Annotations(List<Attribute.TypeCompound> annos) {
             this.annos = annos;
         }
 
@@ -154,18 +191,16 @@
         }
 
         @Override
-        public Annotations combine(final Element other) {
-            // Temporary: we should append the lists, but that won't
-            // work with type annotations today.  Instead, we replace
-            // the list.
-            return new Annotations(((Annotations) other).annos);
+        public Annotations combine(Entry other) {
+            Assert.check(annos == TO_BE_SET);
+            annos = ((Annotations)other).annos;
+            return this;
         }
 
         @Override
         public Kind kind() { return Kind.ANNOTATIONS; }
 
         @Override
-        public String toString() { return "ANNOTATIONS { " + annos + " }"; }
+        public String toString() { return "ANNOTATIONS [ " + annos + " ]"; }
     }
-
 }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
index 70ce043..94c3d21 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
@@ -40,6 +40,7 @@
 import com.sun.tools.javac.code.Attribute.RetentionPolicy;
 import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.Type.UndetVar.InferenceBound;
+import com.sun.tools.javac.code.TypeMetadata.Entry.Kind;
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Check;
 import com.sun.tools.javac.comp.Enter;
@@ -809,7 +810,7 @@
         return isSubtype(t, s, false);
     }
     public boolean isSubtype(Type t, Type s, boolean capture) {
-        if (t == s)
+        if (t.equalsIgnoreMetadata(s))
             return true;
         if (s.isPartial())
             return isSuperType(s, t);
@@ -1081,14 +1082,11 @@
                 isSameTypeStrict.visit(t, s) :
                 isSameTypeLoose.visit(t, s);
     }
-    public boolean isSameAnnotatedType(Type t, Type s) {
-        return isSameAnnotatedType.visit(t, s);
-    }
     // where
         abstract class SameTypeVisitor extends TypeRelation {
 
             public Boolean visitType(Type t, Type s) {
-                if (t == s)
+                if (t.equalsIgnoreMetadata(s))
                     return true;
 
                 if (s.isPartial())
@@ -1281,39 +1279,6 @@
 
     // </editor-fold>
 
-    TypeRelation isSameAnnotatedType = new LooseSameTypeVisitor() {
-            private Boolean compareAnnotations(Type t1, Type t2) {
-                List<Attribute.TypeCompound> annos1 = t1.getAnnotationMirrors();
-                List<Attribute.TypeCompound> annos2 = t2.getAnnotationMirrors();
-                return annos1.containsAll(annos2) && annos2.containsAll(annos1);
-            }
-
-            @Override
-            public Boolean visitType(Type t, Type s) {
-                return compareAnnotations(t, s) && super.visitType(t, s);
-            }
-
-            @Override
-            public Boolean visitWildcardType(WildcardType t, Type s) {
-                return compareAnnotations(t, s) && super.visitWildcardType(t, s);
-            }
-
-            @Override
-            public Boolean visitClassType(ClassType t, Type s) {
-                return compareAnnotations(t, s) && super.visitClassType(t, s);
-            }
-
-            @Override
-            public Boolean visitArrayType(ArrayType t, Type s) {
-                return compareAnnotations(t, s) && super.visitArrayType(t, s);
-            }
-
-            @Override
-            public Boolean visitForAll(ForAll t, Type s) {
-                return compareAnnotations(t, s) && super.visitForAll(t, s);
-            }
-        };
-
     // <editor-fold defaultstate="collapsed" desc="Contains Type">
     public boolean containedBy(Type t, Type s) {
         switch (t.getTag()) {
@@ -2167,7 +2132,7 @@
      * type parameters in t are deleted.
      */
     public Type erasure(Type t) {
-        return eraseNotNeeded(t)? t : erasure(t, false);
+        return eraseNotNeeded(t) ? t : erasure(t, false);
     }
     //where
     private boolean eraseNotNeeded(Type t) {
@@ -2187,23 +2152,23 @@
         }
     // where
         private TypeMapping<Boolean> erasure = new TypeMapping<Boolean>() {
-            private Type combineMetadata(final Type ty,
-                                         final TypeMetadata md) {
-                if (!md.isEmpty()) {
-                    switch (ty.getKind()) {
-                    default: return ty.clone(ty.metadata.combine(md));
-                    case OTHER:
-                    case UNION:
-                    case INTERSECTION:
-                    case PACKAGE:
-                    case EXECUTABLE:
-                    case NONE:
-                    case VOID:
-                    case ERROR:
-                        return ty;
+            private Type combineMetadata(final Type s,
+                                         final Type t) {
+                if (t.getMetadata() != TypeMetadata.EMPTY) {
+                    switch (s.getKind()) {
+                        case OTHER:
+                        case UNION:
+                        case INTERSECTION:
+                        case PACKAGE:
+                        case EXECUTABLE:
+                        case NONE:
+                        case VOID:
+                        case ERROR:
+                            return s;
+                        default: return s.cloneWithMetadata(s.getMetadata().without(Kind.ANNOTATIONS));
                     }
                 } else {
-                    return ty;
+                    return s;
                 }
             }
 
@@ -2212,7 +2177,7 @@
                     return t; /*fast special case*/
                 else {
                     //other cases already handled
-                    return combineMetadata(t, t.getMetadata());
+                    return combineMetadata(t, t);
                 }
             }
 
@@ -2220,17 +2185,18 @@
             public Type visitClassType(ClassType t, Boolean recurse) {
                 Type erased = t.tsym.erasure(Types.this);
                 if (recurse) {
-                    erased = new ErasedClassType(erased.getEnclosingType(),erased.tsym, t.getMetadata());
+                    erased = new ErasedClassType(erased.getEnclosingType(),erased.tsym,
+                            t.getMetadata().without(Kind.ANNOTATIONS));
                     return erased;
                 } else {
-                    return combineMetadata(erased, t.getMetadata());
+                    return combineMetadata(erased, t);
                 }
             }
 
             @Override
             public Type visitTypeVar(TypeVar t, Boolean recurse) {
                 Type erased = erasure(t.bound, recurse);
-                return combineMetadata(erased, t.getMetadata());
+                return combineMetadata(erased, t);
             }
         };
 
@@ -2932,7 +2898,7 @@
     public List<Type> subst(List<Type> ts,
                             List<Type> from,
                             List<Type> to) {
-        return new Subst(from, to).subst(ts);
+        return ts.map(new Subst(from, to));
     }
 
     /**
@@ -2942,10 +2908,10 @@
      * elements of the longer list.
      */
     public Type subst(Type t, List<Type> from, List<Type> to) {
-        return new Subst(from, to).subst(t);
+        return t.map(new Subst(from, to));
     }
 
-    private class Subst extends UnaryVisitor<Type> {
+    private class Subst extends TypeMapping<Void> {
         List<Type> from;
         List<Type> to;
 
@@ -2964,49 +2930,12 @@
             this.to = to;
         }
 
-        Type subst(Type t) {
-            if (from.tail == null)
-                return t;
-            else
-                return visit(t);
-            }
-
-        List<Type> subst(List<Type> ts) {
-            if (from.tail == null)
-                return ts;
-            boolean wild = false;
-            if (ts.nonEmpty() && from.nonEmpty()) {
-                Type head1 = subst(ts.head);
-                List<Type> tail1 = subst(ts.tail);
-                if (head1 != ts.head || tail1 != ts.tail)
-                    return tail1.prepend(head1);
-            }
-            return ts;
-        }
-
-        public Type visitType(Type t, Void ignored) {
-            return t;
-        }
-
-        @Override
-        public Type visitMethodType(MethodType t, Void ignored) {
-            List<Type> argtypes = subst(t.argtypes);
-            Type restype = subst(t.restype);
-            List<Type> thrown = subst(t.thrown);
-            if (argtypes == t.argtypes &&
-                restype == t.restype &&
-                thrown == t.thrown)
-                return t;
-            else
-                return new MethodType(argtypes, restype, thrown, t.tsym);
-        }
-
         @Override
         public Type visitTypeVar(TypeVar t, Void ignored) {
             for (List<Type> from = this.from, to = this.to;
                  from.nonEmpty();
                  from = from.tail, to = to.tail) {
-                if (t == from.head) {
+                if (t.equalsIgnoreMetadata(from.head)) {
                     return to.head.withTypeVar(t);
                 }
             }
@@ -3014,26 +2943,12 @@
         }
 
         @Override
-        public Type visitUndetVar(UndetVar t, Void ignored) {
-            //do nothing - we should not replace inside undet variables
-            return t;
-        }
-
-        @Override
         public Type visitClassType(ClassType t, Void ignored) {
             if (!t.isCompound()) {
-                List<Type> typarams = t.getTypeArguments();
-                List<Type> typarams1 = subst(typarams);
-                Type outer = t.getEnclosingType();
-                Type outer1 = subst(outer);
-                if (typarams1 == typarams && outer1 == outer)
-                    return t;
-                else
-                    return new ClassType(outer1, typarams1, t.tsym,
-                                         t.getMetadata());
+                return super.visitClassType(t, ignored);
             } else {
-                Type st = subst(supertype(t));
-                List<Type> is = subst(interfaces(t));
+                Type st = visit(supertype(t));
+                List<Type> is = visit(interfaces(t), ignored);
                 if (st == supertype(t) && is == interfaces(t))
                     return t;
                 else
@@ -3043,26 +2958,11 @@
 
         @Override
         public Type visitWildcardType(WildcardType t, Void ignored) {
-            Type bound = t.type;
-            if (t.kind != BoundKind.UNBOUND)
-                bound = subst(bound);
-            if (bound == t.type) {
-                return t;
-            } else {
-                if (t.isExtendsBound() && bound.isExtendsBound())
-                    bound = wildUpperBound(bound);
-                return new WildcardType(bound, t.kind, syms.boundClass,
-                                        t.bound, t.getMetadata());
+            WildcardType t2 = (WildcardType)super.visitWildcardType(t, ignored);
+            if (t2 != t && t.isExtendsBound() && t2.type.isExtendsBound()) {
+                t2.type = wildUpperBound(t2.type);
             }
-        }
-
-        @Override
-        public Type visitArrayType(ArrayType t, Void ignored) {
-            Type elemtype = subst(t.elemtype);
-            if (elemtype == t.elemtype)
-                return t;
-            else
-                return new ArrayType(elemtype, t.tsym, t.getMetadata());
+            return t2;
         }
 
         @Override
@@ -3075,21 +2975,25 @@
                                Types.this.subst(t.qtype, t.tvars, freevars));
             }
             List<Type> tvars1 = substBounds(t.tvars, from, to);
-            Type qtype1 = subst(t.qtype);
+            Type qtype1 = visit(t.qtype);
             if (tvars1 == t.tvars && qtype1 == t.qtype) {
                 return t;
             } else if (tvars1 == t.tvars) {
-                return new ForAll(tvars1, qtype1);
+                return new ForAll(tvars1, qtype1) {
+                    @Override
+                    public boolean needsStripping() {
+                        return true;
+                    }
+                };
             } else {
-                return new ForAll(tvars1,
-                                  Types.this.subst(qtype1, t.tvars, tvars1));
+                return new ForAll(tvars1, Types.this.subst(qtype1, t.tvars, tvars1)) {
+                    @Override
+                    public boolean needsStripping() {
+                        return true;
+                    }
+                };
             }
         }
-
-        @Override
-        public Type visitErrorType(ErrorType t, Void ignored) {
-            return t;
-        }
     }
 
     public List<Type> substBounds(List<Type> tvars,
@@ -4232,8 +4136,7 @@
     }
 
     private boolean containsTypeEquivalent(Type t, Type s) {
-        return
-            isSameType(t, s) || // shortcut
+        return isSameType(t, s) || // shortcut
             containsType(t, s) && containsType(s, t);
     }
 
@@ -4675,7 +4578,7 @@
         return getRetention(a.type.tsym);
     }
 
-    public RetentionPolicy getRetention(Symbol sym) {
+    public RetentionPolicy getRetention(TypeSymbol sym) {
         RetentionPolicy vis = RetentionPolicy.CLASS; // the default
         Attribute.Compound c = sym.attribute(syms.retentionType.tsym);
         if (c != null) {
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
index feadce3..35fe5bb 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,28 +25,39 @@
 
 package com.sun.tools.javac.comp;
 
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Attribute.Compound;
+import com.sun.tools.javac.code.Attribute.TypeCompound;
+import com.sun.tools.javac.code.Scope.WriteableScope;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.TypeMetadata.Entry.Kind;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.tree.TreeInfo;
+import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.tree.TreeScanner;
+import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
+import com.sun.tools.javac.util.List;
 
 import javax.tools.JavaFileObject;
+import java.util.*;
 
-import com.sun.tools.javac.util.*;
-import com.sun.tools.javac.util.DefinedBy.Api;
-import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.tree.*;
-import com.sun.tools.javac.tree.JCTree.*;
-
-import static com.sun.tools.javac.code.Kinds.Kind.*;
+import static com.sun.tools.javac.code.Flags.SYNTHETIC;
+import static com.sun.tools.javac.code.Kinds.Kind.MTH;
+import static com.sun.tools.javac.code.Kinds.Kind.VAR;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.ARRAY;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
-import static com.sun.tools.javac.tree.JCTree.Tag.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.ANNOTATION;
+import static com.sun.tools.javac.tree.JCTree.Tag.ASSIGN;
+import static com.sun.tools.javac.tree.JCTree.Tag.IDENT;
+import static com.sun.tools.javac.tree.JCTree.Tag.NEWARRAY;
 
-/** Enter annotations on symbols.  Annotations accumulate in a queue,
- *  which is processed at the top level of any set of recursive calls
- *  requesting it be processed.
+/** Enter annotations onto symbols and types (and trees).
+ *
+ *  This is also a pseudo stage in the compiler taking care of scheduling when annotations are
+ *  entered.
  *
  *  <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.
@@ -64,95 +75,98 @@
     }
 
     private final Attr attr;
-    private final TreeMaker make;
-    private final Log log;
-    private final Symtab syms;
-    private final Names names;
-    private final Resolve rs;
-    private final Types types;
-    private final ConstFold cfolder;
     private final Check chk;
-    private final Lint lint;
+    private final ConstFold cfolder;
     private final DeferredLintHandler deferredLintHandler;
-    private final Source source;
+    private final Enter enter;
+    private final Lint lint;
+    private final Log log;
+    private final Names names;
+    private final Resolve resolve;
+    private final TreeMaker make;
+    private final Symtab syms;
+    private final TypeEnvs typeEnvs;
+    private final Types types;
 
-    private boolean allowTypeAnnos;
-    private boolean allowRepeatedAnnos;
+    private final Attribute theUnfinishedDefaultValue;
+    private final boolean allowRepeatedAnnos;
 
     protected Annotate(Context context) {
         context.put(annotateKey, this);
+
         attr = Attr.instance(context);
-        make = TreeMaker.instance(context);
-        log = Log.instance(context);
-        syms = Symtab.instance(context);
-        names = Names.instance(context);
-        rs = Resolve.instance(context);
-        types = Types.instance(context);
-        cfolder = ConstFold.instance(context);
         chk = Check.instance(context);
-        source = Source.instance(context);
-        lint = Lint.instance(context);
+        cfolder = ConstFold.instance(context);
         deferredLintHandler = DeferredLintHandler.instance(context);
+        enter = Enter.instance(context);
+        log = Log.instance(context);
+        lint = Lint.instance(context);
+        make = TreeMaker.instance(context);
+        names = Names.instance(context);
+        resolve = Resolve.instance(context);
+        syms = Symtab.instance(context);
+        typeEnvs = TypeEnvs.instance(context);
+        types = Types.instance(context);
+
+        theUnfinishedDefaultValue =  new Attribute.Error(syms.errType);
+
+        Source source = Source.instance(context);
         allowRepeatedAnnos = source.allowRepeatedAnnotations();
-        allowTypeAnnos = source.allowTypeAnnotations();
     }
 
-/* ********************************************************************
- * Queue maintenance
- *********************************************************************/
+    /** Semaphore to delay annotation processing */
+    private int blockCount = 0;
 
-    private int enterCount = 0;
-
-    ListBuffer<Worker> q = new ListBuffer<>();
-    ListBuffer<Worker> typesQ = new ListBuffer<>();
-    ListBuffer<Worker> repeatedQ = new ListBuffer<>();
-    ListBuffer<Worker> afterRepeatedQ = new ListBuffer<>();
-    ListBuffer<Worker> validateQ = new ListBuffer<>();
-
-    public void earlier(Worker a) {
-        q.prepend(a);
+    /** Called when annotations processing needs to be postponed. */
+    public void blockAnnotations() {
+        blockCount++;
     }
 
-    public void normal(Worker a) {
-        q.append(a);
-    }
-
-    public void typeAnnotation(Worker a) {
-        typesQ.append(a);
-    }
-
-    public void repeated(Worker a) {
-        repeatedQ.append(a);
-    }
-
-    public void afterRepeated(Worker a) {
-        afterRepeatedQ.append(a);
-    }
-
-    public void validate(Worker a) {
-        validateQ.append(a);
-    }
-
-    /** Called when the Enter phase starts. */
-    public void enterStart() {
-        enterCount++;
-    }
-
-    /** Called after the Enter phase completes. */
-    public void enterDone() {
-        enterCount--;
-        flush();
+    /** Called when annotation processing can be resumed. */
+    public void unblockAnnotations() {
+        blockCount--;
+        if (blockCount == 0)
+            flush();
     }
 
     /** Variant which allows for a delayed flush of annotations.
      * Needed by ClassReader */
-    public void enterDoneWithoutFlush() {
-        enterCount--;
+    public void unblockAnnotationsNoFlush() {
+        blockCount--;
     }
 
+    /** are we blocking annotation processing? */
+    public boolean annotationsBlocked() {return blockCount > 0; }
+
+    public List<TypeCompound> fromAnnotations(List<JCAnnotation> annotations) {
+        if (annotations.isEmpty()) {
+            return List.nil();
+        }
+
+        ListBuffer<TypeCompound> buf = new ListBuffer<>();
+        for (JCAnnotation anno : annotations) {
+            Assert.checkNonNull(anno.attribute);
+            buf.append((TypeCompound) anno.attribute);
+        }
+        return buf.toList();
+    }
+
+    /** Annotate (used for everything else) */
+    public void normal(Runnable r) {
+        q.append(r);
+    }
+
+    /** Validate, triggers after 'normal' */
+    public void validate(Runnable a) {
+        validateQ.append(a);
+    }
+
+    /** Flush all annotation queues */
     public void flush() {
-        if (enterCount != 0) return;
-        enterCount++;
+        if (annotationsBlocked()) return;
+        if (isFlushing()) return;
+
+        startFlushing();
         try {
             while (q.nonEmpty()) {
                 q.next().run();
@@ -160,35 +174,502 @@
             while (typesQ.nonEmpty()) {
                 typesQ.next().run();
             }
-            while (repeatedQ.nonEmpty()) {
-                repeatedQ.next().run();
-            }
-            while (afterRepeatedQ.nonEmpty()) {
-                afterRepeatedQ.next().run();
+            while (afterTypesQ.nonEmpty()) {
+                afterTypesQ.next().run();
             }
             while (validateQ.nonEmpty()) {
                 validateQ.next().run();
             }
         } finally {
-            enterCount--;
+            doneFlushing();
         }
     }
 
-    /** A client that needs to run during {@link #flush()} registers an worker
-     *  into one of the queues defined in this class. The queues are: {@link #earlier(Worker)},
-     *  {@link #normal(Worker)}, {@link #typeAnnotation(Worker)}, {@link #repeated(Worker)},
-     *  {@link #afterRepeated(Worker)}, {@link #validate(Worker)}.
-     *  The {@link Worker#run()} method will called inside the {@link #flush()}
-     *  call. Queues are empties in the abovementioned order.
-     */
-    public interface Worker {
-        void run();
-        String toString();
+    private ListBuffer<Runnable> q = new ListBuffer<>();
+    private ListBuffer<Runnable> validateQ = new ListBuffer<>();
+
+    private int flushCount = 0;
+    private boolean isFlushing() { return flushCount > 0; }
+    private void startFlushing() { flushCount++; }
+    private void doneFlushing() { flushCount--; }
+
+    ListBuffer<Runnable> typesQ = new ListBuffer<>();
+    ListBuffer<Runnable> afterTypesQ = new ListBuffer<>();
+
+
+    public void typeAnnotation(Runnable a) {
+        typesQ.append(a);
+    }
+
+    public void afterTypes(Runnable a) {
+        afterTypesQ.append(a);
     }
 
     /**
+     * Queue annotations for later attribution and entering. This is probably the method you are looking for.
+     *
+     * @param annotations the list of JCAnnotations to attribute and enter
+     * @param localEnv    the enclosing env
+     * @param s           ths Symbol on which to enter the annotations
+     * @param deferPos    report errors here
+     */
+    public void annotateLater(List<JCAnnotation> annotations, Env<AttrContext> localEnv,
+            Symbol s, DiagnosticPosition deferPos)
+    {
+        if (annotations.isEmpty()) {
+            return;
+        }
+
+        s.resetAnnotations(); // mark Annotations as incomplete for now
+
+        normal(new Runnable() {
+            @Override
+            public String toString() {
+                return "Annotate " + annotations + " onto " + s + " in " + s.owner;
+            }
+
+            @Override
+            public void run() {
+                Assert.check(s.annotationsPendingCompletion());
+                JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
+                DiagnosticPosition prevLintPos =
+                        deferPos != null
+                                ? deferredLintHandler.setPos(deferPos)
+                                : deferredLintHandler.immediate();
+                Lint prevLint = deferPos != null ? null : chk.setLint(lint);
+                try {
+                    if (s.hasAnnotations() && annotations.nonEmpty())
+                        log.error(annotations.head.pos, "already.annotated", Kinds.kindName(s), s);
+
+                    Assert.checkNonNull(s, "Symbol argument to actualEnterAnnotations is null");
+                    annotateNow(s, annotations, localEnv, false);
+                } finally {
+                    if (prevLint != null)
+                        chk.setLint(prevLint);
+                    deferredLintHandler.setPos(prevLintPos);
+                    log.useSource(prev);
+                }
+            }
+        });
+
+        validate(new Runnable() { //validate annotations
+            @Override
+            public void run() {
+                JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
+                try {
+                    chk.validateAnnotations(annotations, s);
+                } finally {
+                    log.useSource(prev);
+                }
+            }
+
+            @Override
+            public String toString() {
+                return "validate annotations: " + annotations + " on " + s;
+            }
+        });
+    }
+
+
+    /** Queue processing of an attribute default value. */
+    public void annotateDefaultValueLater(JCExpression defaultValue, Env<AttrContext> localEnv,
+            MethodSymbol m, DiagnosticPosition deferPos)
+    {
+        normal(new Runnable() {
+            @Override
+            public void run() {
+                JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
+                DiagnosticPosition prevLintPos = deferredLintHandler.setPos(deferPos);
+                try {
+                    enterDefaultValue(defaultValue, localEnv, m);
+                } finally {
+                    deferredLintHandler.setPos(prevLintPos);
+                    log.useSource(prev);
+                }
+            }
+
+            @Override
+            public String toString() {
+                return "Annotate " + m.owner + "." +
+                        m + " default " + defaultValue;
+            }
+        });
+
+        validate(new Runnable() { //validate annotations
+            @Override
+            public void run() {
+                JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
+                try {
+                    // if default value is an annotation, check it is a well-formed
+                    // annotation value (e.g. no duplicate values, no missing values, etc.)
+                    chk.validateAnnotationTree(defaultValue);
+                } finally {
+                    log.useSource(prev);
+                }
+            }
+
+            @Override
+            public String toString() {
+                return "Validate default value " + m.owner + "." + m + " default " + defaultValue;
+            }
+        });
+    }
+
+    /** Enter a default value for an annotation element. */
+    private void enterDefaultValue(JCExpression defaultValue,
+            Env<AttrContext> localEnv, MethodSymbol m) {
+        m.defaultValue = attributeAnnotationValue(m.type.getReturnType(), defaultValue, localEnv);
+    }
+
+    /**
+     * Gather up annotations into a map from type symbols to lists of Compound attributes,
+     * then continue on with repeating annotations processing.
+     */
+    private <T extends Attribute.Compound> void annotateNow(Symbol toAnnotate,
+            List<JCAnnotation> withAnnotations, Env<AttrContext> env, boolean typeAnnotations)
+    {
+        Map<TypeSymbol, ListBuffer<T>> annotated = new LinkedHashMap<>();
+        Map<T, DiagnosticPosition> pos = new HashMap<>();
+        boolean allowRepeatedAnnos = this.allowRepeatedAnnos;
+
+        for (List<JCAnnotation> al = withAnnotations; !al.isEmpty(); al = al.tail) {
+            JCAnnotation a = al.head;
+
+            T c;
+            if (typeAnnotations) {
+                @SuppressWarnings("unchecked")
+                T tmp = (T)attributeTypeAnnotation(a, syms.annotationType, env);
+                c = tmp;
+            } else {
+                @SuppressWarnings("unchecked")
+                T tmp = (T)attributeAnnotation(a, syms.annotationType, env);
+                c = tmp;
+            }
+
+            Assert.checkNonNull(c, "Failed to create annotation");
+
+            if (annotated.containsKey(a.type.tsym)) {
+                if (!allowRepeatedAnnos) {
+                    log.error(a.pos(), "repeatable.annotations.not.supported.in.source");
+                    allowRepeatedAnnos = true;
+                }
+                ListBuffer<T> l = annotated.get(a.type.tsym);
+                l = l.append(c);
+                annotated.put(a.type.tsym, l);
+                pos.put(c, a.pos());
+            } else {
+                annotated.put(a.type.tsym, ListBuffer.of(c));
+                pos.put(c, a.pos());
+            }
+
+            // Note: @Deprecated has no effect on local variables and parameters
+            if (!c.type.isErroneous()
+                    && toAnnotate.owner.kind != MTH
+                    && types.isSameType(c.type, syms.deprecatedType)) {
+                toAnnotate.flags_field |= Flags.DEPRECATED;
+            }
+        }
+
+        List<T> buf = List.nil();
+        for (ListBuffer<T> lb : annotated.values()) {
+            if (lb.size() == 1) {
+                buf = buf.prepend(lb.first());
+            } else {
+                AnnotationContext<T> ctx = new AnnotationContext<>(env, annotated, pos, typeAnnotations);
+                T res = makeContainerAnnotation(lb.toList(), ctx, toAnnotate);
+                if (res != null)
+                    buf = buf.prepend(res);
+            }
+        }
+
+        if (typeAnnotations) {
+            @SuppressWarnings("unchecked")
+            List<TypeCompound> attrs = (List<TypeCompound>)buf.reverse();
+            toAnnotate.appendUniqueTypeAttributes(attrs);
+        } else {
+            @SuppressWarnings("unchecked")
+            List<Attribute.Compound> attrs =  (List<Attribute.Compound>)buf.reverse();
+            toAnnotate.resetAnnotations();
+            toAnnotate.setDeclarationAttributes(attrs);
+        }
+    }
+
+    /**
+     * Attribute and store a semantic representation of the annotation tree {@code tree} into the
+     * tree.attribute field.
+     *
+     * @param tree the tree representing an annotation
+     * @param expectedAnnotationType the expected (super)type of the annotation
+     * @param env the current env in where the annotation instance is found
+     */
+    public Attribute.Compound attributeAnnotation(JCAnnotation tree, Type expectedAnnotationType,
+                                                  Env<AttrContext> env)
+    {
+        // The attribute might have been entered if it is Target or Repetable
+        // Because TreeCopier does not copy type, redo this if type is null
+        if (tree.attribute != null && tree.type != null)
+            return tree.attribute;
+
+        List<Pair<MethodSymbol, Attribute>> elems = attributeAnnotationValues(tree, expectedAnnotationType, env);
+        Attribute.Compound ac = new Attribute.Compound(tree.type, elems);
+
+        return tree.attribute = ac;
+    }
+
+    /** Attribute and store a semantic representation of the type annotation tree {@code tree} into
+     * the tree.attribute field.
+     *
+     * @param a the tree representing an annotation
+     * @param expectedAnnotationType the expected (super)type of the annotation
+     * @param env the the current env in where the annotation instance is found
+     */
+    public Attribute.TypeCompound attributeTypeAnnotation(JCAnnotation a, Type expectedAnnotationType,
+                                                          Env<AttrContext> env)
+    {
+        // The attribute might have been entered if it is Target or Repetable
+        // Because TreeCopier does not copy type, redo this if type is null
+        if (a.attribute == null || a.type == null || !(a.attribute instanceof Attribute.TypeCompound)) {
+            // Create a new TypeCompound
+            List<Pair<MethodSymbol,Attribute>> elems =
+                    attributeAnnotationValues(a, expectedAnnotationType, env);
+
+            Attribute.TypeCompound tc =
+                    new Attribute.TypeCompound(a.type, elems, TypeAnnotationPosition.unknown);
+            a.attribute = tc;
+            return tc;
+        } else {
+            // Use an existing TypeCompound
+            return (Attribute.TypeCompound)a.attribute;
+        }
+    }
+
+    /**
+     *  Attribute annotation elements creating a list of pairs of the Symbol representing that
+     *  element and the value of that element as an Attribute. */
+    private List<Pair<MethodSymbol, Attribute>> attributeAnnotationValues(JCAnnotation a,
+            Type expected, Env<AttrContext> env)
+    {
+        // The annotation might have had its type attributed (but not
+        // checked) by attr.attribAnnotationTypes during MemberEnter,
+        // in which case we do not need to do it again.
+        Type at = (a.annotationType.type != null ?
+                a.annotationType.type : attr.attribType(a.annotationType, env));
+        a.type = chk.checkType(a.annotationType.pos(), at, expected);
+
+        boolean isError = a.type.isErroneous();
+        if (!a.type.tsym.isAnnotationType() && !isError) {
+            log.error(a.annotationType.pos(),
+                    "not.annotation.type", a.type.toString());
+            isError = true;
+        }
+
+        // List of name=value pairs (or implicit "value=" if size 1)
+        List<JCExpression> args = a.args;
+
+        boolean elidedValue = false;
+        // special case: elided "value=" assumed
+        if (args.length() == 1 && !args.head.hasTag(ASSIGN)) {
+            args.head = make.at(args.head.pos).
+                    Assign(make.Ident(names.value), args.head);
+            elidedValue = true;
+        }
+
+        ListBuffer<Pair<MethodSymbol,Attribute>> buf = new ListBuffer<>();
+        for (List<JCExpression> tl = args; tl.nonEmpty(); tl = tl.tail) {
+            Pair<MethodSymbol, Attribute> p = attributeAnnotationNameValuePair(tl.head, a.type, isError, env, elidedValue);
+            if (p != null && !p.fst.type.isErroneous())
+                buf.append(p);
+        }
+        return buf.toList();
+    }
+
+    // where
+    private Pair<MethodSymbol, Attribute> attributeAnnotationNameValuePair(JCExpression nameValuePair,
+            Type thisAnnotationType, boolean badAnnotation, Env<AttrContext> env, boolean elidedValue)
+    {
+        if (!nameValuePair.hasTag(ASSIGN)) {
+            log.error(nameValuePair.pos(), "annotation.value.must.be.name.value");
+            attributeAnnotationValue(nameValuePair.type = syms.errType, nameValuePair, env);
+            return null;
+        }
+        JCAssign assign = (JCAssign)nameValuePair;
+        if (!assign.lhs.hasTag(IDENT)) {
+            log.error(nameValuePair.pos(), "annotation.value.must.be.name.value");
+            attributeAnnotationValue(nameValuePair.type = syms.errType, nameValuePair, env);
+            return null;
+        }
+
+        // Resolve element to MethodSym
+        JCIdent left = (JCIdent)assign.lhs;
+        Symbol method = resolve.resolveQualifiedMethod(elidedValue ? assign.rhs.pos() : left.pos(),
+                env, thisAnnotationType,
+                left.name, List.<Type>nil(), null);
+        left.sym = method;
+        left.type = method.type;
+        if (method.owner != thisAnnotationType.tsym && !badAnnotation)
+            log.error(left.pos(), "no.annotation.member", left.name, thisAnnotationType);
+        Type resultType = method.type.getReturnType();
+
+        // Compute value part
+        Attribute value = attributeAnnotationValue(resultType, assign.rhs, env);
+        nameValuePair.type = resultType;
+
+        return method.type.isErroneous() ? null : new Pair<>((MethodSymbol)method, value);
+
+    }
+
+    /** Attribute an annotation element value */
+    private Attribute attributeAnnotationValue(Type expectedElementType, JCExpression tree,
+            Env<AttrContext> env)
+    {
+        //first, try completing the symbol for the annotation value - if acompletion
+        //error is thrown, we should recover gracefully, and display an
+        //ordinary resolution diagnostic.
+        try {
+            expectedElementType.tsym.complete();
+        } catch(CompletionFailure e) {
+            log.error(tree.pos(), "cant.resolve", Kinds.kindName(e.sym), e.sym);
+            expectedElementType = syms.errType;
+        }
+
+        if (expectedElementType.hasTag(ARRAY)) {
+            return getAnnotationArrayValue(expectedElementType, tree, env);
+
+        }
+
+        //error recovery
+        if (tree.hasTag(NEWARRAY)) {
+            if (!expectedElementType.isErroneous())
+                log.error(tree.pos(), "annotation.value.not.allowable.type");
+            JCNewArray na = (JCNewArray)tree;
+            if (na.elemtype != null) {
+                log.error(na.elemtype.pos(), "new.not.allowed.in.annotation");
+            }
+            for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) {
+                attributeAnnotationValue(syms.errType,
+                        l.head,
+                        env);
+            }
+            return new Attribute.Error(syms.errType);
+        }
+
+        if (expectedElementType.tsym.isAnnotationType()) {
+            if (tree.hasTag(ANNOTATION)) {
+                return attributeAnnotation((JCAnnotation)tree, expectedElementType, env);
+            } else {
+                log.error(tree.pos(), "annotation.value.must.be.annotation");
+                expectedElementType = syms.errType;
+            }
+        }
+
+        //error recovery
+        if (tree.hasTag(ANNOTATION)) {
+            if (!expectedElementType.isErroneous())
+                log.error(tree.pos(), "annotation.not.valid.for.type", expectedElementType);
+            attributeAnnotation((JCAnnotation)tree, syms.errType, env);
+            return new Attribute.Error(((JCAnnotation)tree).annotationType.type);
+        }
+
+        if (expectedElementType.isPrimitive() ||
+                (types.isSameType(expectedElementType, syms.stringType) && !expectedElementType.hasTag(TypeTag.ERROR))) {
+            return getAnnotationPrimitiveValue(expectedElementType, tree, env);
+        }
+
+        if (expectedElementType.tsym == syms.classType.tsym) {
+            return getAnnotationClassValue(expectedElementType, tree, env);
+        }
+
+        if (expectedElementType.hasTag(CLASS) &&
+                (expectedElementType.tsym.flags() & Flags.ENUM) != 0) {
+            return getAnnotationEnumValue(expectedElementType, tree, env);
+        }
+
+        //error recovery:
+        if (!expectedElementType.isErroneous())
+            log.error(tree.pos(), "annotation.value.not.allowable.type");
+        return new Attribute.Error(attr.attribExpr(tree, env, expectedElementType));
+    }
+
+    private Attribute getAnnotationEnumValue(Type expectedElementType, JCExpression tree, Env<AttrContext> env) {
+        Type result = attr.attribExpr(tree, env, expectedElementType);
+        Symbol sym = TreeInfo.symbol(tree);
+        if (sym == null ||
+                TreeInfo.nonstaticSelect(tree) ||
+                sym.kind != VAR ||
+                (sym.flags() & Flags.ENUM) == 0) {
+            log.error(tree.pos(), "enum.annotation.must.be.enum.constant");
+            return new Attribute.Error(result.getOriginalType());
+        }
+        VarSymbol enumerator = (VarSymbol) sym;
+        return new Attribute.Enum(expectedElementType, enumerator);
+    }
+
+    private Attribute getAnnotationClassValue(Type expectedElementType, JCExpression tree, Env<AttrContext> env) {
+        Type result = attr.attribExpr(tree, env, expectedElementType);
+        if (result.isErroneous()) {
+            // Does it look like an unresolved class literal?
+            if (TreeInfo.name(tree) == names._class &&
+                    ((JCFieldAccess) tree).selected.type.isErroneous()) {
+                Name n = (((JCFieldAccess) tree).selected).type.tsym.flatName();
+                return new Attribute.UnresolvedClass(expectedElementType,
+                        types.createErrorType(n,
+                                syms.unknownSymbol, syms.classType));
+            } else {
+                return new Attribute.Error(result.getOriginalType());
+            }
+        }
+
+        // Class literals look like field accesses of a field named class
+        // at the tree level
+        if (TreeInfo.name(tree) != names._class) {
+            log.error(tree.pos(), "annotation.value.must.be.class.literal");
+            return new Attribute.Error(syms.errType);
+        }
+        return new Attribute.Class(types,
+                (((JCFieldAccess) tree).selected).type);
+    }
+
+    private Attribute getAnnotationPrimitiveValue(Type expectedElementType, JCExpression tree, Env<AttrContext> env) {
+        Type result = attr.attribExpr(tree, env, expectedElementType);
+        if (result.isErroneous())
+            return new Attribute.Error(result.getOriginalType());
+        if (result.constValue() == null) {
+            log.error(tree.pos(), "attribute.value.must.be.constant");
+            return new Attribute.Error(expectedElementType);
+        }
+        result = cfolder.coerce(result, expectedElementType);
+        return new Attribute.Constant(expectedElementType, result.constValue());
+    }
+
+    private Attribute getAnnotationArrayValue(Type expectedElementType, JCExpression tree, Env<AttrContext> env) {
+        // Special case, implicit array
+        if (!tree.hasTag(NEWARRAY)) {
+            tree = make.at(tree.pos).
+                    NewArray(null, List.<JCExpression>nil(), List.of(tree));
+        }
+
+        JCNewArray na = (JCNewArray)tree;
+        if (na.elemtype != null) {
+            log.error(na.elemtype.pos(), "new.not.allowed.in.annotation");
+        }
+        ListBuffer<Attribute> buf = new ListBuffer<>();
+        for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) {
+            buf.append(attributeAnnotationValue(types.elemtype(expectedElementType),
+                    l.head,
+                    env));
+        }
+        na.type = expectedElementType;
+        return new Attribute.
+                Array(expectedElementType, buf.toArray(new Attribute[buf.length()]));
+    }
+
+    /* *********************************
+     * Support for repeating annotations
+     ***********************************/
+
+    /**
      * This context contains all the information needed to synthesize new
-     * annotations trees by the completer for repeating annotations.
+     * annotations trees for repeating annotations.
      */
     private class AnnotationContext<T extends Attribute.Compound> {
         public final Env<AttrContext> env;
@@ -209,280 +690,15 @@
             this.pos = pos;
             this.isTypeCompound = isTypeCompound;
         }
-
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            sb.append("RepeatedContext[");
-            for (Map.Entry<Symbol.TypeSymbol, ListBuffer<T>> entry :
-                     annotated.entrySet()) {
-                sb.append(" ");
-                sb.append(entry.getKey());
-                sb.append(" = { ");
-                sb.append(entry.getValue());
-                sb.append(" }");
-            }
-            sb.append(" ]");
-            return sb.toString();
-        }
     }
 
-    private static class Placeholder<T extends Attribute.Compound> extends Attribute.Compound {
-
-        private final Annotate.AnnotationContext<T> ctx;
-        private final List<T> placeholderFor;
-        private final Symbol on;
-
-        public Placeholder(Annotate.AnnotationContext<T> ctx,
-                           List<T> placeholderFor, Symbol on) {
-            super(on.type, List.<Pair<Symbol.MethodSymbol, Attribute>>nil(),
-                  placeholderFor.head.position);
-            this.ctx = ctx;
-            this.placeholderFor = placeholderFor;
-            this.on = on;
-        }
-
-        @Override @DefinedBy(Api.LANGUAGE_MODEL)
-        public String toString() {
-            return "<placeholder: " + placeholderFor + " on: " + on + ">";
-    }
-
-        public List<T> getPlaceholderFor() {
-            return placeholderFor;
-        }
-
-        public Annotate.AnnotationContext<T> getRepeatedContext() {
-            return ctx;
-        }
-    }
-
-
-/* ********************************************************************
- * Compute an attribute from its annotation.
- *********************************************************************/
-
-    /** Process a single compound annotation, returning its
-     *  Attribute. Used from MemberEnter for attaching the attributes
-     *  to the annotated symbol.
-     */
-    Attribute.Compound enterAnnotation(JCAnnotation a,
-                                       Type expected,
-                                       Env<AttrContext> env) {
-        List<Pair<MethodSymbol,Attribute>> elems =
-            enterAttributeValues(a, expected, env);
-        Attribute.Compound ac = new Attribute.Compound(a.type, elems);
-        a.attribute = ac;
-
-        return ac;
-    }
-
-    Attribute.TypeCompound enterTypeAnnotation(JCAnnotation a,
-                                               Type expected,
-                                               Env<AttrContext> env) {
-        List<Pair<MethodSymbol,Attribute>> elems =
-            enterAttributeValues(a, expected, env);
-
-        if (a.attribute == null || !(a.attribute instanceof Attribute.TypeCompound)) {
-            // Create a new TypeCompound
-
-            Attribute.TypeCompound tc =
-                new Attribute.TypeCompound(a.type, elems,
-                // TODO: Eventually, we will get rid of this use of
-                // unknown, because we'll get a position from
-                // MemberEnter (task 8027262).
-                                           TypeAnnotationPosition.unknown);
-            a.attribute = tc;
-            return tc;
-        } else {
-            // Use an existing TypeCompound
-            return (Attribute.TypeCompound)a.attribute;
-        }
-    }
-
-    private List<Pair<MethodSymbol,Attribute>>
-            enterAttributeValues(JCAnnotation a,
-                                 Type expected,
-                                 Env<AttrContext> env) {
-        // The annotation might have had its type attributed (but not
-        // checked) by attr.attribAnnotationTypes during MemberEnter,
-        // in which case we do not need to do it again.
-        Type at = (a.annotationType.type != null ? a.annotationType.type
-                  : attr.attribType(a.annotationType, env));
-        a.type = chk.checkType(a.annotationType.pos(), at, expected);
-        boolean isError = a.type.isErroneous();
-        if ((a.type.tsym.flags() & Flags.ANNOTATION) == 0 && !isError) {
-            log.error(a.annotationType.pos(),
-                      "not.annotation.type", a.type.toString());
-            isError = true;
-        }
-        List<JCExpression> args = a.args;
-        boolean elidedValue = false;
-        if (args.length() == 1 && !args.head.hasTag(ASSIGN)) {
-            // special case: elided "value=" assumed
-            elidedValue = true;
-            args.head = make.at(args.head.pos).
-                Assign(make.Ident(names.value), args.head);
-        }
-        ListBuffer<Pair<MethodSymbol,Attribute>> buf =
-            new ListBuffer<>();
-        for (List<JCExpression> tl = args; tl.nonEmpty(); tl = tl.tail) {
-            JCExpression t = tl.head;
-            if (!t.hasTag(ASSIGN)) {
-                log.error(t.pos(), "annotation.value.must.be.name.value");
-                enterAttributeValue(t.type = syms.errType, t, env);
-                continue;
-            }
-            JCAssign assign = (JCAssign)t;
-            if (!assign.lhs.hasTag(IDENT)) {
-                log.error(t.pos(), "annotation.value.must.be.name.value");
-                enterAttributeValue(t.type = syms.errType, t, env);
-                continue;
-            }
-            JCIdent left = (JCIdent)assign.lhs;
-            Symbol method = rs.resolveQualifiedMethod(elidedValue ? assign.rhs.pos() : left.pos(),
-                                                          env,
-                                                          a.type,
-                                                          left.name,
-                                                          List.<Type>nil(),
-                                                          null);
-            left.sym = method;
-            left.type = method.type;
-            if (method.owner != a.type.tsym && !isError)
-                log.error(left.pos(), "no.annotation.member", left.name, a.type);
-            Type result = method.type.getReturnType();
-            Attribute value = enterAttributeValue(result, assign.rhs, env);
-            if (!method.type.isErroneous())
-                buf.append(new Pair<>((MethodSymbol)method, value));
-            t.type = result;
-        }
-        return buf.toList();
-    }
-
-    Attribute enterAttributeValue(Type expected,
-                                  JCExpression tree,
-                                  Env<AttrContext> env) {
-        //first, try completing the attribution value sym - if a completion
-        //error is thrown, we should recover gracefully, and display an
-        //ordinary resolution diagnostic.
-        try {
-            expected.tsym.complete();
-        } catch(CompletionFailure e) {
-            log.error(tree.pos(), "cant.resolve", Kinds.kindName(e.sym), e.sym);
-            expected = syms.errType;
-        }
-        if (expected.hasTag(ARRAY)) {
-            if (!tree.hasTag(NEWARRAY)) {
-                tree = make.at(tree.pos).
-                    NewArray(null, List.<JCExpression>nil(), List.of(tree));
-            }
-            JCNewArray na = (JCNewArray)tree;
-            if (na.elemtype != null) {
-                log.error(na.elemtype.pos(), "new.not.allowed.in.annotation");
-            }
-            ListBuffer<Attribute> buf = new ListBuffer<>();
-            for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) {
-                buf.append(enterAttributeValue(types.elemtype(expected),
-                                               l.head,
-                                               env));
-            }
-            na.type = expected;
-            return new Attribute.
-                Array(expected, buf.toArray(new Attribute[buf.length()]));
-        }
-        if (tree.hasTag(NEWARRAY)) { //error recovery
-            if (!expected.isErroneous())
-                log.error(tree.pos(), "annotation.value.not.allowable.type");
-            JCNewArray na = (JCNewArray)tree;
-            if (na.elemtype != null) {
-                log.error(na.elemtype.pos(), "new.not.allowed.in.annotation");
-            }
-            for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) {
-                enterAttributeValue(syms.errType,
-                                    l.head,
-                                    env);
-            }
-            return new Attribute.Error(syms.errType);
-        }
-        if ((expected.tsym.flags() & Flags.ANNOTATION) != 0) {
-            if (tree.hasTag(ANNOTATION)) {
-                return enterAnnotation((JCAnnotation)tree, expected, env);
-            } else {
-                log.error(tree.pos(), "annotation.value.must.be.annotation");
-                expected = syms.errType;
-            }
-        }
-        if (tree.hasTag(ANNOTATION)) { //error recovery
-            if (!expected.isErroneous())
-                log.error(tree.pos(), "annotation.not.valid.for.type", expected);
-            enterAnnotation((JCAnnotation)tree, syms.errType, env);
-            return new Attribute.Error(((JCAnnotation)tree).annotationType.type);
-        }
-        if (expected.isPrimitive() ||
-            (types.isSameType(expected, syms.stringType) && !expected.hasTag(TypeTag.ERROR))) {
-            Type result = attr.attribExpr(tree, env, expected);
-            if (result.isErroneous())
-                return new Attribute.Error(result.getOriginalType());
-            if (result.constValue() == null) {
-                log.error(tree.pos(), "attribute.value.must.be.constant");
-                return new Attribute.Error(expected);
-            }
-            result = cfolder.coerce(result, expected);
-            return new Attribute.Constant(expected, result.constValue());
-        }
-        if (expected.tsym == syms.classType.tsym) {
-            Type result = attr.attribExpr(tree, env, expected);
-            if (result.isErroneous()) {
-                // Does it look like an unresolved class literal?
-                if (TreeInfo.name(tree) == names._class &&
-                    ((JCFieldAccess) tree).selected.type.isErroneous()) {
-                    Name n = (((JCFieldAccess) tree).selected).type.tsym.flatName();
-                    return new Attribute.UnresolvedClass(expected,
-                            types.createErrorType(n,
-                                    syms.unknownSymbol, syms.classType));
-                } else {
-                    return new Attribute.Error(result.getOriginalType());
-                }
-            }
-
-            // Class literals look like field accesses of a field named class
-            // at the tree level
-            if (TreeInfo.name(tree) != names._class) {
-                log.error(tree.pos(), "annotation.value.must.be.class.literal");
-                return new Attribute.Error(syms.errType);
-            }
-            return new Attribute.Class(types,
-                                       (((JCFieldAccess) tree).selected).type);
-        }
-        if (expected.hasTag(CLASS) &&
-            (expected.tsym.flags() & Flags.ENUM) != 0) {
-            Type result = attr.attribExpr(tree, env, expected);
-            Symbol sym = TreeInfo.symbol(tree);
-            if (sym == null ||
-                TreeInfo.nonstaticSelect(tree) ||
-                sym.kind != VAR ||
-                (sym.flags() & Flags.ENUM) == 0) {
-                log.error(tree.pos(), "enum.annotation.must.be.enum.constant");
-                return new Attribute.Error(result.getOriginalType());
-            }
-            VarSymbol enumerator = (VarSymbol) sym;
-            return new Attribute.Enum(expected, enumerator);
-        }
-        //error recovery:
-        if (!expected.isErroneous())
-            log.error(tree.pos(), "annotation.value.not.allowable.type");
-        return new Attribute.Error(attr.attribExpr(tree, env, expected));
-    }
-
-    /* *********************************
-     * Support for repeating annotations
-     ***********************************/
-
     /* Process repeated annotations. This method returns the
      * synthesized container annotation or null IFF all repeating
      * annotation are invalid.  This method reports errors/warnings.
      */
     private <T extends Attribute.Compound> T processRepeatedAnnotations(List<T> annotations,
-            AnnotationContext<T> ctx,
-            Symbol on) {
+            AnnotationContext<T> ctx, Symbol on)
+    {
         T firstOccurrence = annotations.head;
         List<Attribute> repeated = List.nil();
         Type origAnnoType = null;
@@ -490,14 +706,10 @@
         Type targetContainerType = null;
         MethodSymbol containerValueSymbol = null;
 
-        Assert.check(!annotations.isEmpty() &&
-                     !annotations.tail.isEmpty()); // i.e. size() > 1
+        Assert.check(!annotations.isEmpty() && !annotations.tail.isEmpty()); // i.e. size() > 1
 
         int count = 0;
-        for (List<T> al = annotations;
-             !al.isEmpty();
-             al = al.tail)
-        {
+        for (List<T> al = annotations; !al.isEmpty(); al = al.tail) {
             count++;
 
             // There must be more than a single anno in the annotation list
@@ -532,18 +744,23 @@
             repeated = repeated.prepend(currentAnno);
         }
 
+        if (!repeated.isEmpty() && targetContainerType == null) {
+            log.error(ctx.pos.get(annotations.head), "duplicate.annotation.invalid.repeated", origAnnoType);
+            return null;
+        }
+
         if (!repeated.isEmpty()) {
             repeated = repeated.reverse();
             TreeMaker m = make.at(ctx.pos.get(firstOccurrence));
             Pair<MethodSymbol, Attribute> p =
                     new Pair<MethodSymbol, Attribute>(containerValueSymbol,
-                               new Attribute.Array(arrayOfOrigAnnoType, repeated));
+                            new Attribute.Array(arrayOfOrigAnnoType, repeated));
             if (ctx.isTypeCompound) {
                 /* TODO: the following code would be cleaner:
                 Attribute.TypeCompound at = new Attribute.TypeCompound(targetContainerType, List.of(p),
                         ((Attribute.TypeCompound)annotations.head).position);
                 JCTypeAnnotation annoTree = m.TypeAnnotation(at);
-                at = enterTypeAnnotation(annoTree, targetContainerType, ctx.env);
+                at = attributeTypeAnnotation(annoTree, targetContainerType, ctx.env);
                 */
                 // However, we directly construct the TypeCompound to keep the
                 // direct relation to the contained TypeCompounds.
@@ -562,12 +779,13 @@
                 JCAnnotation annoTree = m.Annotation(c);
 
                 if (!chk.annotationApplicable(annoTree, on))
-                    log.error(annoTree.pos(), "invalid.repeatable.annotation.incompatible.target", targetContainerType, origAnnoType);
+                    log.error(annoTree.pos(), "invalid.repeatable.annotation.incompatible.target",
+                            targetContainerType, origAnnoType);
 
                 if (!chk.validateAnnotationDeferErrors(annoTree))
                     log.error(annoTree.pos(), "duplicate.annotation.invalid.repeated", origAnnoType);
 
-                c = enterAnnotation(annoTree, targetContainerType, ctx.env);
+                c = attributeAnnotation(annoTree, targetContainerType, ctx.env);
                 c.setSynthesized(true);
 
                 @SuppressWarnings("unchecked")
@@ -579,17 +797,19 @@
         }
     }
 
-    /** Fetches the actual Type that should be the containing annotation. */
+    /**
+     * Fetches the actual Type that should be the containing annotation.
+     */
     private Type getContainingType(Attribute.Compound currentAnno,
-            DiagnosticPosition pos,
-            boolean reportError)
+                                   DiagnosticPosition pos,
+                                   boolean reportError)
     {
         Type origAnnoType = currentAnno.type;
         TypeSymbol origAnnoDecl = origAnnoType.tsym;
 
         // Fetch the Repeatable annotation from the current
         // annotation's declaration, or null if it has none
-        Attribute.Compound ca = origAnnoDecl.attribute(syms.repeatableType.tsym);
+        Attribute.Compound ca = origAnnoDecl.getAnnotationTypeMetadata().getRepeatable();
         if (ca == null) { // has no Repeatable annotation
             if (reportError)
                 log.error(pos, "duplicate.annotation.missing.container", origAnnoType, syms.repeatableType);
@@ -597,7 +817,7 @@
         }
 
         return filterSame(extractContainingType(ca, pos, origAnnoDecl),
-                          origAnnoType);
+                origAnnoType);
     }
 
     // returns null if t is same as 's', returns 't' otherwise
@@ -611,8 +831,8 @@
 
     /** Extract the actual Type to be used for a containing annotation. */
     private Type extractContainingType(Attribute.Compound ca,
-            DiagnosticPosition pos,
-            TypeSymbol annoDecl)
+                                       DiagnosticPosition pos,
+                                       TypeSymbol annoDecl)
     {
         // The next three checks check that the Repeatable annotation
         // on the declaration of the annotation type that is repeating is
@@ -657,7 +877,7 @@
             nr_value_elems++;
 
             if (nr_value_elems == 1 &&
-                elm.kind == MTH) {
+                    elm.kind == MTH) {
                 containerValueSymbol = (MethodSymbol)elm;
             } else {
                 error = true;
@@ -665,14 +885,14 @@
         }
         if (error) {
             log.error(pos,
-                      "invalid.repeatable.annotation.multiple.values",
-                      targetContainerType,
-                      nr_value_elems);
+                    "invalid.repeatable.annotation.multiple.values",
+                    targetContainerType,
+                    nr_value_elems);
             return null;
         } else if (nr_value_elems == 0) {
             log.error(pos,
-                      "invalid.repeatable.annotation.no.value",
-                      targetContainerType);
+                    "invalid.repeatable.annotation.no.value",
+                    targetContainerType);
             return null;
         }
 
@@ -680,8 +900,8 @@
         // probably "impossible" to fail this
         if (containerValueSymbol.kind != MTH) {
             log.error(pos,
-                      "invalid.repeatable.annotation.invalid.value",
-                      targetContainerType);
+                    "invalid.repeatable.annotation.invalid.value",
+                    targetContainerType);
             fatalError = true;
         }
 
@@ -690,174 +910,24 @@
         Type valueRetType = containerValueSymbol.type.getReturnType();
         Type expectedType = types.makeArrayType(originalAnnoType);
         if (!(types.isArray(valueRetType) &&
-              types.isSameType(expectedType, valueRetType))) {
+                types.isSameType(expectedType, valueRetType))) {
             log.error(pos,
-                      "invalid.repeatable.annotation.value.return",
-                      targetContainerType,
-                      valueRetType,
-                      expectedType);
+                    "invalid.repeatable.annotation.value.return",
+                    targetContainerType,
+                    valueRetType,
+                    expectedType);
             fatalError = true;
         }
-        if (error) {
-            fatalError = true;
-        }
-
-        // The conditions for a valid containing annotation are made
-        // in Check.validateRepeatedAnnotaton();
 
         return fatalError ? null : containerValueSymbol;
     }
 
-    private <T extends Attribute.Compound> AnnotationContext<T>
-            prepareEnterAnnotations(List<JCAnnotation> annotations,
-                                    Env<AttrContext> env,
-                                    Symbol sym,
-                                    AttributeCreator<T> creator,
-                                    boolean isTypeCompound) {
-        Map<TypeSymbol, ListBuffer<T>> annotated = new LinkedHashMap<>();
-        Map<T, DiagnosticPosition> pos = new HashMap<>();
-
-        for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) {
-            JCAnnotation a = al.head;
-            T c = creator.create(a, syms.annotationType, env);
-
-            Assert.checkNonNull(c, "Failed to create annotation");
-
-            if (annotated.containsKey(a.type.tsym)) {
-                if (!allowRepeatedAnnos) {
-                    log.error(a.pos(), "repeatable.annotations.not.supported.in.source");
-                    allowRepeatedAnnos = true;
-                }
-                ListBuffer<T> l = annotated.get(a.type.tsym);
-                l = l.append(c);
-                annotated.put(a.type.tsym, l);
-                pos.put(c, a.pos());
-            } else {
-                annotated.put(a.type.tsym, ListBuffer.of(c));
-                pos.put(c, a.pos());
-            }
-
-            // Note: @Deprecated has no effect on local variables and parameters
-            if (!c.type.isErroneous()
-                && sym.owner.kind != MTH
-                && types.isSameType(c.type, syms.deprecatedType)) {
-                sym.flags_field |= Flags.DEPRECATED;
-            }
-        }
-
-        return new AnnotationContext<>(env, annotated, pos,
-                                             isTypeCompound);
-    }
-
-    // Gather up annotations into a map from type symbols to lists of
-    // Compound attributes, then continue on with repeating
-    // annotations processing
-    private <T extends Attribute.Compound>
-            void attachAttributesLater(final List<JCAnnotation> annotations,
-                                       final Env<AttrContext> env,
-                                       final Symbol sym,
-                                       final boolean isTypeCompound,
-                                       final AttributeCreator<T> creator,
-                                       final AttributeAttacher<T> attacher) {
-        final AnnotationContext<T> ctx =
-            prepareEnterAnnotations(annotations, env, sym, creator, isTypeCompound);
-        final Map<Symbol.TypeSymbol, ListBuffer<T>> annotated =
-            ctx.annotated;
-        boolean hasRepeated = false;
-
-        List<T> buf = List.<T>nil();
-        for (ListBuffer<T> lb : annotated.values()) {
-            if (lb.size() == 1) {
-                buf = buf.prepend(lb.first());
-            } else {
-                @SuppressWarnings("unchecked")
-                T res = (T) new Placeholder<>(ctx, lb.toList(), sym);
-                buf = buf.prepend(res);
-                hasRepeated = true;
-            }
-        }
-
-        final List<T> attrs = buf.reverse();
-
-        if (!isTypeCompound) {
-            // Attach declaration attributes early, so
-            // that @Repeatable and other annotations get attached.
-            // Since the attacher uses setDeclarationAttributes, this
-            // will be overwritten later.
-            attacher.attach(sym, attrs);
-        }
-        if (hasRepeated) {
-            repeated(new Annotate.Worker() {
-                    @Override
-                    public String toString() {
-                        return "repeated annotation pass of: " + sym + " in: " + sym.owner;
-                    }
-
-                    @Override
-                    public void run() {
-                        JavaFileObject oldSource =
-                            log.useSource(env.toplevel.sourcefile);
-                        try {
-                            attacher.attach(sym, replacePlaceholders(attrs, ctx, sym));
-                        } finally {
-                            log.useSource(oldSource);
-                        }
-                    }
-                });
-        } else {
-            attacher.attach(sym, attrs);
-        }
-    }
-
-    private interface AttributeAttacher<T extends Attribute.Compound> {
-        public void attach(Symbol sym, List<T> attrs);
-    }
-
-    private final AttributeAttacher<Attribute.Compound> declAnnotationsAttacher =
-        new AttributeAttacher<Attribute.Compound>() {
-            @Override
-            public void attach(Symbol sym, List<Attribute.Compound> attrs) {
-                sym.resetAnnotations();
-                sym.setDeclarationAttributes(attrs);
-            }
-        };
-
-    private final AttributeAttacher<Attribute.TypeCompound> typeAnnotationsAttacher =
-        new AttributeAttacher<Attribute.TypeCompound>() {
-            @Override
-            public void attach(Symbol sym, List<Attribute.TypeCompound> attrs) {
-                sym.appendUniqueTypeAttributes(attrs);
-            }
-        };
-
-    private <T extends Attribute.Compound> List<T>
-            replacePlaceholders(List<T> buf,
-                                Annotate.AnnotationContext<T> ctx,
-                                Symbol sym) {
-        List<T> result = List.nil();
-        for (T a : buf) {
-            if (a instanceof Placeholder) {
-                @SuppressWarnings("unchecked")
-                    T replacement = replaceOne((Placeholder<T>) a, ctx, sym);
-
-                if (null != replacement) {
-                    result = result.prepend(replacement);
-                }
-            } else {
-                result = result.prepend(a);
-            }
-        }
-
-        return result.reverse();
-    }
-
-    private <T extends Attribute.Compound> T replaceOne(Placeholder<T> placeholder,
-                                                        Annotate.AnnotationContext<T> ctx,
-                                                        Symbol sym) {
+    private <T extends Attribute.Compound> T makeContainerAnnotation(List<T> toBeReplaced,
+            AnnotationContext<T> ctx, Symbol sym)
+    {
         // Process repeated annotations
         T validRepeated =
-            processRepeatedAnnotations(placeholder.getPlaceholderFor(),
-                                       ctx, sym);
+                processRepeatedAnnotations(toBeReplaced, ctx, sym);
 
         if (validRepeated != null) {
             // Check that the container isn't manually
@@ -865,7 +935,8 @@
             // its contained annotation.
             ListBuffer<T> manualContainer = ctx.annotated.get(validRepeated.type.tsym);
             if (manualContainer != null) {
-                log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present",
+                log.error(ctx.pos.get(manualContainer.first()),
+                        "invalid.repeatable.annotation.repeated.and.container.present",
                         manualContainer.first().type.tsym);
             }
         }
@@ -874,107 +945,16 @@
         return validRepeated;
     }
 
-/* ********************************************************************
- * Annotation processing
- *********************************************************************/
+    /********************
+     * Type annotations *
+     ********************/
 
-    /** Queue annotations for later processing. */
-    void annotateLater(final List<JCAnnotation> annotations,
-                       final Env<AttrContext> localEnv,
-                       final Symbol s,
-                       final DiagnosticPosition deferPos) {
-        if (annotations.isEmpty()) {
-            return;
-        }
-        if (s.kind != PCK) {
-            s.resetAnnotations(); // mark Annotations as incomplete for now
-        }
-        normal(new Annotate.Worker() {
-                @Override
-                public String toString() {
-                    return "annotate " + annotations + " onto " + s + " in " + s.owner;
-                }
-
-                @Override
-                public void run() {
-                    Assert.check(s.kind == PCK || s.annotationsPendingCompletion());
-                    JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
-                    DiagnosticPosition prevLintPos =
-                        deferPos != null
-                        ? deferredLintHandler.setPos(deferPos)
-                        : deferredLintHandler.immediate();
-                    Lint prevLint = deferPos != null ? null : chk.setLint(lint);
-                    try {
-                        if (s.hasAnnotations() &&
-                            annotations.nonEmpty())
-                            log.error(annotations.head.pos,
-                                      "already.annotated",
-                                      Kinds.kindName(s), s);
-                        actualEnterAnnotations(annotations, localEnv, s);
-                    } finally {
-                        if (prevLint != null)
-                            chk.setLint(prevLint);
-                        deferredLintHandler.setPos(prevLintPos);
-                        log.useSource(prev);
-                    }
-                }
-            });
-
-        validate(new Annotate.Worker() { //validate annotations
-            @Override
-            public void run() {
-                JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
-                try {
-                    chk.validateAnnotations(annotations, s);
-                } finally {
-                    log.useSource(prev);
-                }
-            }
-        });
-    }
-
-    private interface AttributeCreator<T extends Attribute.Compound> {
-        public T create(JCAnnotation a, Type expected, Env<AttrContext> env);
-    }
-
-    // TODO: When SE8 features can be used, these can go away and be
-    // replaced by method refs.
-    private final AttributeCreator<Attribute.Compound> enterAnnotationsCreator =
-        new AttributeCreator<Attribute.Compound>() {
-        @Override
-        public Attribute.Compound create(JCAnnotation a,
-                                         Type expected,
-                                         Env<AttrContext> env) {
-            return enterAnnotation(a, syms.annotationType, env);
-        }
-    };
-    private final AttributeCreator<Attribute.TypeCompound> enterTypeAnnotationsCreator =
-        new AttributeCreator<Attribute.TypeCompound>() {
-        @Override
-        public Attribute.TypeCompound create(JCAnnotation a,
-                                             Type expected,
-                                             Env<AttrContext> env) {
-            return enterTypeAnnotation(a, syms.annotationType, env);
-        }
-    };
-
-    /** Enter a set of annotations. */
-    private void actualEnterAnnotations(List<JCAnnotation> annotations,
-                                        Env<AttrContext> env,
-                                        Symbol s) {
-        Assert.checkNonNull(s, "Symbol argument to actualEnterAnnotations is null");
-        attachAttributesLater(annotations, env, s, false,
-                              enterAnnotationsCreator,
-                              declAnnotationsAttacher);
-    }
-
-    /*
-     * If the symbol is non-null, attach the type annotation to it.
+    /**
+     * Attribute the list of annotations and enter them onto s.
      */
-    private void actualEnterTypeAnnotations(final List<JCAnnotation> annotations,
-                                            final Env<AttrContext> env,
-                                            final Symbol s,
-                                            final DiagnosticPosition deferPos) {
+    public void enterTypeAnnotations(List<JCAnnotation> annotations, Env<AttrContext> env,
+            Symbol s, DiagnosticPosition deferPos)
+    {
         Assert.checkNonNull(s, "Symbol argument to actualEnterTypeAnnotations is nul/");
         JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
         DiagnosticPosition prevLintPos = null;
@@ -983,9 +963,7 @@
             prevLintPos = deferredLintHandler.setPos(deferPos);
         }
         try {
-            attachAttributesLater(annotations, env, s, true,
-                                  enterTypeAnnotationsCreator,
-                                  typeAnnotationsAttacher);
+            annotateNow(s, annotations, env, true);
         } finally {
             if (prevLintPos != null)
                 deferredLintHandler.setPos(prevLintPos);
@@ -993,21 +971,61 @@
         }
     }
 
-    public void annotateTypeLater(final JCTree tree,
-                                  final Env<AttrContext> env,
-                                  final Symbol sym,
-                                  final DiagnosticPosition deferPos) {
+    /**
+     * Enqueue tree for scanning of type annotations, attaching to the Symbol sym.
+     */
+    public void queueScanTreeAndTypeAnnotate(JCTree tree, Env<AttrContext> env, Symbol sym,
+            DiagnosticPosition deferPos)
+    {
         Assert.checkNonNull(sym);
-        normal(new Annotate.Worker() {
-                @Override
-                public String toString() {
-                    return "type annotate " + tree + " onto " + sym + " in " + sym.owner;
-                }
-                @Override
-                public void run() {
-                    tree.accept(new TypeAnnotate(env, sym, deferPos));
-                }
-            });
+        normal(new Runnable() {
+            @Override
+            public String toString() {
+                return "type annotate " + tree + " onto " + sym + " in " + sym.owner;
+            }
+
+            @Override
+            public void run() {
+                tree.accept(new TypeAnnotate(env, sym, deferPos));
+            }
+        });
+    }
+
+    /**
+     * Apply the annotations to the particular type.
+     */
+    public void annotateTypeSecondStage(JCTree tree, List<JCAnnotation> annotations, Type storeAt) {
+        typeAnnotation(new Runnable() {
+            @Override
+            public String toString() {
+                return "Type annotate 2:nd stage " + annotations + " onto " + tree;
+            }
+
+            @Override
+            public void run() {
+                List<Attribute.TypeCompound> compounds = fromAnnotations(annotations);
+                Assert.check(annotations.size() == compounds.size());
+                storeAt.getMetadataOfKind(Kind.ANNOTATIONS).combine(new TypeMetadata.Annotations(compounds));
+            }
+        });
+    }
+
+    /**
+     * Apply the annotations to the particular type.
+     */
+    public void annotateTypeParameterSecondStage(JCTree tree, List<JCAnnotation> annotations) {
+        typeAnnotation(new Runnable() {
+            @Override
+            public String toString() {
+                return "Type annotate 2:nd stage " + annotations + " onto " + tree;
+            }
+
+            @Override
+            public void run() {
+                List<Attribute.TypeCompound> compounds = fromAnnotations(annotations);
+                Assert.check(annotations.size() == compounds.size());
+            }
+        });
     }
 
     /**
@@ -1019,9 +1037,7 @@
         private final Symbol sym;
         private DiagnosticPosition deferPos;
 
-        public TypeAnnotate(final Env<AttrContext> env,
-                            final Symbol sym,
-                            final DiagnosticPosition deferPos) {
+        public TypeAnnotate(Env<AttrContext> env, Symbol sym, DiagnosticPosition deferPos) {
 
             this.env = env;
             this.sym = sym;
@@ -1029,27 +1045,28 @@
         }
 
         @Override
-        public void visitAnnotatedType(final JCAnnotatedType tree) {
-            actualEnterTypeAnnotations(tree.annotations, env, sym, deferPos);
-            super.visitAnnotatedType(tree);
+        public void visitAnnotatedType(JCAnnotatedType tree) {
+            enterTypeAnnotations(tree.annotations, env, sym, deferPos);
+            scan(tree.underlyingType);
         }
 
         @Override
-        public void visitTypeParameter(final JCTypeParameter tree) {
-            actualEnterTypeAnnotations(tree.annotations, env, sym, deferPos);
-            super.visitTypeParameter(tree);
+        public void visitTypeParameter(JCTypeParameter tree) {
+            enterTypeAnnotations(tree.annotations, env, sym, deferPos);
+            scan(tree.bounds);
         }
 
         @Override
-        public void visitNewArray(final JCNewArray tree) {
-            actualEnterTypeAnnotations(tree.annotations, env, sym, deferPos);
+        public void visitNewArray(JCNewArray tree) {
+            enterTypeAnnotations(tree.annotations, env, sym, deferPos);
             for (List<JCAnnotation> dimAnnos : tree.dimAnnotations)
-                actualEnterTypeAnnotations(dimAnnos, env, sym, deferPos);
-            super.visitNewArray(tree);
+                enterTypeAnnotations(dimAnnos, env, sym, deferPos);
+            scan(tree.elemtype);
+            scan(tree.elems);
         }
 
         @Override
-        public void visitMethodDef(final JCMethodDecl tree) {
+        public void visitMethodDef(JCMethodDecl tree) {
             scan(tree.mods);
             scan(tree.restype);
             scan(tree.typarams);
@@ -1058,11 +1075,10 @@
             scan(tree.thrown);
             scan(tree.defaultValue);
             // Do not annotate the body, just the signature.
-            // scan(tree.body);
         }
 
         @Override
-        public void visitVarDef(final JCVariableDecl tree) {
+        public void visitVarDef(JCVariableDecl tree) {
             DiagnosticPosition prevPos = deferPos;
             deferPos = tree.pos();
             try {
@@ -1094,4 +1110,238 @@
             }
         }
     }
+
+    /*********************
+     * Completer support *
+     *********************/
+
+    private AnnotationTypeCompleter theSourceCompleter = new AnnotationTypeCompleter() {
+        @Override
+        public void complete(ClassSymbol sym) throws CompletionFailure {
+            Env<AttrContext> context = typeEnvs.get(sym);
+            Annotate.this.attributeAnnotationType(context);
+        }
+    };
+
+    /* Last stage completer to enter just enough annotations to have a prototype annotation type.
+     * This currently means entering @Target and @Repetable.
+     */
+    public AnnotationTypeCompleter annotationTypeSourceCompleter() {
+        return theSourceCompleter;
+    }
+
+    private void attributeAnnotationType(Env<AttrContext> env) {
+        Assert.check(((JCClassDecl)env.tree).sym.isAnnotationType(),
+                "Trying to annotation type complete a non-annotation type");
+
+        JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
+        try {
+            JCClassDecl tree = (JCClassDecl)env.tree;
+            AnnotationTypeVisitor v = new AnnotationTypeVisitor(attr, chk, syms, typeEnvs);
+            v.scanAnnotationType(tree);
+            tree.sym.getAnnotationTypeMetadata().setRepeatable(v.repeatable);
+            tree.sym.getAnnotationTypeMetadata().setTarget(v.target);
+        } finally {
+            log.useSource(prev);
+        }
+    }
+
+    public Attribute unfinishedDefaultValue() {
+        return theUnfinishedDefaultValue;
+    }
+
+    public static interface AnnotationTypeCompleter {
+        void complete(ClassSymbol sym) throws CompletionFailure;
+    }
+
+    /** Visitor to determine a prototype annotation type for a class declaring 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>
+     */
+    public class AnnotationTypeVisitor extends TreeScanner {
+        private Env<AttrContext> env;
+
+        private final Attr attr;
+        private final Check check;
+        private final Symtab tab;
+        private final TypeEnvs typeEnvs;
+
+        private Compound target;
+        private Compound repeatable;
+
+        public AnnotationTypeVisitor(Attr attr, Check check, Symtab tab, TypeEnvs typeEnvs) {
+            this.attr = attr;
+            this.check = check;
+            this.tab = tab;
+            this.typeEnvs = typeEnvs;
+        }
+
+        public Compound getRepeatable() {
+            return repeatable;
+        }
+
+        public Compound getTarget() {
+            return target;
+        }
+
+        public void scanAnnotationType(JCClassDecl decl) {
+            visitClassDef(decl);
+        }
+
+        @Override
+        public void visitClassDef(JCClassDecl tree) {
+            Env<AttrContext> prevEnv = env;
+            env = typeEnvs.get(tree.sym);
+            try {
+                scan(tree.mods); // look for repeatable and target
+                // don't descend into body
+            } finally {
+                env = prevEnv;
+            }
+        }
+
+        @Override
+        public void visitAnnotation(JCAnnotation tree) {
+            Type t = tree.annotationType.type;
+            if (t == null) {
+                t = attr.attribType(tree.annotationType, env);
+                tree.annotationType.type = t = check.checkType(tree.annotationType.pos(), t, tab.annotationType);
+            }
+
+            if (t == tab.annotationTargetType) {
+                target = Annotate.this.attributeAnnotation(tree, tab.annotationTargetType, env);
+            } else if (t == tab.repeatableType) {
+                repeatable = Annotate.this.attributeAnnotation(tree, tab.repeatableType, env);
+            }
+        }
+    }
+
+    /** Represents the semantics 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>
+     */
+    public static class AnnotationTypeMetadata {
+        final ClassSymbol metaDataFor;
+        private Compound target;
+        private Compound repeatable;
+        private AnnotationTypeCompleter annotationTypeCompleter;
+
+        public AnnotationTypeMetadata(ClassSymbol metaDataFor, AnnotationTypeCompleter annotationTypeCompleter) {
+            this.metaDataFor = metaDataFor;
+            this.annotationTypeCompleter = annotationTypeCompleter;
+        }
+
+        private void init() {
+            // Make sure metaDataFor is member entered
+            while (metaDataFor.completer != null)
+                metaDataFor.complete();
+
+            if (annotationTypeCompleter != null) {
+                AnnotationTypeCompleter c = annotationTypeCompleter;
+                annotationTypeCompleter = null;
+                c.complete(metaDataFor);
+            }
+        }
+
+        public void complete() {
+            init();
+        }
+
+        public Compound getRepeatable() {
+            init();
+            return repeatable;
+        }
+
+        public void setRepeatable(Compound repeatable) {
+            Assert.checkNull(this.repeatable);
+            this.repeatable = repeatable;
+        }
+
+        public Compound getTarget() {
+            init();
+            return target;
+        }
+
+        public void setTarget(Compound target) {
+            Assert.checkNull(this.target);
+                this.target = target;
+        }
+
+        public Set<MethodSymbol> getAnnotationElements() {
+            init();
+            Set<MethodSymbol> members = new LinkedHashSet<>();
+            WriteableScope s = metaDataFor.members();
+            Iterable<Symbol> ss = s.getSymbols(NON_RECURSIVE);
+            for (Symbol sym : ss)
+                if (sym.kind == MTH &&
+                        sym.name != sym.name.table.names.clinit &&
+                        (sym.flags() & SYNTHETIC) == 0)
+                    members.add((MethodSymbol)sym);
+            return members;
+        }
+
+        public Set<MethodSymbol> getAnnotationElementsWithDefault() {
+            init();
+            Set<MethodSymbol> members = getAnnotationElements();
+            Set<MethodSymbol> res = new LinkedHashSet<>();
+            for (MethodSymbol m : members)
+                if (m.defaultValue != null)
+                    res.add(m);
+            return res;
+        }
+
+        @Override
+        public String toString() {
+            return "Annotation type for: " + metaDataFor;
+        }
+
+        public boolean isMetadataForAnnotationType() { return true; }
+
+        public static AnnotationTypeMetadata notAnAnnotationType() {
+            return NOT_AN_ANNOTATION_TYPE;
+        }
+
+        private static final AnnotationTypeMetadata NOT_AN_ANNOTATION_TYPE =
+                new AnnotationTypeMetadata(null, null) {
+                    @Override
+                    public void complete() {
+                    } // do nothing
+
+                    @Override
+                    public String toString() {
+                        return "Not an annotation type";
+                    }
+
+                    @Override
+                    public Set<MethodSymbol> getAnnotationElements() {
+                        return new LinkedHashSet<>(0);
+                    }
+
+                    @Override
+                    public Set<MethodSymbol> getAnnotationElementsWithDefault() {
+                        return new LinkedHashSet<>(0);
+                    }
+
+                    @Override
+                    public boolean isMetadataForAnnotationType() {
+                        return false;
+                    }
+
+                    @Override
+                    public Compound getTarget() {
+                        return null;
+                    }
+
+                    @Override
+                    public Compound getRepeatable() {
+                        return null;
+                    }
+                };
+    }
 }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
index 36a9c6b..0234051 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -40,6 +40,7 @@
 import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.code.TypeMetadata.Annotations;
 import com.sun.tools.javac.code.Types.FunctionDescriptorLookupError;
 import com.sun.tools.javac.comp.Check.CheckContext;
 import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
@@ -103,11 +104,11 @@
     final Target target;
     final Types types;
     final JCDiagnostic.Factory diags;
-    final Annotate annotate;
     final TypeAnnotations typeAnnotations;
     final DeferredLintHandler deferredLintHandler;
     final TypeEnvs typeEnvs;
     final Dependencies dependencies;
+    final Annotate annotate;
 
     public static Attr instance(Context context) {
         Attr instance = context.get(attrKey);
@@ -997,7 +998,7 @@
                 }
 
                 // Attribute all type annotations in the body
-                annotate.annotateTypeLater(tree.body, localEnv, m, null);
+                annotate.queueScanTreeAndTypeAnnotate(tree.body, localEnv, m, null);
                 annotate.flush();
 
                 // Attribute method body.
@@ -1020,16 +1021,16 @@
                 env.info.scope.enter(tree.sym);
             } else {
                 try {
-                    annotate.enterStart();
+                    annotate.blockAnnotations();
                     memberEnter.memberEnter(tree, env);
                 } finally {
-                    annotate.enterDone();
+                    annotate.unblockAnnotations();
                 }
             }
         } else {
             if (tree.init != null) {
                 // Field initializer expression need to be entered.
-                annotate.annotateTypeLater(tree.init, env, tree.sym, tree.pos());
+                annotate.queueScanTreeAndTypeAnnotate(tree.init, env, tree.sym, tree.pos());
                 annotate.flush();
             }
         }
@@ -1090,7 +1091,7 @@
 
             if ((tree.flags & STATIC) != 0) localEnv.info.staticLevel++;
             // Attribute all type annotations in the block
-            annotate.annotateTypeLater(tree, localEnv, localEnv.info.scope.owner, null);
+            annotate.queueScanTreeAndTypeAnnotate(tree, localEnv, localEnv.info.scope.owner, null);
             annotate.flush();
             attribStats(tree.stats, localEnv);
 
@@ -1953,9 +1954,16 @@
 
         // Attribute clazz expression and store
         // symbol + type back into the attributed tree.
-        Type clazztype = TreeInfo.isEnumInit(env.tree) ?
-            attribIdentAsEnumType(env, (JCIdent)clazz) :
-            attribType(clazz, env);
+        Type clazztype;
+
+        try {
+            env.info.isNewClass = true;
+            clazztype = TreeInfo.isEnumInit(env.tree) ?
+                attribIdentAsEnumType(env, (JCIdent)clazz) :
+                attribType(clazz, env);
+        } finally {
+            env.info.isNewClass = false;
+        }
 
         clazztype = chk.checkDiamond(tree, clazztype);
         chk.validate(clazz, localEnv);
@@ -4002,7 +4010,7 @@
         TypeVar typeVar = (TypeVar) tree.type;
 
         if (tree.annotations != null && tree.annotations.nonEmpty()) {
-            annotateType(tree, tree.annotations);
+            annotate.annotateTypeParameterSecondStage(tree, tree.annotations);
         }
 
         if (!typeVar.bound.isErroneous()) {
@@ -4092,45 +4100,17 @@
     }
 
     public void visitAnnotation(JCAnnotation tree) {
-        Assert.error("should be handled in Annotate");
+        Assert.error("should be handled in annotate");
     }
 
     public void visitAnnotatedType(JCAnnotatedType tree) {
-        Type underlyingType = attribType(tree.getUnderlyingType(), env);
-        this.attribAnnotationTypes(tree.annotations, env);
-        annotateType(tree, tree.annotations);
-        result = tree.type = underlyingType;
-    }
+        attribAnnotationTypes(tree.annotations, env);
+        Type underlyingType = attribType(tree.underlyingType, env);
+        Type annotatedType = underlyingType.annotatedType(Annotations.TO_BE_SET);
 
-    /**
-     * Apply the annotations to the particular type.
-     */
-    public void annotateType(final JCTree tree, final List<JCAnnotation> annotations) {
-        annotate.typeAnnotation(new Annotate.Worker() {
-            @Override
-            public String toString() {
-                return "annotate " + annotations + " onto " + tree;
-            }
-            @Override
-            public void run() {
-                List<Attribute.TypeCompound> compounds = fromAnnotations(annotations);
-                Assert.check(annotations.size() == compounds.size());
-                tree.type = tree.type.annotatedType(compounds);
-                }
-        });
-    }
-
-    private static List<Attribute.TypeCompound> fromAnnotations(List<JCAnnotation> annotations) {
-        if (annotations.isEmpty()) {
-            return List.nil();
-        }
-
-        ListBuffer<Attribute.TypeCompound> buf = new ListBuffer<>();
-        for (JCAnnotation anno : annotations) {
-            Assert.checkNonNull(anno.attribute);
-            buf.append((Attribute.TypeCompound) anno.attribute);
-        }
-        return buf.toList();
+        if (!env.info.isNewClass)
+            annotate.annotateTypeSecondStage(tree, tree.annotations, annotatedType);
+        result = tree.type = annotatedType;
     }
 
     public void visitErroneous(JCErroneous tree) {
@@ -4298,8 +4278,9 @@
                 log.error(tree.typarams.head.pos(),
                           "intf.annotation.cant.have.type.params");
 
-            // If this annotation has a @Repeatable, validate
-            Attribute.Compound repeatable = c.attribute(syms.repeatableType.tsym);
+            // If this annotation type has a @Repeatable, validate
+            Attribute.Compound repeatable = c.getAnnotationTypeMetadata().getRepeatable();
+            // If this annotation type has a @Repeatable, validate
             if (repeatable != null) {
                 // get diagnostic position for error reporting
                 DiagnosticPosition cbPos = getDiagnosticPosition(tree, repeatable.type);
@@ -4675,7 +4656,7 @@
             // This method will raise an error for such a type.
             for (JCAnnotation ai : annotations) {
                 if (!ai.type.isErroneous() &&
-                        typeAnnotations.annotationType(ai.attribute, sym) == TypeAnnotations.AnnotationType.DECLARATION) {
+                        typeAnnotations.annotationTargetType(ai.attribute, sym) == TypeAnnotations.AnnotationType.DECLARATION) {
                     log.error(ai.pos(), "annotation.type.not.applicable");
                 }
             }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java
index 84d4a53..dd1436e 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java
@@ -68,6 +68,11 @@
      */
     boolean isAnonymousDiamond = false;
 
+    /**
+     *  Is this an attribution environment for an instance creation expression?
+     */
+    boolean isNewClass = false;
+
     /** Are arguments to current function applications boxed into an array for varargs?
      */
     Resolve.MethodResolutionPhase pendingResolutionPhase = null;
@@ -106,6 +111,7 @@
         info.isSerializable = isSerializable;
         info.isSpeculative = isSpeculative;
         info.isAnonymousDiamond = isAnonymousDiamond;
+        info.isNewClass = isNewClass;
         return info;
     }
 
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
index 2f74ea4..3a31e36 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
@@ -31,6 +31,7 @@
 
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Attribute.Compound;
+import com.sun.tools.javac.comp.Annotate.AnnotationTypeMetadata;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.resources.CompilerProperties.Fragments;
@@ -81,6 +82,7 @@
     private final DeferredAttr deferredAttr;
     private final Infer infer;
     private final Types types;
+    private final TypeAnnotations typeAnnotations;
     private final JCDiagnostic.Factory diags;
     private boolean warnOnSyntheticConflicts;
     private boolean suppressAbortOnBadClassFile;
@@ -120,6 +122,7 @@
         deferredAttr = DeferredAttr.instance(context);
         infer = Infer.instance(context);
         types = Types.instance(context);
+        typeAnnotations = TypeAnnotations.instance(context);
         diags = JCDiagnostic.Factory.instance(context);
         Options options = Options.instance(context);
         lint = Lint.instance(context);
@@ -526,7 +529,7 @@
      *  @param found      The type that was found.
      *  @param req        The type that was required.
      */
-    Type checkType(DiagnosticPosition pos, Type found, Type req) {
+    public Type checkType(DiagnosticPosition pos, Type found, Type req) {
         return checkType(pos, found, req, basicHandler);
     }
 
@@ -587,7 +590,7 @@
                 public void report() {
                     if (lint.isEnabled(Lint.LintCategory.CAST))
                         log.warning(Lint.LintCategory.CAST,
-                                tree.pos(), "redundant.cast", tree.expr.type);
+                                tree.pos(), "redundant.cast", tree.clazz.type);
                 }
             });
         }
@@ -2830,7 +2833,7 @@
         }
     }
 
-    private void validateRetention(Symbol container, Symbol contained, DiagnosticPosition pos) {
+    private void validateRetention(TypeSymbol container, TypeSymbol contained, DiagnosticPosition pos) {
         Attribute.RetentionPolicy containerRetention = types.getRetention(container);
         Attribute.RetentionPolicy containedRetention = types.getRetention(contained);
 
@@ -2869,7 +2872,7 @@
         }
     }
 
-    private void validateTarget(Symbol container, Symbol contained, DiagnosticPosition pos) {
+    private void validateTarget(TypeSymbol container, TypeSymbol contained, DiagnosticPosition pos) {
         // The set of targets the container is applicable to must be a subset
         // (with respect to annotation target semantics) of the set of targets
         // the contained is applicable to. The target sets may be implicit or
@@ -2996,32 +2999,18 @@
 
     /** Is the annotation applicable to types? */
     protected boolean isTypeAnnotation(JCAnnotation a, boolean isTypeParameter) {
-        Attribute.Compound atTarget =
-            a.annotationType.type.tsym.attribute(syms.annotationTargetType.tsym);
-        if (atTarget == null) {
-            // An annotation without @Target is not a type annotation.
-            return false;
-        }
-
-        Attribute atValue = atTarget.member(names.value);
-        if (!(atValue instanceof Attribute.Array)) {
-            return false; // error recovery
-        }
-
-        Attribute.Array arr = (Attribute.Array) atValue;
-        for (Attribute app : arr.values) {
-            if (!(app instanceof Attribute.Enum)) {
-                return false; // recovery
-            }
-            Attribute.Enum e = (Attribute.Enum) app;
-
-            if (e.value.name == names.TYPE_USE)
-                return true;
-            else if (isTypeParameter && e.value.name == names.TYPE_PARAMETER)
-                return true;
-        }
-        return false;
+        List<Attribute> targets = typeAnnotations.annotationTargets(a.attribute);
+        return (targets == null) ?
+                false :
+                targets.stream()
+                        .anyMatch(attr -> isTypeAnnotation(attr, isTypeParameter));
     }
+    //where
+        boolean isTypeAnnotation(Attribute a, boolean isTypeParameter) {
+            Attribute.Enum e = (Attribute.Enum)a;
+            return (e.value.name == names.TYPE_USE ||
+                    (isTypeParameter && e.value.name == names.TYPE_PARAMETER));
+        }
 
     /** Is the annotation applicable to the symbol? */
     boolean annotationApplicable(JCAnnotation a, Symbol s) {
@@ -3043,51 +3032,55 @@
             }
         }
         for (Name target : targets) {
-            if (target == names.TYPE)
-                { if (s.kind == TYP) return true; }
-            else if (target == names.FIELD)
-                { if (s.kind == VAR && s.owner.kind != MTH) return true; }
-            else if (target == names.METHOD)
-                { if (s.kind == MTH && !s.isConstructor()) return true; }
-            else if (target == names.PARAMETER)
-                { if (s.kind == VAR && s.owner.kind == MTH &&
-                      (s.flags() & PARAMETER) != 0)
+            if (target == names.TYPE) {
+                if (s.kind == TYP)
+                    return true;
+            } else if (target == names.FIELD) {
+                if (s.kind == VAR && s.owner.kind != MTH)
+                    return true;
+            } else if (target == names.METHOD) {
+                if (s.kind == MTH && !s.isConstructor())
+                    return true;
+            } else if (target == names.PARAMETER) {
+                if (s.kind == VAR && s.owner.kind == MTH &&
+                      (s.flags() & PARAMETER) != 0) {
                     return true;
                 }
-            else if (target == names.CONSTRUCTOR)
-                { if (s.kind == MTH && s.isConstructor()) return true; }
-            else if (target == names.LOCAL_VARIABLE)
-                { if (s.kind == VAR && s.owner.kind == MTH &&
-                      (s.flags() & PARAMETER) == 0)
+            } else if (target == names.CONSTRUCTOR) {
+                if (s.kind == MTH && s.isConstructor())
+                    return true;
+            } else if (target == names.LOCAL_VARIABLE) {
+                if (s.kind == VAR && s.owner.kind == MTH &&
+                      (s.flags() & PARAMETER) == 0) {
                     return true;
                 }
-            else if (target == names.ANNOTATION_TYPE)
-                { if (s.kind == TYP && (s.flags() & ANNOTATION) != 0)
+            } else if (target == names.ANNOTATION_TYPE) {
+                if (s.kind == TYP && (s.flags() & ANNOTATION) != 0) {
                     return true;
                 }
-            else if (target == names.PACKAGE)
-                { if (s.kind == PCK) return true; }
-            else if (target == names.TYPE_USE)
-                { if (s.kind == TYP || s.kind == VAR ||
-                      (s.kind == MTH && !s.isConstructor() &&
-                      !s.type.getReturnType().hasTag(VOID)) ||
-                      (s.kind == MTH && s.isConstructor()))
+            } else if (target == names.PACKAGE) {
+                if (s.kind == PCK)
+                    return true;
+            } else if (target == names.TYPE_USE) {
+                if (s.kind == TYP || s.kind == VAR ||
+                        (s.kind == MTH && !s.isConstructor() &&
+                                !s.type.getReturnType().hasTag(VOID)) ||
+                        (s.kind == MTH && s.isConstructor())) {
                     return true;
                 }
-            else if (target == names.TYPE_PARAMETER)
-                { if (s.kind == TYP && s.type.hasTag(TYPEVAR))
+            } else if (target == names.TYPE_PARAMETER) {
+                if (s.kind == TYP && s.type.hasTag(TYPEVAR))
                     return true;
-                }
-            else
-                return true; // recovery
+            } else
+                return true; // Unknown ElementType. This should be an error at declaration site,
+                             // assume applicable.
         }
         return false;
     }
 
 
-    Attribute.Array getAttributeTargetAttribute(Symbol s) {
-        Attribute.Compound atTarget =
-            s.attribute(syms.annotationTargetType.tsym);
+    Attribute.Array getAttributeTargetAttribute(TypeSymbol s) {
+        Attribute.Compound atTarget = s.getAnnotationTypeMetadata().getTarget();
         if (atTarget == null) return null; // ok, is applicable
         Attribute atValue = atTarget.member(names.value);
         if (!(atValue instanceof Attribute.Array)) return null; // error recovery
@@ -3117,32 +3110,33 @@
 
     private boolean validateAnnotation(JCAnnotation a) {
         boolean isValid = true;
+        AnnotationTypeMetadata metadata = a.annotationType.type.tsym.getAnnotationTypeMetadata();
+
         // collect an inventory of the annotation elements
-        Set<MethodSymbol> members = new LinkedHashSet<>();
-        for (Symbol sym : a.annotationType.type.tsym.members().getSymbols(NON_RECURSIVE))
-            if (sym.kind == MTH && sym.name != names.clinit &&
-                    (sym.flags() & SYNTHETIC) == 0)
-                members.add((MethodSymbol) sym);
+        Set<MethodSymbol> elements = metadata.getAnnotationElements();
 
         // remove the ones that are assigned values
         for (JCTree arg : a.args) {
             if (!arg.hasTag(ASSIGN)) continue; // recovery
-            JCAssign assign = (JCAssign) arg;
+            JCAssign assign = (JCAssign)arg;
             Symbol m = TreeInfo.symbol(assign.lhs);
             if (m == null || m.type.isErroneous()) continue;
-            if (!members.remove(m)) {
+            if (!elements.remove(m)) {
                 isValid = false;
                 log.error(assign.lhs.pos(), "duplicate.annotation.member.value",
-                          m.name, a.type);
+                        m.name, a.type);
             }
         }
 
         // all the remaining ones better have default values
         List<Name> missingDefaults = List.nil();
-        for (MethodSymbol m : members) {
-            if (m.defaultValue == null && !m.type.isErroneous()) {
+        Set<MethodSymbol> membersWithDefault = metadata.getAnnotationElementsWithDefault();
+        for (MethodSymbol m : elements) {
+            if (m.type.isErroneous())
+                continue;
+
+            if (!membersWithDefault.contains(m))
                 missingDefaults = missingDefaults.append(m.name);
-            }
         }
         missingDefaults = missingDefaults.reverse();
         if (missingDefaults.nonEmpty()) {
@@ -3153,12 +3147,18 @@
             log.error(a.pos(), key, a.type, missingDefaults);
         }
 
+        return isValid && validateTargetAnnotationValue(a);
+    }
+
+    /* Validate the special java.lang.annotation.Target annotation */
+    boolean validateTargetAnnotationValue(JCAnnotation a) {
         // special case: java.lang.annotation.Target must not have
         // repeated values in its value member
         if (a.annotationType.type.tsym != syms.annotationTargetType.tsym ||
-            a.args.tail == null)
-            return isValid;
+                a.args.tail == null)
+            return true;
 
+        boolean isValid = true;
         if (!a.args.head.hasTag(ASSIGN)) return false; // error recovery
         JCAssign assign = (JCAssign) a.args.head;
         Symbol m = TreeInfo.symbol(assign.lhs);
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
index 9cb73b3..385cc98 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
@@ -176,14 +176,14 @@
         SpeculativeCache speculativeCache;
 
         DeferredType(JCExpression tree, Env<AttrContext> env) {
-            super(null, TypeMetadata.empty);
+            super(null, TypeMetadata.EMPTY);
             this.tree = tree;
             this.env = attr.copyEnv(env);
             this.speculativeCache = new SpeculativeCache();
         }
 
         @Override
-        public DeferredType clone(TypeMetadata md) {
+        public DeferredType cloneWithMetadata(TypeMetadata md) {
             throw new AssertionError("Cannot add metadata to a deferred type");
         }
 
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
index 177dbf8..7ab1793 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
@@ -25,7 +25,6 @@
 
 package com.sun.tools.javac.comp;
 
-import java.util.*;
 import javax.tools.JavaFileObject;
 import javax.tools.JavaFileManager;
 
@@ -34,7 +33,6 @@
 import com.sun.tools.javac.code.Scope.*;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
-import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.main.Option.PkgInfo;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
@@ -87,11 +85,11 @@
 public class Enter extends JCTree.Visitor {
     protected static final Context.Key<Enter> enterKey = new Context.Key<>();
 
+    Annotate annotate;
     Log log;
     Symtab syms;
     Check chk;
     TreeMaker make;
-    Annotate annotate;
     TypeEnter typeEnter;
     Types types;
     Lint lint;
@@ -253,11 +251,13 @@
         Env<AttrContext> prevEnv = this.env;
         try {
             this.env = env;
+            annotate.blockAnnotations();
             tree.accept(this);
             return result;
         }  catch (CompletionFailure ex) {
             return chk.completionError(tree.pos(), ex);
         } finally {
+            annotate.unblockAnnotations();
             this.env = prevEnv;
         }
     }
@@ -474,7 +474,7 @@
      *  @param c          The class symbol to be processed or null to process all.
      */
     public void complete(List<JCCompilationUnit> trees, ClassSymbol c) {
-        annotate.enterStart();
+        annotate.blockAnnotations();
         ListBuffer<ClassSymbol> prevUncompleted = uncompleted;
         if (typeEnter.completionEnabled) uncompleted = new ListBuffer<>();
 
@@ -497,7 +497,7 @@
             }
         } finally {
             uncompleted = prevUncompleted;
-            annotate.enterDone();
+            annotate.unblockAnnotations();
         }
     }
 
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
index 4558aeb..72a4326 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
@@ -2766,20 +2766,6 @@
             return translationMap;
         }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        // No need to retain type annotations in the tree
-        // tree.annotations = translate(tree.annotations);
-        tree.annotations = List.nil();
-        tree.underlyingType = translate(tree.underlyingType);
-        // but maintain type annotations in the type.
-        if (tree.type.isAnnotated()) {
-            tree.type = tree.underlyingType.type.annotatedType(tree.type.getAnnotationMirrors());
-        } else if (tree.underlyingType.type.isAnnotated()) {
-            tree.type = tree.underlyingType.type;
-        }
-        result = tree;
-    }
-
     public void visitTypeCast(JCTypeCast tree) {
         tree.clazz = translate(tree.clazz);
         if (tree.type.isPrimitive() != tree.expr.type.isPrimitive())
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
index 9207268..46b65e5 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
 
 package com.sun.tools.javac.comp;
 
-import javax.tools.JavaFileObject;
-
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.tree.*;
@@ -224,10 +222,12 @@
         annotate.annotateLater(tree.mods.annotations, localEnv, m, tree.pos());
         // Visit the signature of the method. Note that
         // TypeAnnotate doesn't descend into the body.
-        annotate.annotateTypeLater(tree, localEnv, m, tree.pos());
+        annotate.queueScanTreeAndTypeAnnotate(tree, localEnv, m, tree.pos());
 
-        if (tree.defaultValue != null)
-            annotateDefaultValueLater(tree.defaultValue, localEnv, m, tree.pos());
+        if (tree.defaultValue != null) {
+            m.defaultValue = annotate.unfinishedDefaultValue(); // set it to temporary sentinel for now
+            annotate.annotateDefaultValueLater(tree.defaultValue, localEnv, m, tree.pos());
+        }
     }
 
     /** Create a fresh environment for method bodies.
@@ -255,6 +255,7 @@
             localEnv.info.staticLevel++;
         }
         DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos());
+
         try {
             if (TreeInfo.isEnumInit(tree)) {
                 attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype);
@@ -297,7 +298,7 @@
         }
 
         annotate.annotateLater(tree.mods.annotations, localEnv, v, tree.pos());
-        annotate.annotateTypeLater(tree.vartype, localEnv, v, tree.pos());
+        annotate.queueScanTreeAndTypeAnnotate(tree.vartype, localEnv, v, tree.pos());
 
         v.pos = tree.pos;
     }
@@ -434,53 +435,4 @@
         Env<AttrContext> iEnv = initEnv(tree, env);
         return iEnv;
     }
-
-    /** Queue processing of an attribute default value. */
-    void annotateDefaultValueLater(final JCExpression defaultValue,
-                                   final Env<AttrContext> localEnv,
-                                   final MethodSymbol m,
-                                   final DiagnosticPosition deferPos) {
-        annotate.normal(new Annotate.Worker() {
-                @Override
-                public String toString() {
-                    return "annotate " + m.owner + "." +
-                        m + " default " + defaultValue;
-                }
-
-                @Override
-                public void run() {
-                    JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
-                    DiagnosticPosition prevLintPos = deferredLintHandler.setPos(deferPos);
-                    try {
-                        enterDefaultValue(defaultValue, localEnv, m);
-                    } finally {
-                        deferredLintHandler.setPos(prevLintPos);
-                        log.useSource(prev);
-                    }
-                }
-            });
-        annotate.validate(new Annotate.Worker() { //validate annotations
-            @Override
-            public void run() {
-                JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
-                try {
-                    // if default value is an annotation, check it is a well-formed
-                    // annotation value (e.g. no duplicate values, no missing values, etc.)
-                    chk.validateAnnotationTree(defaultValue);
-                } finally {
-                    log.useSource(prev);
-                }
-            }
-        });
-    }
-
-    /** Enter a default value for an attribute method. */
-    private void enterDefaultValue(final JCExpression defaultValue,
-                                   final Env<AttrContext> localEnv,
-                                   final MethodSymbol m) {
-        m.defaultValue = annotate.enterAttributeValue(m.type.getReturnType(),
-                                                      defaultValue,
-                                                      localEnv);
-    }
-
 }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java
index 9052153..f3dbb34 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java
@@ -28,6 +28,7 @@
 import java.util.*;
 
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Attribute.TypeCompound;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
@@ -68,6 +69,7 @@
     private TreeMaker make;
     private Enter enter;
     private Types types;
+    private Annotate annotate;
     private final Resolve resolve;
     private final CompileStates compileStates;
 
@@ -91,6 +93,7 @@
         Source source = Source.instance(context);
         allowInterfaceBridges = source.allowDefaultMethods();
         allowGraphInference = source.allowGraphInference();
+        annotate = Annotate.instance(context);
     }
 
     /** A hashtable mapping bridge methods to the methods they override after
@@ -751,6 +754,15 @@
         result = tree;
     }
 
+    public void visitAnnotatedType(JCAnnotatedType tree) {
+        // For now, we need to keep the annotations in the tree because of the current
+        // MultiCatch implementation wrt type annotations
+        List<TypeCompound> mirrors = annotate.fromAnnotations(tree.annotations);
+        tree.underlyingType = translate(tree.underlyingType);
+        tree.type = tree.underlyingType.type.annotatedType(mirrors);
+        result = tree;
+    }
+
     public void visitTypeCast(JCTypeCast tree) {
         tree.clazz = translate(tree.clazz, null);
         Type originalTarget = tree.type;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java
index a27378c..c54cfd6 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
 import com.sun.tools.javac.code.Scope.NamedImportScope;
 import com.sun.tools.javac.code.Scope.StarImportScope;
 import com.sun.tools.javac.code.Scope.WriteableScope;
+import com.sun.tools.javac.comp.Annotate.AnnotationTypeMetadata;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.DefinedBy.Api;
@@ -135,6 +136,7 @@
         lint = Lint.instance(context);
         typeEnvs = TypeEnvs.instance(context);
         dependencies = Dependencies.instance(context);
+        Source source = Source.instance(context);
         allowTypeAnnos = source.allowTypeAnnotations();
         allowDeprecationOnImport = source.allowDeprecationOnImport();
     }
@@ -164,7 +166,7 @@
                 Env<AttrContext> topEnv = enter.topLevelEnv(tree);
                 finishImports(tree, () -> { completeClass.resolveImports(tree, topEnv); });
             }
-       }
+        }
     }
 
 /* ********************************************************************
@@ -184,7 +186,7 @@
         }
 
         try {
-            annotate.enterStart();
+            annotate.blockAnnotations();
             sym.flags_field |= UNATTRIBUTED;
 
             List<Env<AttrContext>> queue;
@@ -206,7 +208,7 @@
                 }
             }
         } finally {
-            annotate.enterDone();
+            annotate.unblockAnnotations();
         }
     }
 
@@ -780,9 +782,9 @@
             Env<AttrContext> baseEnv = baseEnv(tree, env);
 
             if (tree.extending != null)
-                annotate.annotateTypeLater(tree.extending, baseEnv, sym, tree.pos());
+                annotate.queueScanTreeAndTypeAnnotate(tree.extending, baseEnv, sym, tree.pos());
             for (JCExpression impl : tree.implementing)
-                annotate.annotateTypeLater(impl, baseEnv, sym, tree.pos());
+                annotate.queueScanTreeAndTypeAnnotate(impl, baseEnv, sym, tree.pos());
             annotate.flush();
 
             attribSuperTypes(env, baseEnv);
@@ -800,7 +802,7 @@
 
             attr.attribTypeVariables(tree.typarams, baseEnv);
             for (JCTypeParameter tp : tree.typarams)
-                annotate.annotateTypeLater(tp, baseEnv, sym, tree.pos());
+                annotate.queueScanTreeAndTypeAnnotate(tp, baseEnv, sym, tree.pos());
 
             // check that no package exists with same fully qualified name,
             // but admit classes in the unnamed package which have the same
@@ -899,6 +901,11 @@
                 addEnumMembers(tree, env);
             }
             memberEnter.memberEnter(tree.defs, env);
+
+            if (tree.sym.isAnnotationType()) {
+                Assert.checkNull(tree.sym.completer);
+                tree.sym.setAnnotationTypeMetadata(new AnnotationTypeMetadata(tree.sym, annotate.annotationTypeSourceCompleter()));
+            }
         }
 
         /** Add the implicit members for an enum type
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
index 6410986..abcf45d 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
@@ -36,17 +36,17 @@
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
-
+import com.sun.tools.javac.comp.Annotate;
+import com.sun.tools.javac.comp.Annotate.AnnotationTypeCompleter;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.code.Type.*;
-import com.sun.tools.javac.comp.Annotate;
+import com.sun.tools.javac.comp.Annotate.AnnotationTypeMetadata;
 import com.sun.tools.javac.file.BaseFileObject;
 import com.sun.tools.javac.jvm.ClassFile.NameAndType;
 import com.sun.tools.javac.jvm.ClassFile.Version;
@@ -81,7 +81,7 @@
 
     public static final int INITIAL_BUFFER_SIZE = 0x0fff0;
 
-    Annotate annotate;
+    private final Annotate annotate;
 
     /** Switch: verbose output.
      */
@@ -190,6 +190,18 @@
      */
     Set<Name> warnedAttrs = new HashSet<>();
 
+    /**
+     * The prototype @Target Attribute.Compound if this class is an annotation annotated with
+     * @Target
+     */
+    CompoundAnnotationProxy target;
+
+    /**
+     * The prototype @Repetable Attribute.Compound if this class is an annotation annotated with
+     * @Repeatable
+     */
+    CompoundAnnotationProxy repeatable;
+
     /** Get the ClassReader instance for this invocation. */
     public static ClassReader instance(Context context) {
         ClassReader instance = context.get(classReaderKey);
@@ -201,6 +213,7 @@
     /** Construct a new class reader. */
     protected ClassReader(Context context) {
         context.put(classReaderKey, this);
+        annotate = Annotate.instance(context);
         names = Names.instance(context);
         syms = Symtab.instance(context);
         types = Types.instance(context);
@@ -212,9 +225,8 @@
         log = Log.instance(context);
 
         Options options = Options.instance(context);
-        annotate = Annotate.instance(context);
-        verbose        = options.isSet(VERBOSE);
-        checkClassFile = options.isSet("-checkclassfile");
+        verbose         = options.isSet(VERBOSE);
+        checkClassFile  = options.isSet("-checkclassfile");
 
         Source source = Source.instance(context);
         allowSimplifiedVarargs = source.allowSimplifiedVarargs();
@@ -1304,6 +1316,13 @@
             ListBuffer<CompoundAnnotationProxy> proxies = new ListBuffer<>();
             for (int i = 0; i<numAttributes; i++) {
                 CompoundAnnotationProxy proxy = readCompoundAnnotation();
+
+                if (proxy.type.tsym == syms.annotationTargetType.tsym) {
+                    target = proxy;
+                } else if (proxy.type.tsym == syms.repeatableType.tsym) {
+                    repeatable = proxy;
+                }
+
                 proxies.append(proxy);
             }
             annotate.normal(new AnnotationCompleter(sym, proxies.toList()));
@@ -1705,8 +1724,11 @@
     }
 
     class AnnotationDeproxy implements ProxyVisitor {
-        private ClassSymbol requestingOwner = currentOwner.kind == MTH
-            ? currentOwner.enclClass() : (ClassSymbol)currentOwner;
+        private ClassSymbol requestingOwner;
+
+        AnnotationDeproxy(ClassSymbol owner) {
+            this.requestingOwner = owner;
+        }
 
         List<Attribute.Compound> deproxyCompoundList(List<CompoundAnnotationProxy> pl) {
             // also must fill in types!!!!
@@ -1855,19 +1877,19 @@
         }
     }
 
-    class AnnotationDefaultCompleter extends AnnotationDeproxy implements Annotate.Worker {
+    class AnnotationDefaultCompleter extends AnnotationDeproxy implements Runnable {
         final MethodSymbol sym;
         final Attribute value;
         final JavaFileObject classFile = currentClassFile;
-        @Override
-        public String toString() {
-            return " ClassReader store default for " + sym.owner + "." + sym + " is " + value;
-        }
+
         AnnotationDefaultCompleter(MethodSymbol sym, Attribute value) {
+            super(currentOwner.kind == MTH
+                    ? currentOwner.enclClass() : (ClassSymbol)currentOwner);
             this.sym = sym;
             this.value = value;
         }
-        // implement Annotate.Worker.run()
+
+        @Override
         public void run() {
             JavaFileObject previousClassFile = currentClassFile;
             try {
@@ -1880,22 +1902,27 @@
                 currentClassFile = previousClassFile;
             }
         }
+
+        @Override
+        public String toString() {
+            return " ClassReader store default for " + sym.owner + "." + sym + " is " + value;
+        }
     }
 
-    class AnnotationCompleter extends AnnotationDeproxy implements Annotate.Worker {
+    class AnnotationCompleter extends AnnotationDeproxy implements Runnable {
         final Symbol sym;
         final List<CompoundAnnotationProxy> l;
         final JavaFileObject classFile;
-        @Override
-        public String toString() {
-            return " ClassReader annotate " + sym.owner + "." + sym + " with " + l;
-        }
+
         AnnotationCompleter(Symbol sym, List<CompoundAnnotationProxy> l) {
+            super(currentOwner.kind == MTH
+                    ? currentOwner.enclClass() : (ClassSymbol)currentOwner);
             this.sym = sym;
             this.l = l;
             this.classFile = currentClassFile;
         }
-        // implement Annotate.Worker.run()
+
+        @Override
         public void run() {
             JavaFileObject previousClassFile = currentClassFile;
             try {
@@ -1910,6 +1937,11 @@
                 currentClassFile = previousClassFile;
             }
         }
+
+        @Override
+        public String toString() {
+            return " ClassReader annotate " + sym.owner + "." + sym + " with " + l;
+        }
     }
 
     class TypeAnnotationCompleter extends AnnotationCompleter {
@@ -2298,6 +2330,8 @@
         currentClassFile = c.classfile;
         warnedAttrs.clear();
         filling = true;
+        target = null;
+        repeatable = null;
         try {
             bp = 0;
             buf = readInputStream(buf, c.classfile.openInputStream());
@@ -2318,6 +2352,12 @@
                 Name name = missingTypeVariables.head.tsym.name;
                 throw badClassFile("undecl.type.var", name);
             }
+
+            if ((c.flags_field & Flags.ANNOTATION) != 0) {
+                c.setAnnotationTypeMetadata(new AnnotationTypeMetadata(c, new CompleterDeproxy(c, target, repeatable)));
+            } else {
+                c.setAnnotationTypeMetadata(AnnotationTypeMetadata.notAnAnnotationType());
+            }
         } catch (IOException ex) {
             throw badClassFile("unable.to.access.file", ex.getMessage());
         } catch (ArrayIndexOutOfBoundsException ex) {
@@ -2515,4 +2555,42 @@
             return name.hashCode();
         }
     }
+
+    private class CompleterDeproxy implements AnnotationTypeCompleter {
+        ClassSymbol proxyOn;
+        CompoundAnnotationProxy target;
+        CompoundAnnotationProxy repeatable;
+
+        public CompleterDeproxy(ClassSymbol c, CompoundAnnotationProxy target,
+                CompoundAnnotationProxy repeatable)
+        {
+            this.proxyOn = c;
+            this.target = target;
+            this.repeatable = repeatable;
+        }
+
+        @Override
+        public void complete(ClassSymbol sym) {
+            Assert.check(proxyOn == sym);
+            Attribute.Compound theTarget = null, theRepeatable = null;
+            AnnotationDeproxy deproxy;
+
+            try {
+                if (target != null) {
+                    deproxy = new AnnotationDeproxy(proxyOn);
+                    theTarget = deproxy.deproxyCompound(target);
+                }
+
+                if (repeatable != null) {
+                    deproxy = new AnnotationDeproxy(proxyOn);
+                    theRepeatable = deproxy.deproxyCompound(repeatable);
+                }
+            } catch (Exception e) {
+                throw new CompletionFailure(sym, e.getMessage());
+            }
+
+            sym.getAnnotationTypeMetadata().setTarget(theTarget);
+            sym.getAnnotationTypeMetadata().setRepeatable(theRepeatable);
+        }
+    }
 }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
index 402ae13..32adf07 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
@@ -75,6 +75,7 @@
     private final Types types;
     private final Lower lower;
     private final Flow flow;
+    private final Annotate annotate;
 
     /** Format of stackmap tables to be generated. */
     private final Code.StackMapFormat stackMap;
@@ -142,6 +143,7 @@
         }
         this.jsrlimit = setjsrlimit;
         this.useJsrLocally = false; // reset in visitTry
+        annotate = Annotate.instance(context);
     }
 
     /** Switches
@@ -1468,21 +1470,18 @@
                       int startpc, int endpc,
                       List<Integer> gaps) {
             if (startpc != endpc) {
-                List<JCExpression> subClauses = TreeInfo.isMultiCatch(tree) ?
-                        ((JCTypeUnion)tree.param.vartype).alternatives :
-                        List.of(tree.param.vartype);
+                List<Pair<List<Attribute.TypeCompound>, JCExpression>> catchTypeExprs
+                        = catchTypesWithAnnotations(tree);
                 while (gaps.nonEmpty()) {
-                    for (JCExpression subCatch : subClauses) {
+                    for (Pair<List<Attribute.TypeCompound>, JCExpression> subCatch1 : catchTypeExprs) {
+                        JCExpression subCatch = subCatch1.snd;
                         int catchType = makeRef(tree.pos(), subCatch.type);
                         int end = gaps.head.intValue();
                         registerCatch(tree.pos(),
                                       startpc,  end, code.curCP(),
                                       catchType);
-                        if (subCatch.type.isAnnotated()) {
-                            for (Attribute.TypeCompound tc :
-                                     subCatch.type.getAnnotationMirrors()) {
+                        for (Attribute.TypeCompound tc :  subCatch1.fst) {
                                 tc.position.setCatchInfo(catchType, startpc);
-                            }
                         }
                     }
                     gaps = gaps.tail;
@@ -1490,16 +1489,14 @@
                     gaps = gaps.tail;
                 }
                 if (startpc < endpc) {
-                    for (JCExpression subCatch : subClauses) {
+                    for (Pair<List<Attribute.TypeCompound>, JCExpression> subCatch1 : catchTypeExprs) {
+                        JCExpression subCatch = subCatch1.snd;
                         int catchType = makeRef(tree.pos(), subCatch.type);
                         registerCatch(tree.pos(),
                                       startpc, endpc, code.curCP(),
                                       catchType);
-                        if (subCatch.type.isAnnotated()) {
-                            for (Attribute.TypeCompound tc :
-                                     subCatch.type.getAnnotationMirrors()) {
-                                tc.position.setCatchInfo(catchType, startpc);
-                            }
+                        for (Attribute.TypeCompound tc :  subCatch1.fst) {
+                            tc.position.setCatchInfo(catchType, startpc);
                         }
                     }
                 }
@@ -1507,7 +1504,7 @@
                 code.statBegin(tree.pos);
                 code.markStatBegin();
                 int limit = code.nextreg;
-                int exlocal = code.newLocal(exparam);
+                code.newLocal(exparam);
                 items.makeLocalItem(exparam).store();
                 code.statBegin(TreeInfo.firstStatPos(tree.body));
                 genStat(tree.body, env, CRT_BLOCK);
@@ -1515,6 +1512,30 @@
                 code.statBegin(TreeInfo.endPos(tree.body));
             }
         }
+        // where
+        List<Pair<List<Attribute.TypeCompound>, JCExpression>> catchTypesWithAnnotations(JCCatch tree) {
+            return TreeInfo.isMultiCatch(tree) ?
+                    catchTypesWithAnnotationsFromMulticatch((JCTypeUnion)tree.param.vartype, tree.param.sym.getRawTypeAttributes()) :
+                    List.of(new Pair<>(tree.param.sym.getRawTypeAttributes(), tree.param.vartype));
+        }
+        // where
+        List<Pair<List<Attribute.TypeCompound>, JCExpression>> catchTypesWithAnnotationsFromMulticatch(JCTypeUnion tree, List<TypeCompound> first) {
+            List<JCExpression> alts = tree.alternatives;
+            List<Pair<List<TypeCompound>, JCExpression>> res = List.of(new Pair<>(first, alts.head));
+            alts = alts.tail;
+
+            while(alts != null && alts.head != null) {
+                JCExpression alt = alts.head;
+                if (alt instanceof JCAnnotatedType) {
+                    JCAnnotatedType a = (JCAnnotatedType)alt;
+                    res = res.prepend(new Pair<>(annotate.fromAnnotations(a.annotations), alt));
+                } else {
+                    res = res.prepend(new Pair<>(List.nil(), alt));
+                }
+                alts = alts.tail;
+            }
+            return res.reverse();
+        }
 
         /** Register a catch clause in the "Exceptions" code-attribute.
          */
@@ -2052,7 +2073,7 @@
             code.emitop2(new_, makeRef(pos, stringBufferType));
             code.emitop0(dup);
             callMethod(
-                pos, stringBufferType, names.init, List.<Type>nil(), false);
+                    pos, stringBufferType, names.init, List.<Type>nil(), false);
         }
 
         /** Append value (on tos) to string buffer (on tos - 1).
@@ -2100,11 +2121,11 @@
          */
         void bufferToString(DiagnosticPosition pos) {
             callMethod(
-                pos,
-                stringBufferType,
-                names.toString,
-                List.<Type>nil(),
-                false);
+                    pos,
+                    stringBufferType,
+                    names.toString,
+                    List.<Type>nil(),
+                    false);
         }
 
         /** Complete generating code for operation, with left operand
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/UninitializedType.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/UninitializedType.java
index d1dacc3..5b40f64 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/UninitializedType.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/UninitializedType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@
     }
 
     @Override
-    public UninitializedType clone(final TypeMetadata md) {
+    public UninitializedType cloneWithMetadata(final TypeMetadata md) {
         return new UninitializedType(tag, qtype, offset, md);
     }
 
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java
index 9849f2d..ed66428 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,11 +25,13 @@
 
 package com.sun.tools.javac.model;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.EnumSet;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 import javax.lang.model.element.*;
 import javax.lang.model.type.*;
@@ -115,14 +117,17 @@
     @DefinedBy(Api.LANGUAGE_MODEL)
     public List<Type> directSupertypes(TypeMirror t) {
         validateTypeNotIn(t, EXEC_OR_PKG);
-        return types.directSupertypes((Type) t);
+        Type ty = (Type)t;
+        return types.directSupertypes(ty).stream()
+                .map(Type::stripMetadataIfNeeded)
+                .collect(Collectors.toList());
     }
 
     @DefinedBy(Api.LANGUAGE_MODEL)
     public TypeMirror erasure(TypeMirror t) {
         if (t.getKind() == TypeKind.PACKAGE)
             throw new IllegalArgumentException(t.toString());
-        return types.erasure((Type) t);
+        return types.erasure((Type)t).stripMetadataIfNeeded();
     }
 
     @DefinedBy(Api.LANGUAGE_MODEL)
@@ -143,7 +148,7 @@
     @DefinedBy(Api.LANGUAGE_MODEL)
     public TypeMirror capture(TypeMirror t) {
         validateTypeNotIn(t, EXEC_OR_PKG);
-        return types.capture((Type) t);
+        return types.capture((Type)t).stripMetadataIfNeeded();
     }
 
     @DefinedBy(Api.LANGUAGE_MODEL)
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java
index 656079a..a1efba6 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,8 +34,6 @@
 import javax.tools.JavaFileObject;
 
 import com.sun.source.tree.*;
-import com.sun.source.tree.LambdaExpressionTree.BodyKind;
-import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Scope.*;
 import com.sun.tools.javac.code.Symbol.*;
@@ -2502,12 +2500,6 @@
 
         public JCTree annotationType;
         public List<JCExpression> args;
-
-        // Attribute.Compound if tag is ANNOTATION
-        // Attribute.TypeCompound if tag is TYPE_ANNOTATION
-        //
-        // NOTE: This field is slated for removal in the future.  Do
-        // not use it for anything new.
         public Attribute.Compound attribute;
 
         protected JCAnnotation(Tag tag, JCTree annotationType, List<JCExpression> args) {
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java
index c543782..0925fd1 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -234,6 +234,8 @@
     }
 
     private boolean unique(TypeVar typevar) {
+        typevar = (TypeVar)typevar.stripMetadataIfNeeded();
+
         int found = 0;
         for (Type t : whereClauses.get(WhereClauseKind.TYPEVAR).keySet()) {
             if (t.toString().equals(typevar.toString())) {
@@ -542,6 +544,7 @@
 
         @Override
         public Void visitTypeVar(TypeVar t, Void ignored) {
+            t = (TypeVar)t.stripMetadataIfNeeded();
             if (indexOf(t, WhereClauseKind.TYPEVAR) == -1) {
                 //access the bound type and skip error types
                 Type bound = t.bound;
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/api/AnnotatedArrayOrder.java b/langtools/test/tools/javac/annotations/typeAnnotations/api/AnnotatedArrayOrder.java
index 2c7ac55..4e457f7 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/api/AnnotatedArrayOrder.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/api/AnnotatedArrayOrder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8031744
  * @summary Checks the annotation types targeting array types
  */
 
@@ -34,7 +35,6 @@
 import java.util.Map;
 import java.util.HashMap;
 import java.lang.annotation.*;
-import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import com.sun.source.tree.*;
 import com.sun.source.util.JavacTask;
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/BasicTest.java b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/BasicTest.java
index dac1637..71bab2f 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/BasicTest.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/BasicTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6843077 8006775
+ * @bug 6843077 8006775 8031744
  * @summary random tests for new locations
  * @author Matt Papi
  * @compile BasicTest.java
@@ -41,12 +41,16 @@
 @interface C {}
 @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
 @interface D {}
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface E {}
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface F {}
 
 /**
  * Tests basic JSR 308 parser functionality. We don't really care about what
  * the parse tree looks like, just that these annotations can be parsed.
  */
-class BasicTest<T extends @A Object> extends @B LinkedList<T> implements @C List<T> {
+class BasicTest<@D T extends @A Object> extends @B LinkedList<@E T> implements @C List<@F T> {
 
     void test() {
 
diff --git a/langtools/test/tools/javac/lib/DPrinter.java b/langtools/test/tools/javac/lib/DPrinter.java
index da9f62d..d5907fd 100644
--- a/langtools/test/tools/javac/lib/DPrinter.java
+++ b/langtools/test/tools/javac/lib/DPrinter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -477,7 +477,7 @@
                 out.print(label);
                 out.println(": " +
                         info(sym.getClass(),
-                            String.format("0x%x--%s", sym.kind, Kinds.kindName(sym)),
+                            String.format("0x%x--%s", sym.kind.ordinal(), Kinds.kindName(sym)),
                             sym.getKind())
                         + " " + sym.name
                         + " " + hashString(sym));
diff --git a/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java b/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java
index aafe60a..c2e4e86 100644
--- a/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java
+++ b/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,21 +23,27 @@
 
 /*
  * @test
- * @bug     8013852
+ * @bug 8013852 8031744
  * @summary Annotations on types
  * @library /tools/javac/lib
- * @ignore 8057688 type annotations in type argument position are lost
- * @ignore 8031744 Annotations on many Language Model elements are not returned
  * @build JavacTestingAbstractProcessor DPrinter BasicAnnoTests
  * @compile/process -processor BasicAnnoTests -proc:only BasicAnnoTests.java
  */
 
 import java.io.PrintWriter;
+import java.io.Serializable;
 import java.lang.annotation.Annotation;
 import java.lang.annotation.ElementType;
+import java.lang.annotation.Repeatable;
 import java.lang.annotation.Target;
+import java.util.ArrayList;
+
+import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
+import java.util.NavigableMap;
 import java.util.Set;
+import java.util.TreeMap;
 
 import javax.annotation.processing.ProcessingEnvironment;
 import javax.annotation.processing.RoundEnvironment;
@@ -48,15 +54,23 @@
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.type.ArrayType;
+import javax.lang.model.type.DeclaredType;
 import javax.lang.model.type.ExecutableType;
+import javax.lang.model.type.IntersectionType;
 import javax.lang.model.type.TypeMirror;
 import javax.lang.model.type.TypeVariable;
 import javax.lang.model.type.WildcardType;
+import javax.lang.model.util.Types;
 import javax.tools.Diagnostic.Kind;
 
+import com.sun.tools.javac.code.Attribute;
 import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import com.sun.tools.javac.util.Name;
+
+import static com.sun.tools.javac.code.Attribute.Array;
+import static com.sun.tools.javac.code.Attribute.Constant;
+import static com.sun.tools.javac.code.Attribute.Compound;
 
 /**
  * The test scans this file looking for test cases annotated with @Test.
@@ -77,7 +91,7 @@
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
         TestElementScanner s = new TestElementScanner();
         for (Element e: roundEnv.getRootElements()) {
-            s.scan(e);
+            s.scan(e, null);
         }
         return true;
     }
@@ -95,17 +109,17 @@
      */
     class TestElementScanner extends ElementScanner<Void,Void> {
         public Void scan(Element elem, Void ignore) {
+            List<AnnotationMirror> tests = new ArrayList<>();
             AnnotationMirror test = getAnnotation(elem, Test.class.getName().replace('$', '.'));
             if (test != null) {
+                tests.add(test);
+            }
+            tests.addAll(getAnnotations(elem, Tests.class.getName().replace('$', '.')));
+
+            if (tests.size() > 0) {
                 out.println("Test: " + elem + " " + test);
-                TestTypeScanner s = new TestTypeScanner(elem, test);
-                s.scan(elem.asType(), null);
-                if (getPosn(test) >= s.count)
-                    error(elem, "position " + getPosn(test) + " not found");
-                if (!s.found) {
-                    dprinter.printSymbol("element", (Symbol) elem);
-                    dprinter.printType("type", (Type) elem.asType());
-                }
+                TestTypeScanner s = new TestTypeScanner(elem, tests, types);
+                s.test(elem.asType());
                 out.println();
             }
             return super.scan(elem, ignore);
@@ -118,45 +132,110 @@
      */
     class TestTypeScanner extends TypeScanner<Void, Void> {
         Element elem;
-        AnnotationMirror test;
+        NavigableMap<Integer, AnnotationMirror> toBeFound;
         int count = 0;
-        boolean found = false;
+        Set<TypeMirror> seen = new HashSet<>();
 
-        TestTypeScanner(Element elem, AnnotationMirror test) {
+        TestTypeScanner(Element elem, List<AnnotationMirror> tests, Types types) {
+            super(types);
             this.elem = elem;
-            this.test = test;
+
+            NavigableMap<Integer, AnnotationMirror> testByPos = new TreeMap<>();
+            for (AnnotationMirror test : tests) {
+                for (int pos : getPosn(test)) {
+                    testByPos.put(pos, test);
+                }
+            }
+            this.toBeFound = testByPos;
+        }
+
+        public void test(TypeMirror t) {
+            scan(t, null);
         }
 
         @Override
         Void scan(TypeMirror t, Void ignore) {
             if (t == null)
                 return DEFAULT_VALUE;
-            if (verbose)
-                out.println("scan " + count + ": " + t);
-            if (count == getPosn(test)) {
-                String annoType = getAnnoType(test);
-                AnnotationMirror anno = getAnnotation(t, annoType);
-                if (anno == null) {
-                    error(elem, "annotation not found on " + count + ": " + t);
-                } else {
-                    String v = getValue(anno, "value").toString();
-                    if (v.equals(getExpect(test))) {
-                        out.println("found " + anno + " as expected");
-                        found = true;
+
+            if (!seen.contains(t)) {
+                try {
+                    seen.add(t);
+                    if (verbose)
+                        out.println("scan " + count + ": " + t);
+                    if (toBeFound.size() > 0) {
+                        if (toBeFound.firstKey().equals(count)) {
+                            AnnotationMirror test = toBeFound.pollFirstEntry().getValue();
+                            String annoType = getAnnoType(test);
+                            AnnotationMirror anno = getAnnotation(t, annoType);
+                            if (anno == null) {
+                                error(elem, "annotation not found on " + count + ": " + t);
+                            } else {
+                                String v = getValue(anno, "value").toString();
+                                if (v.equals(getExpect(test))) {
+                                    out.println("found " + anno + " as expected");
+                                } else {
+                                    error(elem, "Unexpected value: " + v + ", expected: " + getExpect(test));
+                                }
+                            }
+                        } else if (count > toBeFound.firstKey()) {
+                            rescue();
+                        } else {
+                            List<? extends AnnotationMirror> annos = t.getAnnotationMirrors();
+                            if (annos.size() > 0) {
+                                for (AnnotationMirror a : annos)
+                                    error(elem, "annotation " + a + " found on " + count + ": " + t);
+                            }
+                        }
                     } else {
-                        error(elem, "Unexpected value: " + v + ", expected: " + getExpect(test));
+                        List<? extends AnnotationMirror> annos = t.getAnnotationMirrors();
+                        if (annos.size() > 0) {
+                            for (AnnotationMirror a : annos)
+                                error(elem, "annotation " + a + " found on " + count + ": " + t);
+                        }
                     }
+                    count++;
+                    return super.scan(t, ignore);
+
+                } finally {
+                    seen.remove(t);
                 }
             }
-            count++;
-            return super.scan(t, ignore);
+
+            return DEFAULT_VALUE;
+
+        }
+
+        private void rescue() {
+            while (toBeFound.size() > 0 && toBeFound.firstKey() >= count)
+                toBeFound.pollFirstEntry();
         }
     }
 
-    /** Get the position value from an @Test annotation mirror. */
-    static int getPosn(AnnotationMirror test) {
+    /** Get the position value from an element annotated with a @Test annotation mirror. */
+    static int[] getPosn(Element elem) {
+        return elem.getAnnotation(Test.class).posn();
+    }
+
+    /** Get the position value from a @Test annotation mirror. */
+    static Integer[] getPosn(AnnotationMirror test) {
         AnnotationValue v = getValue(test, "posn");
-        return (Integer) v.getValue();
+        Object value = v.getValue();
+        Integer i = 0;
+        if (value instanceof Constant) {
+            i = (Integer)((Constant)value).getValue();
+            Integer[] res = new Integer[1];
+            res[0] = i;
+            return res;
+        } else if (value instanceof List) {
+            List<Constant> l = (List<Constant>)value;
+            Integer[] res = new Integer[l.size()];
+            for (int c = 0; c < l.size(); c++) {
+                res[c] = (Integer)l.get(c).getValue();
+            }
+            return res;
+        }
+        return null;
     }
 
     /** Get the expect value from an @Test annotation mirror. */
@@ -185,6 +264,25 @@
         return null;
     }
 
+    static List<AnnotationMirror> getAnnotations(Element e, String name) {
+        Name valueName = ((Symbol)e).getSimpleName().table.names.value;
+        List<AnnotationMirror> res = new ArrayList<>();
+
+        for (AnnotationMirror m : e.getAnnotationMirrors()) {
+            TypeElement te = (TypeElement) m.getAnnotationType().asElement();
+            if (te.getQualifiedName().contentEquals(name)) {
+                Compound theAnno = (Compound)m;
+                Array valueArray = (Array)theAnno.member(valueName);
+                for (Attribute a : valueArray.getValue()) {
+                    AnnotationMirror theMirror = (AnnotationMirror) a;
+
+                    res.add(theMirror);
+                }
+            }
+        }
+        return res;
+    }
+
     /**
      * Get a specific value from an annotation mirror.
      */
@@ -203,6 +301,13 @@
      * one sufficient for our needs.
      */
     static class TypeScanner<R, P> extends SimpleTypeVisitor<R, P> {
+        private Types types;
+
+        public TypeScanner(Types types) {
+            super();
+            this.types = types;
+        }
+
         @Override
         public R visitArray(ArrayType t, P p) {
             scan(t.getComponentType(), p);
@@ -211,17 +316,34 @@
 
         @Override
         public R visitExecutable(ExecutableType t, P p) {
+            //out.println("  type parameters: " + t.getTypeVariables());
+            scan(t.getTypeVariables(), p);
+            //out.println("  return: " + t.getReturnType());
+            scan(t.getReturnType(), p);
+            //out.println("  receiver: " + t.getReceiverTypes());
             scan(t.getReceiverType());
             //out.println("  params: " + t.getParameterTypes());
             scan(t.getParameterTypes(), p);
-            //out.println("  return: " + t.getReturnType());
-            scan(t.getReturnType(), p);
             //out.println("  throws: " + t.getThrownTypes());
             scan(t.getThrownTypes(), p);
             return super.visitExecutable(t, p);
         }
 
         @Override
+        public R visitDeclared(DeclaredType t, P p) {
+            scan(t.getTypeArguments(), p);
+            // don't scan enclosing
+            scan(types.directSupertypes(t), p);
+            return super.visitDeclared(t, p);
+        }
+
+        @Override
+        public R visitIntersection(IntersectionType t, P p) {
+            scan(t.getBounds(), p);
+            return super.visitIntersection(t, p);
+        }
+
+        @Override
         public R visitTypeVariable(TypeVariable t, P p) {
             scan(t.getLowerBound(), p);
             scan(t.getUpperBound(), p);
@@ -254,36 +376,194 @@
     }
 
     /** Annotation to identify test cases. */
+    @Repeatable(Tests.class)
     @interface Test {
         /** Where to look for the annotation, expressed as a scan index. */
-        int posn();
+        int[] posn();
         /** The annotation to look for. */
         Class<? extends Annotation> annoType();
         /** The string representation of the annotation's value. */
         String expect();
     }
 
+    @interface Tests {
+        Test[] value();
+    }
+
     /** Type annotation to use in test cases. */
     @Target(ElementType.TYPE_USE)
     public @interface TA {
         int value();
     }
+    @Target(ElementType.TYPE_USE)
+    public @interface TB {
+        int value();
+    }
+
+    // Test cases
+
+    // TODO: add more cases for arrays
+    //       all annotated
+    //       all but one annotated
+    //             vary position of one not annotated
+    //       only one annotated
+    //             vary position of one annotated
+    //       the three above with the corner case of the ambiguos decl + type anno added
 
     @Test(posn=0, annoType=TA.class, expect="1")
     public @TA(1) int f1;
 
+    @Test(posn=0, annoType=TA.class, expect="11")
+    @TA(11) public int f11;
+
+    @Test(posn=1, annoType=TA.class, expect="111")
+    @TA(111) public int [] f111;
+
+    @Test(posn=1, annoType=TA.class, expect="1120")
+    @Test(posn=0, annoType=TB.class, expect="1121")
+    @TA(1120) public int @TB(1121) [] f112;
+
+    @Test(posn=0, annoType=TB.class, expect="11211")
+    @Test(posn=1, annoType=TA.class, expect="11200")
+    public @TA(11200) int @TB(11211) [] f112b;
+
+    @Test(posn=1, annoType=TB.class, expect="1131")
+    @Test(posn=2, annoType=TA.class, expect="1130")
+    @TA(1130) public int [] @TB(1131) [] f113;
+
+    @Test(posn=5, annoType=TA.class, expect="12")
+    public @TA(12) int [] [] [] [] [] f12;
+
+    @Test(posn=6, annoType=TA.class, expect="13")
+    public @TA(13) int [] [] [] [] [] [] f13;
+
+    @Test(posn=7, annoType=TA.class, expect="14")
+    @TA(14) public int [] [] [] [] [] [] [] f14;
+
+    @Test(posn=6, annoType=TA.class, expect="150")
+    @Test(posn=7, annoType=TB.class, expect="151")
+    @TB(151) public int [] [] [] [] [] [] @TA(150) [] f15;
+
+    @Test(posn=0, annoType=TB.class, expect="1511")
+    @Test(posn=3, annoType=TA.class, expect="1512")
+    @Test(posn=6, annoType=TA.class, expect="150")
+    @Test(posn=7, annoType=TB.class, expect="151")
+    @TB(151) public int @TB(1511) [] [] [] @TA(1512) [] [] [] @TA(150) [] f15b;
+
+    @Test(posn=0, annoType=TB.class, expect="1521")
+    @Test(posn=3, annoType=TA.class, expect="1522")
+    @Test(posn=6, annoType=TA.class, expect="152")
+    public int @TB(1521) [] [] [] @TA(1522) [] [] [] @TA(152) [] f15c;
+
+    @Test(posn=5, annoType=TA.class, expect="160")
+    @Test(posn=6, annoType=TB.class, expect="161")
+    public int [] [] [] [] [] @TA(160) [] @TB(161) [] f16;
+
     @Test(posn=0, annoType=TA.class, expect="2")
     public int @TA(2) [] f2;
 
+    @Test(posn=0, annoType=TB.class, expect="33")
     @Test(posn=1, annoType=TA.class, expect="3")
-    public @TA(3) int [] f3;
+    public @TA(3) int @TB(33) [] f3;
 
-    @Test(posn=1, annoType=TA.class, expect="4")
+    @Test(posn=2, annoType=TA.class, expect="4")
     public int m1(@TA(4) float a) throws Exception { return 0; }
 
-    @Test(posn=2, annoType=TA.class, expect="5")
+    @Test(posn=1, annoType=TA.class, expect="5")
     public @TA(5) int m2(float a) throws Exception { return 0; }
 
     @Test(posn=3, annoType=TA.class, expect="6")
     public int m3(float a) throws @TA(6) Exception { return 0; }
+
+    // Also tests that a decl anno on a typevar doesn't show up on the Type
+    @Test(posn=7, annoType=TA.class, expect="8")
+    public <@TA(7) M> M m4(@TA(8) float a) throws Exception { return null; }
+
+    // Also tests that a decl anno on a typevar doesn't show up on the Type
+    @Test(posn=4, annoType=TA.class, expect="10")
+    public class Inner1<@TA(9) S> extends @TA(10) Object implements Cloneable {}
+
+    // Also tests that a decl anno on a typevar doesn't show up on the Type
+    @Test(posn=5, annoType=TA.class, expect="12")
+    public class Inner2<@TA(11) S> extends Object implements @TA(12) Cloneable {}
+
+    @Test(posn={3,6}, annoType=TA.class, expect="13")
+    public <M extends @TA(13) Object> M m5(float a) { return null; }
+
+    @Test(posn=3, annoType=TA.class, expect="14")
+    public class Inner3<QQQ extends @TA(14) Map> {}
+
+    @Test(posn=4, annoType=TA.class, expect="15")
+    public class Inner4<T extends @TA(15) Object & Cloneable & Serializable> {}
+
+    @Test(posn=5, annoType=TA.class, expect="16")
+    public class Inner5<T extends Object & @TA(16) Cloneable & Serializable> {}
+
+    @Test(posn=7, annoType=TA.class, expect="17")
+    public class Inner6<T extends Object & Cloneable & @TA(17) Serializable> {}
+
+    // Test annotated bounds
+
+    @Test(posn=1, annoType=TA.class, expect="18")
+    public Set<@TA(18) ? extends Object> f4;
+
+    @Test(posn=2, annoType=TA.class, expect="19")
+    public Set<? extends @TA(19) Object> f5;
+
+    @Test(posn=3, annoType=TA.class, expect="20")
+    public Set<? extends Set<@TA(20) ? extends Object>> f6;
+
+    @Test(posn=4, annoType=TA.class, expect="21")
+    public Set<? extends Set<? extends @TA(21) Object>> f7;
+
+    @Test(posn=1, annoType=TA.class, expect="22")
+    public Set<@TA(22) ?> f8;
+
+    @Test(posn=1, annoType=TA.class, expect="23")
+    public Set<@TA(23) ? super Object> f9;
+
+    // Test type use annotations on uses of type variables
+    @Test(posn=5, annoType = TA.class, expect = "25")
+    @Test(posn=5, annoType = TB.class, expect = "26")
+    <T> void m6(@TA(25) @TB(26) T t) { }
+
+    class Inner7<T> {
+        @Test(posn=0, annoType = TA.class, expect = "30")
+        @Test(posn=0, annoType = TB.class, expect = "31")
+        @TA(30) @TB(31) T f;
+    }
+
+    // Test type use annotations on uses of type variables
+    @Test(posn=5, annoType = TB.class, expect = "41")
+    <@TA(40) T> void m7(@TB(41) T t) { }
+
+    class Inner8<@TA(50) T> {
+        @Test(posn=0, annoType = TB.class, expect = "51")
+        @TB(51) T f;
+    }
+
+    // Test type use annotations on uses of Class types
+    @Test(posn=5, annoType = TA.class, expect = "60")
+    @Test(posn=5, annoType = TB.class, expect = "61")
+    <T> void m60(@TA(60) @TB(61) String t) { }
+
+    class Inner70<T> {
+        @Test(posn=0, annoType = TA.class, expect = "70")
+        @Test(posn=0, annoType = TB.class, expect = "71")
+        @TA(70) @TB(71) String f;
+    }
+
+    // Test type use annotations on uses of type variables
+    @Test(posn=5, annoType = TB.class, expect = "81")
+    <@TA(80) T> void m80(@TB(81) String t) { }
+
+    class Inner90<@TA(90) T> {
+        @Test(posn=0, annoType = TB.class, expect = "91")
+        @TB(91) String f;
+    }
+
+    // Recursive bound
+    @Test(posn=4, annoType = TB.class, expect = "100")
+    class Inner100<T extends Inner100<@TB(100) T>> {
+    }
 }
diff --git a/langtools/test/tools/javac/warnings/6747671/T6747671.out b/langtools/test/tools/javac/warnings/6747671/T6747671.out
index 518804d..1176234 100644
--- a/langtools/test/tools/javac/warnings/6747671/T6747671.out
+++ b/langtools/test/tools/javac/warnings/6747671/T6747671.out
@@ -7,6 +7,6 @@
 T6747671.java:32:9: compiler.warn.raw.class.use: T6747671.A, T6747671<E>.A<X>
 T6747671.java:32:20: compiler.warn.raw.class.use: T6747671.A, T6747671<E>.A<X>
 T6747671.java:33:16: compiler.warn.raw.class.use: T6747671.A.Z, T6747671<E>.A<X>.Z<Y>
-T6747671.java:36:9: compiler.warn.raw.class.use: @T6747671.TA T6747671.B, T6747671.B<X>
+T6747671.java:36:9: compiler.warn.raw.class.use: T6747671.B, T6747671.B<X>
 T6747671.java:36:27: compiler.warn.raw.class.use: T6747671.B, T6747671.B<X>
 11 warnings
diff --git a/make/Help.gmk b/make/Help.gmk
index 4f2dae1..739a85e 100644
--- a/make/Help.gmk
+++ b/make/Help.gmk
@@ -88,28 +88,15 @@
 	$(info $(_)                        # make test TEST="jdk_lang jdk_net")
 	$(info )
 	$(if $(all_confs), $(info Available configurations in $(build_dir):) $(foreach var,$(all_confs),$(info * $(var))),\
-	    $(info No configurations were found in $(build_dir).) $(info Run 'bash configure' to create a configuration))
+	    $(info No configurations were found in $(build_dir).) $(info Run 'bash configure' to create a configuration.))
         # We need a dummy rule otherwise make will complain
 	@true
 
-print-targets:
-	$(if $(any_spec_file), ,\
-	  @echo "Note: More targets will be available when at least one configuration exists." 1>&2\
-	)
-	@echo $(ALL_TARGETS)
-
-print-modules:
-	$(if $(any_spec_file), \
-	  @$(MAKE) -s -f $(topdir)/make/Main.gmk -I $(topdir)/make/common SPEC=$(any_spec_file) print-modules \
-	, \
-	  @echo print-modules can currently only be run when at least one configuration exists \
-	)
-
 print-configurations:
 	$(foreach var, $(all_confs), $(info $(var)))
         # We need a dummy rule otherwise make will complain
 	@true
 
-ALL_GLOBAL_TARGETS := help print-modules print-targets print-configurations
+ALL_GLOBAL_TARGETS := help print-configurations
 
 .PHONY: $(ALL_GLOBAL_TARGETS)
diff --git a/make/Init.gmk b/make/Init.gmk
index 59f98fa..431b3a7 100644
--- a/make/Init.gmk
+++ b/make/Init.gmk
@@ -37,84 +37,102 @@
 # serially, regardless of -j.
 .NOTPARALLEL:
 
-# If included from the top-level Makefile then topdir is set, but not when
-# recursively calling ourself with a spec.
-ifeq ($(topdir),)
-  topdir := $(strip $(patsubst %/make/, %, $(dir $(lastword $(MAKEFILE_LIST)))))
-endif
-
-# Our helper functions. Will include $(SPEC) if $(HAS_SPEC) is true.
-include $(topdir)/make/InitSupport.gmk
-
-# Here are "global" targets, i.e. targets that can be executed without having a configuration.
-# This will define ALL_GLOBAL_TARGETS.
-include $(topdir)/make/Help.gmk
-
-# Extract main targets from Main.gmk.
-ifneq ($(any_spec_file), )
-  ifeq ($(wildcard $(dir $(any_spec_file))/make-support/module-deps.gmk),)
-    # If make-support does not exist, we need to build the genmodules java tool first.
-    $(info Creating data for first make execution in new configuration...)
-    ignore_output := $(shell $(MAKE) -r -R -f $(topdir)/make/Main.gmk \
-        -I $(topdir)/make/common SPEC=$(any_spec_file) NO_RECIPES=true FRC)
-    $(info Done)
-  endif
-  ALL_MAIN_TARGETS := $(shell $(MAKE) -r -R -f $(topdir)/make/Main.gmk \
-      -I $(topdir)/make/common SPEC=$(any_spec_file) NO_RECIPES=true print-targets)
-else
-  # Without at least a single valid configuration, we cannot extract any real
-  # targets. To provide a helpful error message about the missing configuration
-  # later on, accept whatever targets the user has provided for now.
-  ALL_MAIN_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default)
-endif
-
-# Targets provided by this file.
-ALL_INIT_TARGETS := reconfigure
-
-ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS))
-
-ifneq ($(findstring qp, $(MAKEFLAGS)),)
+ifeq ($(HAS_SPEC),)
   ##############################################################################
-  # When called with -qp, assume an external part (e.g. bash completion) is trying
-  # to understand our targets. Just list our targets and do no more checking.
+  # This is the default mode. We have not been recursively called with a SPEC.
   ##############################################################################
 
-  $(ALL_TARGETS):
+  # Include our helper functions.
+  include $(topdir)/make/InitSupport.gmk
 
-  .PHONY: $(ALL_TARGETS)
+  # Here are "global" targets, i.e. targets that can be executed without having
+  # a configuration. This will define ALL_GLOBAL_TARGETS.
+  include $(topdir)/make/Help.gmk
 
-else ifeq ($(HAS_SPEC),)
-
-  ##############################################################################
-  # This is the normal case, we have been called from the command line by the
-  # user and we need to call ourself back with a proper SPEC.
-  ##############################################################################
-
-  $(eval $(call CheckControlVariables))
-  $(eval $(call CheckDeprecatedEnvironment))
-  $(eval $(call CheckInvalidMakeFlags))
-
-  $(eval $(call ParseConfCheckOption))
-
-  # Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE and MAKE_LOG_FLAGS.
-  $(eval $(call ParseLogLevel))
-
-  ifneq ($(findstring $(LOG_LEVEL),info debug trace),)
-    $(info Running make as '$(strip $(MAKE) $(MFLAGS) $(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))')
-  endif
+  # Targets provided by Init.gmk.
+  ALL_INIT_TARGETS := print-modules print-targets reconfigure
 
   # CALLED_TARGETS is the list of targets that the user provided,
   # or "default" if unspecified.
   CALLED_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default)
-  CALLED_SPEC_TARGETS := $(filter $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS), $(CALLED_TARGETS))
-  ifneq ($(CALLED_SPEC_TARGETS),)
-    # We have at least one non-global target, which need a SPEC
-    $(eval $(call ParseConfAndSpec))
-    # Now SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails)
 
+  # Extract non-global targets that require a spec file.
+  CALLED_SPEC_TARGETS := $(filter-out $(ALL_GLOBAL_TARGETS), $(CALLED_TARGETS))
+
+  # If we have only global targets, or if we are called with -qp (assuming an
+  # external part, e.g. bash completion, is trying to understand our targets),
+  # we will skip SPEC location and the sanity checks.
+  ifeq ($(CALLED_SPEC_TARGETS), )
+    ONLY_GLOBAL_TARGETS := true
+  endif
+  ifneq ($(findstring qp, $(MAKEFLAGS)),)
+    ONLY_GLOBAL_TARGETS := true
+  endif
+
+  ifeq ($(ONLY_GLOBAL_TARGETS), true)
+    ############################################################################
+    # We have only global targets, or are called with -pq.
+    ############################################################################
+
+    ifeq ($(wildcard $(SPEC)), )
+      # If we have no SPEC provided, we will just make a "best effort" target list.
+      # First try to grab any available pre-existing main-targets.gmk.
+      main_targets_file := $(firstword $(wildcard $(build_dir)/*/make-support/main-targets.gmk))
+      ifneq ($(main_targets_file), )
+        # Extract the SPEC that corresponds to this main-targets.gmk file.
+        SPEC := $(patsubst %/make-support/main-targets.gmk, %/spec.gmk, $(main_targets_file))
+      else
+        # None found, pick an arbitrary SPEC for which to generate a file
+        SPEC := $(firstword $(all_spec_files))
+      endif
+    endif
+
+    ifneq ($(wildcard $(SPEC)), )
+      $(eval $(call DefineMainTargets, LAZY, $(SPEC)))
+    else
+      # If we have no configurations we can not provide any main targets.
+      ALL_MAIN_TARGETS :=
+    endif
+
+    ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS))
+
+    # Just list all our targets.
+    $(ALL_TARGETS):
+
+    .PHONY: $(ALL_TARGETS)
+
+  else
+    ############################################################################
+    # This is the normal case, we have been called from the command line by the
+    # user and we need to call ourself back with a proper SPEC.
+    # We have at least one non-global target, so we need to find a spec file.
+    ############################################################################
+
+    # Basic checks on environment and command line.
+    $(eval $(call CheckControlVariables))
+    $(eval $(call CheckDeprecatedEnvironment))
+    $(eval $(call CheckInvalidMakeFlags))
+
+    # Check that CONF_CHECK is valid.
+    $(eval $(call ParseConfCheckOption))
+
+    # Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE and MAKE_LOG_FLAGS.
+    $(eval $(call ParseLogLevel))
+
+    # After this SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails).
+    $(eval $(call ParseConfAndSpec))
+
+    # Extract main targets from Main.gmk using the spec(s) provided. In theory,
+    # with multiple specs, we should find the intersection of targets provided
+    # by all specs, but we approximate this by an arbitrary spec from the list.
+    # This will setup ALL_MAIN_TARGETS.
+    $(eval $(call DefineMainTargets, FORCE, $(firstword $(SPECS))))
+
+    # Separate called targets depending on type.
     INIT_TARGETS := $(filter $(ALL_INIT_TARGETS), $(CALLED_SPEC_TARGETS))
-    SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(CALLED_SPEC_TARGETS))
-    PARALLEL_TARGETS := $(filter-out $(INIT_TARGETS) $(SEQUENTIAL_TARGETS), $(CALLED_SPEC_TARGETS))
+    MAIN_TARGETS := $(filter $(ALL_MAIN_TARGETS), $(CALLED_SPEC_TARGETS))
+    SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(MAIN_TARGETS))
+    PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS))
 
     # The spec files depend on the autoconf source code. This check makes sure
     # the configuration is up to date after changes to configure.
@@ -126,30 +144,41 @@
         else ifeq ($(CONF_CHECK), auto)
 	  @echo "Note: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'."
 	  @( cd $(topdir) && \
-	      $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -f $(topdir)/make/Init.gmk SPEC=$@ HAS_SPEC=true \
+	      $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
+	      SPEC=$@ HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
 	      reconfigure )
         else ifeq ($(CONF_CHECK), ignore)
           # Do nothing
         endif
 
-    # Unless reconfigure is explicitely called, let all targets depend on the spec files to be up to date.
-    ifeq ($(findstring reconfigure, $(CALLED_SPEC_TARGETS)), )
-      $(CALLED_SPEC_TARGETS): $(SPECS)
+    # Unless reconfigure is explicitely called, let all main targets depend on
+    # the spec files to be up to date.
+    ifeq ($(findstring reconfigure, $(INIT_TARGETS)), )
+      $(MAIN_TARGETS): $(SPECS)
     endif
 
-    # The recipe will be run once for every target specified, but we only want to execute the
-    # recipe a single time, hence the TARGET_DONE with a dummy command if true.
-    $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS):
+    make-info:
+        ifneq ($(findstring $(LOG_LEVEL),info debug trace),)
+	  $(info Running make as '$(strip $(MAKE) $(MFLAGS) \
+	      $(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))')
+        endif
+
+    # Now the init and main targets will be called, once for each SPEC. The
+    # recipe will be run once for every target specified, but we only want to
+    # execute the recipe a single time, hence the TARGET_DONE with a dummy
+    # command if true.
+    $(ALL_INIT_TARGETS) $(ALL_MAIN_TARGETS): make-info
 	@$(if $(TARGET_DONE), \
 	  true \
 	, \
 	  $(foreach spec, $(SPECS), \
 	    ( cd $(topdir) && \
-	    $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -j 1 -f $(topdir)/make/Init.gmk \
-	        SPEC=$(spec) HAS_SPEC=true \
+	    $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \
+	        SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
 	        USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \
 	        LOG_LEVEL=$(LOG_LEVEL) LOG_NOFILE=$(LOG_NOFILE) \
-	        INIT_TARGETS="$(INIT_TARGETS)" SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \
+	        INIT_TARGETS="$(INIT_TARGETS)" \
+	        SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \
 	        PARALLEL_TARGETS="$(PARALLEL_TARGETS)"  \
 	        main ) && \
 	  ) true \
@@ -158,7 +187,7 @@
 
     .PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)
 
-  endif # has $(CALLED_SPEC_TARGETS)
+  endif # $(ONLY_GLOBAL_TARGETS)!=true
 
 else # HAS_SPEC=true
 
@@ -168,6 +197,14 @@
   # file.
   ##############################################################################
 
+  include $(SPEC)
+
+  # Our helper functions.
+  include $(TOPDIR)/make/InitSupport.gmk
+
+  # Verify that the spec file we included seems okay.
+  $(eval $(call CheckSpecSanity))
+
   ifeq ($(LOG_NOFILE), true)
     # Disable log wrapper if LOG=[level,]nofile was given
     override BUILD_LOG_WRAPPER :=
@@ -177,7 +214,19 @@
     OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
   endif
 
-  $(eval $(call CheckSpecSanity))
+  ##############################################################################
+  # Init targets
+  ##############################################################################
+
+  print-modules:
+	( cd $(TOPDIR) && \
+	    $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
+	    NO_RECIPES=true print-modules )
+
+  print-targets:
+	( cd $(TOPDIR) && \
+	    $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
+	    NO_RECIPES=true print-targets )
 
   reconfigure:
         ifneq ($(CONFIGURE_COMMAND_LINE), )
@@ -188,42 +237,43 @@
 	( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
 	    $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
 
-  main-init:
-	$(call RotateLogFiles)
-	$(BUILD_LOG_WRAPPER) $(PRINTF) "Building target(s) '$(strip \
-	    $(INIT_TARGETS) $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) \
-	    )' in configuration '$(CONF_NAME)'\n"
+  ##############################################################################
+  # The main target, for delegating into Main.gmk
+  ##############################################################################
 
+  MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS)
+  TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \
+      '$(strip $(MAIN_TARGETS))' in configuration '$(CONF_NAME)'
 
   # MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls.
   # We need to clear it of the init-specific variables. The user-specified
   # variables are explicitely propagated using $(USER_MAKE_VARS).
   main: MAKEOVERRIDES :=
 
-  main: $(INIT_TARGETS) main-init
-        ifneq ($(SEQUENTIAL_TARGETS), )
-          # Don't touch build output dir since we might be cleaning. That means
-	  # no log wrapper.
-	  ( cd $(TOPDIR) && \
-	      $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
-	      $(SEQUENTIAL_TARGETS) \
-	  )
+  main: $(INIT_TARGETS)
+        ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
+	  $(call RotateLogFiles)
+	  $(BUILD_LOG_WRAPPER) $(PRINTF) "Building $(TARGET_DESCRIPTION)\n"
+          ifneq ($(SEQUENTIAL_TARGETS), )
+            # Don't touch build output dir since we might be cleaning. That
+            # means no log wrapper.
+	    ( cd $(TOPDIR) && \
+	        $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
+	        $(SEQUENTIAL_TARGETS) )
+          endif
+          ifneq ($(PARALLEL_TARGETS), )
+	    $(call StartGlobalTimer)
+	    $(call PrepareSmartJavac)
+	    ( cd $(TOPDIR) && \
+	        $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
+	        -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
+	        $(PARALLEL_TARGETS) )
+	    $(call CleanupSmartJavac)
+	    $(call StopGlobalTimer)
+	    $(call ReportBuildTimes)
+          endif
+	  $(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n"
         endif
-        ifneq ($(PARALLEL_TARGETS), )
-	  $(call StartGlobalTimer)
-	  $(call PrepareSmartJavac)
-	  ( cd $(TOPDIR) && \
-	      $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
-	      -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
-	      $(PARALLEL_TARGETS) \
-	  )
-	  $(call CleanupSmartJavac)
-	  $(call StopGlobalTimer)
-	  $(call ReportBuildTimes)
-        endif
-	$(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building target(s) '$(strip \
-	    $(INIT_TARGETS) $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) \
-	    )' in configuration '$(CONF_NAME)'\n"
 
-  .PHONY: reconfigure main-init main
+  .PHONY: print-targets print-modules reconfigure main
 endif
diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk
index cc733cf..b41b108 100644
--- a/make/InitSupport.gmk
+++ b/make/InitSupport.gmk
@@ -32,13 +32,6 @@
 ifndef _INITSUPPORT_GMK
 _INITSUPPORT_GMK := 1
 
-# Setup information about available configurations, if any.
-build_dir=$(topdir)/build
-all_spec_files=$(wildcard $(build_dir)/*/spec.gmk)
-# Extract the configuration names from the path
-all_confs=$(patsubst %/spec.gmk, %, $(patsubst $(build_dir)/%, %, $(all_spec_files)))
-any_spec_file=$(firstword $(all_spec_files))
-
 ifeq ($(HAS_SPEC),)
   ##############################################################################
   # Helper functions for the initial part of Init.gmk, before the spec file is
@@ -62,17 +55,24 @@
   # line, but in reverse order to what the user entered.
   COMMAND_LINE_VARIABLES := $(subst \#,\ , $(call reverse, $(subst \ ,\#,$(MAKEOVERRIDES))))
 
-  # A list like FOO="val1" BAR="val2" containing all user-supplied make variables
-  # that we should propagate.
+  # A list like FOO="val1" BAR="val2" containing all user-supplied make
+  # variables that we should propagate.
   USER_MAKE_VARS := $(filter-out $(addsuffix =%, $(INIT_CONTROL_VARIABLES)), \
       $(MAKEOVERRIDES))
 
+  # Setup information about available configurations, if any.
+  build_dir=$(topdir)/build
+  all_spec_files=$(wildcard $(build_dir)/*/spec.gmk)
+  # Extract the configuration names from the path
+  all_confs=$(patsubst %/spec.gmk, %, $(patsubst $(build_dir)/%, %, $(all_spec_files)))
+
   # Check for unknown command-line variables
   define CheckControlVariables
     command_line_variables := $$(strip $$(foreach var, \
         $$(subst \ ,_,$$(MAKEOVERRIDES)), \
         $$(firstword $$(subst =, , $$(var)))))
-    unknown_command_line_variables := $$(strip $$(filter-out $$(MAKE_CONTROL_VARIABLES), $$(command_line_variables)))
+    unknown_command_line_variables := $$(strip \
+        $$(filter-out $$(MAKE_CONTROL_VARIABLES), $$(command_line_variables)))
     ifneq ($$(unknown_command_line_variables), )
       $$(info Note: Command line contains non-control variables:)
       $$(foreach var, $$(unknown_command_line_variables), $$(info * $$(var)=$$($$(var))))
@@ -182,7 +182,7 @@
       override SPEC :=
     else
       # Use spec.gmk files in the build output directory
-      ifeq ($$(any_spec_file),)
+      ifeq ($$(all_spec_files),)
         $$(info Error: No configurations found for $$(topdir).)
         $$(info Please run 'bash configure' to create a configuration.)
         $$(info )
@@ -196,7 +196,8 @@
           matching_confs := $$(strip $$(all_confs))
         else
           # Otherwise select those that contain the given CONF string
-          matching_confs := $$(strip $$(foreach var, $$(all_confs), $$(if $$(findstring $$(CONF), $$(var)), $$(var))))
+          matching_confs := $$(strip $$(foreach var, $$(all_confs), \
+              $$(if $$(findstring $$(CONF), $$(var)), $$(var))))
         endif
         ifeq ($$(matching_confs),)
           $$(info Error: No configurations found matching CONF=$$(CONF).)
@@ -231,6 +232,37 @@
     endif
   endef
 
+  # Extract main targets from Main.gmk using the spec provided in $2.
+  #
+  # Param 1: FORCE = force generation of main-targets.gmk or LAZY = do not force.
+  # Param 2: The SPEC file to use.
+  define DefineMainTargets
+
+    # We will start by making sure the main-targets.gmk file is removed, if
+    # make has not been restarted. By the -include, we will trigger the
+    # rule for generating the file (which is never there since we removed it),
+    # thus generating it fresh, and make will restart, incrementing the restart
+    # count.
+    main_targets_file := $$(dir $(strip $2))make-support/main-targets.gmk
+
+    ifeq ($$(MAKE_RESTARTS),)
+      # Only do this if make has not been restarted, and if we do not force it.
+      ifeq ($(strip $1), FORCE)
+        $$(shell rm -f $$(main_targets_file))
+      endif
+    endif
+
+    $$(main_targets_file):
+	@( cd $$(topdir) && \
+	    $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/Main.gmk \
+	    -I $$(topdir)/make/common SPEC=$(strip $2) NO_RECIPES=true \
+	    LOG_LEVEL=$$(LOG_LEVEL) \
+	    create-main-targets-include )
+
+    # Now include main-targets.gmk. This will define ALL_MAIN_TARGETS.
+    -include $$(main_targets_file)
+  endef
+
   define PrintConfCheckFailed
 	@echo ' '
 	@echo "Please rerun configure! Easiest way to do this is by running"
@@ -242,10 +274,9 @@
 else # $(HAS_SPEC)=true
   ##############################################################################
   # Helper functions for the 'main' target. These functions assume a single,
-  # proper and existing SPEC is provided, and will load it.
+  # proper and existing SPEC is included.
   ##############################################################################
 
-  include $(SPEC)
   include $(SRC_ROOT)/make/common/MakeBase.gmk
 
   # Define basic logging setup
@@ -263,11 +294,11 @@
 
   # Sanity check the spec file, so it matches this source code
   define CheckSpecSanity
-    ifneq ($$(topdir), $$(TOPDIR))
-      ifneq ($$(topdir), $$(ORIGINAL_TOPDIR))
-        ifneq ($$(topdir), $$(CANONICAL_TOPDIR))
+    ifneq ($$(ACTUAL_TOPDIR), $$(TOPDIR))
+      ifneq ($$(ACTUAL_TOPDIR), $$(ORIGINAL_TOPDIR))
+        ifneq ($$(ACTUAL_TOPDIR), $$(CANONICAL_TOPDIR))
           $$(info Error: SPEC mismatch! Current working directory)
-          $$(info $$(topdir))
+          $$(info $$(ACTUAL_TOPDIR))
           $$(info does not match either TOPDIR, ORIGINAL_TOPDIR or CANONICAL_TOPDIR)
           $$(info $$(TOPDIR))
           $$(info $$(ORIGINAL_TOPDIR))
diff --git a/make/Main.gmk b/make/Main.gmk
index a6aef46..221a0ca 100644
--- a/make/Main.gmk
+++ b/make/Main.gmk
@@ -541,7 +541,7 @@
 CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
 CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native
 CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
-CLEAN_PHASES := gensrc java native include
+CLEAN_PHASES := gensrc java native include docs
 CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
 CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
 # Construct targets of the form clean-$module-$phase
@@ -550,7 +550,7 @@
 
 # Remove everything, except the output from configure.
 clean: $(CLEAN_DIR_TARGETS)
-	($(CD) $(OUTPUT_ROOT) && $(RM) -r source_tips build.log* build-trace*.log*)
+	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
 	$(ECHO) Cleaned all build artifacts.
 
 $(CLEAN_DIR_TARGETS):
@@ -574,13 +574,11 @@
 # while classes and touch files end up in jdk.
 clean-support: clean-jdk
 
-clean-docs: clean-docstemp
-
-# Remove everything, including configure configuration.
-# If the output directory was created by configure and now becomes empty, remove it as well.
+# Remove everything, including configure configuration. If the output
+# directory was created by configure and now becomes empty, remove it as well.
 dist-clean: clean
-	($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments \
-	    Makefile compare.sh tmp javacservers)
+	($(CD) $(OUTPUT_ROOT) && \
+	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
 	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
 	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
 	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
@@ -607,14 +605,19 @@
 
 ################################################################################
 
+# The following targets are intentionally not added to ALL_TARGETS since they
+# are internal only, to support Init.gmk.
+
 print-targets:
 	  @$(ECHO) $(sort $(ALL_TARGETS))
 
 print-modules:
 	  @$(ECHO) $(sort $(ALL_MODULES))
 
-# print-* targets intentionally not added to ALL_TARGETS since they are internal only.
-# The corresponding external targets are in Help.gmk
+create-main-targets-include:
+	  @$(ECHO) $(LOG_INFO) Generating main target list
+	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
+	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
 
 ################################################################################
 
diff --git a/make/MainSupport.gmk b/make/MainSupport.gmk
index aded13e..bbd7b81 100644
--- a/make/MainSupport.gmk
+++ b/make/MainSupport.gmk
@@ -41,46 +41,60 @@
 # Cleans the dir given as $1
 define CleanDir
 	@$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
-	@($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
+	@$(PRINTF) "\n" $(LOG_DEBUG)
+	($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
 	@$(PRINTF) " done\n"
 endef
 
 define CleanTest
 	@$(PRINTF) "Cleaning test $(strip $1) ..."
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1))
+	@$(PRINTF) "\n" $(LOG_DEBUG)
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1))
 	@$(PRINTF) " done\n"
 endef
 
 define Clean-gensrc
 	@$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..."
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1)
+	@$(PRINTF) "\n" $(LOG_DEBUG)
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1)
 	@$(PRINTF) " done\n"
 endef
 
 define Clean-java
 	@$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..."
-	@$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1)
-	@$(PRINTF) " done\n"
-	@$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..."
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
+	@$(PRINTF) "\n" $(LOG_DEBUG)
+	$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1)
+	$(PRINTF) " done\n"
+	$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..."
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
 	@$(PRINTF) " done\n"
 endef
 
 define Clean-native
 	@$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..."
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1)
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1)
+	@$(PRINTF) "\n" $(LOG_DEBUG)
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1)
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1)
 	@$(PRINTF) " done\n"
 endef
 
 define Clean-include
 	@$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..."
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1)
+	@$(PRINTF) "\n" $(LOG_DEBUG)
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1)
+	@$(PRINTF) " done\n"
+endef
+
+define Clean-docs
+	@$(PRINTF) "Cleaning docs ..."
+	@$(PRINTF) "\n" $(LOG_DEBUG)
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/docs
+	$(RM) -r $(IMAGES_OUTPUTDIR)/docs
 	@$(PRINTF) " done\n"
 endef
 
diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index 9785b65..2b228db 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -292,3 +292,4 @@
 2e640036000dfadcadaf6638b5fd61db9c71a25c jdk9-b56
 3bcfcb13c23402cf435079766eb2f9a3c4f890e8 jdk9-b57
 5096a7cca5f0fda814832ac777966bea893f837e jdk9-b58
+ea4e794c3927df4e03f53202e15a3248375b7902 jdk9-b59
diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java
index 8eb19b7..115e4b1 100644
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java
@@ -124,8 +124,6 @@
         if (memberCount > 0) {
             // call "super(map$)"
             mi.getStatic(className, PROPERTYMAP_FIELD_NAME, PROPERTYMAP_DESC);
-            // make sure we use duplicated PropertyMap so that original map
-            // stays intact and so can be used for many global.
             mi.invokeSpecial(PROTOTYPEOBJECT_TYPE, INIT, SCRIPTOBJECT_INIT_DESC);
             // initialize Function type fields
             initFunctionFields(mi);
diff --git a/nashorn/docs/DEVELOPER_README b/nashorn/docs/DEVELOPER_README
index 5550b90..faff28c 100644
--- a/nashorn/docs/DEVELOPER_README
+++ b/nashorn/docs/DEVELOPER_README
@@ -63,16 +63,19 @@
 See the description of the codegen logger below.
 
 
-SYSTEM PROPERTY: -Dnashorn.fields.objects
+SYSTEM PROPERTY: -Dnashorn.fields.objects, -Dnashorn.fields.dual
 
-When this property is true, Nashorn will only use object fields for
-AccessorProperties. This means that primitive values must be boxed
-when stored in a field, which is significantly slower than using
-primitive fields.
+When the nashorn.fields.objects property is true, Nashorn will always
+use object fields for AccessorProperties, requiring boxing for all
+primitive property values. When nashorn.fields.dual is set, Nashorn
+will always use dual long/object fields, which allows primitives to be
+stored without boxing. When neither system property is set, Nashorn
+chooses a setting depending on the optimistic types setting (dual
+fields when optimistic types are enabled, object-only fields otherwise).
 
-By default, Nashorn uses dual object and long fields. Ints are
-represented as the 32 low bits of the long fields. Doubles are
-represented as the doubleToLongBits of their value. This way a
+With dual fields, Nashorn uses long fields to store primitive values.
+Ints are represented as the 32 low bits of the long fields. Doubles
+are represented as the doubleToLongBits of their value. This way a
 single field can be used for all primitive types. Packing and
 unpacking doubles to their bit representation is intrinsified by
 the JVM and extremely fast.
diff --git a/nashorn/make/build.xml b/nashorn/make/build.xml
index bd87590..df478ee 100644
--- a/nashorn/make/build.xml
+++ b/nashorn/make/build.xml
@@ -402,14 +402,14 @@
   <!-- only to be invoked as dependency of "test" target -->
   <target name="-test-classes-all" depends="jar" unless="test.class">
       <fileset id="test.classes" dir="${build.test.classes.dir}">
-          <include name="**/api/javaaccess/*Test.class"/>
-          <include name="**/api/scripting/*Test.class"/>
-          <include name="**/api/tree/*Test.class"/>
-          <include name="**/codegen/*Test.class"/>
-          <include name="**/parser/*Test.class"/>
-          <include name="**/runtime/*Test.class"/>
-          <include name="**/runtime/regexp/*Test.class"/>
-          <include name="**/runtime/regexp/joni/*Test.class"/>
+          <include name="**/api/javaaccess/test/*Test.class"/>
+          <include name="**/api/scripting/test/*Test.class"/>
+          <include name="**/api/tree/test/*Test.class"/>
+          <include name="**/codegen/test/*Test.class"/>
+          <include name="**/parser/test/*Test.class"/>
+          <include name="**/runtime/test/*Test.class"/>
+          <include name="**/runtime/regexp/test/*Test.class"/>
+          <include name="**/runtime/regexp/joni/test/*Test.class"/>
           <include name="**/framework/*Test.class"/>
      </fileset>
   </target>
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
index fd627a6..81daa4f 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -43,7 +43,6 @@
 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup;
 import static jdk.nashorn.internal.codegen.CompilerConstants.typeDescriptor;
 import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup;
-import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY;
 import static jdk.nashorn.internal.ir.Symbol.HAS_SLOT;
 import static jdk.nashorn.internal.ir.Symbol.IS_INTERNAL;
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT;
@@ -306,6 +305,14 @@
     }
 
     /**
+     * Are we using dual primitive/object field representation?
+     * @return true if using dual field representation, false for object-only fields
+     */
+    boolean useDualFields() {
+        return compiler.getContext().useDualFields();
+    }
+
+    /**
      * Load an identity node
      *
      * @param identNode an identity node to load
@@ -1896,10 +1903,10 @@
                         //this symbol will be put fielded, we can't initialize it as undefined with a known type
                         @Override
                         public Class<?> getValueType() {
-                            if (OBJECT_FIELDS_ONLY || value == null || paramType == null) {
+                            if (!useDualFields() ||  value == null || paramType == null || paramType.isBoolean()) {
                                 return Object.class;
                             }
-                            return paramType.isBoolean() ? Object.class : paramType.getTypeClass();
+                            return paramType.getTypeClass();
                         }
                     });
                 }
@@ -2555,7 +2562,7 @@
 
             //for literals, a value of null means object type, i.e. the value null or getter setter function
             //(I think)
-            final Class<?> valueType = (OBJECT_FIELDS_ONLY || value == null || value.getType().isBoolean()) ? Object.class : value.getType().getTypeClass();
+            final Class<?> valueType = (!useDualFields() || value == null || value.getType().isBoolean()) ? Object.class : value.getType().getTypeClass();
             tuples.add(new MapTuple<Expression>(key, symbol, Type.typeFor(valueType), value) {
                 @Override
                 public Class<?> getValueType() {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilerConstants.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilerConstants.java
index e84c9f0..a7f31d5 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilerConstants.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilerConstants.java
@@ -149,8 +149,11 @@
     /** Arguments parameter in scope object constructors; in slot 3 when present */
     INIT_ARGUMENTS(null, 3),
 
-    /** prefix for all ScriptObject subclasses with fields, @see ObjectGenerator */
-    JS_OBJECT_PREFIX("JO"),
+    /** prefix for all ScriptObject subclasses with dual object/primitive fields, see {@link ObjectClassGenerator} */
+    JS_OBJECT_DUAL_FIELD_PREFIX("JD"),
+
+    /** prefix for all ScriptObject subclasses with object fields only, see {@link ObjectClassGenerator} */
+    JS_OBJECT_SINGLE_FIELD_PREFIX("JO"),
 
     /** name for allocate method in JO objects */
     ALLOCATE("allocate"),
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FieldObjectCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FieldObjectCreator.java
index 491af86..25baea0 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FieldObjectCreator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FieldObjectCreator.java
@@ -151,7 +151,7 @@
     @Override
     protected PropertyMap makeMap() {
         assert propertyMap == null : "property map already initialized";
-        propertyMap = newMapCreator(fieldObjectClass).makeFieldMap(hasArguments(), fieldCount, paddedFieldCount, evalCode);
+        propertyMap = newMapCreator(fieldObjectClass).makeFieldMap(hasArguments(), codegen.useDualFields(), fieldCount, paddedFieldCount, evalCode);
         return propertyMap;
     }
 
@@ -166,7 +166,7 @@
     private void putField(final MethodEmitter method, final String key, final int fieldIndex, final MapTuple<T> tuple) {
         method.dup();
 
-        final Type    fieldType   = tuple.isPrimitive() ? PRIMITIVE_FIELD_TYPE : Type.OBJECT;
+        final Type    fieldType   = codegen.useDualFields() && tuple.isPrimitive() ? PRIMITIVE_FIELD_TYPE : Type.OBJECT;
         final String  fieldClass  = getClassName();
         final String  fieldName   = getFieldName(fieldIndex, fieldType);
         final String  fieldDesc   = typeDescriptor(fieldType.getTypeClass());
@@ -202,8 +202,8 @@
      */
     private void findClass() {
         fieldObjectClassName = isScope() ?
-                ObjectClassGenerator.getClassName(fieldCount, paramCount) :
-                ObjectClassGenerator.getClassName(paddedFieldCount);
+                ObjectClassGenerator.getClassName(fieldCount, paramCount, codegen.useDualFields()) :
+                ObjectClassGenerator.getClassName(paddedFieldCount, codegen.useDualFields());
 
         try {
             this.fieldObjectClass = Context.forStructureClass(Compiler.binaryName(fieldObjectClassName));
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java
index b45b986..9f9abf9 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java
@@ -207,7 +207,7 @@
         final RecompilableScriptFunctionData data = new RecompilableScriptFunctionData(
                 newFunctionNode,
                 compiler.getCodeInstaller(),
-                ObjectClassGenerator.createAllocationStrategy(newFunctionNode.getThisProperties()),
+                ObjectClassGenerator.createAllocationStrategy(newFunctionNode.getThisProperties(), compiler.getContext().useDualFields()),
                 nestedFunctions,
                 externalSymbolDepths.get(fnId),
                 internalSymbols.get(fnId),
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java
index ae96dc4..be99db9 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java
@@ -68,17 +68,17 @@
      * @param evalCode      is this property map created for 'eval' code?
      * @return New map populated with accessor properties.
      */
-    PropertyMap makeFieldMap(final boolean hasArguments, final int fieldCount, final int fieldMaximum, final boolean evalCode) {
+    PropertyMap makeFieldMap(final boolean hasArguments, final boolean dualFields, final int fieldCount, final int fieldMaximum, final boolean evalCode) {
         final List<Property> properties = new ArrayList<>();
         assert tuples != null;
 
         for (final MapTuple<T> tuple : tuples) {
             final String   key         = tuple.key;
             final Symbol   symbol      = tuple.symbol;
-            final Class<?> initialType = tuple.getValueType();
+            final Class<?> initialType = dualFields ? tuple.getValueType() : Object.class;
 
             if (symbol != null && !isValidArrayIndex(getArrayIndex(key))) {
-                final int      flags    = getPropertyFlags(symbol, hasArguments, evalCode);
+                final int      flags    = getPropertyFlags(symbol, hasArguments, evalCode, dualFields);
                 final Property property = new AccessorProperty(
                         key,
                         flags,
@@ -92,7 +92,7 @@
         return PropertyMap.newMap(properties, structure.getName(), fieldCount, fieldMaximum, 0);
     }
 
-    PropertyMap makeSpillMap(final boolean hasArguments) {
+    PropertyMap makeSpillMap(final boolean hasArguments, final boolean dualFields) {
         final List<Property> properties = new ArrayList<>();
         int spillIndex = 0;
         assert tuples != null;
@@ -100,10 +100,10 @@
         for (final MapTuple<T> tuple : tuples) {
             final String key    = tuple.key;
             final Symbol symbol = tuple.symbol;
-            final Class<?> initialType = tuple.getValueType();
+            final Class<?> initialType = dualFields ? tuple.getValueType() : Object.class;
 
             if (symbol != null && !isValidArrayIndex(getArrayIndex(key))) {
-                final int flags = getPropertyFlags(symbol, hasArguments, false);
+                final int flags = getPropertyFlags(symbol, hasArguments, false, dualFields);
                 properties.add(
                         new SpillProperty(
                                 key,
@@ -124,7 +124,7 @@
      *
      * @return flags to use for fields
      */
-    static int getPropertyFlags(final Symbol symbol, final boolean hasArguments, final boolean evalCode) {
+    static int getPropertyFlags(final Symbol symbol, final boolean hasArguments, final boolean evalCode, final boolean dualFields) {
         int flags = 0;
 
         if (symbol.isParam()) {
@@ -162,6 +162,10 @@
             flags |= Property.NEEDS_DECLARATION;
         }
 
+        if (dualFields) {
+            flags |= Property.DUAL_FIELDS;
+        }
+
         return flags;
     }
 }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapTuple.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapTuple.java
index 024c3d6..44cdc8b 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapTuple.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapTuple.java
@@ -25,8 +25,6 @@
 
 package jdk.nashorn.internal.codegen;
 
-import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY;
-
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.Symbol;
 
@@ -52,11 +50,11 @@
     }
 
     public Class<?> getValueType() {
-        return OBJECT_FIELDS_ONLY ? Object.class : null; //until proven otherwise we are undefined, see NASHORN-592 int.class;
+        return null; //until proven otherwise we are undefined, see NASHORN-592 int.class;
     }
 
     boolean isPrimitive() {
-        return !OBJECT_FIELDS_ONLY && getValueType().isPrimitive() && getValueType() != boolean.class;
+        return getValueType() != null && getValueType().isPrimitive() && getValueType() != boolean.class;
     }
 
     @Override
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
index 2205044..383d2f1 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
@@ -31,7 +31,8 @@
 import static jdk.nashorn.internal.codegen.CompilerConstants.INIT_MAP;
 import static jdk.nashorn.internal.codegen.CompilerConstants.INIT_SCOPE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.JAVA_THIS;
-import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_PREFIX;
+import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_DUAL_FIELD_PREFIX;
+import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_SINGLE_FIELD_PREFIX;
 import static jdk.nashorn.internal.codegen.CompilerConstants.className;
 import static jdk.nashorn.internal.codegen.CompilerConstants.constructorNoLookup;
 import static jdk.nashorn.internal.lookup.Lookup.MH;
@@ -99,18 +100,10 @@
      */
     private final DebugLogger log;
 
-    /**
-     * Should the runtime only use java.lang.Object slots for fields? If this is false, the representation
-     * will be a primitive 64-bit long value used for all primitives and a java.lang.Object for references.
-     * This introduces a larger number of method handles in the system, as we need to have different getters
-     * and setters for the different fields.
-     *
-     * This is engineered to plug into the TaggedArray implementation, when it's done.
-     */
-    public static final boolean OBJECT_FIELDS_ONLY = Options.getBooleanProperty("nashorn.fields.objects");
-
-    /** The field types in the system */
-    private static final List<Type> FIELD_TYPES = new LinkedList<>();
+    /** Field types for object-only fields */
+    private static final Type[] FIELD_TYPES_OBJECT = new Type[] { Type.OBJECT };
+    /** Field types for dual primitive/object fields */
+    private static final Type[] FIELD_TYPES_DUAL   = new Type[] { Type.LONG, Type.OBJECT };
 
     /** What type is the primitive type in dual representation */
     public static final Type PRIMITIVE_FIELD_TYPE = Type.LONG;
@@ -118,33 +111,27 @@
     private static final MethodHandle GET_DIFFERENT           = findOwnMH("getDifferent", Object.class, Object.class, Class.class, MethodHandle.class, MethodHandle.class, int.class);
     private static final MethodHandle GET_DIFFERENT_UNDEFINED = findOwnMH("getDifferentUndefined", Object.class, int.class);
 
-    /**
-     * The list of field types that we support - one type creates one field. This is currently either
-     * LONG + OBJECT or just OBJECT for classic mode.
-     */
-    static {
-        if (!OBJECT_FIELDS_ONLY) {
-            FIELD_TYPES.add(PRIMITIVE_FIELD_TYPE);
-        }
-        FIELD_TYPES.add(Type.OBJECT);
-    }
     private static boolean initialized = false;
 
     /** The context */
     private final Context context;
 
+    private final boolean dualFields;
+
     /**
      * Constructor
      *
      * @param context a context
+     * @param dualFields whether to use dual fields representation
      */
-    public ObjectClassGenerator(final Context context) {
+    public ObjectClassGenerator(final Context context, final boolean dualFields) {
         this.context = context;
+        this.dualFields = dualFields;
         assert context != null;
         this.log = initLogger(context);
         if (!initialized) {
             initialized = true;
-            if (OBJECT_FIELDS_ONLY) {
+            if (!dualFields) {
                 log.warning("Running with object fields only - this is a deprecated configuration.");
             }
         }
@@ -176,16 +163,30 @@
         throw new AssertionError("cannot pack" + n);
     }
 
+    private static String getPrefixName(final boolean dualFields) {
+        return dualFields ? JS_OBJECT_DUAL_FIELD_PREFIX.symbolName() : JS_OBJECT_SINGLE_FIELD_PREFIX.symbolName();
+    }
+
+    private static String getPrefixName(final String className) {
+        if (className.startsWith(JS_OBJECT_DUAL_FIELD_PREFIX.symbolName())) {
+            return getPrefixName(true);
+        } else if (className.startsWith(JS_OBJECT_SINGLE_FIELD_PREFIX.symbolName())) {
+            return getPrefixName(false);
+        }
+        throw new AssertionError("Not a structure class: " + className);
+    }
+
     /**
      * Returns the class name for JavaScript objects with fieldCount fields.
      *
      * @param fieldCount Number of fields to allocate.
-     *
+     * @param dualFields whether to use dual fields representation
      * @return The class name.
      */
-    public static String getClassName(final int fieldCount) {
-        return fieldCount != 0 ? SCRIPTS_PACKAGE + '/' + JS_OBJECT_PREFIX.symbolName() + fieldCount :
-                                 SCRIPTS_PACKAGE + '/' + JS_OBJECT_PREFIX.symbolName();
+    public static String getClassName(final int fieldCount, final boolean dualFields) {
+        final String prefix = getPrefixName(dualFields);
+        return fieldCount != 0 ? SCRIPTS_PACKAGE + '/' + prefix + fieldCount :
+                                 SCRIPTS_PACKAGE + '/' + prefix;
     }
 
     /**
@@ -194,22 +195,23 @@
      *
      * @param fieldCount Number of fields to allocate.
      * @param paramCount Number of parameters to allocate
-     *
+     * @param dualFields whether to use dual fields representation
      * @return The class name.
      */
-    public static String getClassName(final int fieldCount, final int paramCount) {
-        return SCRIPTS_PACKAGE + '/' + JS_OBJECT_PREFIX.symbolName() + fieldCount + SCOPE_MARKER + paramCount;
+    public static String getClassName(final int fieldCount, final int paramCount, final boolean dualFields) {
+        return SCRIPTS_PACKAGE + '/' + getPrefixName(dualFields) + fieldCount + SCOPE_MARKER + paramCount;
     }
 
     /**
      * Returns the number of fields in the JavaScript scope class. Its name had to be generated using either
-     * {@link #getClassName(int)} or {@link #getClassName(int, int)}.
+     * {@link #getClassName(int, boolean)} or {@link #getClassName(int, int, boolean)}.
      * @param clazz the JavaScript scope class.
      * @return the number of fields in the scope class.
      */
     public static int getFieldCount(final Class<?> clazz) {
         final String name = clazz.getSimpleName();
-        final String prefix = JS_OBJECT_PREFIX.symbolName();
+        final String prefix = getPrefixName(name);
+
         if (prefix.equals(name)) {
             return 0;
         }
@@ -238,8 +240,8 @@
      * @param className  name of class
      * @param fieldNames fields to initialize to undefined, where applicable
      */
-    private static void initializeToUndefined(final MethodEmitter init, final String className, final List<String> fieldNames) {
-        if (!OBJECT_FIELDS_ONLY) {
+    private void initializeToUndefined(final MethodEmitter init, final String className, final List<String> fieldNames) {
+        if (dualFields) {
             // no need to initialize anything to undefined in the dual field world
             // - then we have a constant getter for undefined for any unknown type
             return;
@@ -292,7 +294,7 @@
      * @return Byte codes for generated class.
      */
     public byte[] generate(final int fieldCount) {
-        final String       className    = getClassName(fieldCount);
+        final String       className    = getClassName(fieldCount, dualFields);
         final String       superName    = className(ScriptObject.class);
         final ClassEmitter classEmitter = newClassEmitter(className, superName);
 
@@ -322,7 +324,7 @@
      * @return Byte codes for generated class.
      */
     public byte[] generate(final int fieldCount, final int paramCount) {
-        final String       className    = getClassName(fieldCount, paramCount);
+        final String       className    = getClassName(fieldCount, paramCount, dualFields);
         final String       superName    = className(FunctionScope.class);
         final ClassEmitter classEmitter = newClassEmitter(className, superName);
         final List<String> initFields   = addFields(classEmitter, fieldCount);
@@ -353,11 +355,11 @@
      *
      * @return List fields that need to be initialized.
      */
-    private static List<String> addFields(final ClassEmitter classEmitter, final int fieldCount) {
+    private List<String> addFields(final ClassEmitter classEmitter, final int fieldCount) {
         final List<String> initFields = new LinkedList<>();
-
+        final Type[] fieldTypes = dualFields ? FIELD_TYPES_DUAL : FIELD_TYPES_OBJECT;
         for (int i = 0; i < fieldCount; i++) {
-            for (final Type type : FIELD_TYPES) {
+            for (final Type type : fieldTypes) {
                 final String fieldName = getFieldName(i, type);
                 classEmitter.field(fieldName, type.getTypeClass());
 
@@ -533,13 +535,10 @@
     private static MethodHandle getterForType(final Class<?> forType, final MethodHandle primitiveGetter, final MethodHandle objectGetter) {
         switch (getAccessorTypeIndex(forType)) {
         case TYPE_INT_INDEX:
-            assert !OBJECT_FIELDS_ONLY : "this can only happen with dual fields";
             return MH.explicitCastArguments(primitiveGetter, primitiveGetter.type().changeReturnType(int.class));
         case TYPE_LONG_INDEX:
-            assert !OBJECT_FIELDS_ONLY : "this can only happen with dual fields";
             return primitiveGetter;
         case TYPE_DOUBLE_INDEX:
-            assert !OBJECT_FIELDS_ONLY : "this can only happen with dual fields";
             return MH.filterReturnValue(primitiveGetter, UNPACK_DOUBLE);
         case TYPE_OBJECT_INDEX:
             return objectGetter;
@@ -557,7 +556,7 @@
         final boolean isPrimitiveStorage = forType != null && forType.isPrimitive();
 
         //which is the primordial getter
-        final MethodHandle getter = OBJECT_FIELDS_ONLY ? objectGetter : isPrimitiveStorage ? primitiveGetter : objectGetter;
+        final MethodHandle getter = primitiveGetter == null ? objectGetter : isPrimitiveStorage ? primitiveGetter : objectGetter;
 
         if (forType == null) {
             if (isOptimistic) {
@@ -580,8 +579,7 @@
             return MH.dropArguments(GET_UNDEFINED.get(ti), 0, Object.class);
         }
 
-        assert forType != null;
-        assert !OBJECT_FIELDS_ONLY || forType == Object.class : forType;
+        assert primitiveGetter != null || forType == Object.class : forType;
 
         if (isOptimistic) {
             if (fti < ti) {
@@ -635,8 +633,6 @@
             return tgetter;
         }
 
-        assert !OBJECT_FIELDS_ONLY;
-        //final MethodType pmt = primitiveGetter.type();
         assert primitiveGetter != null;
         final MethodType tgetterType = tgetter.type();
         switch (fti) {
@@ -727,7 +723,7 @@
         final int fti = getAccessorTypeIndex(forType);
         final int ti  = getAccessorTypeIndex(type);
 
-        if (fti == TYPE_OBJECT_INDEX || OBJECT_FIELDS_ONLY) {
+        if (fti == TYPE_OBJECT_INDEX || primitiveSetter == null) {
             if (ti == TYPE_OBJECT_INDEX) {
                 return objectSetter;
             }
@@ -735,8 +731,6 @@
             return MH.asType(objectSetter, objectSetter.type().changeParameterType(1, type));
         }
 
-        assert !OBJECT_FIELDS_ONLY;
-
         final MethodType pmt = primitiveSetter.type();
 
         switch (fti) {
@@ -832,8 +826,8 @@
      * @param thisProperties number of properties assigned to "this"
      * @return the allocation strategy
      */
-    static AllocationStrategy createAllocationStrategy(final int thisProperties) {
+    static AllocationStrategy createAllocationStrategy(final int thisProperties, final boolean dualFields) {
         final int paddedFieldCount = getPaddedFieldCount(thisProperties);
-        return new AllocationStrategy(paddedFieldCount);
+        return new AllocationStrategy(paddedFieldCount, dualFields);
     }
 }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectCreator.java
index 1a09ca6..782e3d2 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectCreator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectCreator.java
@@ -134,7 +134,7 @@
 
     MethodEmitter loadTuple(final MethodEmitter method, final MapTuple<T> tuple, final boolean pack) {
         loadValue(tuple.value, tuple.type);
-        if (pack && tuple.isPrimitive()) {
+        if (pack && codegen.useDualFields() && tuple.isPrimitive()) {
             method.pack();
         } else {
             method.convert(Type.OBJECT);
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java
index 40d12df..567edba 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java
@@ -27,7 +27,6 @@
 
 import static jdk.nashorn.internal.codegen.CompilerConstants.constructorNoLookup;
 import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup;
-import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY;
 
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -42,6 +41,7 @@
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 import jdk.nashorn.internal.runtime.arrays.ArrayIndex;
+import jdk.nashorn.internal.scripts.JD;
 import jdk.nashorn.internal.scripts.JO;
 
 /**
@@ -65,10 +65,13 @@
         assert !isScope() : "spill scope objects are not currently supported";
 
         final int          length        = tuples.size();
-        final long[]       jpresetValues = new long[ScriptObject.spillAllocationLength(length)];
-        final Object[]     opresetValues = new Object[ScriptObject.spillAllocationLength(length)];
+        final boolean      dualFields    = codegen.useDualFields();
+        final int          spillLength   = ScriptObject.spillAllocationLength(length);
+        final long[]       jpresetValues = dualFields ? new long[spillLength] : null;
+        final Object[]     opresetValues = new Object[spillLength];
         final Set<Integer> postsetValues = new LinkedHashSet<>();
         final int          callSiteFlags = codegen.getCallSiteFlags();
+        final Class<?>     objectClass   = dualFields ? JD.class : JO.class;
         ArrayData          arrayData     = ArrayData.allocate(ScriptRuntime.EMPTY_ARRAY);
 
         // Compute constant property values
@@ -88,9 +91,9 @@
                     final Property property = propertyMap.findProperty(key);
                     if (property != null) {
                         // normal property key
-                        property.setType(JSType.unboxedFieldType(constantValue));
+                        property.setType(dualFields ? JSType.unboxedFieldType(constantValue) : Object.class);
                         final int slot = property.getSlot();
-                        if (!OBJECT_FIELDS_ONLY && constantValue instanceof Number) {
+                        if (dualFields && constantValue instanceof Number) {
                             jpresetValues[slot] = ObjectClassGenerator.pack((Number)constantValue);
                         } else {
                             opresetValues[slot] = constantValue;
@@ -130,28 +133,32 @@
         //assert postsetValues.isEmpty() : "test me " + postsetValues;
 
         // create object and invoke constructor
-        method._new(JO.class).dup();
+        method._new(objectClass).dup();
         codegen.loadConstant(propertyMap);
 
         //load primitive values to j spill array
-        codegen.loadConstant(jpresetValues);
-        for (final int i : postsetValues) {
-            final MapTuple<Expression> tuple    = tuples.get(i);
-            final Property                property = propertyMap.findProperty(tuple.key);
-            if (property != null && tuple.isPrimitive()) {
-                method.dup();
-                method.load(property.getSlot());
-                loadTuple(method, tuple);
-                method.arraystore();
+        if (dualFields) {
+            codegen.loadConstant(jpresetValues);
+            for (final int i : postsetValues) {
+                final MapTuple<Expression> tuple = tuples.get(i);
+                final Property property = propertyMap.findProperty(tuple.key);
+                if (property != null && tuple.isPrimitive()) {
+                    method.dup();
+                    method.load(property.getSlot());
+                    loadTuple(method, tuple);
+                    method.arraystore();
+                }
             }
+        } else {
+            method.loadNull();
         }
 
         //load object values to o spill array
         codegen.loadConstant(opresetValues);
         for (final int i : postsetValues) {
-            final MapTuple<Expression> tuple    = tuples.get(i);
-            final Property             property = propertyMap.findProperty(tuple.key);
-            if (property != null && !tuple.isPrimitive()) {
+            final MapTuple<Expression> tuple = tuples.get(i);
+            final Property property = propertyMap.findProperty(tuple.key);
+            if (property != null && (!dualFields || !tuple.isPrimitive())) {
                 method.dup();
                 method.load(property.getSlot());
                 loadTuple(method, tuple);
@@ -160,7 +167,7 @@
         }
 
         //instantiate the script object with spill objects
-        method.invoke(constructorNoLookup(JO.class, PropertyMap.class, long[].class, Object[].class));
+        method.invoke(constructorNoLookup(objectClass, PropertyMap.class, long[].class, Object[].class));
 
         // Set prefix array data if any
         if (arrayData.length() > 0) {
@@ -171,8 +178,8 @@
 
         // set postfix
         for (final int i : postsetValues) {
-            final MapTuple<Expression> tuple    = tuples.get(i);
-            final Property             property = propertyMap.findProperty(tuple.key);
+            final MapTuple<Expression> tuple = tuples.get(i);
+            final Property property = propertyMap.findProperty(tuple.key);
             if (property == null) {
                 final int index = ArrayIndex.getArrayIndex(tuple.key);
                 assert ArrayIndex.isValidArrayIndex(index);
@@ -188,7 +195,9 @@
     @Override
     protected PropertyMap makeMap() {
         assert propertyMap == null : "property map already initialized";
-        propertyMap = new MapCreator<>(JO.class, tuples).makeSpillMap(false);
+        final boolean dualFields = codegen.useDualFields();
+        final Class<? extends ScriptObject> clazz = dualFields ? JD.class : JO.class;
+        propertyMap = new MapCreator<>(clazz, tuples).makeSpillMap(false, codegen.useDualFields());
         return propertyMap;
     }
 
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java
index e6eba09..16ec29e 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java
@@ -79,6 +79,7 @@
 import jdk.nashorn.internal.runtime.linker.InvokeByName;
 import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
 import jdk.nashorn.internal.runtime.regexp.RegExpResult;
+import jdk.nashorn.internal.scripts.JD;
 import jdk.nashorn.internal.scripts.JO;
 import jdk.nashorn.tools.ShellFunctions;
 
@@ -718,7 +719,7 @@
     private static final MethodHandle LOAD                 = findOwnMH_S("load",                Object.class, Object.class, Object.class);
     private static final MethodHandle LOAD_WITH_NEW_GLOBAL = findOwnMH_S("loadWithNewGlobal",   Object.class, Object.class, Object[].class);
     private static final MethodHandle EXIT                 = findOwnMH_S("exit",                Object.class, Object.class, Object.class);
-    private static final MethodHandle LEXICAL_SCOPE_FILTER = findOwnMH_S("lexicalScopeFilter", Object.class, Object.class);
+    private static final MethodHandle LEXICAL_SCOPE_FILTER = findOwnMH_S("lexicalScopeFilter",  Object.class, Object.class);
 
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
@@ -750,6 +751,11 @@
         return context;
     }
 
+    @Override
+    protected boolean useDualFields() {
+        return context.useDualFields();
+    }
+
     // performs initialization checks for Global constructor and returns the
     // PropertyMap, if everything is fine.
     private static PropertyMap checkAndGetMap(final Context context) {
@@ -933,7 +939,7 @@
      * @return the new ScriptObject
      */
     public ScriptObject newObject() {
-        return new JO(getObjectPrototype(), JO.getInitialMap());
+        return useDualFields() ? new JD(getObjectPrototype()) : new JO(getObjectPrototype());
     }
 
     /**
@@ -2744,8 +2750,8 @@
      */
     private static class LexicalScope extends ScriptObject {
 
-        LexicalScope(final ScriptObject proto) {
-            super(proto, PropertyMap.newMap());
+        LexicalScope(final Global global) {
+            super(global, PropertyMap.newMap());
         }
 
         @Override
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java
index c5ca910..c5ece8c 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java
@@ -160,7 +160,7 @@
     }
 
     private static ScriptObject wrapAdaptee(final ScriptObject adaptee) {
-        return new JO(adaptee, JO.getInitialMap());
+        return new JO(adaptee);
     }
 
     @Override
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/JSONParser.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/JSONParser.java
index 5243818..5360226 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/JSONParser.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/JSONParser.java
@@ -41,6 +41,7 @@
 import jdk.nashorn.internal.runtime.SpillProperty;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 import jdk.nashorn.internal.runtime.arrays.ArrayIndex;
+import jdk.nashorn.internal.scripts.JD;
 import jdk.nashorn.internal.scripts.JO;
 
 import static jdk.nashorn.internal.parser.TokenType.STRING;
@@ -54,11 +55,10 @@
 
     final private String source;
     final private Global global;
+    final private boolean dualFields;
     final int length;
     int pos = 0;
 
-    private static PropertyMap EMPTY_MAP = PropertyMap.newMap();
-
     private static final int EOF = -1;
 
     private static final String TRUE  = "true";
@@ -74,10 +74,11 @@
      * @param source  the source
      * @param global the global object
      */
-    public JSONParser(final String source, final Global global ) {
+    public JSONParser(final String source, final Global global, final boolean dualFields) {
         this.source = source;
         this.global = global;
         this.length = source.length();
+        this.dualFields = dualFields;
     }
 
     /**
@@ -180,7 +181,7 @@
     }
 
     private Object parseObject() {
-        PropertyMap propertyMap = EMPTY_MAP;
+        PropertyMap propertyMap = dualFields ? JD.getInitialMap() : JO.getInitialMap();
         ArrayData arrayData = ArrayData.EMPTY_ARRAY;
         final ArrayList<Object> values = new ArrayList<>();
         int state = STATE_EMPTY;
@@ -241,36 +242,45 @@
         return newArrayData.set(index, value, false);
     }
 
-    private static PropertyMap addObjectProperty(final PropertyMap propertyMap, final List<Object> values,
+    private PropertyMap addObjectProperty(final PropertyMap propertyMap, final List<Object> values,
                                                  final String id, final Object value) {
         final Property oldProperty = propertyMap.findProperty(id);
         final PropertyMap newMap;
-        final Class<?> type = ObjectClassGenerator.OBJECT_FIELDS_ONLY ? Object.class : getType(value);
+        final Class<?> type;
+        final int flags;
+        if (dualFields) {
+            type = getType(value);
+            flags = Property.DUAL_FIELDS;
+        } else {
+            type = Object.class;
+            flags = 0;
+        }
 
         if (oldProperty != null) {
             values.set(oldProperty.getSlot(), value);
-            newMap = propertyMap.replaceProperty(oldProperty, new SpillProperty(id, 0, oldProperty.getSlot(), type));;
+            newMap = propertyMap.replaceProperty(oldProperty, new SpillProperty(id, flags, oldProperty.getSlot(), type));;
         } else {
             values.add(value);
-            newMap = propertyMap.addProperty(new SpillProperty(id, 0, propertyMap.size(), type));
+            newMap = propertyMap.addProperty(new SpillProperty(id, flags, propertyMap.size(), type));
         }
 
         return newMap;
     }
 
     private Object createObject(final PropertyMap propertyMap, final List<Object> values, final ArrayData arrayData) {
-        final long[] primitiveSpill = new long[values.size()];
+        final long[] primitiveSpill = dualFields ? new long[values.size()] : null;
         final Object[] objectSpill = new Object[values.size()];
 
         for (final Property property : propertyMap.getProperties()) {
-            if (property.getType() == Object.class) {
+            if (!dualFields || property.getType() == Object.class) {
                 objectSpill[property.getSlot()] = values.get(property.getSlot());
             } else {
                 primitiveSpill[property.getSlot()] = ObjectClassGenerator.pack((Number) values.get(property.getSlot()));
             }
         }
 
-        final ScriptObject object = new JO(propertyMap, primitiveSpill, objectSpill);
+        final ScriptObject object = dualFields ?
+                new JD(propertyMap, primitiveSpill, objectSpill) : new JO(propertyMap, null, objectSpill);
         object.setInitialProto(global.getObjectPrototype());
         object.setArray(arrayData);
         return object;
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java
index a9afeb9..6fde66b 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java
@@ -25,7 +25,6 @@
 
 package jdk.nashorn.internal.runtime;
 
-import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY;
 import static jdk.nashorn.internal.codegen.ObjectClassGenerator.PRIMITIVE_FIELD_TYPE;
 import static jdk.nashorn.internal.codegen.ObjectClassGenerator.createGetter;
 import static jdk.nashorn.internal.codegen.ObjectClassGenerator.createSetter;
@@ -98,7 +97,7 @@
                 objectSetters[i] = MH.asType(MH.setter(LOOKUP, structure, fieldName, typeClass), Lookup.SET_OBJECT_TYPE);
             }
 
-            if (!OBJECT_FIELDS_ONLY) {
+            if (!StructureLoader.isSingleFieldStructure(structure.getName())) {
                 for (int i = 0; i < fieldCount; i++) {
                     final String fieldNamePrimitive = getFieldName(i, PRIMITIVE_FIELD_TYPE);
                     final Class<?> typeClass = PRIMITIVE_FIELD_TYPE.getTypeClass();
@@ -211,7 +210,7 @@
      * @param setter the property setter or null if non writable, non configurable
      */
     private AccessorProperty(final String key, final int flags, final int slot, final MethodHandle getter, final MethodHandle setter) {
-        super(key, flags | IS_BUILTIN | (getter.type().returnType().isPrimitive() ? IS_NASGEN_PRIMITIVE : 0), slot);
+        super(key, flags | IS_BUILTIN | DUAL_FIELDS | (getter.type().returnType().isPrimitive() ? IS_NASGEN_PRIMITIVE : 0), slot);
         assert !isSpill();
 
         // we don't need to prep the setters these will never be invalidated as this is a nasgen
@@ -221,18 +220,15 @@
         final Class<?> setterType = setter == null ? null : setter.type().parameterType(1);
 
         assert setterType == null || setterType == getterType;
-        if (OBJECT_FIELDS_ONLY) {
-            primitiveGetter = primitiveSetter = null;
+
+        if (getterType == int.class || getterType == long.class) {
+            primitiveGetter = MH.asType(getter, Lookup.GET_PRIMITIVE_TYPE);
+            primitiveSetter = setter == null ? null : MH.asType(setter, Lookup.SET_PRIMITIVE_TYPE);
+        } else if (getterType == double.class) {
+            primitiveGetter = MH.asType(MH.filterReturnValue(getter, ObjectClassGenerator.PACK_DOUBLE), Lookup.GET_PRIMITIVE_TYPE);
+            primitiveSetter = setter == null ? null : MH.asType(MH.filterArguments(setter, 1, ObjectClassGenerator.UNPACK_DOUBLE), Lookup.SET_PRIMITIVE_TYPE);
         } else {
-            if (getterType == int.class || getterType == long.class) {
-                primitiveGetter = MH.asType(getter, Lookup.GET_PRIMITIVE_TYPE);
-                primitiveSetter = setter == null ? null : MH.asType(setter, Lookup.SET_PRIMITIVE_TYPE);
-            } else if (getterType == double.class) {
-                primitiveGetter = MH.asType(MH.filterReturnValue(getter, ObjectClassGenerator.PACK_DOUBLE), Lookup.GET_PRIMITIVE_TYPE);
-                primitiveSetter = setter == null ? null : MH.asType(MH.filterArguments(setter, 1, ObjectClassGenerator.UNPACK_DOUBLE), Lookup.SET_PRIMITIVE_TYPE);
-            } else {
-                primitiveGetter = primitiveSetter = null;
-            }
+            primitiveGetter = primitiveSetter = null;
         }
 
         assert primitiveGetter == null || primitiveGetter.type() == Lookup.GET_PRIMITIVE_TYPE : primitiveGetter + "!=" + Lookup.GET_PRIMITIVE_TYPE;
@@ -241,7 +237,7 @@
         objectGetter  = getter.type() != Lookup.GET_OBJECT_TYPE ? MH.asType(getter, Lookup.GET_OBJECT_TYPE) : getter;
         objectSetter  = setter != null && setter.type() != Lookup.SET_OBJECT_TYPE ? MH.asType(setter, Lookup.SET_OBJECT_TYPE) : setter;
 
-        setType(OBJECT_FIELDS_ONLY ? Object.class : getterType);
+        setType(getterType);
     }
 
     /**
@@ -282,6 +278,9 @@
             objectSetter    = gs.objectSetters[slot];
             primitiveSetter = gs.primitiveSetters[slot];
         }
+
+        // Always use dual fields except for single field structures
+        assert hasDualFields() != StructureLoader.isSingleFieldStructure(structure.getName());
     }
 
     /**
@@ -310,7 +309,7 @@
      */
     public AccessorProperty(final String key, final int flags, final Class<?> structure, final int slot, final Class<?> initialType) {
         this(key, flags, structure, slot);
-        setType(OBJECT_FIELDS_ONLY ? Object.class : initialType);
+        setType(hasDualFields() ? initialType : Object.class);
     }
 
     /**
@@ -347,7 +346,7 @@
      * @param initialValue initial value
      */
     protected final void setInitialValue(final ScriptObject owner, final Object initialValue) {
-        setType(JSType.unboxedFieldType(initialValue));
+        setType(hasDualFields() ? JSType.unboxedFieldType(initialValue) : Object.class);
         if (initialValue instanceof Integer) {
             invokeSetter(owner, ((Integer)initialValue).intValue());
         } else if (initialValue instanceof Long) {
@@ -363,7 +362,7 @@
      * Initialize the type of a property
      */
     protected final void initializeType() {
-        setType(OBJECT_FIELDS_ONLY ? Object.class : null);
+        setType(!hasDualFields() ? Object.class : null);
     }
 
     private void readObject(final ObjectInputStream s) throws IOException, ClassNotFoundException {
@@ -670,7 +669,7 @@
 
     @Override
     public final boolean canChangeType() {
-        if (OBJECT_FIELDS_ONLY) {
+        if (!hasDualFields()) {
             return false;
         }
         // Return true for currently undefined even if non-writable/configurable to allow initialization of ES6 CONST.
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java
index 395aee5..f25b588 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java
@@ -44,6 +44,9 @@
     /** Number of fields in the allocated object */
     private final int fieldCount;
 
+    /** Whether to use dual field representation */
+    private final boolean dualFields;
+
     /** Name of class where allocator function resides */
     private transient String allocatorClassName;
 
@@ -53,15 +56,17 @@
     /**
      * Construct an allocation strategy with the given map and class name.
      * @param fieldCount number of fields in the allocated object
+     * @param dualFields whether to use dual field representation
      */
-    public AllocationStrategy(final int fieldCount) {
+    public AllocationStrategy(final int fieldCount, final boolean dualFields) {
         this.fieldCount = fieldCount;
+        this.dualFields = dualFields;
     }
 
     private String getAllocatorClassName() {
         if (allocatorClassName == null) {
             // These classes get loaded, so an interned variant of their name is most likely around anyway.
-            allocatorClassName = Compiler.binaryName(ObjectClassGenerator.getClassName(fieldCount)).intern();
+            allocatorClassName = Compiler.binaryName(ObjectClassGenerator.getClassName(fieldCount, dualFields)).intern();
         }
         return allocatorClassName;
     }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java
index 8c265c8..5c4bbd6 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java
@@ -131,6 +131,23 @@
     private static MethodType CREATE_PROGRAM_FUNCTION_TYPE = MethodType.methodType(ScriptFunction.class, ScriptObject.class);
 
     /**
+     * Should scripts use only object slots for fields, or dual long/object slots? The default
+     * behaviour is to couple this to optimistic types, using dual representation if optimistic types are enabled
+     * and single field representation otherwise. This can be overridden by setting either the "nashorn.fields.objects"
+     * or "nashorn.fields.dual" system property.
+     */
+    private final FieldMode fieldMode;
+
+    private static enum FieldMode {
+        /** Value for automatic field representation depending on optimistic types setting */
+        AUTO,
+        /** Value for object field representation regardless of optimistic types setting */
+        OBJECTS,
+        /** Value for dual primitive/object field representation regardless of optimistic types setting */
+        DUAL
+    }
+
+    /**
      * Keeps track of which builtin prototypes and properties have been relinked
      * Currently we are conservative and associate the name of a builtin class with all
      * its properties, so it's enough to invalidate a property to break all assumptions
@@ -434,7 +451,7 @@
      * @param appLoader application class loader
      */
     public Context(final Options options, final ErrorManager errors, final ClassLoader appLoader) {
-        this(options, errors, appLoader, (ClassFilter)null);
+        this(options, errors, appLoader, null);
     }
 
     /**
@@ -522,6 +539,14 @@
             getErr().println("nashorn full version " + Version.fullVersion());
         }
 
+        if (Options.getBooleanProperty("nashorn.fields.dual")) {
+            fieldMode = FieldMode.DUAL;
+        } else if (Options.getBooleanProperty("nashorn.fields.objects")) {
+            fieldMode = FieldMode.OBJECTS;
+        } else {
+            fieldMode = FieldMode.AUTO;
+        }
+
         initLoggers();
     }
 
@@ -576,6 +601,14 @@
     }
 
     /**
+     * Should scripts compiled by this context use dual field representation?
+     * @return true if using dual fields, false for object-only fields
+     */
+    public boolean useDualFields() {
+        return fieldMode == FieldMode.DUAL || (fieldMode == FieldMode.AUTO && env._optimistic_types);
+    }
+
+    /**
      * Get the PropertyMap of the current global scope
      * @return the property map of the current global scope
      */
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java
index 9622b59..d5f3af7 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java
@@ -72,7 +72,8 @@
     public static Object parse(final Object text, final Object reviver) {
         final String     str    = JSType.toString(text);
         final Global     global = Context.getGlobal();
-        final JSONParser parser = new JSONParser(str, global);
+        final boolean    dualFields = ((ScriptObject) global).useDualFields();
+        final JSONParser parser = new JSONParser(str, global, dualFields);
         final Object     value;
 
         try {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java
index c7eae4f..31be7d2 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java
@@ -26,7 +26,6 @@
 package jdk.nashorn.internal.runtime;
 
 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall;
-import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY;
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 
@@ -1972,10 +1971,6 @@
      * @return primive type or Object.class if not primitive
      */
     public static Class<?> unboxedFieldType(final Object o) {
-        if (OBJECT_FIELDS_ONLY) {
-            return Object.class;
-        }
-
         if (o == null) {
             return Object.class;
         } else if (o.getClass() == Integer.class) {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java
index 4225c25..7d54420 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java
@@ -96,6 +96,9 @@
     /** Is this property an ES6 lexical binding? */
     public static final int IS_LEXICAL_BINDING      = 1 << 10;
 
+    /** Does this property support dual field representation? */
+    public static final int DUAL_FIELDS             = 1 << 11;
+
     /** Property key. */
     private final String key;
 
@@ -286,7 +289,7 @@
      * @return true if parameter
      */
     public boolean isParameter() {
-        return (flags & IS_PARAMETER) == IS_PARAMETER;
+        return (flags & IS_PARAMETER) != 0;
     }
 
     /**
@@ -294,7 +297,7 @@
      * @return true if has arguments
      */
     public boolean hasArguments() {
-        return (flags & HAS_ARGUMENTS) == HAS_ARGUMENTS;
+        return (flags & HAS_ARGUMENTS) != 0;
     }
 
     /**
@@ -316,7 +319,7 @@
      * @return true if this is a bound property
      */
     public boolean isBound() {
-        return (flags & IS_BOUND) == IS_BOUND;
+        return (flags & IS_BOUND) != 0;
     }
 
     /**
@@ -325,7 +328,7 @@
      * @return true if this is a block-scoped variable
      */
     public boolean needsDeclaration() {
-        return (flags & NEEDS_DECLARATION) == NEEDS_DECLARATION;
+        return (flags & NEEDS_DECLARATION) != 0;
     }
 
     /**
@@ -346,16 +349,6 @@
     }
 
     /**
-     * Check if a flag is set for a property
-     * @param property property
-     * @param flag     flag to check
-     * @return true if flag is set
-     */
-    public static boolean checkFlag(final Property property, final int flag) {
-        return (property.getFlags() & flag) == flag;
-    }
-
-    /**
      * Get the flags for this property
      * @return property flags
      */
@@ -364,16 +357,6 @@
     }
 
     /**
-     * Get the modify flags for this property. The modify flags are the ECMA 8.6.1
-     * flags that decide if the Property is writable, configurable and/or enumerable.
-     *
-     * @return modify flags for property
-     */
-    public int getModifyFlags() {
-        return flags & MODIFY_MASK;
-    }
-
-    /**
      * Remove property flags from the property. Properties are immutable here,
      * so any property change that results in a smaller flag set results in the
      * property being cloned. Use only the return value
@@ -715,7 +698,7 @@
      * @return whether this property is a function declaration or not.
      */
     public boolean isFunctionDeclaration() {
-        return (flags & IS_FUNCTION_DECLARATION) == IS_FUNCTION_DECLARATION;
+        return (flags & IS_FUNCTION_DECLARATION) != 0;
     }
 
     /**
@@ -723,6 +706,14 @@
      * @return true if this property represents a lexical binding.
      */
     public boolean isLexicalBinding() {
-        return (flags & IS_LEXICAL_BINDING) == IS_LEXICAL_BINDING;
+        return (flags & IS_LEXICAL_BINDING) != 0;
+    }
+
+    /**
+     * Does this property support dual fields for both primitive and object values?
+     * @return true if supports dual fields
+     */
+    public boolean hasDualFields() {
+        return (flags & DUAL_FIELDS) != 0;
     }
 }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java
index db7c5c9..fbc0dbb 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java
@@ -199,12 +199,21 @@
     }
 
     /**
+     * Return a sharable empty map for the given object class.
+     * @param clazz the base object class
+     * @return New empty {@link PropertyMap}.
+     */
+    public static PropertyMap newMap(final Class<? extends ScriptObject> clazz) {
+        return new PropertyMap(EMPTY_HASHMAP, clazz.getName(), 0, 0, 0, false);
+    }
+
+    /**
      * Return a sharable empty map.
      *
      * @return New empty {@link PropertyMap}.
      */
     public static PropertyMap newMap() {
-        return new PropertyMap(EMPTY_HASHMAP, JO.class.getName(), 0, 0, 0, false);
+        return newMap(JO.class);
     }
 
     /**
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
index 284505a..daf65c2 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
@@ -28,7 +28,6 @@
 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup;
 import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCall;
 import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup;
-import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY;
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.ECMAErrors.referenceError;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
@@ -146,12 +145,6 @@
     /** Area for reference properties added to object after instantiation, see {@link AccessorProperty} */
     protected Object[] objectSpill;
 
-    /**
-     * Number of elements in the spill. This may be less than the spill array lengths, if not all of
-     * the allocated memory is in use
-     */
-    private int spillLength;
-
     /** Indexed array data. */
     private ArrayData arrayData;
 
@@ -171,12 +164,6 @@
     /** Method handle for getting the array data */
     public static final Call GET_ARRAY          = virtualCall(MethodHandles.lookup(), ScriptObject.class, "getArray", ArrayData.class);
 
-    /** Method handle for getting the property map - debugging purposes */
-    public static final Call GET_MAP            = virtualCall(MethodHandles.lookup(), ScriptObject.class, "getMap", PropertyMap.class);
-
-    /** Method handle for setting the array data */
-    public static final Call SET_ARRAY          = virtualCall(MethodHandles.lookup(), ScriptObject.class, "setArray", void.class, ArrayData.class);
-
     /** Method handle for getting a function argument at a given index. Used from MapCreator */
     public static final Call GET_ARGUMENT       = virtualCall(MethodHandles.lookup(), ScriptObject.class, "getArgument", Object.class, int.class);
 
@@ -259,8 +246,7 @@
         this(map);
         this.primitiveSpill = primitiveSpill;
         this.objectSpill    = objectSpill;
-        assert primitiveSpill.length == objectSpill.length : " primitive spill pool size is not the same length as object spill pool size";
-        this.spillLength = spillAllocationLength(primitiveSpill.length);
+        assert primitiveSpill == null || primitiveSpill.length == objectSpill.length : " primitive spill pool size is not the same length as object spill pool size";
     }
 
     /**
@@ -727,7 +713,7 @@
             setArray(getArray().ensure(longIndex));
             doesNotHaveEnsureDelete(longIndex, oldLength, false);
         }
-        setArray(getArray().set(index,value, false));
+        setArray(getArray().set(index, value, false));
     }
 
     private void checkIntegerKey(final String key) {
@@ -976,10 +962,10 @@
      * @param setter        setter for {@link UserAccessorProperty}, null if not present or N/A
      */
     protected final void initUserAccessors(final String key, final int propertyFlags, final ScriptFunction getter, final ScriptFunction setter) {
-        final int slot = spillLength;
-        ensureSpillSize(spillLength); //arguments=slot0, caller=slot0
-        objectSpill[slot] = new UserAccessorProperty.Accessors(getter, setter);
         final PropertyMap oldMap = getMap();
+        final int slot = oldMap.getFreeSpillSlot();
+        ensureSpillSize(slot);
+        objectSpill[slot] = new UserAccessorProperty.Accessors(getter, setter);
         Property    newProperty;
         PropertyMap newMap;
         do {
@@ -1006,19 +992,12 @@
             final int slot = uc.getSlot();
 
             assert uc.getLocalType() == Object.class;
-            if (slot >= spillLength) {
-                uc.setAccessors(this, getMap(), new UserAccessorProperty.Accessors(getter, setter));
-            } else {
-                final UserAccessorProperty.Accessors gs = uc.getAccessors(this); //this crashes
-                if (gs == null) {
-                    uc.setAccessors(this, getMap(), new UserAccessorProperty.Accessors(getter, setter));
-                } else {
-                    //reuse existing getter setter for speed
-                    gs.set(getter, setter);
-                    if (uc.getFlags() == propertyFlags) {
-                        return oldProperty;
-                    }
-                }
+            final UserAccessorProperty.Accessors gs = uc.getAccessors(this); //this crashes
+            assert gs != null;
+            //reuse existing getter setter for speed
+            gs.set(getter, setter);
+            if (uc.getFlags() == propertyFlags) {
+                return oldProperty;
             }
             newProperty = new UserAccessorProperty(uc.getKey(), propertyFlags, slot);
         } else {
@@ -2053,8 +2032,6 @@
             protoSwitchPoint = null;
         }
 
-        assert OBJECT_FIELDS_ONLY || guard != null : "we always need a map guard here";
-
         final GuardedInvocation inv = new GuardedInvocation(mh, guard, protoSwitchPoint, exception);
         return inv.addSwitchPoint(findBuiltinSwitchPoint(name));
     }
@@ -2531,13 +2508,14 @@
 
     /**
      * Add a spill property for the given key.
-     * @param key           Property key.
-     * @param propertyFlags Property flags.
+     * @param key    Property key.
+     * @param flags  Property flags.
      * @return Added property.
      */
-    private Property addSpillProperty(final String key, final int propertyFlags, final Object value, final boolean hasInitialValue) {
+    private Property addSpillProperty(final String key, final int flags, final Object value, final boolean hasInitialValue) {
         final PropertyMap propertyMap = getMap();
         final int fieldSlot  = propertyMap.getFreeFieldSlot();
+        final int propertyFlags = flags | (useDualFields() ? Property.DUAL_FIELDS : 0);
 
         Property property;
         if (fieldSlot > -1) {
@@ -2562,7 +2540,7 @@
      * @return Setter method handle.
      */
     MethodHandle addSpill(final Class<?> type, final String key) {
-        return addSpillProperty(key, 0, null, false).getSetter(OBJECT_FIELDS_ONLY ? Object.class : type, getMap());
+        return addSpillProperty(key, 0, null, false).getSetter(type, getMap());
     }
 
     /**
@@ -2649,9 +2627,9 @@
         final int spreadArgs = mh.type().parameterCount() - callSiteParamCount + 1;
         return MH.filterArguments(
             MH.asSpreader(
-            mh,
-            Object[].class,
-            spreadArgs),
+                mh,
+                Object[].class,
+                spreadArgs),
             callSiteParamCount - 1,
             MH.insertArguments(
                 TRUNCATINGFILTER,
@@ -3739,24 +3717,32 @@
         return uc;
     }
 
+    /**
+     * Returns {@code true} if properties for this object should use dual field mode, {@code false} otherwise.
+     * @return {@code true} if dual fields should be used.
+     */
+    protected boolean useDualFields() {
+        return !StructureLoader.isSingleFieldStructure(getClass().getName());
+    }
+
     Object ensureSpillSize(final int slot) {
-        if (slot < spillLength) {
+        final int oldLength = objectSpill == null ? 0 : objectSpill.length;
+        if (slot < oldLength) {
             return this;
         }
         final int newLength = alignUp(slot + 1, SPILL_RATE);
         final Object[] newObjectSpill    = new Object[newLength];
-        final long[]   newPrimitiveSpill = OBJECT_FIELDS_ONLY ? null : new long[newLength];
+        final long[]   newPrimitiveSpill = useDualFields() ? new long[newLength] : null;
 
         if (objectSpill != null) {
-            System.arraycopy(objectSpill, 0, newObjectSpill, 0, spillLength);
-            if (!OBJECT_FIELDS_ONLY) {
-                System.arraycopy(primitiveSpill, 0, newPrimitiveSpill, 0, spillLength);
+            System.arraycopy(objectSpill, 0, newObjectSpill, 0, oldLength);
+            if (primitiveSpill != null && newPrimitiveSpill != null) {
+                System.arraycopy(primitiveSpill, 0, newPrimitiveSpill, 0, oldLength);
             }
         }
 
         this.primitiveSpill = newPrimitiveSpill;
         this.objectSpill    = newObjectSpill;
-        this.spillLength = newLength;
 
         return this;
     }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java
index 90bbf43..4fe1b4f 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java
@@ -232,14 +232,18 @@
     }
 
     private SetMethod createNewFieldSetter(final SwitchPoint builtinSwitchPoint) {
-        return createNewSetter(new AccessorProperty(getName(), 0, sobj.getClass(), getMap().getFreeFieldSlot(), type), builtinSwitchPoint);
+        return createNewSetter(new AccessorProperty(getName(), getFlags(sobj), sobj.getClass(), getMap().getFreeFieldSlot(), type), builtinSwitchPoint);
     }
 
     private SetMethod createNewSpillPropertySetter(final SwitchPoint builtinSwitchPoint) {
-        return createNewSetter(new SpillProperty(getName(), 0, getMap().getFreeSpillSlot(), type), builtinSwitchPoint);
+        return createNewSetter(new SpillProperty(getName(), getFlags(sobj), getMap().getFreeSpillSlot(), type), builtinSwitchPoint);
     }
 
     private PropertyMap getNewMap(final Property property) {
         return getMap().addProperty(property);
     }
+
+    private static int getFlags(final ScriptObject scriptObject) {
+        return scriptObject.useDualFields() ? Property.DUAL_FIELDS : 0;
+    }
 }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java
index 856504a..9019b56 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java
@@ -25,7 +25,6 @@
 
 package jdk.nashorn.internal.runtime;
 
-import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY;
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 
 import java.lang.invoke.MethodHandle;
@@ -139,11 +138,11 @@
         }
     }
 
-    private static MethodHandle primitiveGetter(final int slot) {
-        return OBJECT_FIELDS_ONLY ? null : Accessors.getCached(slot, true, true);
+    private static MethodHandle primitiveGetter(final int slot, final int flags) {
+        return (flags & DUAL_FIELDS) == DUAL_FIELDS ? Accessors.getCached(slot, true, true) : null;
     }
-    private static MethodHandle primitiveSetter(final int slot) {
-        return OBJECT_FIELDS_ONLY ? null : Accessors.getCached(slot, true, false);
+    private static MethodHandle primitiveSetter(final int slot, final int flags) {
+        return (flags & DUAL_FIELDS) == DUAL_FIELDS ? Accessors.getCached(slot, true, false) : null;
     }
     private static MethodHandle objectGetter(final int slot) {
         return Accessors.getCached(slot, false, true);
@@ -160,8 +159,7 @@
      * @param slot   spill slot
      */
     public SpillProperty(final String key, final int flags, final int slot) {
-        super(key, flags, slot, primitiveGetter(slot), primitiveSetter(slot), objectGetter(slot), objectSetter(slot));
-        assert !OBJECT_FIELDS_ONLY || getLocalType() == Object.class;
+        super(key, flags, slot, primitiveGetter(slot, flags), primitiveSetter(slot, flags), objectGetter(slot), objectSetter(slot));
     }
 
     /**
@@ -173,7 +171,7 @@
      */
     public SpillProperty(final String key, final int flags, final int slot, final Class<?> initialType) {
         this(key, flags, slot);
-        setType(OBJECT_FIELDS_ONLY ? Object.class : initialType);
+        setType(hasDualFields() ? initialType : Object.class);
     }
 
     SpillProperty(final String key, final int flags, final int slot, final ScriptObject owner, final Object initialValue) {
@@ -216,8 +214,8 @@
     @Override
     void initMethodHandles(final Class<?> structure) {
         final int slot  = getSlot();
-        primitiveGetter = primitiveGetter(slot);
-        primitiveSetter = primitiveSetter(slot);
+        primitiveGetter = primitiveGetter(slot, getFlags());
+        primitiveSetter = primitiveSetter(slot, getFlags());
         objectGetter    = objectGetter(slot);
         objectSetter    = objectSetter(slot);
     }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java
index 41201cd..8324730 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java
@@ -27,7 +27,8 @@
 
 import static jdk.nashorn.internal.codegen.Compiler.SCRIPTS_PACKAGE;
 import static jdk.nashorn.internal.codegen.Compiler.binaryName;
-import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_PREFIX;
+import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_DUAL_FIELD_PREFIX;
+import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_SINGLE_FIELD_PREFIX;
 
 import java.security.ProtectionDomain;
 import jdk.nashorn.internal.codegen.ObjectClassGenerator;
@@ -36,7 +37,8 @@
  * Responsible for on the fly construction of structure classes.
  */
 final class StructureLoader extends NashornLoader {
-    private static final String JS_OBJECT_PREFIX_EXTERNAL = binaryName(SCRIPTS_PACKAGE) + '.' + JS_OBJECT_PREFIX.symbolName();
+    private static final String SINGLE_FIELD_PREFIX = binaryName(SCRIPTS_PACKAGE) + '.' + JS_OBJECT_SINGLE_FIELD_PREFIX.symbolName();
+    private static final String DUAL_FIELD_PREFIX   = binaryName(SCRIPTS_PACKAGE) + '.' + JS_OBJECT_DUAL_FIELD_PREFIX.symbolName();
 
     /**
      * Constructor.
@@ -45,14 +47,39 @@
         super(parent);
     }
 
+    /**
+     * Returns true if the class name represents a structure object with dual primitive/object fields.
+     * @param name a class name
+     * @return true if a dual field structure class
+     */
+    private static boolean isDualFieldStructure(final String name) {
+        return name.startsWith(DUAL_FIELD_PREFIX);
+    }
+
+    /**
+     * Returns true if the class name represents a structure object with single object-only fields.
+     * @param name a class name
+     * @return true if a single field structure class
+     */
+    static boolean isSingleFieldStructure(final String name) {
+        return name.startsWith(SINGLE_FIELD_PREFIX);
+    }
+
+    /**
+     * Returns true if the class name represents a Nashorn structure object.
+     * @param name a class name
+     * @return true if a structure class
+     */
     static boolean isStructureClass(final String name) {
-        return name.startsWith(JS_OBJECT_PREFIX_EXTERNAL);
+        return isDualFieldStructure(name) || isSingleFieldStructure(name);
     }
 
     @Override
     protected Class<?> findClass(final String name) throws ClassNotFoundException {
-        if (isStructureClass(name)) {
-            return generateClass(name, name.substring(JS_OBJECT_PREFIX_EXTERNAL.length()));
+        if (isDualFieldStructure(name)) {
+            return generateClass(name, name.substring(DUAL_FIELD_PREFIX.length()), true);
+        } else if (isSingleFieldStructure(name)) {
+            return generateClass(name, name.substring(SINGLE_FIELD_PREFIX.length()), false);
         }
         return super.findClass(name);
     }
@@ -63,10 +90,10 @@
      * @param descriptor Layout descriptor.
      * @return Generated class.
      */
-    private Class<?> generateClass(final String name, final String descriptor) {
+    private Class<?> generateClass(final String name, final String descriptor, final boolean dualFields) {
         final Context context = Context.getContextTrusted();
 
-        final byte[] code = new ObjectClassGenerator(context).generate(descriptor);
+        final byte[] code = new ObjectClassGenerator(context, dualFields).generate(descriptor);
         return defineClass(name, code, 0, code.length, new ProtectionDomain(null, getPermissions(null)));
     }
 }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java
index b00d3ec..9cdf6d5 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java
@@ -74,17 +74,16 @@
      * of object fields only, it is fine. However, with dual fields, in order to get
      * performance on benchmarks with a lot of object instantiation and then field
      * reassignment, it can take slightly more relinks to become stable with type
-     * changes swapping out an entire proprety map and making a map guard fail.
-     * Therefore the relink threshold is set to 16 for dual fields (now the default).
-     * This doesn't seem to have any other negative performance implication.
+     * changes swapping out an entire property map and making a map guard fail.
+     * Since we need to set this value statically it must work with possibly changing
+     * optimistic types and dual fields settings. A higher value does not seem to have
+     * any other negative performance implication when running with object-only fields,
+     * so we choose a higher value here.
      *
      * See for example octane.gbemu, run with --log=fields:warning to study
      * megamorphic behavior
      */
-    private static final int NASHORN_DEFAULT_UNSTABLE_RELINK_THRESHOLD =
-            ObjectClassGenerator.OBJECT_FIELDS_ONLY ?
-                     8 :
-                    16;
+    private static final int NASHORN_DEFAULT_UNSTABLE_RELINK_THRESHOLD = 16;
 
     // do not create me!!
     private Bootstrap() {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java
index dac36d4..ca7034d 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java
@@ -33,7 +33,6 @@
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.nashorn.api.scripting.JSObject;
-import jdk.nashorn.internal.codegen.ObjectClassGenerator;
 import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.Property;
 import jdk.nashorn.internal.runtime.PropertyMap;
@@ -123,7 +122,7 @@
      */
     static boolean needsGuard(final Property property, final CallSiteDescriptor desc) {
         return property == null || property.isConfigurable()
-                || property.isBound() || !ObjectClassGenerator.OBJECT_FIELDS_ONLY
+                || property.isBound() || property.hasDualFields()
                 || !NashornCallSiteDescriptor.isFastScope(desc) || property.canChangeType();
     }
 
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JD.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JD.java
new file mode 100644
index 0000000..11d6cac
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JD.java
@@ -0,0 +1,88 @@
+/*
+ * 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.nashorn.internal.scripts;
+
+import jdk.nashorn.internal.runtime.PropertyMap;
+import jdk.nashorn.internal.runtime.ScriptObject;
+
+/**
+ * Empty object class for dual primitive-object fields.
+ */
+public class JD extends ScriptObject {
+
+    private static final PropertyMap map$ = PropertyMap.newMap(JD.class);
+
+    /**
+     * Returns the initial property map to be used.
+     * @return the initial property map.
+     */
+    public static PropertyMap getInitialMap() {
+        return map$;
+    }
+
+    /**
+     * Constructor given an initial property map
+     *
+     * @param map the property map
+     */
+    public JD(final PropertyMap map) {
+        super(map);
+    }
+
+    /**
+     * Constructor given an initial prototype and the default initial property map.
+     *
+     * @param proto the prototype object
+     */
+    public JD(final ScriptObject proto) {
+        super(proto, getInitialMap());
+    }
+
+    /**
+     * Constructor that takes a pre-initialized spill pool. Used by
+     * {@link jdk.nashorn.internal.codegen.SpillObjectCreator} and
+     * {@link jdk.nashorn.internal.parser.JSONParser} for initializing object literals
+     *
+     * @param map            property map
+     * @param primitiveSpill primitive spill pool
+     * @param objectSpill    reference spill pool
+     */
+    public JD(final PropertyMap map, final long[] primitiveSpill, final Object[] objectSpill) {
+        super(map, primitiveSpill, objectSpill);
+    }
+
+    /**
+     * A method handle of this method is passed to the ScriptFunction constructor.
+     *
+     * @param map  the property map to use for allocatorMap
+     *
+     * @return newly allocated ScriptObject
+     */
+    public static ScriptObject allocate(final PropertyMap map) {
+        return new JD(map);
+    }
+}
+
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JO.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JO.java
index 2388a97..1f9aa7c 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JO.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JO.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -29,11 +29,11 @@
 import jdk.nashorn.internal.runtime.ScriptObject;
 
 /**
- * Empty object class.
+ * Empty object class for object-only fields.
  */
 public class JO extends ScriptObject {
 
-    private static final PropertyMap map$ = PropertyMap.newMap();
+    private static final PropertyMap map$ = PropertyMap.newMap(JO.class);
 
     /**
      * Returns the initial property map to be used.
@@ -53,13 +53,12 @@
     }
 
     /**
-     * Constructor given an initial prototype and an initial property map.
+     * Constructor given an initial prototype and the default initial property map.
      *
      * @param proto the prototype object
-     * @param map the property map
      */
-    public JO(final ScriptObject proto, final PropertyMap map) {
-        super(proto, map);
+    public JO(final ScriptObject proto) {
+        super(proto, getInitialMap());
     }
 
     /**
@@ -86,3 +85,4 @@
         return new JO(map);
     }
 }
+
diff --git a/nashorn/test/script/nosecurity/JDK-8067215.js b/nashorn/test/script/nosecurity/JDK-8067215.js
new file mode 100644
index 0000000..12877ac
--- /dev/null
+++ b/nashorn/test/script/nosecurity/JDK-8067215.js
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8067215: Disable dual fields when not using optimistic types
+ *
+ * @test
+ * @run
+ * @option -Dnashorn.debug=true
+ * @fork
+ */
+
+var intType    = Java.type("int");
+var doubleType = Java.type("double");
+var longType   = Java.type("long");
+var objectType = Java.type("java.lang.Object");
+
+var Context = Java.type("jdk.nashorn.internal.runtime.Context");
+var JSType  = Java.type("jdk.nashorn.internal.runtime.JSType");
+
+var context = Context.getContext();
+var dualFields = context.useDualFields();
+var optimisticTypes = context.getEnv()._optimistic_types;
+
+if (dualFields != optimisticTypes) {
+    throw new Error("Wrong dual fields setting");
+}
+
+function testMap(obj) {
+    obj.x = "foo";
+    obj["y"] = 0;
+    Object.defineProperty(obj, "z", {value: 0.5});
+    var map = Debug.map(obj);
+    for (var key in obj) {
+        var prop = map.findProperty(key);
+        if (prop.hasDualFields() !== dualFields) {
+            throw new Error("Wrong property flags: " + prop);
+        }
+        if (prop.getType() != getExpectedType(obj[key])) {
+            throw new Error("Wrong property type: " + prop.getType() + " // " + getExpectedType(obj[key]));
+
+        }
+    }
+}
+
+function getExpectedType(value) {
+    if (!dualFields) {
+        return objectType.class;
+    }
+    if (JSType.isRepresentableAsInt(value)) {
+        return intType.class;
+    }
+    if (JSType.isRepresentableAsLong(value)) {
+        return longType.class;
+    }
+    if (JSType.isNumber(value)) {
+        return doubleType.class;
+    }
+    return objectType.class;
+}
+
+var o = {
+    a: 1,
+    b: 2.5,
+    c: 0x10000000000,
+    d: true
+};
+
+function C() {
+    this.a = 1;
+    this.b = 2.5;
+    this.c = 0x10000000000;
+    this.d = true;
+}
+
+var a = 1;
+var b = 2.5;
+var c = 0x10000000000;
+var d = true;
+
+testMap(o);
+testMap(new C());
+testMap(JSON.parse('{ "a": 1, "b": 2.5, "c": 1099511627776, "d": true }'));
+testMap(this);
diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/BooleanAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/BooleanAccessTest.java
index f460927..8030419 100644
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/BooleanAccessTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/BooleanAccessTest.java
@@ -38,8 +38,8 @@
 
 /**
  * @test
- * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.BooleanAccessTest
- * @run testng/othervm jdk.nashorn.api.javaaccess.BooleanAccessTest
+ * @build jdk.nashorn.api.javaaccess.test.SharedObject jdk.nashorn.api.javaaccess.test.Person jdk.nashorn.api.javaaccess.test.BooleanAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.test.BooleanAccessTest
  */
 @SuppressWarnings("javadoc")
 public class BooleanAccessTest {
@@ -57,7 +57,7 @@
         e = m.getEngineByName("nashorn");
         o = new SharedObject();
         e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
+        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.test.SharedObject;");
     }
 
     @AfterClass
diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/MethodAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/MethodAccessTest.java
index 91487a8..ba3460d 100644
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/MethodAccessTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/MethodAccessTest.java
@@ -41,8 +41,8 @@
 
 /**
  * @test
- * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.MethodAccessTest
- * @run testng/othervm jdk.nashorn.api.javaaccess.MethodAccessTest
+ * @build jdk.nashorn.api.javaaccess.test.SharedObject jdk.nashorn.api.javaaccess.test.Person jdk.nashorn.api.javaaccess.test.MethodAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.test.MethodAccessTest
  */
 @SuppressWarnings("javadoc")
 public class MethodAccessTest {
@@ -61,8 +61,8 @@
         o = new SharedObject();
         o.setEngine(e);
         e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
-        e.eval("var Person = Packages.jdk.nashorn.api.javaaccess.Person;");
+        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.test.SharedObject;");
+        e.eval("var Person = Packages.jdk.nashorn.api.javaaccess.test.Person;");
     }
 
     @AfterClass
@@ -338,13 +338,13 @@
 
     @Test
     public void accessDefaultConstructor() throws ScriptException {
-        e.eval("var dc = new Packages.jdk.nashorn.api.javaaccess.Person()");
+        e.eval("var dc = new Packages.jdk.nashorn.api.javaaccess.test.Person()");
         assertEquals(new Person(), e.get("dc"));
     }
 
     @Test
     public void accessCustomConstructor() throws ScriptException {
-        e.eval("var cc = new Packages.jdk.nashorn.api.javaaccess.Person(17)");
+        e.eval("var cc = new Packages.jdk.nashorn.api.javaaccess.test.Person(17)");
         assertEquals(new Person(17), e.get("cc"));
     }
 
diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberAccessTest.java
index ffe7db3..882ed06 100644
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberAccessTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberAccessTest.java
@@ -38,8 +38,8 @@
 
 /**
  * @test
- * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberAccessTest
- * @run testng/othervm jdk.nashorn.api.javaaccess.NumberAccessTest
+ * @build jdk.nashorn.api.javaaccess.test.SharedObject jdk.nashorn.api.javaaccess.test.Person jdk.nashorn.api.javaaccess.test.NumberAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.test.NumberAccessTest
  */
 @SuppressWarnings("javadoc")
 public class NumberAccessTest {
@@ -57,7 +57,7 @@
         e = m.getEngineByName("nashorn");
         o = new SharedObject();
         e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
+        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.test.SharedObject;");
     }
 
     @AfterClass
diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberBoxingTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberBoxingTest.java
index fb9aa6a..9d5a2f7 100644
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberBoxingTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberBoxingTest.java
@@ -37,8 +37,8 @@
 
 /**
  * @test
- * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberBoxingTest
- * @run testng/othervm jdk.nashorn.api.javaaccess.NumberBoxingTest
+ * @build jdk.nashorn.api.javaaccess.test.SharedObject jdk.nashorn.api.javaaccess.test.Person jdk.nashorn.api.javaaccess.test.NumberBoxingTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.test.NumberBoxingTest
  */
 @SuppressWarnings("javadoc")
 public class NumberBoxingTest {
@@ -56,7 +56,7 @@
         e = m.getEngineByName("nashorn");
         o = new SharedObject();
         e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
+        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.test.SharedObject;");
     }
 
     @AfterClass
diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ObjectAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ObjectAccessTest.java
index fdecf25..80a325e 100644
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ObjectAccessTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ObjectAccessTest.java
@@ -37,8 +37,8 @@
 
 /**
  * @test
- * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.ObjectAccessTest
- * @run testng/othervm jdk.nashorn.api.javaaccess.ObjectAccessTest
+ * @build jdk.nashorn.api.javaaccess.test.SharedObject jdk.nashorn.api.javaaccess.test.Person jdk.nashorn.api.javaaccess.test.ObjectAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.test.ObjectAccessTest
  */
 @SuppressWarnings("javadoc")
 public class ObjectAccessTest {
@@ -56,8 +56,8 @@
         e = m.getEngineByName("nashorn");
         o = new SharedObject();
         e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
-        e.eval("var Person = Packages.jdk.nashorn.api.javaaccess.Person;");
+        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.test.SharedObject;");
+        e.eval("var Person = Packages.jdk.nashorn.api.javaaccess.test.Person;");
     }
 
     @AfterClass
@@ -80,7 +80,7 @@
         e.eval("var p_object_array = o.publicObjectArray;");
         assertEquals(o.publicObjectArray[0], e.eval("o.publicObjectArray[0]"));
         assertArrayEquals(o.publicObjectArray, (Object[])e.get("p_object_array"));
-        e.eval("var t_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
+        e.eval("var t_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.test.Person[]\"))(3);" +
                 "t_object_arr[0] = new Person(100);" +
                 "t_object_arr[1] = new Person(120);" +
                 "t_object_arr[2] = new Person(140);" +
@@ -104,7 +104,7 @@
         e.eval("var ps_object_array = SharedObject.publicStaticObjectArray;");
         assertEquals(SharedObject.publicStaticObjectArray[0], e.eval("SharedObject.publicStaticObjectArray[0]"));
         assertArrayEquals(SharedObject.publicStaticObjectArray, (Object[])e.get("ps_object_array"));
-        e.eval("var ts_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
+        e.eval("var ts_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.test.Person[]\"))(3);" +
                 "ts_object_arr[0] = new Person(100);" +
                 "ts_object_arr[1] = new Person(120);" +
                 "ts_object_arr[2] = new Person(140);" +
@@ -128,7 +128,7 @@
         e.eval("var pf_object_array = o.publicFinalObjectArray;");
         assertEquals(o.publicFinalObjectArray[0], e.eval("o.publicFinalObjectArray[0]"));
         assertArrayEquals(o.publicFinalObjectArray, (Object[])e.get("pf_object_array"));
-        e.eval("var tf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
+        e.eval("var tf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.test.Person[]\"))(3);" +
                 "tf_object_arr[0] = new Person(100);" +
                 "tf_object_arr[1] = new Person(120);" +
                 "tf_object_arr[2] = new Person(140);" +
@@ -152,7 +152,7 @@
         e.eval("var psf_object_array = SharedObject.publicStaticFinalObjectArray;");
         assertEquals(SharedObject.publicStaticFinalObjectArray[0], e.eval("SharedObject.publicStaticFinalObjectArray[0]"));
         assertArrayEquals(SharedObject.publicStaticFinalObjectArray, (Object[])e.get("psf_object_array"));
-        e.eval("var tsf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
+        e.eval("var tsf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.test.Person[]\"))(3);" +
                 "tsf_object_arr[0] = new Person(100);" +
                 "tsf_object_arr[1] = new Person(120);" +
                 "tsf_object_arr[2] = new Person(140);" +
diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/StringAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/StringAccessTest.java
index 8ec43e6..909ddb4 100644
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/StringAccessTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/StringAccessTest.java
@@ -37,8 +37,8 @@
 
 /**
  * @test
- * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.StringAccessTest
- * @run testng/othervm jdk.nashorn.api.javaaccess.StringAccessTest
+ * @build jdk.nashorn.api.javaaccess.test.SharedObject jdk.nashorn.api.javaaccess.test.Person jdk.nashorn.api.javaaccess.test.StringAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.test.StringAccessTest
  */
 @SuppressWarnings("javadoc")
 public class StringAccessTest {
@@ -56,7 +56,7 @@
         e = m.getEngineByName("nashorn");
         o = new SharedObject();
         e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
+        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.test.SharedObject;");
     }
 
     @AfterClass
diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/test/MultipleEngineTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/MultipleEngineTest.java
index 1dd6908..76982fa 100644
--- a/nashorn/test/src/jdk/nashorn/api/scripting/test/MultipleEngineTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/MultipleEngineTest.java
@@ -35,7 +35,7 @@
  * independently.
  *
  * @test
- * @run testng jdk.nashorn.api.scripting.MultipleEngineTest
+ * @run testng jdk.nashorn.api.scripting.test.MultipleEngineTest
  */
 @SuppressWarnings("javadoc")
 public class MultipleEngineTest {
diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java
index 258c6bc..3b683e2 100644
--- a/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java
@@ -58,8 +58,8 @@
  * Tests for JSR-223 script engine for Nashorn.
  *
  * @test
- * @build jdk.nashorn.api.scripting.Window jdk.nashorn.api.scripting.WindowEventHandler jdk.nashorn.api.scripting.VariableArityTestInterface jdk.nashorn.api.scripting.ScriptEngineTest
- * @run testng/othervm jdk.nashorn.api.scripting.ScriptEngineTest
+ * @build jdk.nashorn.api.scripting.test.Window jdk.nashorn.api.scripting.test.WindowEventHandler jdk.nashorn.api.scripting.test.VariableArityTestInterface jdk.nashorn.api.scripting.test.ScriptEngineTest
+ * @run testng/othervm jdk.nashorn.api.scripting.test.ScriptEngineTest
  */
 @SuppressWarnings("javadoc")
 public class ScriptEngineTest {
diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/test/JoniTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/test/JoniTest.java
index a208d02..a907f8f 100644
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/test/JoniTest.java
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/test/JoniTest.java
@@ -32,7 +32,7 @@
  * Joni coverage tests
  *
  * @test
- * @run testng jdk.nashorn.internal.runtime.regexp.joni.JoniTest
+ * @run testng jdk.nashorn.internal.runtime.regexp.joni.test.JoniTest
  */
 @SuppressWarnings("javadoc")
 public class JoniTest {
diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/test/JdkRegExpTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/test/JdkRegExpTest.java
index 87a27d0..20cb367 100644
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/test/JdkRegExpTest.java
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/test/JdkRegExpTest.java
@@ -38,7 +38,7 @@
  * Basic tests for the JDK based RegExp implementation.
  *
  * @test
- * @run testng jdk.nashorn.internal.runtime.regexp.JdkRegExpTest
+ * @run testng jdk.nashorn.internal.runtime.regexp.test.JdkRegExpTest
  */
 public class JdkRegExpTest {
 
diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java
index 1d10d81..31342ce 100644
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java
@@ -38,10 +38,11 @@
 import org.testng.annotations.Test;
 
 /**
+ * @ignore Fails with jtreg, but passes with ant test run. Ignore for now.
  * @test
  * @bug 8039185 8039403
  * @summary  Test for persistent code cache and path handling
- * @run testng jdk.nashorn.internal.runtime.CodeStoreAndPathTest
+ * @run testng jdk.nashorn.internal.runtime.test.CodeStoreAndPathTest
  */
 @SuppressWarnings("javadoc")
 public class CodeStoreAndPathTest {
diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/ConsStringTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ConsStringTest.java
index 161a212..f86c5b7 100644
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/ConsStringTest.java
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ConsStringTest.java
@@ -34,7 +34,7 @@
  * Tests for JSType methods.
  *
  * @test
- * @run testng jdk.nashorn.internal.runtime.ConsStringTest
+ * @run testng jdk.nashorn.internal.runtime.test.ConsStringTest
  */
 public class ConsStringTest {
 
diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/ContextTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ContextTest.java
index fbe20d8..b927de2 100644
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/ContextTest.java
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ContextTest.java
@@ -44,7 +44,7 @@
  * Basic Context API tests.
  *
  * @test
- * @run testng jdk.nashorn.internal.runtime.ContextTest
+ * @run testng jdk.nashorn.internal.runtime.test.ContextTest
  */
 @SuppressWarnings("javadoc")
 public class ContextTest {
diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java
index 1c80bde..3cb27ad 100644
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java
@@ -42,7 +42,7 @@
  * JDK-8044518: Ensure exceptions related to optimistic recompilation are not serializable
  *
  * @test
- * @run testng jdk.nashorn.internal.runtime.ExceptionsNotSerializable
+ * @run testng jdk.nashorn.internal.runtime.test.ExceptionsNotSerializable
  */
 @SuppressWarnings("javadoc")
 public class ExceptionsNotSerializable {
diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/JSTypeTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/JSTypeTest.java
index 71f818c..a91a442 100644
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/JSTypeTest.java
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/JSTypeTest.java
@@ -37,7 +37,7 @@
  * Tests for JSType methods.
  *
  * @test
- * @run testng jdk.nashorn.internal.runtime.JSTypeTest
+ * @run testng jdk.nashorn.internal.runtime.test.JSTypeTest
  */
 public class JSTypeTest {
     /**
diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java
index eb68232..713a33c 100644
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java
@@ -40,7 +40,7 @@
  * Top-level lexical binding tests.
  *
  * @test
- * @run testng jdk.nashorn.internal.runtime.LexicalBindingTest
+ * @run testng jdk.nashorn.internal.runtime.test.LexicalBindingTest
  */
 @SuppressWarnings("javadoc")
 public class LexicalBindingTest {
diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/NoPersistenceCachingTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/NoPersistenceCachingTest.java
index 0872448..d9643e6 100644
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/NoPersistenceCachingTest.java
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/NoPersistenceCachingTest.java
@@ -43,7 +43,7 @@
  * @test
  * @bug 8037378
  * @summary Sanity tests for no persistence caching
- * @run testng/othervm jdk.nashorn.internal.runtime.NoPersistenceCachingTest
+ * @run testng/othervm jdk.nashorn.internal.runtime.test.NoPersistenceCachingTest
  */
 @SuppressWarnings("javadoc")
 public class NoPersistenceCachingTest {
diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/SourceTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/SourceTest.java
index d62b2f4..fdf406c 100644
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/SourceTest.java
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/SourceTest.java
@@ -49,7 +49,7 @@
     final private static String SOURCE_STRING = "var x = 1;";
     final private static char[] SOURCE_CHARS = SOURCE_STRING.toCharArray();
     final private static String RESOURCE_PATH = "resources/load_test.js";
-    final private static File SOURCE_FILE = new File("build/test/classes/jdk/nashorn/internal/runtime/" + RESOURCE_PATH);
+    final private static File SOURCE_FILE = new File("build/test/classes/jdk/nashorn/internal/runtime/test/" + RESOURCE_PATH);
     final private static URL  SOURCE_URL = SourceTest.class.getResource(RESOURCE_PATH);