changeset 15304:40efaa47dc5b

Merge
author prr
date Fri, 05 Aug 2016 10:23:28 -0700
parents a2772291aae0 dec5ee648013
children 0060376192f1 bdd65f1e645f
files test/ProblemList.txt
diffstat 42 files changed, 1157 insertions(+), 296 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Aug 03 14:49:01 2016 +0530
+++ b/.hgtags	Fri Aug 05 10:23:28 2016 -0700
@@ -372,3 +372,4 @@
 7a97b89ba83077ca62e4aa5a05437adc8f315343 jdk-9+127
 9446c534f0222b4eecfd9d9e25ab37c4fd4400a5 jdk-9+128
 47699aa2e69ec2702542dc73eb01de3bfb61aea0 jdk-9+129
+6c827500e34587061af97ad6fef0e859280255c5 jdk-9+130
--- a/src/java.base/share/classes/java/lang/Runtime.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Runtime.java	Fri Aug 05 10:23:28 2016 -0700
@@ -1112,7 +1112,62 @@
          * @return  The Version of the given string
          */
         public static Version parse(String s) {
-            return VersionBuilder.parse(s);
+            if (s == null)
+                throw new NullPointerException();
+
+            // Shortcut to avoid initializing VersionPattern when creating
+            // major version constants during startup
+            if (isSimpleNumber(s)) {
+                return new Version(List.of(Integer.parseInt(s)),
+                        Optional.empty(), Optional.empty(), Optional.empty());
+            }
+            Matcher m = VersionPattern.VSTR_PATTERN.matcher(s);
+            if (!m.matches())
+                throw new IllegalArgumentException("Invalid version string: '"
+                                                   + s + "'");
+
+            // $VNUM is a dot-separated list of integers of arbitrary length
+            List<Integer> version = new ArrayList<>();
+            for (String i : m.group(VersionPattern.VNUM_GROUP).split("\\."))
+                version.add(Integer.parseInt(i));
+
+            Optional<String> pre = Optional.ofNullable(
+                    m.group(VersionPattern.PRE_GROUP));
+
+            String b = m.group(VersionPattern.BUILD_GROUP);
+            // $BUILD is an integer
+            Optional<Integer> build = (b == null)
+                ? Optional.empty()
+                : Optional.of(Integer.parseInt(b));
+
+            Optional<String> optional = Optional.ofNullable(
+                    m.group(VersionPattern.OPT_GROUP));
+
+            // empty '+'
+            if ((m.group(VersionPattern.PLUS_GROUP) != null)
+                    && !build.isPresent()) {
+                if (optional.isPresent()) {
+                    if (pre.isPresent())
+                        throw new IllegalArgumentException("'+' found with"
+                            + " pre-release and optional components:'" + s
+                            + "'");
+                } else {
+                    throw new IllegalArgumentException("'+' found with neither"
+                        + " build or optional components: '" + s + "'");
+                }
+            }
+            return new Version(version, pre, build, optional);
+        }
+
+        private static boolean isSimpleNumber(String s) {
+            for (int i = 0; i < s.length(); i++) {
+                char c = s.charAt(i);
+                char lowerBound = (i > 0) ? '0' : '1';
+                if (c < lowerBound || c > '9') {
+                    return false;
+                }
+            }
+            return true;
         }
 
         /**
@@ -1441,86 +1496,26 @@
         }
     }
 
-    private static class VersionBuilder {
+    private static class VersionPattern {
         // $VNUM(-$PRE)?(\+($BUILD)?(\-$OPT)?)?
         // RE limits the format of version strings
         // ([1-9][0-9]*(?:(?:\.0)*\.[1-9][0-9]*)*)(?:-([a-zA-Z0-9]+))?(?:(\+)(0|[1-9][0-9]*)?)?(?:-([-a-zA-Z0-9.]+))?
 
         private static final String VNUM
             = "(?<VNUM>[1-9][0-9]*(?:(?:\\.0)*\\.[1-9][0-9]*)*)";
-        private static final String VNUM_GROUP  = "VNUM";
-
         private static final String PRE      = "(?:-(?<PRE>[a-zA-Z0-9]+))?";
-        private static final String PRE_GROUP   = "PRE";
-
         private static final String BUILD
             = "(?:(?<PLUS>\\+)(?<BUILD>0|[1-9][0-9]*)?)?";
-        private static final String PLUS_GROUP  = "PLUS";
-        private static final String BUILD_GROUP = "BUILD";
-
         private static final String OPT      = "(?:-(?<OPT>[-a-zA-Z0-9.]+))?";
-        private static final String OPT_GROUP   = "OPT";
-
         private static final String VSTR_FORMAT
             = "^" + VNUM + PRE + BUILD + OPT + "$";
-        private static final Pattern VSTR_PATTERN = Pattern.compile(VSTR_FORMAT);
 
-        /**
-         * Constructs a valid <a href="verStr">version string</a> containing
-         * a <a href="#verNum">version number</a> followed by pre-release and
-         * build information.
-         *
-         * @param  s
-         *         A string to be interpreted as a version
-         *
-         * @throws  IllegalArgumentException
-         *          If the given string cannot be interpreted as a valid
-         *          version
-         *
-         * @throws  NullPointerException
-         *          If {@code s} is {@code null}
-         *
-         * @throws  NumberFormatException
-         *          If an element of the version number or the build number
-         *          cannot be represented as an {@link Integer}
-         */
-        static Version parse(String s) {
-            if (s == null)
-                throw new NullPointerException();
+        static final Pattern VSTR_PATTERN = Pattern.compile(VSTR_FORMAT);
 
-            Matcher m = VSTR_PATTERN.matcher(s);
-            if (!m.matches())
-                throw new IllegalArgumentException("Invalid version string: '"
-                                                   + s + "'");
-
-            // $VNUM is a dot-separated list of integers of arbitrary length
-            List<Integer> version = new ArrayList<>();
-            for (String i : m.group(VNUM_GROUP).split("\\."))
-                version.add(Integer.parseInt(i));
-
-            Optional<String> pre = Optional.ofNullable(m.group(PRE_GROUP));
-
-            String b = m.group(BUILD_GROUP);
-            // $BUILD is an integer
-            Optional<Integer> build = (b == null)
-                ? Optional.empty()
-                : Optional.of(Integer.parseInt(b));
-
-            Optional<String> optional = Optional.ofNullable(m.group(OPT_GROUP));
-
-            // empty '+'
-            if ((m.group(PLUS_GROUP) != null) && !build.isPresent()) {
-                if (optional.isPresent()) {
-                    if (pre.isPresent())
-                        throw new IllegalArgumentException("'+' found with"
-                            + " pre-release and optional components:'" + s
-                            + "'");
-                } else {
-                    throw new IllegalArgumentException("'+' found with neither"
-                        + " build or optional components: '" + s + "'");
-                }
-            }
-            return new Version(version, pre, build, optional);
-        }
+        static final String VNUM_GROUP  = "VNUM";
+        static final String PRE_GROUP   = "PRE";
+        static final String PLUS_GROUP  = "PLUS";
+        static final String BUILD_GROUP = "BUILD";
+        static final String OPT_GROUP   = "OPT";
     }
 }
--- a/src/java.base/share/classes/java/net/Inet4Address.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.base/share/classes/java/net/Inet4Address.java	Fri Aug 05 10:23:28 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -164,7 +164,7 @@
     }
 
     /**
-     * Utility routine to check if the InetAddress in a wildcard address.
+     * Utility routine to check if the InetAddress is a wildcard address.
      * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
      * @since 1.4
--- a/src/java.base/share/classes/java/net/Inet6Address.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.base/share/classes/java/net/Inet6Address.java	Fri Aug 05 10:23:28 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -691,7 +691,7 @@
     }
 
     /**
-     * Utility routine to check if the InetAddress in a wildcard address.
+     * Utility routine to check if the InetAddress is a wildcard address.
      *
      * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
--- a/src/java.base/share/classes/java/net/InetAddress.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.base/share/classes/java/net/InetAddress.java	Fri Aug 05 10:23:28 2016 -0700
@@ -361,7 +361,7 @@
     }
 
     /**
-     * Utility routine to check if the InetAddress in a wildcard address.
+     * Utility routine to check if the InetAddress is a wildcard address.
      * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
      * @since 1.4
--- a/src/java.base/share/classes/java/net/Socket.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.base/share/classes/java/net/Socket.java	Fri Aug 05 10:23:28 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -907,7 +907,6 @@
             throw new SocketException("Socket is not connected");
         if (isInputShutdown())
             throw new SocketException("Socket input is shutdown");
-        final Socket s = this;
         InputStream is = null;
         try {
             is = AccessController.doPrivileged(
@@ -947,7 +946,6 @@
             throw new SocketException("Socket is not connected");
         if (isOutputShutdown())
             throw new SocketException("Socket output is shutdown");
-        final Socket s = this;
         OutputStream os = null;
         try {
             os = AccessController.doPrivileged(
--- a/src/java.base/share/classes/java/nio/file/FileTreeWalker.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.base/share/classes/java/nio/file/FileTreeWalker.java	Fri Aug 05 10:23:28 2016 -0700
@@ -168,7 +168,7 @@
      * @throws  IllegalArgumentException
      *          if {@code maxDepth} is negative
      * @throws  ClassCastException
-     *          if (@code options} contains an element that is not a
+     *          if {@code options} contains an element that is not a
      *          {@code FileVisitOption}
      * @throws  NullPointerException
      *          if {@code options} is {@ocde null} or the options
--- a/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Fri Aug 05 10:23:28 2016 -0700
@@ -810,7 +810,7 @@
      * The localized decimal style is not used.
      * <p>
      * The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
-     * and optionally (@code NANO_OF_SECOND). The value of {@code INSTANT_SECONDS}
+     * and optionally {@code NANO_OF_SECOND}. The value of {@code INSTANT_SECONDS}
      * may be outside the maximum range of {@code LocalDateTime}.
      * <p>
      * The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
@@ -848,7 +848,7 @@
      * digits from zero to nine are accepted.
      * <p>
      * The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
-     * and optionally (@code NANO_OF_SECOND). The value of {@code INSTANT_SECONDS}
+     * and optionally {@code NANO_OF_SECOND}. The value of {@code INSTANT_SECONDS}
      * may be outside the maximum range of {@code LocalDateTime}.
      * <p>
      * The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
--- a/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Fri Aug 05 10:23:28 2016 -0700
@@ -30,7 +30,7 @@
 import java.lang.reflect.*;
 import java.io.Serializable;
 import java.util.*;
-import java.util.stream.Collectors;
+import java.util.stream.*;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
@@ -163,47 +163,167 @@
      */
     private static String memberValueToString(Object value) {
         Class<?> type = value.getClass();
-        if (!type.isArray()) {   // primitive, string, class, enum const,
-                                 // or annotation
+        if (!type.isArray()) {
+            // primitive value, string, class, enum const, or annotation
             if (type == Class.class)
-                return classValueToString((Class<?>) value);
+                return toSourceString((Class<?>) value);
+            else if (type == String.class)
+                return  toSourceString((String) value);
+            if (type == Character.class)
+                return toSourceString((char) value);
+            else if (type == Double.class)
+                return  toSourceString((double) value);
+            else if (type == Float.class)
+                return  toSourceString((float) value);
+            else if (type == Long.class)
+                return  toSourceString((long) value);
             else
                 return value.toString();
+        } else {
+            Stream<String> stringStream;
+            if (type == byte[].class)
+                stringStream = convert((byte[]) value);
+            else if (type == char[].class)
+                stringStream = convert((char[]) value);
+            else if (type == double[].class)
+                stringStream = DoubleStream.of((double[]) value)
+                    .mapToObj(AnnotationInvocationHandler::toSourceString);
+            else if (type == float[].class)
+                stringStream = convert((float[]) value);
+            else if (type == int[].class)
+                stringStream = IntStream.of((int[]) value).mapToObj(String::valueOf);
+            else if (type == long[].class) {
+                stringStream = LongStream.of((long[]) value)
+                    .mapToObj(AnnotationInvocationHandler::toSourceString);
+            } else if (type == short[].class)
+                stringStream = convert((short[]) value);
+            else if (type == boolean[].class)
+                stringStream = convert((boolean[]) value);
+            else if (type == Class[].class)
+                stringStream =
+                    Arrays.stream((Class<?>[]) value).
+                    map(AnnotationInvocationHandler::toSourceString);
+            else if (type == String[].class)
+                stringStream =
+                    Arrays.stream((String[])value).
+                    map(AnnotationInvocationHandler::toSourceString);
+            else
+                stringStream = Arrays.stream((Object[])value).map(Objects::toString);
+
+            return stringStreamToString(stringStream);
         }
-
-        if (type == byte[].class)
-            return Arrays.toString((byte[]) value);
-        if (type == char[].class)
-            return Arrays.toString((char[]) value);
-        if (type == double[].class)
-            return Arrays.toString((double[]) value);
-        if (type == float[].class)
-            return Arrays.toString((float[]) value);
-        if (type == int[].class)
-            return Arrays.toString((int[]) value);
-        if (type == long[].class)
-            return Arrays.toString((long[]) value);
-        if (type == short[].class)
-            return Arrays.toString((short[]) value);
-        if (type == boolean[].class)
-            return Arrays.toString((boolean[]) value);
-        if (type == Class[].class)
-            return classArrayValueToString((Class<?>[])value);
-        return Arrays.toString((Object[]) value);
     }
 
     /**
      * Translates a Class value to a form suitable for use in the
      * string representation of an annotation.
      */
-    private static String classValueToString(Class<?> clazz) {
-        return clazz.getName() + ".class" ;
+    private static String toSourceString(Class<?> clazz) {
+        Class<?> finalComponent = clazz;
+        StringBuilder arrayBackets = new StringBuilder();
+
+        while(finalComponent.isArray()) {
+            finalComponent = finalComponent.getComponentType();
+            arrayBackets.append("[]");
+        }
+
+        return finalComponent.getName() + arrayBackets.toString() + ".class" ;
     }
 
-    private static String classArrayValueToString(Class<?>[] classes) {
-        return Arrays.stream(classes)
-            .map(AnnotationInvocationHandler::classValueToString)
-            .collect(Collectors.joining(", ", "{", "}"));
+    private static String toSourceString(float f) {
+        if (Float.isFinite(f))
+            return Float.toString(f) + "f" ;
+        else {
+            if (Float.isInfinite(f)) {
+                return (f < 0.0f) ? "-1.0f/0.0f": "1.0f/0.0f";
+            } else
+                return "0.0f/0.0f";
+        }
+    }
+
+    private static String toSourceString(double d) {
+        if (Double.isFinite(d))
+            return Double.toString(d);
+        else {
+            if (Double.isInfinite(d)) {
+                return (d < 0.0f) ? "-1.0/0.0": "1.0/0.0";
+            } else
+                return "0.0/0.0";
+        }
+    }
+
+    private static String toSourceString(char c) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("'");
+        if (c == '\'')
+            sb.append("\\'");
+        else
+            sb.append(c);
+        sb.append("'");
+        return sb.toString();
+    }
+
+    private static String toSourceString(long ell) {
+        return (Math.abs(ell) <= Integer.MAX_VALUE) ?
+            String.valueOf(ell) :
+            (String.valueOf(ell) + "L");
+    }
+
+    /**
+     * Return a string suitable for use in the string representation
+     * of an annotation.
+     */
+    private static String toSourceString(String s) {
+        StringBuilder sb = new StringBuilder();
+        sb.append('"');
+        // Escape embedded quote characters, if present, but don't do
+        // anything more heroic.
+        if (s.indexOf('"') != -1) {
+            s = s.replace("\"", "\\\"");
+        }
+        sb.append(s);
+        sb.append('"');
+        return sb.toString();
+    }
+
+    private static Stream<String> convert(byte[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (byte b : values)
+            list.add(Byte.toString(b));
+        return list.stream();
+    }
+
+    private static Stream<String> convert(char[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (char c : values)
+            list.add(toSourceString(c));
+        return list.stream();
+    }
+
+    private static Stream<String> convert(float[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (float f : values) {
+            list.add(toSourceString(f));
+        }
+        return list.stream();
+    }
+
+    private static Stream<String> convert(short[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (short s : values)
+            list.add(Short.toString(s));
+        return list.stream();
+    }
+
+    private static Stream<String> convert(boolean[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (boolean b : values)
+            list.add(Boolean.toString(b));
+        return list.stream();
+    }
+
+    private static String stringStreamToString(Stream<String> stream) {
+        return stream.collect(Collectors.joining(", ", "{", "}"));
     }
 
     /**
--- a/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java	Fri Aug 05 10:23:28 2016 -0700
@@ -28,16 +28,12 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Locale.*;
 import static java.util.Locale.FilteringMode.*;
 import static java.util.Locale.LanguageRange.*;
 import java.util.Map;
-import java.util.Set;
 
 /**
  * Implementation for BCP47 Locale matching
@@ -111,10 +107,22 @@
 
     private static List<String> filterBasic(List<LanguageRange> priorityList,
                                             Collection<String> tags) {
+        int splitIndex = splitRanges(priorityList);
+        List<LanguageRange> nonZeroRanges;
+        List<LanguageRange> zeroRanges;
+        if (splitIndex != -1) {
+            nonZeroRanges = priorityList.subList(0, splitIndex);
+            zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+        } else {
+            nonZeroRanges = priorityList;
+            zeroRanges = List.of();
+        }
+
         List<String> list = new ArrayList<>();
-        for (LanguageRange lr : priorityList) {
+        for (LanguageRange lr : nonZeroRanges) {
             String range = lr.getRange();
             if (range.equals("*")) {
+                tags = removeTagsMatchingBasicZeroRange(zeroRanges, tags);
                 return new ArrayList<String>(tags);
             } else {
                 for (String tag : tags) {
@@ -122,7 +130,8 @@
                     if (tag.startsWith(range)) {
                         int len = range.length();
                         if ((tag.length() == len || tag.charAt(len) == '-')
-                            && !list.contains(tag)) {
+                            && !list.contains(tag)
+                            && !shouldIgnoreFilterBasicMatch(zeroRanges, tag)) {
                             list.add(tag);
                         }
                     }
@@ -133,12 +142,76 @@
         return list;
     }
 
+    /**
+     * Removes the tag(s) which are falling in the basic exclusion range(s) i.e
+     * range(s) with q=0 and returns the updated collection. If the basic
+     * language ranges contains '*' as one of its non zero range then instead of
+     * returning all the tags, remove those which are matching the range with
+     * quality weight q=0.
+     */
+    private static Collection<String> removeTagsMatchingBasicZeroRange(
+            List<LanguageRange> zeroRange, Collection<String> tags) {
+        if (zeroRange.isEmpty()) {
+            return tags;
+        }
+
+        List<String> matchingTags = new ArrayList<>();
+        for (String tag : tags) {
+            tag = tag.toLowerCase(Locale.ROOT);
+            if (!shouldIgnoreFilterBasicMatch(zeroRange, tag)) {
+                matchingTags.add(tag);
+            }
+        }
+
+        return matchingTags;
+    }
+
+    /**
+     * The tag which is falling in the basic exclusion range(s) should not
+     * be considered as the matching tag. Ignores the tag matching with the
+     * non-zero ranges, if the tag also matches with one of the basic exclusion
+     * ranges i.e. range(s) having quality weight q=0
+     */
+    private static boolean shouldIgnoreFilterBasicMatch(
+            List<LanguageRange> zeroRange, String tag) {
+        if (zeroRange.isEmpty()) {
+            return false;
+        }
+
+        for (LanguageRange lr : zeroRange) {
+            String range = lr.getRange();
+            if (range.equals("*")) {
+                return true;
+            }
+            if (tag.startsWith(range)) {
+                int len = range.length();
+                if ((tag.length() == len || tag.charAt(len) == '-')) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
     private static List<String> filterExtended(List<LanguageRange> priorityList,
                                                Collection<String> tags) {
+        int splitIndex = splitRanges(priorityList);
+        List<LanguageRange> nonZeroRanges;
+        List<LanguageRange> zeroRanges;
+        if (splitIndex != -1) {
+            nonZeroRanges = priorityList.subList(0, splitIndex);
+            zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+        } else {
+            nonZeroRanges = priorityList;
+            zeroRanges = List.of();
+        }
+
         List<String> list = new ArrayList<>();
-        for (LanguageRange lr : priorityList) {
+        for (LanguageRange lr : nonZeroRanges) {
             String range = lr.getRange();
             if (range.equals("*")) {
+                tags = removeTagsMatchingExtendedZeroRange(zeroRanges, tags);
                 return new ArrayList<String>(tags);
             }
             String[] rangeSubtags = range.split("-");
@@ -150,33 +223,101 @@
                     continue;
                 }
 
-                int rangeIndex = 1;
-                int tagIndex = 1;
-
-                while (rangeIndex < rangeSubtags.length
-                       && tagIndex < tagSubtags.length) {
-                   if (rangeSubtags[rangeIndex].equals("*")) {
-                       rangeIndex++;
-                   } else if (rangeSubtags[rangeIndex].equals(tagSubtags[tagIndex])) {
-                       rangeIndex++;
-                       tagIndex++;
-                   } else if (tagSubtags[tagIndex].length() == 1
-                              && !tagSubtags[tagIndex].equals("*")) {
-                       break;
-                   } else {
-                       tagIndex++;
-                   }
-               }
-
-               if (rangeSubtags.length == rangeIndex && !list.contains(tag)) {
-                   list.add(tag);
-               }
+                int rangeIndex = matchFilterExtendedSubtags(rangeSubtags,
+                        tagSubtags);
+                if (rangeSubtags.length == rangeIndex && !list.contains(tag)
+                        && !shouldIgnoreFilterExtendedMatch(zeroRanges, tag)) {
+                    list.add(tag);
+                }
             }
         }
 
         return list;
     }
 
+    /**
+     * Removes the tag(s) which are falling in the extended exclusion range(s)
+     * i.e range(s) with q=0 and returns the updated collection. If the extended
+     * language ranges contains '*' as one of its non zero range then instead of
+     * returning all the tags, remove those which are matching the range with
+     * quality weight q=0.
+     */
+    private static Collection<String> removeTagsMatchingExtendedZeroRange(
+            List<LanguageRange> zeroRange, Collection<String> tags) {
+        if (zeroRange.isEmpty()) {
+            return tags;
+        }
+
+        List<String> matchingTags = new ArrayList<>();
+        for (String tag : tags) {
+            tag = tag.toLowerCase(Locale.ROOT);
+            if (!shouldIgnoreFilterExtendedMatch(zeroRange, tag)) {
+                matchingTags.add(tag);
+            }
+        }
+
+        return matchingTags;
+    }
+
+    /**
+     * The tag which is falling in the extended exclusion range(s) should
+     * not be considered as the matching tag. Ignores the tag matching with the
+     * non zero range(s), if the tag also matches with one of the extended
+     * exclusion range(s) i.e. range(s) having quality weight q=0
+     */
+    private static boolean shouldIgnoreFilterExtendedMatch(
+            List<LanguageRange> zeroRange, String tag) {
+        if (zeroRange.isEmpty()) {
+            return false;
+        }
+
+        String[] tagSubtags = tag.split("-");
+        for (LanguageRange lr : zeroRange) {
+            String range = lr.getRange();
+            if (range.equals("*")) {
+                return true;
+            }
+
+            String[] rangeSubtags = range.split("-");
+
+            if (!rangeSubtags[0].equals(tagSubtags[0])
+                    && !rangeSubtags[0].equals("*")) {
+                continue;
+            }
+
+            int rangeIndex = matchFilterExtendedSubtags(rangeSubtags,
+                    tagSubtags);
+            if (rangeSubtags.length == rangeIndex) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    private static int matchFilterExtendedSubtags(String[] rangeSubtags,
+            String[] tagSubtags) {
+        int rangeIndex = 1;
+        int tagIndex = 1;
+
+        while (rangeIndex < rangeSubtags.length
+                && tagIndex < tagSubtags.length) {
+            if (rangeSubtags[rangeIndex].equals("*")) {
+                rangeIndex++;
+            } else if (rangeSubtags[rangeIndex]
+                    .equals(tagSubtags[tagIndex])) {
+                rangeIndex++;
+                tagIndex++;
+            } else if (tagSubtags[tagIndex].length() == 1
+                    && !tagSubtags[tagIndex].equals("*")) {
+                break;
+            } else {
+                tagIndex++;
+            }
+        }
+        return rangeIndex;
+    }
+
     public static Locale lookup(List<LanguageRange> priorityList,
                                 Collection<Locale> locales) {
         if (priorityList.isEmpty() || locales.isEmpty()) {
@@ -205,7 +346,18 @@
             return null;
         }
 
-        for (LanguageRange lr : priorityList) {
+        int splitIndex = splitRanges(priorityList);
+        List<LanguageRange> nonZeroRanges;
+        List<LanguageRange> zeroRanges;
+        if (splitIndex != -1) {
+            nonZeroRanges = priorityList.subList(0, splitIndex);
+            zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+        } else {
+            nonZeroRanges = priorityList;
+            zeroRanges = List.of();
+        }
+
+        for (LanguageRange lr : nonZeroRanges) {
             String range = lr.getRange();
 
             // Special language range ("*") is ignored in lookup.
@@ -217,31 +369,83 @@
             while (rangeForRegex.length() > 0) {
                 for (String tag : tags) {
                     tag = tag.toLowerCase(Locale.ROOT);
-                    if (tag.matches(rangeForRegex)) {
+                    if (tag.matches(rangeForRegex)
+                            && !shouldIgnoreLookupMatch(zeroRanges, tag)) {
                         return tag;
                     }
                 }
 
                 // Truncate from the end....
-                int index = rangeForRegex.lastIndexOf('-');
-                if (index >= 0) {
-                    rangeForRegex = rangeForRegex.substring(0, index);
-
-                    // if range ends with an extension key, truncate it.
-                    index = rangeForRegex.lastIndexOf('-');
-                    if (index >= 0 && index == rangeForRegex.length()-2) {
-                        rangeForRegex =
-                            rangeForRegex.substring(0, rangeForRegex.length()-2);
-                    }
-                } else {
-                    rangeForRegex = "";
-                }
+                rangeForRegex = truncateRange(rangeForRegex);
             }
         }
 
         return null;
     }
 
+    /**
+     * The tag which is falling in the exclusion range(s) should not be
+     * considered as the matching tag. Ignores the tag matching with the
+     * non zero range(s), if the tag also matches with one of the exclusion
+     * range(s) i.e. range(s) having quality weight q=0.
+     */
+    private static boolean shouldIgnoreLookupMatch(List<LanguageRange> zeroRange,
+            String tag) {
+        for (LanguageRange lr : zeroRange) {
+            String range = lr.getRange();
+
+            // Special language range ("*") is ignored in lookup.
+            if (range.equals("*")) {
+                continue;
+            }
+
+            String rangeForRegex = range.replaceAll("\\x2A", "\\\\p{Alnum}*");
+            while (rangeForRegex.length() > 0) {
+                if (tag.matches(rangeForRegex)) {
+                    return true;
+                }
+                // Truncate from the end....
+                rangeForRegex = truncateRange(rangeForRegex);
+            }
+        }
+
+        return false;
+    }
+
+    /* Truncate the range from end during the lookup match */
+    private static String truncateRange(String rangeForRegex) {
+        int index = rangeForRegex.lastIndexOf('-');
+        if (index >= 0) {
+            rangeForRegex = rangeForRegex.substring(0, index);
+
+            // if range ends with an extension key, truncate it.
+            index = rangeForRegex.lastIndexOf('-');
+            if (index >= 0 && index == rangeForRegex.length() - 2) {
+                rangeForRegex
+                        = rangeForRegex.substring(0, rangeForRegex.length() - 2);
+            }
+        } else {
+            rangeForRegex = "";
+        }
+
+        return rangeForRegex;
+    }
+
+    /* Returns the split index of the priority list, if it contains
+     * language range(s) with quality weight as 0 i.e. q=0, else -1
+     */
+    private static int splitRanges(List<LanguageRange> priorityList) {
+        int size = priorityList.size();
+        for (int index = 0; index < size; index++) {
+            LanguageRange range = priorityList.get(index);
+            if (range.getWeight() == 0) {
+                return index;
+            }
+        }
+
+        return -1; // no q=0 range exists
+    }
+
     public static List<LanguageRange> parse(String ranges) {
         ranges = ranges.replaceAll(" ", "").toLowerCase(Locale.ROOT);
         if (ranges.startsWith("accept-language:")) {
--- a/src/java.base/solaris/lib/security/default.policy	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.base/solaris/lib/security/default.policy	Fri Aug 05 10:23:28 2016 -0700
@@ -11,6 +11,6 @@
                    "clearProviderProperties.OracleUcrypto";
     permission java.security.SecurityPermission
                    "removeProviderProperty.OracleUcrypto";
-    permission java.io.FilePermission
-                   "${java.home}/conf/security/ucrypto-solaris.cfg", "read";
+    // Needed for reading Ucrypto config file
+    permission java.io.FilePermission "<<ALL FILES>>", "read";
 };
--- a/src/java.base/unix/native/libjava/TimeZone_md.c	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.base/unix/native/libjava/TimeZone_md.c	Fri Aug 05 10:23:28 2016 -0700
@@ -44,6 +44,12 @@
 
 #define SKIP_SPACE(p)   while (*p == ' ' || *p == '\t') p++;
 
+#define RESTARTABLE(_cmd, _result) do { \
+  do { \
+    _result = _cmd; \
+  } while((_result == -1) && (errno == EINTR)); \
+} while(0)
+
 #if defined(_ALLBSD_SOURCE)
 #define dirent64 dirent
 #define readdir64_r readdir_r
@@ -121,6 +127,7 @@
     int fd = -1;
     char *dbuf = NULL;
     char *tz = NULL;
+    int res;
 
     dirp = opendir(dir);
     if (dirp == NULL) {
@@ -161,7 +168,8 @@
         if (pathname == NULL) {
             break;
         }
-        if (stat(pathname, &statbuf) == -1) {
+        RESTARTABLE(stat(pathname, &statbuf), res);
+        if (res == -1) {
             break;
         }
 
@@ -175,10 +183,12 @@
             if (dbuf == NULL) {
                 break;
             }
-            if ((fd = open(pathname, O_RDONLY)) == -1) {
+            RESTARTABLE(open(pathname, O_RDONLY), fd);
+            if (fd == -1) {
                 break;
             }
-            if (read(fd, dbuf, size) != (ssize_t) size) {
+            RESTARTABLE(read(fd, dbuf, size), res);
+            if (res != (ssize_t) size) {
                 break;
             }
             if (memcmp(buf, dbuf, size) == 0) {
@@ -230,6 +240,7 @@
     int fd;
     char *buf;
     size_t size;
+    int res;
 
 #if defined(__linux__)
     /*
@@ -260,7 +271,8 @@
     /*
      * Next, try /etc/localtime to find the zone ID.
      */
-    if (lstat(DEFAULT_ZONEINFO_FILE, &statbuf) == -1) {
+    RESTARTABLE(lstat(DEFAULT_ZONEINFO_FILE, &statbuf), res);
+    if (res == -1) {
         return NULL;
     }
 
@@ -294,10 +306,13 @@
      * If initial symbolic link resolution failed, we should treat target
      * file as a regular file.
      */
-    if ((fd = open(DEFAULT_ZONEINFO_FILE, O_RDONLY)) == -1) {
+    RESTARTABLE(open(DEFAULT_ZONEINFO_FILE, O_RDONLY), fd);
+    if (fd == -1) {
         return NULL;
     }
-    if (fstat(fd, &statbuf) == -1) {
+
+    RESTARTABLE(fstat(fd, &statbuf), res);
+    if (res == -1) {
         (void) close(fd);
         return NULL;
     }
@@ -308,7 +323,8 @@
         return NULL;
     }
 
-    if (read(fd, buf, size) != (ssize_t) size) {
+    RESTARTABLE(read(fd, buf, size), res);
+    if (res != (ssize_t) size) {
         (void) close(fd);
         free((void *) buf);
         return NULL;
@@ -372,7 +388,8 @@
     /*
      * It assumes read open.
      */
-    if ((fd = open(fname, O_RDONLY)) == -1) {
+    RESTARTABLE(open(fname, O_RDONLY), fd);
+    if (fd == -1) {
         return NULL;
     }
 
@@ -420,7 +437,8 @@
         if (iop->ptr == iop->endptr) {
             ssize_t len;
 
-            if ((len = read(iop->fd, (void *)iop->buffer, BUFFER_SIZE)) == -1) {
+            RESTARTABLE(read(iop->fd, (void *)iop->buffer, BUFFER_SIZE), len);
+            if (len == -1) {
                 return NULL;
             }
             if (len == 0) {
@@ -558,6 +576,7 @@
     size_t size;
     char *buf;
     int fd;
+    int res;
     /* scf specific variables */
     scf_handle_t *h = NULL;
     scf_snapshot_t *snap = NULL;
@@ -593,7 +612,8 @@
     }
     cleanupScf(h, snap, inst, pg, prop, val, tz);
 
-    if (stat(DEFAULT_ZONEINFO_FILE, &statbuf) == -1) {
+    RESTARTABLE(stat(DEFAULT_ZONEINFO_FILE, &statbuf), res);
+    if (res == -1) {
         return NULL;
     }
     size = (size_t) statbuf.st_size;
@@ -601,12 +621,14 @@
     if (buf == NULL) {
         return NULL;
     }
-    if ((fd = open(DEFAULT_ZONEINFO_FILE, O_RDONLY)) == -1) {
+    RESTARTABLE(open(DEFAULT_ZONEINFO_FILE, O_RDONLY), fd);
+    if (fd == -1) {
         free((void *) buf);
         return NULL;
     }
 
-    if (read(fd, buf, size) != (ssize_t) size) {
+    RESTARTABLE(read(fd, buf, size), res);
+    if (res != (ssize_t) size) {
         (void) close(fd);
         free((void *) buf);
         return NULL;
--- a/src/java.desktop/share/classes/javax/swing/event/TableModelEvent.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.desktop/share/classes/javax/swing/event/TableModelEvent.java	Fri Aug 05 10:23:28 2016 -0700
@@ -177,7 +177,7 @@
      * @param lastRow  the last row affected by this event
      * @param column the column index of cells changed; {@code ALL_COLUMNS}
      *        signifies all cells in the specified range of rows are changed.
-     * @param type the type of change signified by this even, @code INSERT},
+     * @param type the type of change signified by this even, {@code INSERT},
      *        {@code DELETE } or {@code UPDATE}
      */
     public TableModelEvent(TableModel source, int firstRow, int lastRow, int column, int type) {
--- a/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java	Fri Aug 05 10:23:28 2016 -0700
@@ -297,7 +297,7 @@
      * If {@code lw1} and {@code lw2} are both greater than zero, then
      * the parallelogram figure is doubled by both expanding and contracting
      * each delta vector by its corresponding {@code lw} value.
-     * If either (@code lw1) or {@code lw2} are also greater than 1, then
+     * If either {@code lw1} or {@code lw2} are also greater than 1, then
      * the inner (contracted) parallelogram disappears and the figure is
      * simply a single expanded parallelogram.
      * The {@code clip} parameter specifies the current clip in effect
--- a/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Fri Aug 05 10:23:28 2016 -0700
@@ -395,7 +395,7 @@
     public void dispose() throws GSSException;
 
     /**
-     * Return the mechanism-specific attribute associated with (@code type}.
+     * Return the mechanism-specific attribute associated with {@code type}.
      *
      * @param type the type of the attribute requested
      * @return the attribute
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Fri Aug 05 10:23:28 2016 -0700
@@ -34,6 +34,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.UncheckedIOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.UncheckedIOException;
@@ -55,11 +56,11 @@
 import java.util.Properties;
 import java.util.Set;
 import jdk.tools.jlink.internal.BasicImageWriter;
-import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin.SymImageFile;
 import jdk.tools.jlink.internal.ExecutableImage;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.ResourcePoolModule;
 import jdk.tools.jlink.plugin.PluginException;
 
 /**
@@ -144,14 +145,12 @@
         Files.createDirectories(mdir);
     }
 
-    private void storeFiles(Set<String> modules, Map<String, String> release) throws IOException {
+    private void storeFiles(Set<String> modules, Properties release) throws IOException {
         if (release != null) {
-            Properties props = new Properties();
-            props.putAll(release);
-            addModules(props, modules);
+            addModules(release, modules);
             File r = new File(root.toFile(), "release");
             try (FileOutputStream fo = new FileOutputStream(r)) {
-                props.store(fo, null);
+                release.store(fo, null);
             }
         }
     }
@@ -184,14 +183,10 @@
             files.moduleView().modules().forEach(m -> {
                 // Only add modules that contain packages
                 if (!m.packages().isEmpty()) {
-                    // Skip the fake module used by FileCopierPlugin when copying files.
-                    if (m.name().equals(FileCopierPlugin.FAKE_MODULE)) {
-                        return;
-                    }
                     modules.add(m.name());
                 }
             });
-            storeFiles(modules, files.releaseProperties());
+            storeFiles(modules, releaseProperties(files));
 
             if (Files.getFileStore(root).supportsFileAttributeView(PosixFileAttributeView.class)) {
                 // launchers in the bin directory need execute permission
@@ -219,6 +214,28 @@
         }
     }
 
+    private Properties releaseProperties(ResourcePool pool) throws IOException {
+        Properties props = new Properties();
+        Optional<ResourcePoolModule> javaBase = pool.moduleView().findModule("java.base");
+        javaBase.ifPresent(mod -> {
+            // fill release information available from transformed "java.base" module!
+            ModuleDescriptor desc = mod.descriptor();
+            desc.osName().ifPresent(s -> props.setProperty("OS_NAME", s));
+            desc.osVersion().ifPresent(s -> props.setProperty("OS_VERSION", s));
+            desc.osArch().ifPresent(s -> props.setProperty("OS_ARCH", s));
+            props.setProperty("JAVA_VERSION", System.getProperty("java.version"));
+        });
+
+        Optional<ResourcePoolEntry> release = pool.findEntry("/java.base/release");
+        if (release.isPresent()) {
+            try (InputStream is = release.get().content()) {
+                props.load(is);
+            }
+        }
+
+        return props;
+    }
+
     /**
      * Generates launcher scripts.
      *
@@ -317,6 +334,8 @@
                 case CONFIG:
                     writeEntry(in, destFile("conf", filename));
                     break;
+                case TOP:
+                    break;
                 case OTHER:
                     if (file instanceof SymImageFile) {
                         SymImageFile sym = (SymImageFile) file;
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java	Fri Aug 05 10:23:28 2016 -0700
@@ -279,6 +279,8 @@
         private class LastModule implements ResourcePoolModule {
 
             final ResourcePoolModule module;
+            // lazily initialized
+            ModuleDescriptor descriptor;
 
             LastModule(ResourcePoolModule module) {
                 this.module = module;
@@ -297,7 +299,10 @@
 
             @Override
             public ModuleDescriptor descriptor() {
-                return module.descriptor();
+                if (descriptor == null) {
+                    descriptor = ResourcePoolManager.readModuleDescriptor(this);
+                }
+                return descriptor;
             }
 
             @Override
@@ -420,11 +425,6 @@
             return pool.byteOrder();
         }
 
-        @Override
-        public Map<String, String> releaseProperties() {
-            return pool.releaseProperties();
-        }
-
         private ResourcePoolEntry getUncompressed(ResourcePoolEntry res) {
             if (res != null) {
                 if (res instanceof ResourcePoolManager.CompressedModuleData) {
@@ -458,18 +458,6 @@
             throws Exception {
         Objects.requireNonNull(original);
         Objects.requireNonNull(transformed);
-        Optional<ResourcePoolModule> javaBase = transformed.moduleView().findModule("java.base");
-        javaBase.ifPresent(mod -> {
-            try {
-                Map<String, String> release = transformed.releaseProperties();
-                // fill release information available from transformed "java.base" module!
-                ModuleDescriptor desc = mod.descriptor();
-                desc.osName().ifPresent(s -> release.put("OS_NAME", s));
-                desc.osVersion().ifPresent(s -> release.put("OS_VERSION", s));
-                desc.osArch().ifPresent(s -> release.put("OS_ARCH", s));
-            } catch (Exception ignored) {}
-        });
-
         imageBuilder.storeFiles(new LastPoolManager(transformed).resourcePool());
     }
 
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java	Fri Aug 05 10:23:28 2016 -0700
@@ -50,10 +50,22 @@
  * A manager for pool of resources.
  */
 public class ResourcePoolManager {
+    // utility to read ModuleDescriptor of the given ResourcePoolModule
+    static ModuleDescriptor readModuleDescriptor(ResourcePoolModule mod) {
+        String p = "/" + mod.name() + "/module-info.class";
+        Optional<ResourcePoolEntry> content = mod.findEntry(p);
+        if (!content.isPresent()) {
+              throw new PluginException("No module-info for " + mod.name()
+                      + " module");
+        }
+        ByteBuffer bb = ByteBuffer.wrap(content.get().contentBytes());
+        return ModuleDescriptor.read(bb);
+    }
 
     class ResourcePoolModuleImpl implements ResourcePoolModule {
 
         final Map<String, ResourcePoolEntry> moduleContent = new LinkedHashMap<>();
+        // lazily initialized
         private ModuleDescriptor descriptor;
         final String name;
 
@@ -80,14 +92,7 @@
         @Override
         public ModuleDescriptor descriptor() {
             if (descriptor == null) {
-                String p = "/" + name + "/module-info.class";
-                Optional<ResourcePoolEntry> content = findEntry(p);
-                if (!content.isPresent()) {
-                    throw new PluginException("No module-info for " + name
-                            + " module");
-                }
-                ByteBuffer bb = ByteBuffer.wrap(content.get().contentBytes());
-                descriptor = ModuleDescriptor.read(bb);
+                descriptor = readModuleDescriptor(this);
             }
             return descriptor;
         }
@@ -166,11 +171,6 @@
             return ResourcePoolManager.this.byteOrder();
         }
 
-        @Override
-        public Map<String, String> releaseProperties() {
-            return ResourcePoolManager.this.releaseProperties();
-        }
-
         public StringTable getStringTable() {
             return ResourcePoolManager.this.getStringTable();
         }
@@ -213,8 +213,6 @@
 
     private final Map<String, ResourcePoolEntry> resources = new LinkedHashMap<>();
     private final Map<String, ResourcePoolModule> modules = new LinkedHashMap<>();
-    private final ResourcePoolModuleImpl fileCopierModule = new ResourcePoolModuleImpl(FileCopierPlugin.FAKE_MODULE);
-    private Map<String, String> releaseProps = new HashMap<>();
     private final ByteOrder order;
     private final StringTable table;
     private final ResourcePool poolImpl;
@@ -273,11 +271,6 @@
         }
         String modulename = data.moduleName();
         ResourcePoolModuleImpl m = (ResourcePoolModuleImpl)modules.get(modulename);
-        // ## TODO: FileCopierPlugin should not add content to a module
-        // FAKE_MODULE is not really a module to be added in the image
-        if (FileCopierPlugin.FAKE_MODULE.equals(modulename)) {
-            m = fileCopierModule;
-        }
         if (m == null) {
             m = new ResourcePoolModuleImpl(modulename);
             modules.put(modulename, m);
@@ -391,10 +384,6 @@
         return order;
     }
 
-    public Map<String, String> releaseProperties() {
-        return releaseProps;
-    }
-
     public StringTable getStringTable() {
         return table;
     }
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Fri Aug 05 10:23:28 2016 -0700
@@ -38,6 +38,7 @@
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolModule;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.PluginException;
 
@@ -98,9 +99,8 @@
      * e.g.: /java.base/native/amd64/server/libjvm.so
      * /java.base/native/server/libjvm.dylib
      */
-    private List<ResourcePoolEntry> getVMs(ResourcePool in) {
-        String jvmlib = jvmlib();
-        List<ResourcePoolEntry> ret = in.moduleView().findModule("java.base").get().entries().filter((t) -> {
+    private List<ResourcePoolEntry> getVMs(ResourcePoolModule javaBase, String jvmlib) {
+        List<ResourcePoolEntry> ret = javaBase.entries().filter((t) -> {
             return t.path().endsWith("/" + jvmlib);
         }).collect(Collectors.toList());
         return ret;
@@ -108,12 +108,13 @@
 
     @Override
     public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
-        String jvmlib = jvmlib();
+        ResourcePoolModule javaBase = in.moduleView().findModule("java.base").get();
+        String jvmlib = jvmlib(javaBase.descriptor().osName().get());
         TreeSet<Jvm> existing = new TreeSet<>(new JvmComparator());
         TreeSet<Jvm> removed = new TreeSet<>(new JvmComparator());
         if (!keepAll) {
             // First retrieve all available VM names and removed VM
-            List<ResourcePoolEntry> jvms = getVMs(in);
+            List<ResourcePoolEntry> jvms = getVMs(javaBase, jvmlib);
             for (Jvm jvm : Jvm.values()) {
                 for (ResourcePoolEntry md : jvms) {
                     if (md.path().endsWith("/" + jvm.getName() + "/" + jvmlib)) {
@@ -247,21 +248,21 @@
         return orig.copyWithContent(content);
     }
 
-    private static String jvmlib() {
+    private static String jvmlib(String osName) {
         String lib = "libjvm.so";
-        if (isWindows()) {
+        if (isWindows(osName)) {
             lib = "jvm.dll";
-        } else if (isMac()) {
+        } else if (isMac(osName)) {
             lib = "libjvm.dylib";
         }
         return lib;
     }
 
-    private static boolean isWindows() {
-        return System.getProperty("os.name").startsWith("Windows");
+    private static boolean isWindows(String osName) {
+        return osName.startsWith("Windows");
     }
 
-    private static boolean isMac() {
-        return System.getProperty("os.name").startsWith("Mac OS");
+    private static boolean isMac(String osName) {
+        return osName.startsWith("Mac OS") || osName.startsWith("Darwin");
     }
 }
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java	Fri Aug 05 10:23:28 2016 -0700
@@ -58,8 +58,6 @@
         Path source;
         Path target;
     }
-    public static final String FAKE_MODULE = "$jlink-file-copier";
-
     private final List<CopiedFile> files = new ArrayList<>();
 
     /**
@@ -159,7 +157,7 @@
         Objects.requireNonNull(file);
         Objects.requireNonNull(path);
         ResourcePoolEntry impl = ResourcePoolEntry.create(
-                "/" + FAKE_MODULE + "/other/" + path,
+                "/java.base/other/" + path,
                 ResourcePoolEntry.Type.OTHER, file);
         try {
             pool.add(impl);
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Fri Aug 05 10:23:28 2016 -0700
@@ -31,6 +31,7 @@
 import java.util.Locale;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Optional;
 import static java.util.ResourceBundle.Control;
 import java.util.Set;
@@ -342,9 +343,8 @@
                     // locales from the pre-filtered list.
                     locales.stream()
                         .filter(l -> l.toString().equalsIgnoreCase(loc.toString()))
-                        .findAny()
-                        .orElse(Locale.ROOT))
-                .filter(loc -> !loc.equals(Locale.ROOT))
+                        .findAny())
+                .flatMap(Optional::stream)
                 .flatMap(IncludeLocalesPlugin::localeToTags)
                 .distinct()
                 .collect(Collectors.toList());
@@ -373,40 +373,42 @@
     }
 
     private static Stream<String> localeToTags(Locale loc) {
+        Objects.requireNonNull(loc);
+
         String tag = loc.toLanguageTag();
-        Stream<String> ret = null;
+        List<String> tags = null;
 
         switch (loc.getLanguage()) {
             // ISO3166 compatibility
             case "iw":
-                ret = List.of(tag, tag.replaceFirst("^he", "iw")).stream();
+                tags = List.of(tag, tag.replaceFirst("^he", "iw"));
                 break;
             case "in":
-                ret = List.of(tag, tag.replaceFirst("^id", "in")).stream();
+                tags = List.of(tag, tag.replaceFirst("^id", "in"));
                 break;
             case "ji":
-                ret = List.of(tag, tag.replaceFirst("^yi", "ji")).stream();
+                tags = List.of(tag, tag.replaceFirst("^yi", "ji"));
                 break;
 
             // Special COMPAT provider locales
             case "ja":
                 if (loc.getCountry() == "JP") {
-                    ret = List.of(tag, jaJPJPTag).stream();
+                    tags = List.of(tag, jaJPJPTag);
                 }
                 break;
             case "no":
             case "nn":
                 if (loc.getCountry() == "NO") {
-                    ret = List.of(tag, noNONYTag).stream();
+                    tags = List.of(tag, noNONYTag);
                 }
                 break;
             case "th":
                 if (loc.getCountry() == "TH") {
-                    ret = List.of(tag, thTHTHTag).stream();
+                    tags = List.of(tag, thTHTHTag);
                 }
                 break;
         }
 
-        return ret == null ? List.of(tag).stream() : ret;
+        return tags == null ? List.of(tag).stream() : tags.stream();
     }
 }
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java	Fri Aug 05 10:23:28 2016 -0700
@@ -24,17 +24,23 @@
  */
 package jdk.tools.jlink.internal.plugins;
 
+import java.io.ByteArrayOutputStream;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.lang.module.ModuleDescriptor;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Properties;
 import java.util.Set;
 import java.util.function.Function;
 import jdk.tools.jlink.internal.Utils;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.ResourcePoolModule;
 import jdk.tools.jlink.plugin.Plugin.Category;
 import jdk.tools.jlink.plugin.Plugin.State;
 import jdk.tools.jlink.plugin.Plugin;
@@ -119,7 +125,23 @@
 
     @Override
     public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
-        in.releaseProperties().putAll(release);
-        return in;
+        in.transformAndCopy(Function.identity(), out);
+
+        // create a TOP level ResourcePoolEntry for "release" file.
+        out.add(ResourcePoolEntry.create("/java.base/release",
+            ResourcePoolEntry.Type.TOP, releaseFileContent()));
+        return out.build();
+    }
+
+    private byte[] releaseFileContent() {
+        Properties props = new Properties();
+        props.putAll(release);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try {
+            props.store(baos, "");
+            return baos.toByteArray();
+        } catch (IOException ex) {
+            throw new UncheckedIOException(ex);
+        }
     }
 }
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePool.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePool.java	Fri Aug 05 10:23:28 2016 -0700
@@ -95,13 +95,6 @@
     public ByteOrder byteOrder();
 
     /**
-     * Release properties such as OS, CPU name, version etc.
-     *
-     * @return the release properties
-     */
-    public Map<String, String> releaseProperties();
-
-    /**
      * Visit each ResourcePoolEntry in this ResourcePool to transform it and copy
      * the transformed ResourcePoolEntry to the output ResourcePoolBuilder.
      *
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolEntry.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolEntry.java	Fri Aug 05 10:23:28 2016 -0700
@@ -41,6 +41,7 @@
  * <ul>
  * <li>For jimage content: /{module name}/{package1}/.../{packageN}/{file
  * name}</li>
+ * <li>For top-level files:/{module name}/{file name}</li>
  * <li>For other files (shared lib, launchers, config, ...):/{module name}/
  * {@literal bin|conf|native}/{dir1}/.../{dirN}/{file name}</li>
  * </ul>
@@ -54,6 +55,7 @@
      * <ul>CONFIG: A configuration file.</ul>
      * <ul>NATIVE_CMD: A native process launcher.</ul>
      * <ul>NATIVE_LIB: A native library.</ul>
+     * <ul>TOP: A top-level file in the jdk run-time image directory.</ul>
      * <ul>OTHER: Other kind of file.</ul>
      * </li>
      */
@@ -62,6 +64,7 @@
         CONFIG,
         NATIVE_CMD,
         NATIVE_LIB,
+        TOP,
         OTHER
     }
 
--- a/test/ProblemList.txt	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/ProblemList.txt	Fri Aug 05 10:23:28 2016 -0700
@@ -315,7 +315,7 @@
 
 ############################################################################
 
-# jdk_tools
+# core_tools
 
 tools/pack200/CommandLineTests.java                             7143279,8059906 generic-all
 
@@ -365,20 +365,14 @@
 
 sun/tools/jcmd/TestJcmdSanity.java                              8031482 windows-all
 
-sun/tools/jmap/heapconfig/JMapHeapConfigTest.java               8072131,8132452 generic-all
-
 sun/tools/jstatd/TestJstatdExternalRegistry.java                8046285 generic-all
 
 sun/tools/jps/TestJpsJar.java                                   8160923 generic-all
 
 sun/tools/jps/TestJpsJarRelative.java                           6456333 generic-all
 
-sun/tools/jinfo/JInfoRunningProcessFlagTest.java                6734748 generic-all
-
 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java    8057732 generic-all
 
-sun/tools/jinfo/JInfoSanityTest.java                            8059035 generic-all
-
 demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java       8151899 generic-all
 
 ############################################################################
@@ -388,9 +382,3 @@
 com/sun/jndi/ldap/DeadSSLLdapTimeoutTest.java                   8141370 linux-i586,macosx-all
 
 ############################################################################
-
-# core_tools
-
-tools/jlink/JLinkOptimTest.java                                 8159264 generic-all
-
-############################################################################
--- a/test/TEST.groups	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/TEST.groups	Fri Aug 05 10:23:28 2016 -0700
@@ -27,7 +27,6 @@
 
 tier1 = \
     :jdk_lang \
-    -java/lang/ProcessBuilder/Zombies.java \
     :jdk_util \
     -java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
     -java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
@@ -38,7 +37,6 @@
     tools/pack200
 
 tier2 = \
-    java/lang/ProcessBuilder/Zombies.java \
     java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
     java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
     :jdk_io \
--- a/test/java/lang/ProcessBuilder/Zombies.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/java/lang/ProcessBuilder/Zombies.java	Fri Aug 05 10:23:28 2016 -0700
@@ -23,7 +23,8 @@
 
 /*
  * @test
- * @bug 6474073
+ * @run main/othervm Zombies
+ * @bug 6474073 6180151
  * @key intermittent
  * @summary Make sure zombies don't get created on Unix
  * @author Martin Buchholz
@@ -65,22 +66,21 @@
 
         Process p = rt.exec(TrueCommand);
         ProcessHandle pp = p.toHandle().parent().orElse(null);
-        System.out.printf("pid: %d, parent: %s%n", p.getPid(), pp);
+        System.out.printf("%s pid: %d, parent: %s%n", TrueCommand, p.getPid(), pp);
         p.waitFor();
 
         // Count all the zombies that are children of this Java process
         final String[] zombieCounter = {
             "/usr/bin/perl", "-e",
-            "exit @{[`/bin/ps -eo ppid,s` =~ /^ *@{[getppid]} +Z$/mog]}"
+                "$a=`/bin/ps -eo ppid,pid,s,command`;" +
+                        "print @b=$a=~/^ *@{[getppid]} +[0-9]+ +Z.*$/mog;" +
+                        "exit @b"
         };
 
-        int zombies = rt.exec(zombieCounter).waitFor();
+        ProcessBuilder pb = new ProcessBuilder(zombieCounter);
+        pb.inheritIO();
+        int zombies = pb.start().waitFor();
         if (zombies != 0) {
-            // Log remaining processes
-            ProcessBuilder pb = new ProcessBuilder("/bin/ps", "-ef");
-            pb.inheritIO();
-            Process p2 = pb.start();
-            p2.waitFor();
             throw new Error(zombies + " zombies!");
         }
     }
--- a/test/java/lang/Runtime/exec/LotsOfOutput.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/java/lang/Runtime/exec/LotsOfOutput.java	Fri Aug 05 10:23:28 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
  * @test
  * @bug 4369826 8078582
  * @summary Process with lots of output should not crash VM
- * @key intermittent
  * @author kladko
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/annotation/AnnotationToStringTest.java	Fri Aug 05 10:23:28 2016 -0700
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8162817
+ * @summary Test of toString on normal annotations
+ */
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+/**
+ * The expected string values are stored in @ExpectedString
+ * annotations. The essence of the test is comparing the toString()
+ * result of annotations to the corresponding ExpectedString.value().
+ */
+
+public class AnnotationToStringTest {
+    public static void main(String... args) throws Exception {
+        int failures = 0;
+
+        failures += check(PrimHost.class.getAnnotation(ExpectedString.class).value(),
+                          PrimHost.class.getAnnotation(MostlyPrimitive.class).toString());
+        failures += classyTest();
+        failures += arrayAnnotationTest();
+
+        if (failures > 0)
+            throw new RuntimeException(failures + " failures");
+    }
+
+    private static int check(String expected, String actual) {
+        if (!expected.equals(actual)) {
+            System.err.printf("ERROR: Expected ''%s'';%ngot             ''%s''.\n",
+                              expected, actual);
+            return 1;
+        } else
+            return 0;
+    }
+
+    @ExpectedString(
+        "@MostlyPrimitive(c0='a', "+
+        "c1='\\'', " +
+        "i0=1, " +
+        "i1=2, " +
+        "f0=1.0f, " +
+        "f1=0.0f/0.0f, " +
+        "d0=0.0, " +
+        "d1=1.0/0.0, " +
+        "l0=5, " +
+        "l1=9223372036854775807L, " +
+        "s0=\"Hello world.\", " +
+        "s1=\"a\\\"b\", " +
+        "class0=Obj[].class)")
+    @MostlyPrimitive(
+        c0='a',
+        c1='\'',
+        i0=1,
+        i1=2,
+        f0=1.0f,
+        f1=Float.NaN,
+        d0=0.0,
+        d1=2.0/0.0,
+        l0=5,
+        l1=Long.MAX_VALUE,
+        s0="Hello world.",
+        s1="a\"b",
+        class0=Obj[].class
+    )
+    static class PrimHost{}
+
+    private static int classyTest() {
+        int failures = 0;
+        for (Field f : AnnotationHost.class.getFields()) {
+            Annotation a = f.getAnnotation(Classy.class);
+            System.out.println(a);
+            failures += check(f.getAnnotation(ExpectedString.class).value(),
+                              a.toString());
+        }
+        return failures;
+    }
+
+    static class AnnotationHost {
+        @ExpectedString(
+       "@Classy(value=Obj.class)")
+        @Classy(value=Obj.class)
+        public int f0;
+
+        @ExpectedString(
+       "@Classy(value=Obj[].class)")
+        @Classy(value=Obj[].class)
+        public int f1;
+
+        @ExpectedString(
+       "@Classy(value=Obj[][].class)")
+        @Classy(value=Obj[][].class)
+        public int f2;
+
+        @ExpectedString(
+       "@Classy(value=Obj[][][].class)")
+        @Classy(value=Obj[][][].class)
+        public int f3;
+
+        @ExpectedString(
+       "@Classy(value=int.class)")
+        @Classy(value=int.class)
+        public int f4;
+
+        @ExpectedString(
+       "@Classy(value=int[][][].class)")
+        @Classy(value=int[][][].class)
+        public int f5;
+    }
+
+    /**
+     * Each field should have two annotations, the first being
+     * @ExpectedString and the second the annotation under test.
+     */
+    private static int arrayAnnotationTest() {
+        int failures = 0;
+        for (Field f : ArrayAnnotationHost.class.getFields()) {
+            Annotation[] annotations = f.getAnnotations();
+            System.out.println(annotations[1]);
+            failures += check(((ExpectedString)annotations[0]).value(),
+                              annotations[1].toString());
+        }
+        return failures;
+    }
+
+    static class ArrayAnnotationHost {
+        @ExpectedString(
+       "@BooleanArray(value={true, false, true})")
+        @BooleanArray(value={true, false, true})
+        public boolean[]   f0;
+
+        @ExpectedString(
+       "@FloatArray(value={3.0f, 4.0f, 0.0f/0.0f, -1.0f/0.0f, 1.0f/0.0f})")
+        @FloatArray(value={3.0f, 4.0f, Float.NaN, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY})
+        public float[]     f1;
+
+        @ExpectedString(
+       "@DoubleArray(value={1.0, 2.0, 0.0/0.0, 1.0/0.0, -1.0/0.0})")
+        @DoubleArray(value={1.0, 2.0, Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY,})
+        public double[]    f2;
+
+        @ExpectedString(
+       "@ByteArray(value={10, 11, 12})")
+        @ByteArray(value={10, 11, 12})
+        public byte[]      f3;
+
+        @ExpectedString(
+       "@ShortArray(value={0, 4, 5})")
+        @ShortArray(value={0, 4, 5})
+        public short[]     f4;
+
+        @ExpectedString(
+       "@CharArray(value={'a', 'b', 'c', '\\''})")
+        @CharArray(value={'a', 'b', 'c', '\''})
+        public char[]      f5;
+
+        @ExpectedString(
+       "@IntArray(value={1})")
+        @IntArray(value={1})
+        public int[]       f6;
+
+        @ExpectedString(
+       "@LongArray(value={-2147483647, 2147483648L, 9223372036854775807L})")
+        @LongArray(value={-Integer.MAX_VALUE, Integer.MAX_VALUE+1L, Long.MAX_VALUE})
+        public long[]      f7;
+
+        @ExpectedString(
+       "@StringArray(value={\"A\", \"B\", \"C\", \"\\\"Quote\\\"\"})")
+        @StringArray(value={"A", "B", "C", "\"Quote\""})
+        public String[]    f8;
+
+        @ExpectedString(
+       "@ClassArray(value={int.class, Obj[].class})")
+        @ClassArray(value={int.class, Obj[].class})
+        public Class<?>[]  f9;
+
+        @ExpectedString(
+       "@EnumArray(value={SOURCE})")
+        @EnumArray(value={RetentionPolicy.SOURCE})
+        public RetentionPolicy[]  f10;
+    }
+}
+
+// ------------ Supporting types ------------
+
+class Obj {}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ExpectedString {
+    String value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Classy {
+    Class<?> value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface BooleanArray {
+    boolean[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface FloatArray {
+    float[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface DoubleArray {
+    double[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ByteArray {
+    byte[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ShortArray {
+    short[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface CharArray {
+    char[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface IntArray {
+    int[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface LongArray {
+    long[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ClassArray {
+    Class<?>[] value() default {int.class, Obj[].class};
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface StringArray {
+    String[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface EnumArray {
+    RetentionPolicy[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface MostlyPrimitive {
+    char   c0();
+    char   c1();
+    int    i0();
+    int    i1();
+    float  f0();
+    float  f1();
+    double d0();
+    double d1();
+    long   l0();
+    long   l1();
+    String s0();
+    String s1();
+    Class<?> class0();
+}
--- a/test/java/lang/annotation/ParameterAnnotations.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/java/lang/annotation/ParameterAnnotations.java	Fri Aug 05 10:23:28 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6761678
+ * @bug 6761678 8162817
  * @summary Check properties of Annotations returned from
  * getParameterAnnotations, including freedom from security
  * exceptions.
@@ -89,8 +89,8 @@
                 equal(ann.length, 2);
                 Annotation foo = ann[0][0];
                 Annotation bar = ann[1][0];
-                equal(foo.toString(), "@Named(value=foo)");
-                equal(bar.toString(), "@Named(value=bar)");
+                equal(foo.toString(), "@Named(value=\"foo\")");
+                equal(bar.toString(), "@Named(value=\"bar\")");
                 check(foo.equals(foo));
                 check(! foo.equals(bar));
             }
--- a/test/java/nio/file/WatchService/DeleteInterference.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/java/nio/file/WatchService/DeleteInterference.java	Fri Aug 05 10:23:28 2016 -0700
@@ -38,6 +38,7 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 
+import static java.lang.System.out;
 import static java.nio.file.StandardWatchEventKinds.*;
 
 public class DeleteInterference {
@@ -66,22 +67,28 @@
     private static void openAndCloseWatcher(Path dir) {
         FileSystem fs = FileSystems.getDefault();
         for (int i = 0; i < ITERATIONS_COUNT; i++) {
+            out.printf("open %d begin%n", i);
             try (WatchService watcher = fs.newWatchService()) {
                 dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
             } catch (IOException ioe) {
                 // ignore
+            } finally {
+                out.printf("open %d end%n", i);
             }
         }
     }
 
     private static void deleteAndRecreateDirectory(Path dir) {
         for (int i = 0; i < ITERATIONS_COUNT; i++) {
+            out.printf("del %d begin%n", i);
             try {
                 deleteFileTree(dir);
                 Path subdir = Files.createDirectories(dir.resolve("subdir"));
                 Files.createFile(subdir.resolve("test"));
             } catch (IOException ioe) {
                 // ignore
+            } finally {
+                out.printf("del %d end%n", i);
             }
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/Locale/Bug8035133.java	Fri Aug 05 10:23:28 2016 -0700
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 8035133
+ * @summary Checks that the tags matching the range with quality weight q=0
+ *          e.g. en;q=0 must be elimited and must not be the part of output
+ */
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+
+public class Bug8035133 {
+
+    private static boolean err = false;
+
+    public static void main(String[] args) {
+
+        // checking Locale.lookup with de-ch;q=0
+        checkLookup("en;q=0.1, *-ch;q=0.5, de-ch;q=0",
+                "de-ch, en, fr-ch", "fr-CH");
+
+        /* checking Locale.lookup with *;q=0 '*' should be ignored
+         * in lookup
+         */
+        checkLookup("en;q=0.1, *-ch;q=0.5, *;q=0",
+                "de-ch, en, fr-ch", "de-CH");
+
+        // checking Locale.filter with fr-ch;q=0 in BASIC_FILTERING
+        checkFilter("en;q=0.1, fr-ch;q=0.0, de-ch;q=0.5",
+                "de-ch, en, fr-ch", "de-CH, en");
+
+        // checking Locale.filter with *;q=0 in BASIC_FILTERING
+        checkFilter("de-ch;q=0.6, *;q=0", "de-ch, fr-ch", "");
+
+        // checking Locale.filter with *;q=0 in BASIC_FILTERING
+        checkFilter("de-ch;q=0.6, de;q=0", "de-ch", "");
+
+        // checking Locale.filter with *;q=0.6, en;q=0 in BASIC_FILTERING
+        checkFilter("*;q=0.6, en;q=0", "de-ch, hi-in, en", "de-CH, hi-IN");
+
+        // checking Locale.filter with de-ch;q=0 in EXTENDED_FILTERING
+        checkFilter("en;q=0.1, *-ch;q=0.5, de-ch;q=0",
+                "de-ch, en, fr-ch", "fr-CH, en");
+
+        /* checking Locale.filter with *-ch;q=0 in EXTENDED_FILTERING which
+         * must make filter to return "" empty or no match
+         */
+        checkFilter("de-ch;q=0.5, *-ch;q=0", "de-ch, fr-ch", "");
+
+        /* checking Locale.filter with *;q=0 in EXTENDED_FILTERING which
+         * must make filter to return "" empty or no match
+         */
+        checkFilter("*-ch;q=0.5, *;q=0", "de-ch, fr-ch", "");
+
+        /* checking Locale.filter with *;q=0.6, *-Latn;q=0 in
+         * EXTENDED_FILTERING
+         */
+        checkFilter("*;q=0.6, *-Latn;q=0", "de-ch, hi-in, en-Latn",
+                "de-CH, hi-IN");
+
+        if (err) {
+            throw new RuntimeException("[LocaleMatcher method(s) failed]");
+        }
+
+    }
+
+    private static void checkLookup(String ranges, String tags,
+            String expectedLocale) {
+
+        List<Locale.LanguageRange> priorityList = Locale.LanguageRange
+                .parse(ranges);
+        List<Locale> localeList = generateLocales(tags);
+        Locale loc = Locale.lookup(priorityList, localeList);
+        String actualLocale
+                = loc.toLanguageTag();
+
+        if (!actualLocale.equals(expectedLocale)) {
+            System.err.println("Locale.lookup failed with ranges: " + ranges
+                    + " Expected: " + expectedLocale
+                    + " Actual: " + actualLocale);
+            err = true;
+        }
+
+    }
+
+    private static void checkFilter(String ranges, String tags,
+            String expectedLocales) {
+
+        List<Locale.LanguageRange> priorityList = Locale.LanguageRange
+                .parse(ranges);
+        List<Locale> localeList = generateLocales(tags);
+        String actualLocales = getLocalesAsString(
+                Locale.filter(priorityList, localeList));
+
+        if (!actualLocales.equals(expectedLocales)) {
+            System.err.println("Locale.filter failed with ranges: " + ranges
+                    + " Expected: " + expectedLocales
+                    + " Actual: " + actualLocales);
+            err = true;
+        }
+
+    }
+
+    private static List<Locale> generateLocales(String tags) {
+        if (tags == null) {
+            return null;
+        }
+
+        List<Locale> localeList = new ArrayList<>();
+        if (tags.equals("")) {
+            return localeList;
+        }
+        String[] t = tags.split(", ");
+        for (String tag : t) {
+            localeList.add(Locale.forLanguageTag(tag));
+        }
+        return localeList;
+    }
+
+    private static String getLocalesAsString(List<Locale> locales) {
+        StringBuilder sb = new StringBuilder();
+
+        Iterator<Locale> itr = locales.iterator();
+        if (itr.hasNext()) {
+            sb.append(itr.next().toLanguageTag());
+        }
+        while (itr.hasNext()) {
+            sb.append(", ");
+            sb.append(itr.next().toLanguageTag());
+        }
+
+        return sb.toString().trim();
+    }
+
+}
--- a/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java	Fri Aug 05 10:23:28 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @bug 8068721
  * @summary test RMI-IIOP call with ConcurrentHashMap as an argument
  * @library /lib/testlibrary
+ * @modules java.corba
  * @build jdk.testlibrary.*
  * @compile -addmods java.corba Test.java HelloInterface.java HelloServer.java HelloClient.java
  *    HelloImpl.java _HelloImpl_Tie.java _HelloInterface_Stub.java ConcurrentHashMapTest.java
--- a/test/javax/transaction/testng/Driver.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/javax/transaction/testng/Driver.java	Fri Aug 05 10:23:28 2016 -0700
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @modules java.sql java.transaction
  * @compile -addmods java.transaction
  *   test/transaction/InvalidTransactionExceptionTests.java
  *   test/transaction/TransactionRequiredExceptionTests.java
--- a/test/javax/xml/soap/spi/SAAJFactoryTest.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/javax/xml/soap/spi/SAAJFactoryTest.java	Fri Aug 05 10:23:28 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,7 @@
  * run main/othervm SAAJFactoryTest saaj.factory.Valid -
  *      scenario14 javax.xml.soap.MessageFactory=saaj.factory.Valid saaj.factory.Valid2 -
  *
+ * @modules java.xml.ws
  * @compile -addmods java.xml.ws saaj/factory/Invalid.java saaj/factory/Valid.java
  *     saaj/factory/Valid2.java saaj/factory/Valid3.java SAAJFactoryTest.java
  *
--- a/test/javax/xml/ws/8043129/MailTest.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/javax/xml/ws/8043129/MailTest.java	Fri Aug 05 10:23:28 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary JAF initialisation in SAAJ clashing with the one in javax.mail
  * @author mkos
  * @library javax.mail.jar
+ * @modules java.xml.ws
  * @compile -addmods java.xml.ws MailTest.java
  * @run main/othervm -addmods java.xml.ws MailTest
  */
--- a/test/javax/xml/ws/publish/WSTest.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/javax/xml/ws/publish/WSTest.java	Fri Aug 05 10:23:28 2016 -0700
@@ -25,6 +25,7 @@
  * @test
  * @bug 8146086
  * @summary Publishing two webservices on same port fails with "java.net.BindException: Address already in use"
+ * @modules java.xml.ws
  * @compile -addmods java.xml.ws WSTest.java
  * @run main/othervm -addmods java.xml.ws WSTest
  */
--- a/test/javax/xml/ws/xsanymixed/Test.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/javax/xml/ws/xsanymixed/Test.java	Fri Aug 05 10:23:28 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @bug 8036981 8038966 8051441
  * @summary the content of xs:any content:mixed should remain as is,
  *          no white space changes and no changes to namespace prefixes
+ * @modules java.xml.ws
  * @run shell compile-wsdl.sh
  * @compile -addmods java.xml.ws Test.java
  * @run main/othervm -addmods java.xml.ws Test
--- a/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java	Fri Aug 05 10:23:28 2016 -0700
@@ -32,7 +32,7 @@
  * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator
  * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator
  *                                                   sm TestKeyPairGenerator.policy
- * @key intermittent randomness
+ * @key randomness
  */
 
 import java.math.BigInteger;
--- a/test/tools/jlink/IntegrationTest.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/tools/jlink/IntegrationTest.java	Fri Aug 05 10:23:28 2016 -0700
@@ -22,6 +22,7 @@
  */
 
 import java.io.File;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.UncheckedIOException;
 import java.nio.file.Files;
@@ -33,6 +34,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 import java.util.function.Function;
 import jdk.tools.jlink.Jlink;
@@ -203,6 +205,27 @@
             throw new AssertionError("release not generated");
         }
 
+        Properties props = new Properties();
+        try (FileReader reader = new FileReader(release)) {
+            props.load(reader);
+        }
+
+        if (props.getProperty("JAVA_VERSION") == null) {
+            throw new AssertionError("release file does not contain JAVA_VERSION");
+        }
+
+        if (props.getProperty("OS_NAME") == null) {
+            throw new AssertionError("release file does not contain OS_NAME");
+        }
+
+        if (props.getProperty("OS_ARCH") == null) {
+            throw new AssertionError("release file does not contain OS_ARCH");
+        }
+
+        if (props.getProperty("OS_VERSION") == null) {
+            throw new AssertionError("release file does not contain OS_VERSION");
+        }
+
         if (!Files.exists(output.resolve("toto.txt"))) {
             throw new AssertionError("Post processing not called");
         }
--- a/test/tools/jlink/plugins/ExcludeVMPluginTest.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/tools/jlink/plugins/ExcludeVMPluginTest.java	Fri Aug 05 10:23:28 2016 -0700
@@ -30,6 +30,9 @@
  * @run main ExcludeVMPluginTest
  */
 import java.io.ByteArrayInputStream;
+import java.net.URI;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.Map;
 import jdk.tools.jlink.internal.ResourcePoolManager;
@@ -167,6 +170,13 @@
         poolMgr.add(
             ResourcePoolEntry.create("/java.base/native/jvm.cfg",
                 ResourcePoolEntry.Type.NATIVE_LIB, jvmcfgContent));
+
+        // java.base/module-info.class is used by exclude vm plugin
+        // to get current osName(). We read it from jrt-fs and add a
+        // ResourcePoolEntry
+        poolMgr.add(
+            ResourcePoolEntry.create("/java.base/module-info.class",
+                ResourcePoolEntry.Type.CLASS_OR_RESOURCE, getJavaBaseModuleInfo()));
         for (String in : input) {
             poolMgr.add(ResourcePoolEntry.create(in,
                     ResourcePoolEntry.Type.NATIVE_LIB, new byte[0]));
@@ -187,15 +197,19 @@
             throw new Exception("Got content " + newContent + " expected " + expectdJvmCfg);
         }
 
-        if (out.entryCount() != (expectedOutput.length + 1)) {
+        // Apart from native resources, we should find jvm.cfg and
+        // java.base/module-info.class. So, we add 2 here to the
+        // expected count!
+        if (out.entryCount() != (expectedOutput.length + 2)) {
             out.entries().forEach(m -> {
                 System.err.println(m.path());
             });
-            throw new Exception("Invalid output size " + out.entryCount() + " expected " + (expectedOutput.length + 1));
+            throw new Exception("Invalid output size " + out.entryCount() + " expected " + (expectedOutput.length + 2));
         }
 
         out.entries().forEach(md -> {
-            if (md.path().equals("/java.base/native/jvm.cfg")) {
+            if (md.path().equals("/java.base/native/jvm.cfg") ||
+                md.path().equals("/java.base/module-info.class")) {
                 return;
             }
             boolean contained = false;
@@ -209,7 +223,11 @@
                 throw new RuntimeException(md.path() + " not expected");
             }
         });
+    }
 
+    // read java.base/module-info.class from jrt-fs
+    private static Path getJavaBaseModuleInfo() {
+        return Paths.get(URI.create("jrt:/modules/java.base/module-info.class"));
     }
 
     private static boolean isWindows() {
--- a/test/tools/jlink/plugins/FileCopierPluginTest.java	Wed Aug 03 14:49:01 2016 +0530
+++ b/test/tools/jlink/plugins/FileCopierPluginTest.java	Fri Aug 05 10:23:28 2016 -0700
@@ -32,8 +32,10 @@
  */
 
 import java.io.File;
+import java.net.URI;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -41,6 +43,7 @@
 import jdk.tools.jlink.builder.DefaultImageBuilder;
 
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
+import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.ResourcePool;
 
@@ -86,6 +89,12 @@
         conf.put(FileCopierPlugin.NAME, builder.toString());
         plug.configure(conf);
         ResourcePoolManager poolMgr = new ResourcePoolManager();
+        // java.base/module-info.class is used to add "release" file
+        // We read it from jrt-fs and add a ResourcePoolEntry
+        poolMgr.add(
+            ResourcePoolEntry.create("/java.base/module-info.class",
+                ResourcePoolEntry.Type.CLASS_OR_RESOURCE, getJavaBaseModuleInfo()));
+        expected++;
         ResourcePool pool = plug.transform(
                 new ResourcePoolManager().resourcePool(),
                 poolMgr.resourcePoolBuilder());
@@ -93,7 +102,8 @@
             throw new AssertionError("Wrong number of added files");
         }
         pool.entries().forEach(f -> {
-            if (!f.type().equals(ResourcePoolEntry.Type.OTHER)) {
+            if (!f.type().equals(ResourcePoolEntry.Type.OTHER) &&
+                !f.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
                 throw new AssertionError("Invalid type " + f.type()
                         + " for file " + f.path());
             }
@@ -145,4 +155,9 @@
             throw new AssertionError("Invalid Content in src2 dir");
         }
     }
+
+    // read java.base/module-info.class from jrt-fs
+    private static Path getJavaBaseModuleInfo() {
+        return Paths.get(URI.create("jrt:/modules/java.base/module-info.class"));
+    }
 }