--- a/jdk/make/docs/CORE_PKGS.gmk Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/docs/CORE_PKGS.gmk Wed May 01 11:34:06 2013 -0700
@@ -142,6 +142,7 @@
java.util.prefs \
java.util.regex \
java.util.spi \
+ java.util.stream \
java.util.zip \
javax.accessibility \
javax.activation \
--- a/jdk/make/java/java/FILES_java.gmk Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/java/java/FILES_java.gmk Wed May 01 11:34:06 2013 -0700
@@ -252,6 +252,7 @@
java/util/Scanner.java \
java/util/InputMismatchException.java \
java/util/Stack.java \
+ java/util/StringJoiner.java \
java/util/StringTokenizer.java \
java/util/TimeZone.java \
java/util/SimpleTimeZone.java \
--- a/jdk/make/netbeans/common/closed-share-sources.ent Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/netbeans/common/closed-share-sources.ent Wed May 01 11:34:06 2013 -0700
@@ -37,6 +37,7 @@
<location>${root}/src/closed/share/classes</location>
<includes>${includes}</includes>
<excludes>${excludes}</excludes>
+ <encoding>US-ASCII</encoding>
</source-folder>
<source-folder>
<label>Closed-Source Packages</label>
--- a/jdk/make/netbeans/common/demo-view.ent Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/netbeans/common/demo-view.ent Wed May 01 11:34:06 2013 -0700
@@ -31,7 +31,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
-<source-folder style="tree">
+<source-folder style="tree"> <!-- hierarchy in demo/ dir isn't packages -->
<label>Demos</label>
<location>${root}/src/share/demo</location>
<includes>${demos}</includes>
--- a/jdk/make/netbeans/common/java-data-native.ent Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/netbeans/common/java-data-native.ent Wed May 01 11:34:06 2013 -0700
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -34,8 +34,9 @@
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3">
<compilation-unit>
<package-root>${root}/src/share/classes</package-root>
+ <package-root>${root}/src/macosx/classes</package-root>
+ <package-root>${root}/src/solaris/classes</package-root>
<package-root>${root}/src/windows/classes</package-root>
- <package-root>${root}/src/solaris/classes</package-root>
<classpath mode="boot">${bootstrap.jdk}/jre/lib/rt.jar</classpath>
<built-to>${root}/build/${platform}-${arch}/classes</built-to>
<javadoc-built-to>${root}/build/${platform}-${arch}/docs/api</javadoc-built-to>
@@ -44,6 +45,7 @@
<compilation-unit>
<package-root>${root}/test</package-root>
<unit-tests/>
+ <classpath mode="compile">${jtreg.home}/lib/testng.jar</classpath>
<source-level>1.8</source-level>
</compilation-unit>
</java-data>
--- a/jdk/make/netbeans/common/java-data-no-native.ent Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/netbeans/common/java-data-no-native.ent Wed May 01 11:34:06 2013 -0700
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -42,6 +42,7 @@
<compilation-unit>
<package-root>${root}/test</package-root>
<unit-tests/>
+ <classpath mode="compile">${jtreg.home}/lib/testng.jar</classpath>
<source-level>1.8</source-level>
</compilation-unit>
</java-data>
--- a/jdk/make/netbeans/common/jtreg-view.ent Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/netbeans/common/jtreg-view.ent Wed May 01 11:34:06 2013 -0700
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -31,7 +31,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
-<source-folder style="tree">
+<source-folder style="tree"> <!-- hierarchy in test/ dir isn't packages -->
<label>Tests</label>
<location>${root}/test</location>
<includes>${jtreg.tests}</includes>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/netbeans/common/macosx-sources.ent Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<!--
+ OS X is a trademark in the United States and other countries,
+ exclusively licensed through Apple Inc.
+-->
+<source-folder>
+ <label>Sources for OS X™ Platform</label>
+ <type>java</type>
+ <location>${root}/src/macosx/classes</location>
+ <includes>${includes}</includes>
+ <excludes>${excludes}</excludes>
+ <encoding>US-ASCII</encoding>
+</source-folder>
+<source-folder>
+ <label>Sources for OS X™ Platform</label>
+ <location>${root}/src/macosx/classes</location>
+</source-folder>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/netbeans/common/macosx-view.ent Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<!--
+ OS X is a trademark in the United States and other countries,
+ exclusively licensed through Apple Inc.
+-->
+<source-folder style="tree">
+ <label>Sources for OS X™ Platform</label>
+ <location>${root}/src/macosx/classes</location>
+ <includes>${includes}</includes>
+ <excludes>${excludes}</excludes>
+</source-folder>
--- a/jdk/make/netbeans/common/properties.ent Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/netbeans/common/properties.ent Wed May 01 11:34:06 2013 -0700
@@ -41,3 +41,5 @@
<property-file>${user.home}/.openjdk/build.properties</property-file>
<property-file>build.properties</property-file>
<property name="bootstrap.jdk">${java.home}/..</property>
+<property name="jtreg.home">${env.JT_HOME}</property>
+<property name="jtreg.tests">**</property>
--- a/jdk/make/netbeans/common/sample-view.ent Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/netbeans/common/sample-view.ent Wed May 01 11:34:06 2013 -0700
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -31,7 +31,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
-<source-folder style="tree">
+<source-folder style="tree"> <!-- hierarchy in sample/ dir isn't packages -->
<label>Samples</label>
<location>${root}/src/share/sample</location>
<includes>${samples}</includes>
--- a/jdk/make/netbeans/common/share-sources.ent Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/netbeans/common/share-sources.ent Wed May 01 11:34:06 2013 -0700
@@ -37,6 +37,7 @@
<location>${root}/src/share/classes</location>
<includes>${includes}</includes>
<excludes>${excludes}</excludes>
+ <encoding>US-ASCII</encoding>
</source-folder>
<source-folder>
<label>Sources for All Platforms</label>
--- a/jdk/make/netbeans/common/shared.xml Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/netbeans/common/shared.xml Wed May 01 11:34:06 2013 -0700
@@ -276,7 +276,7 @@
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-jtreg" depends="-init,-pre-jtreg,-taskdef-jtreg,-check-tests-defined,-jtreg-setup,-jtreg-make,-jtreg-ant,-post-jtreg">
- <property name="jtreg.report" location="${jtreg.dir}/JTreport/report.html"/>
+ <property name="jtreg.report" location="${jtreg.dir}/JTreport/html/report.html"/>
<condition property="jtreg.passed">
<equals arg1="${jtreg.result}" arg2="0"/>
</condition>
@@ -338,7 +338,7 @@
<!-- Note: even with this default value, includes/excludes
from share.src.dir get javadoc'd; see packageset below -->
<property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project -->
- <javadoc destdir="${javadoc.dir}" source="1.5"
+ <javadoc destdir="${javadoc.dir}" source="1.8"
windowtitle="UNOFFICIAL" failonerror="true" use="true"
author="false" version="false"
packagenames="${javadoc.packagenames}">
--- a/jdk/make/netbeans/common/unix-sources.ent Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/netbeans/common/unix-sources.ent Wed May 01 11:34:06 2013 -0700
@@ -41,6 +41,7 @@
<location>${root}/src/solaris/classes</location>
<includes>${includes}</includes>
<excludes>${excludes}</excludes>
+ <encoding>US-ASCII</encoding>
</source-folder>
<source-folder>
<label>Sources for Unix® Platform</label>
--- a/jdk/make/netbeans/common/windows-sources.ent Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/netbeans/common/windows-sources.ent Wed May 01 11:34:06 2013 -0700
@@ -37,6 +37,7 @@
<location>${root}/src/windows/classes</location>
<includes>${includes}</includes>
<excludes>${excludes}</excludes>
+ <encoding>US-ASCII</encoding>
</source-folder>
<source-folder>
<label>Sources for Windows Platform</label>
--- a/jdk/make/netbeans/j2se/nbproject/project.xml Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/netbeans/j2se/nbproject/project.xml Wed May 01 11:34:06 2013 -0700
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -34,12 +34,14 @@
<!DOCTYPE project [
<!ENTITY properties SYSTEM "../../common/properties.ent">
<!ENTITY share-sources SYSTEM "../../common/share-sources.ent">
+ <!ENTITY macosx-sources SYSTEM "../../common/macosx-sources.ent">
<!ENTITY unix-sources SYSTEM "../../common/unix-sources.ent">
<!ENTITY windows-sources SYSTEM "../../common/windows-sources.ent">
<!ENTITY jtreg-sources SYSTEM "../../common/jtreg-sources.ent">
<!ENTITY build-folder SYSTEM "../../common/build-folder.ent">
<!ENTITY standard-bindings SYSTEM "../../common/standard-bindings.ent">
<!ENTITY share-view SYSTEM "../../common/share-view.ent">
+ <!ENTITY macosx-view SYSTEM "../../common/macosx-view.ent">
<!ENTITY unix-view SYSTEM "../../common/unix-view.ent">
<!ENTITY windows-view SYSTEM "../../common/windows-view.ent">
<!ENTITY jtreg-view SYSTEM "../../common/jtreg-view.ent">
@@ -58,6 +60,7 @@
</properties>
<folders>
&share-sources;
+ &macosx-sources;
&unix-sources;
&windows-sources;
&build-folder;
@@ -83,6 +86,7 @@
<view>
<items>
&share-view;
+ &macosx-view;
&unix-view;
&windows-view;
&jtreg-view;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/netbeans/jdbc/README Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,64 @@
+Working on JDBC Using the NetBeans IDE
+
+This JDBC NetBeans project allows a developer interested in making changes
+to and/or fixing bugs in the JDBC source to modify, build, run and test
+as well as generating the javadoc.
+
+README FIRST
+
+ make/netbeans/README to get started with NetBeans IDE and OpenJDK, and
+ working with the OpenJDK NetBeans projects.
+
+WORKING WITH JDBC
+
+JDBC doesn't contain native code. You don't need to
+have all the Java SE sources to work on JDBC but just the following subset:
+
+ make/netbeans/
+ src/share/classes/com/sun/rowset/
+ src/share/classes/java/sql/
+ src/share/classes/javax/sql/
+ test/TEST.ROOT
+ test/java/sql/
+ test/javax/sql/
+
+The set of actions supported by this project are:
+
+* Build Project:
+
+ - Compiles JDBC source files and puts the class files under
+ build/${platform}-${arch}/classes.
+
+ - Generates JDBC's jar file under dist/lib/jdbc.jar
+
+ This new jar file could be used to patch an existing JDK installation
+ by using -Xbootclasspath/p:$MYSRC/dist/lib/jdbc.jar
+
+* Generate Javadoc for Project
+
+ - Generates the javadoc for the JDBC source files,
+
+ - The javadoc is generated under build/${platform}-${arch}/javadoc/jdbc.
+
+* Test Project
+
+ - Runs the JDBC jtreg unit tests located under test/java/sql or test/javax/sql.
+
+ - The test results are written under
+
+ build/${platform}-${arch}/jtreg/jdbc
+
+ and the HTML test report can be found at
+
+ build/${platform}-${arch}/jtreg/jdbc/JTreport/html/report.html
+
+
+
+* Clean Project
+
+ - Cleans the files created by this projet under build and dist.
+
+IMPORTANT NOTE
+
+ Please make sure to follow carefully the governance rules documented at
+ http://openjdk.dev.java.net/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/netbeans/jdbc/build.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,46 @@
+#
+# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# - Neither the name of Oracle nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+includes=\
+ java/sql/ \
+ javax/sql/ \
+ com/sun/rowset/
+excludes=
+jtreg.tests=\
+ java/sql/ \
+ javax/sql/
+
+build.jdk.version = 1.8.0
+build.release = ${build.jdk.version}-opensource
+build.number = b00
+jdbc.version = ${build.release}-${user.name}-${build.number}
+jdbc.args = -debug
+javadoc.options=-J-Xmx256m -Xdoclint:none -keywords -quiet
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/netbeans/jdbc/build.xml Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,52 @@
+<!--
+ Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<project name="jdbc" default="build" basedir=".">
+
+ <import file="../common/shared.xml"/>
+
+ <target name="-post-compile">
+ <mkdir dir="${dist.dir}/lib"/>
+ <jar destfile="${dist.dir}/lib/jdbc.jar">
+ <fileset dir="${classes.dir}">
+ <include name="java/sql/**/*.class"/>
+ <include name="javax/sql/**/*.class"/>
+ <include name="com/sun/rowset/**/*.class"/>
+ </fileset>
+ </jar>
+ </target>
+
+
+ <target name="clean" depends="-init,shared.clean">
+ <delete file="${dist.dir}/lib/jdbc.jar"/>
+ </target>
+
+</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/netbeans/jdbc/nbproject/project.xml Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<!DOCTYPE project [
+ <!ENTITY properties SYSTEM "../../common/properties.ent">
+ <!ENTITY share-sources SYSTEM "../../common/share-sources.ent">
+ <!ENTITY jtreg-sources SYSTEM "../../common/jtreg-sources.ent">
+ <!ENTITY build-folder SYSTEM "../../common/build-folder.ent">
+ <!ENTITY standard-bindings SYSTEM "../../common/standard-bindings.ent">
+ <!ENTITY share-view SYSTEM "../../common/share-view.ent">
+ <!ENTITY jtreg-view SYSTEM "../../common/jtreg-view.ent">
+ <!ENTITY file-view SYSTEM "../../common/file-view.ent">
+ <!ENTITY standard-actions SYSTEM "../../common/standard-actions.ent">
+ <!ENTITY java-data-no-native SYSTEM "../../common/java-data-no-native.ent">
+]>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.ant.freeform</type>
+ <configuration>
+ <general-data xmlns="http://www.netbeans.org/ns/freeform-project/2">
+ <name>JDBC</name> <!-- Customized -->
+ <properties>
+ <property name="name">jdbc</property> <!-- Customized -->
+ &properties;
+ </properties>
+ <folders>
+ &share-sources;
+ &jtreg-sources;
+ &build-folder;
+ </folders>
+ <ide-actions>
+ &standard-bindings;
+ <action name="run">
+ <target>run</target>
+ </action>
+ <action name="debug">
+ <target>debug</target>
+ </action>
+ <action name="rowsetjavadoc">
+ <target>debug</target>
+ </action>
+ </ide-actions>
+ <view>
+ <items>
+ &share-view;
+ &jtreg-view;
+ &file-view;
+ </items>
+ <context-menu>
+ &standard-actions;
+ <ide-action name="run"/>
+ <ide-action name="debug"/>
+ <ide-action name="rowsetjavadoc"/>
+ </context-menu>
+ </view>
+ </general-data>
+ &java-data-no-native;
+ </configuration>
+</project>
--- a/jdk/make/netbeans/world/nbproject/project.xml Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/netbeans/world/nbproject/project.xml Wed May 01 11:34:06 2013 -0700
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -34,11 +34,13 @@
<!DOCTYPE project [
<!ENTITY properties SYSTEM "../../common/properties.ent">
<!ENTITY share-sources SYSTEM "../../common/share-sources.ent">
+ <!ENTITY macosx-sources SYSTEM "../../common/macosx-sources.ent">
<!ENTITY unix-sources SYSTEM "../../common/unix-sources.ent">
<!ENTITY windows-sources SYSTEM "../../common/windows-sources.ent">
<!ENTITY build-folder SYSTEM "../../common/build-folder.ent">
<!ENTITY standard-bindings SYSTEM "../../common/standard-bindings.ent">
<!ENTITY share-view SYSTEM "../../common/share-view.ent">
+ <!ENTITY macosx-view SYSTEM "../../common/macosx-view.ent">
<!ENTITY unix-view SYSTEM "../../common/unix-view.ent">
<!ENTITY windows-view SYSTEM "../../common/windows-view.ent">
<!ENTITY file-view SYSTEM "../../common/file-view.ent">
@@ -56,6 +58,7 @@
</properties>
<folders>
&share-sources;
+ &macosx-sources;
&unix-sources;
&windows-sources;
&build-folder;
@@ -66,6 +69,7 @@
<view>
<items>
&share-view;
+ &macosx-view;
&unix-view;
&windows-view;
&file-view;
--- a/jdk/make/tools/src/build/tools/deps/refs.allowed Wed May 01 11:27:12 2013 -0700
+++ b/jdk/make/tools/src/build/tools/deps/refs.allowed Wed May 01 11:34:06 2013 -0700
@@ -13,10 +13,11 @@
javax.security.auth.kerberos.KerberosKey=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
javax.security.auth.kerberos.KerberosPrincipal=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
javax.security.auth.kerberos.KerberosTicket=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+javax.security.auth.kerberos.KeyTab=sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
javax.security.auth.kerberos.ServicePermission=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
sun.security.jgss.GSSCaller=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
sun.security.jgss.krb5.Krb5Util=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
-sun.security.jgss.krb5.ServiceCreds=sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+sun.security.jgss.krb5.ServiceCreds=sun.security.ssl.krb5.Krb5ProxyImpl,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
sun.security.krb5.EncryptedData= sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
sun.security.krb5.EncryptionKey=sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
sun.security.krb5.internal.crypto.KeyUsage=sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
--- a/jdk/makefiles/CopyFiles.gmk Wed May 01 11:27:12 2013 -0700
+++ b/jdk/makefiles/CopyFiles.gmk Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -294,45 +294,56 @@
ifeq ($(OPENJDK_TARGET_CPU_BITS),32)
- # On 32 bit machines, we can have client and/or server libjvms installed.
- # Since the currently committed jvm.cfg expects clientANDserver, we need
- # to patch the jvm.cfg when we have built only a client or only a server.
- # This should also support -kernel, -zero and -zeroshark.
- ifeq ($(JVM_VARIANTS),$(COMMA)client$(COMMA))
- # Create a patched jvm.cfg to use -client by default and alias -server to -client.
- $(JVMCFG):
- $(MKDIR) -p $(@D)
- $(RM) $(JVMCFG)
- $(PRINTF) "-client KNOWN\n">$(JVMCFG)
- $(PRINTF) "-server ALIASED_TO -client\n">>$(JVMCFG)
- $(PRINTF) "-hotspot ALIASED_TO -client\n">>$(JVMCFG)
- $(PRINTF) "-classic WARN\n">>$(JVMCFG)
- $(PRINTF) "-native ERROR\n">>$(JVMCFG)
- $(PRINTF) "-green ERROR\n">>$(JVMCFG)
+ # On 32-bit machines we have three potential VMs: client, server and minimal.
+ # Historically we usually have both client and server and so that is what the
+ # committed jvm.cfg expects (including platform specific ergonomics switches
+ # to decide whether to use client or server by default). So when we have anything
+ # other than client and server we need to define a new jvm.cfg file.
+ # The main problem is deciding whether to use aliases for the VMs that are not
+ # present and the current position is that we add aliases for client and server, but
+ # not for minimal.
+ # To do: should this also support, -zero and -zeroshark?
+
+ CLIENT_AND_SERVER := $(and $(findstring true,$(JVM_VARIANT_SERVER)),$(findstring true,$(JVM_VARIANT_CLIENT)))
+ ifeq ($(CLIENT_AND_SERVER), true)
+ # Use the committed jvm.cfg for this 32 bit setup (the minimal
+ # VM is already KNOWN on platforms that potentially support it)
+ $(JVMCFG): $(JVMCFG_SRC)
+ $(call install-file)
+ else
+ $(JVMCFG):
+ $(MKDIR) -p $(@D)
+ $(RM) $(@)
+
+ # Now check for other permutations
+ ifeq ($(JVM_VARIANT_SERVER), true)
+ $(PRINTF) "-server KNOWN\n">>$(@)
+ $(PRINTF) "-client ALIASED_TO -server\n">>$(@)
+ ifeq ($(JVM_VARIANT_MINIMAL1), true)
+ $(PRINTF) "-minimal KNOWN\n">>$(@)
+ endif
else
- ifeq ($(JVM_VARIANTS),$(COMMA)server$(COMMA))
- # Create a patched jvm.cfg to use -server by default and alias -client to -server.
-
- $(JVMCFG):
- $(MKDIR) -p $(@D)
- $(RM) $(JVMCFG)
- $(PRINTF) "-server KNOWN\n">$(JVMCFG)
- $(PRINTF) "-client IGNORE\n">>$(JVMCFG)
- $(PRINTF) "-hotspot IGNORE\n">>$(JVMCFG)
- $(PRINTF) "-classic WARN\n">>$(JVMCFG)
- $(PRINTF) "-native ERROR\n">>$(JVMCFG)
- $(PRINTF) "-green ERROR\n">>$(JVMCFG)
+ ifeq ($(JVM_VARIANT_CLIENT), true)
+ $(PRINTF) "-client KNOWN\n">>$(@)
+ $(PRINTF) "-server ALIASED_TO -client\n">>$(@)
+ ifeq ($(JVM_VARIANT_MINIMAL1), true)
+ $(PRINTF) "-minimal KNOWN\n">>$(@)
+ endif
else
- # Use the default jvm.cfg for this 32 bit setup.
- $(JVMCFG): $(JVMCFG_SRC)
- $(call install-file)
+ ifeq ($(JVM_VARIANT_MINIMAL1), true)
+ $(PRINTF) "-minimal KNOWN\n">>$(@)
+ $(PRINTF) "-server ALIASED_TO -minimal\n">>$(@)
+ $(PRINTF) "-client ALIASED_TO -minimal\n">>$(@)
+ endif
endif
endif
+ endif
+
else
# Use the default jvm.cfg for this 64 bit setup.
$(JVMCFG): $(JVMCFG_SRC)
- $(call install-file)
+ $(call install-file)
endif
COPY_FILES += $(JVMCFG)
--- a/jdk/makefiles/profile-includes.txt Wed May 01 11:27:12 2013 -0700
+++ b/jdk/makefiles/profile-includes.txt Wed May 01 11:34:06 2013 -0700
@@ -36,7 +36,6 @@
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt.diz \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sunec$(SHARED_LIBRARY_SUFFIX) \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify.diz \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)zip$(SHARED_LIBRARY_SUFFIX) \
@@ -172,6 +171,7 @@
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)mlib_image$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)splashscreen$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)t2k$(SHARED_LIBRARY_SUFFIX) \
+ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX) \
alt-rt.jar \
charsets.jar \
cmm/CIEXYZ.pf \
--- a/jdk/src/macosx/bin/x86_64/jvm.cfg Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/macosx/bin/x86_64/jvm.cfg Wed May 01 11:34:06 2013 -0700
@@ -1,4 +1,4 @@
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,3 @@
#
-server KNOWN
-client IGNORE
--hotspot ERROR
--classic WARN
--native ERROR
--green ERROR
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_de.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,183 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=Allgemeine Datei
+FileChooser.directoryDescription.textAndMnemonic=Verzeichnis
+FileChooser.newFolderError.textAndMnemonic=Bei der Erstellung des Ordners ist ein Fehler aufgetreten
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=Alle Dateien
+FileChooser.cancelButton.textAndMnemonic=Abbrechen
+FileChooser.saveButton.textAndMnemonic=Speichern
+FileChooser.openButton.textAndMnemonic=\u00D6ffnen
+FileChooser.saveDialogTitle.textAndMnemonic=Speichern
+FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
+FileChooser.updateButton.textAndMnemonic=Updaten
+FileChooser.helpButton.textAndMnemonic=Hilfe
+FileChooser.directoryOpenButton.textAndMnemonic=\u00D6ffnen
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=Speichern
+FileChooser.openTitle.textAndMnemonic=\u00D6ffnen
+FileChooser.newFolderExistsError.textAndMnemonic=Dieser Name ist bereits vergeben
+FileChooser.chooseButton.textAndMnemonic=W\u00E4hlen
+
+FileChooser.newFolderButton.textAndMnemonic=Neuer Ordner
+FileChooser.newFolderTitle.textAndMnemonic=Neuer Ordner
+FileChooser.fileNameLabel.textAndMnemonic=Datei:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=Speichern unter:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Dateiformat:
+
+FileChooser.desktopName=Desktop
+FileChooser.newFolderPrompt.textAndMnemonic=Name des neuen Ordners:
+FileChooser.untitledFolderName=unbenannter Ordner
+FileChooser.untitledFileName=unbenannt
+FileChooser.createButton.textAndMnemonic=Erstellen
+
+FileChooser.byDate.textAndMnemonic=\u00C4nderungsdatum
+FileChooser.by.textAndMnemonic=Name
+FileChooser.newFolderAccessibleName=Neuer Ordner
+
+FileChooser.mac.newFolder=unbenannter Ordner
+FileChooser.mac.newFolder.subsequent=unbenannter Ordner {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=Vorschau
+ColorChooser.ok.textAndMnemonic=OK
+ColorChooser.cancel.textAndMnemonic=Abbrechen
+ColorChooser.reset.textAndMnemonic=&Zur\u00FCcksetzen
+ColorChooser.sample.textAndMnemonic=Beispieltext Beispieltext
+ColorChooser.swatches.textAndMnemonic=&Muster
+ColorChooser.swatchesRecent.textAndMnemonic=Aktuell:
+ColorChooser.hsb.textAndMnemonic=&HSB
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgbRed.textAndMnemonic=Ro&t
+ColorChooser.rgbGreen.textAndMnemonic=Gr\u00FC&n
+ColorChooser.rgbBlue.textAndMnemonic=&Blau
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=&Ja
+OptionPane.noButton.textAndMnemonic=&Nein
+OptionPane.okButton.textAndMnemonic=OK
+OptionPane.cancelButton.textAndMnemonic=Abbrechen
+OptionPane.title.textAndMnemonic=Option ausw\u00E4hlen
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=Eingabe
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=Meldung
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=Drucken
+PrintingDialog.titleAborting.textAndMnemonic=Drucken (wird abgebrochen)
+
+PrintingDialog.contentInitial.textAndMnemonic=Druckvorgang l\u00E4uft...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=Seite {0} wurde gedruckt ...
+
+PrintingDialog.contentAborting.textAndMnemonic=Druckvorgang wird abgebrochen ...
+
+PrintingDialog.abortButton.textAndMnemonic=&Abbruch
+PrintingDialog.abortButtonToolTip.textAndMnemonic=Druckvorgang abbrechen
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=Minimieren
+InternalFrame.maxButtonToolTip=Maximieren
+InternalFrame.restoreButtonToolTip=Wiederherstellen
+InternalFrame.closeButtonToolTip=Schlie\u00DFen
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=Wiederherstellen
+InternalFrameTitlePane.moveButton.textAndMnemonic=Verschieben
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Gr\u00F6\u00DFe
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimieren
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximieren
+InternalFrameTitlePane.closeButton.textAndMnemonic=Schlie\u00DFen
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=Abfrage weiterleiten
+FormView.resetButton.textAndMnemonic=Zur\u00FCcksetzen
+FormView.browseFileButton.textAndMnemonic=Durchsuchen ...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=Formatvorlagen\u00E4nderung
+AbstractDocument.addition.textAndMnemonic=Hinzuf\u00FCgen
+AbstractDocument.deletion.textAndMnemonic=L\u00F6schen
+AbstractDocument.undo.textAndMnemonic=R\u00FCckg\u00E4ngig
+AbstractDocument.redo.textAndMnemonic=Wiederherstellen
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=Klicken
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=R\u00FCckg\u00E4ngig
+AbstractUndoableEdit.redo.textAndMnemonic=Wiederherstellen
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=Fortschritt ...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=linke Schaltfl\u00E4che
+SplitPane.rightButton.textAndMnemonic=rechte Schaltfl\u00E4che
+# Used for Isindex
+IsindexView.prompt=Dieser Index kann durchsucht werden. Geben Sie Schl\u00FCsselw\u00F6rter f\u00FCr die Suche ein:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=Als Symbol darstellen
+InternalFrameTitlePane.maximizeButtonAccessibleName=Maximieren
+InternalFrameTitlePane.closeButtonAccessibleName=Schlie\u00DFen
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_es.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,183 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=Archivo Gen\u00E9rico
+FileChooser.directoryDescription.textAndMnemonic=Directorio
+FileChooser.newFolderError.textAndMnemonic=Se ha producido un error durante la creaci\u00F3n de carpetas
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=Todos los Archivos
+FileChooser.cancelButton.textAndMnemonic=Cancelar
+FileChooser.saveButton.textAndMnemonic=Guardar
+FileChooser.openButton.textAndMnemonic=Abrir
+FileChooser.saveDialogTitle.textAndMnemonic=Guardar
+FileChooser.openDialogTitle.textAndMnemonic=Abrir
+FileChooser.updateButton.textAndMnemonic=Actualizar
+FileChooser.helpButton.textAndMnemonic=Ayuda
+FileChooser.directoryOpenButton.textAndMnemonic=Abrir
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=Guardar
+FileChooser.openTitle.textAndMnemonic=Abrir
+FileChooser.newFolderExistsError.textAndMnemonic=Ya existe ese nombre
+FileChooser.chooseButton.textAndMnemonic=Seleccionar
+
+FileChooser.newFolderButton.textAndMnemonic=Nueva Carpeta
+FileChooser.newFolderTitle.textAndMnemonic=Nueva Carpeta
+FileChooser.fileNameLabel.textAndMnemonic=Archivo:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=Guardar como:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Formato de Archivo:
+
+FileChooser.desktopName=Escritorio
+FileChooser.newFolderPrompt.textAndMnemonic=Nombre de la Nueva Carpeta:
+FileChooser.untitledFolderName=carpeta sin t\u00EDtulo
+FileChooser.untitledFileName=sin t\u00EDtulo
+FileChooser.createButton.textAndMnemonic=Crear
+
+FileChooser.byDate.textAndMnemonic=Fecha de Modificaci\u00F3n
+FileChooser.by.textAndMnemonic=Nombre
+FileChooser.newFolderAccessibleName=Nueva Carpeta
+
+FileChooser.mac.newFolder=carpeta sin t\u00EDtulo
+FileChooser.mac.newFolder.subsequent=carpeta sin t\u00EDtulo {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=Vista Previa
+ColorChooser.ok.textAndMnemonic=Aceptar
+ColorChooser.cancel.textAndMnemonic=Cancelar
+ColorChooser.reset.textAndMnemonic=&Restablecer
+ColorChooser.sample.textAndMnemonic=Texto de Ejemplo Texto de Ejemplo
+ColorChooser.swatches.textAndMnemonic=M&uestras
+ColorChooser.swatchesRecent.textAndMnemonic=Reciente:
+ColorChooser.hsb.textAndMnemonic=&HSB
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgbRed.textAndMnemonic=Ro&jo
+ColorChooser.rgbGreen.textAndMnemonic=&Verde
+ColorChooser.rgbBlue.textAndMnemonic=A&zul
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=&S\u00ED
+OptionPane.noButton.textAndMnemonic=&No
+OptionPane.okButton.textAndMnemonic=Aceptar
+OptionPane.cancelButton.textAndMnemonic=Cancelar
+OptionPane.title.textAndMnemonic=Seleccionar una Opci\u00F3n
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=Entrada
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=Mensaje
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=Impresi\u00F3n
+PrintingDialog.titleAborting.textAndMnemonic=Impresi\u00F3n (Abortando)
+
+PrintingDialog.contentInitial.textAndMnemonic=Impresi\u00F3n en curso...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=P\u00E1gina {0} impresa...
+
+PrintingDialog.contentAborting.textAndMnemonic=Abortando la impresi\u00F3n...
+
+PrintingDialog.abortButton.textAndMnemonic=&Abortar
+PrintingDialog.abortButtonToolTip.textAndMnemonic=Abortar Impresi\u00F3n
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=Minimizar
+InternalFrame.maxButtonToolTip=Maximizar
+InternalFrame.restoreButtonToolTip=Restaurar
+InternalFrame.closeButtonToolTip=Cerrar
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurar
+InternalFrameTitlePane.moveButton.textAndMnemonic=Mover
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Tama\u00F1o
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimizar
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximizar
+InternalFrameTitlePane.closeButton.textAndMnemonic=Cerrar
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=Enviar Consulta
+FormView.resetButton.textAndMnemonic=Restablecer
+FormView.browseFileButton.textAndMnemonic=Examinar...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=cambio de estilo
+AbstractDocument.addition.textAndMnemonic=adici\u00F3n
+AbstractDocument.deletion.textAndMnemonic=supresi\u00F3n
+AbstractDocument.undo.textAndMnemonic=Deshacer
+AbstractDocument.redo.textAndMnemonic=Rehacer
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=hacer clic
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=Deshacer
+AbstractUndoableEdit.redo.textAndMnemonic=Rehacer
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=Progreso...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=bot\u00F3n: izquierda
+SplitPane.rightButton.textAndMnemonic=bot\u00F3n: derecha
+# Used for Isindex
+IsindexView.prompt=En este \u00EDndice se pueden efectuar b\u00FAsquedas. Escriba las palabras clave de b\u00FAsqueda:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=Convertir en Icono
+InternalFrameTitlePane.maximizeButtonAccessibleName=Maximizar
+InternalFrameTitlePane.closeButtonAccessibleName=Cerrar
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,183 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=Fichier g\u00E9n\u00E9rique
+FileChooser.directoryDescription.textAndMnemonic=R\u00E9pertoire
+FileChooser.newFolderError.textAndMnemonic=Erreur lors de la cr\u00E9ation du dossier
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=Tous les fichiers
+FileChooser.cancelButton.textAndMnemonic=Annuler
+FileChooser.saveButton.textAndMnemonic=Enregistrer
+FileChooser.openButton.textAndMnemonic=Ouvrir
+FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer
+FileChooser.openDialogTitle.textAndMnemonic=Ouvrir
+FileChooser.updateButton.textAndMnemonic=Mettre \u00E0 jour
+FileChooser.helpButton.textAndMnemonic=Aide
+FileChooser.directoryOpenButton.textAndMnemonic=Ouvrir
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=Enregistrer
+FileChooser.openTitle.textAndMnemonic=Ouvrir
+FileChooser.newFolderExistsError.textAndMnemonic=Ce nom est d\u00E9j\u00E0 utilis\u00E9
+FileChooser.chooseButton.textAndMnemonic=Choisir
+
+FileChooser.newFolderButton.textAndMnemonic=Nouveau dossier
+FileChooser.newFolderTitle.textAndMnemonic=Nouveau dossier
+FileChooser.fileNameLabel.textAndMnemonic=Fichier :
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=Enregistrer sous :
+FileChooser.filesOfTypeLabel.textAndMnemonic=Format de fichier :
+
+FileChooser.desktopName=Bureau
+FileChooser.newFolderPrompt.textAndMnemonic=Nom du nouveau dossier :
+FileChooser.untitledFolderName=dossier sans titre
+FileChooser.untitledFileName=sans titre
+FileChooser.createButton.textAndMnemonic=Cr\u00E9er
+
+FileChooser.byDate.textAndMnemonic=Date de modification
+FileChooser.by.textAndMnemonic=Nom
+FileChooser.newFolderAccessibleName=Nouveau dossier
+
+FileChooser.mac.newFolder=dossier sans titre
+FileChooser.mac.newFolder.subsequent=dossier {0} sans titre
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=Aper\u00E7u
+ColorChooser.ok.textAndMnemonic=OK
+ColorChooser.cancel.textAndMnemonic=Annuler
+ColorChooser.reset.textAndMnemonic=&R\u00E9initialiser
+ColorChooser.sample.textAndMnemonic=Echantillon de texte Echantillon de texte
+ColorChooser.swatches.textAndMnemonic=&Echantillons
+ColorChooser.swatchesRecent.textAndMnemonic=Dernier :
+ColorChooser.hsb.textAndMnemonic=&TSL
+ColorChooser.hsbHue.textAndMnemonic=T
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=V
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=R&VB
+ColorChooser.rgbRed.textAndMnemonic=R&ouge
+ColorChooser.rgbGreen.textAndMnemonic=&Vert
+ColorChooser.rgbBlue.textAndMnemonic=&Bleu
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=&Oui
+OptionPane.noButton.textAndMnemonic=&Non
+OptionPane.okButton.textAndMnemonic=OK
+OptionPane.cancelButton.textAndMnemonic=Annuler
+OptionPane.title.textAndMnemonic=S\u00E9lectionner une option
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=Entr\u00E9e
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=Message
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=Impression
+PrintingDialog.titleAborting.textAndMnemonic=Impression (abandon)
+
+PrintingDialog.contentInitial.textAndMnemonic=Impression en cours...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=Page {0} imprim\u00E9e...
+
+PrintingDialog.contentAborting.textAndMnemonic=Abandon de l'impression...
+
+PrintingDialog.abortButton.textAndMnemonic=&Abandonner
+PrintingDialog.abortButtonToolTip.textAndMnemonic=Abandonner l'impression
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=R\u00E9duire
+InternalFrame.maxButtonToolTip=Agrandir
+InternalFrame.restoreButtonToolTip=Restaurer
+InternalFrame.closeButtonToolTip=Fermer
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurer
+InternalFrameTitlePane.moveButton.textAndMnemonic=D\u00E9placer
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Taille
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=R\u00E9duire
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Agrandir
+InternalFrameTitlePane.closeButton.textAndMnemonic=Fermer
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=Soumettre la requ\u00EAte
+FormView.resetButton.textAndMnemonic=R\u00E9initialiser
+FormView.browseFileButton.textAndMnemonic=Parcourir...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=modification de style
+AbstractDocument.addition.textAndMnemonic=ajout
+AbstractDocument.deletion.textAndMnemonic=suppression
+AbstractDocument.undo.textAndMnemonic=Annuler
+AbstractDocument.redo.textAndMnemonic=R\u00E9tablir
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=cliquer
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=Annuler
+AbstractUndoableEdit.redo.textAndMnemonic=R\u00E9tablir
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=Progression...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=bouton gauche
+SplitPane.rightButton.textAndMnemonic=bouton droit
+# Used for Isindex
+IsindexView.prompt=Ceci est un index de recherche. Tapez des mots-cl\u00E9s pour la recherche :
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=R\u00E9duire
+InternalFrameTitlePane.maximizeButtonAccessibleName=Agrandir
+InternalFrameTitlePane.closeButtonAccessibleName=Fermer
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_it.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,183 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=File generico
+FileChooser.directoryDescription.textAndMnemonic=Directory
+FileChooser.newFolderError.textAndMnemonic=Si \u00E8 verificato un errore durante la creazione della cartella
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=Tutti i file
+FileChooser.cancelButton.textAndMnemonic=Annulla
+FileChooser.saveButton.textAndMnemonic=Salva
+FileChooser.openButton.textAndMnemonic=Apri
+FileChooser.saveDialogTitle.textAndMnemonic=Salva
+FileChooser.openDialogTitle.textAndMnemonic=Apri
+FileChooser.updateButton.textAndMnemonic=Aggiorna
+FileChooser.helpButton.textAndMnemonic=?
+FileChooser.directoryOpenButton.textAndMnemonic=Apri
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=Salva
+FileChooser.openTitle.textAndMnemonic=Apri
+FileChooser.newFolderExistsError.textAndMnemonic=Il nome \u00E8 gi\u00E0 stato assegnato
+FileChooser.chooseButton.textAndMnemonic=Scegli
+
+FileChooser.newFolderButton.textAndMnemonic=Nuova cartella
+FileChooser.newFolderTitle.textAndMnemonic=Nuova cartella
+FileChooser.fileNameLabel.textAndMnemonic=File:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=Salva con nome:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Formato file:
+
+FileChooser.desktopName=Desktop
+FileChooser.newFolderPrompt.textAndMnemonic=Nome nuova cartella:
+FileChooser.untitledFolderName=cartella senza titolo
+FileChooser.untitledFileName=senza titolo
+FileChooser.createButton.textAndMnemonic=Crea
+
+FileChooser.byDate.textAndMnemonic=Data modifica
+FileChooser.by.textAndMnemonic=Nome
+FileChooser.newFolderAccessibleName=Nuova cartella
+
+FileChooser.mac.newFolder=cartella senza titolo
+FileChooser.mac.newFolder.subsequent=cartella senza titolo {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=Anteprima
+ColorChooser.ok.textAndMnemonic=OK
+ColorChooser.cancel.textAndMnemonic=Annulla
+ColorChooser.reset.textAndMnemonic=R&eimposta
+ColorChooser.sample.textAndMnemonic=Testo di prova Testo di prova
+ColorChooser.swatches.textAndMnemonic=Colori ca&mpione
+ColorChooser.swatchesRecent.textAndMnemonic=Recenti:
+ColorChooser.hsb.textAndMnemonic=&HSB
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgbRed.textAndMnemonic=&Rosso
+ColorChooser.rgbGreen.textAndMnemonic=Ver&de
+ColorChooser.rgbBlue.textAndMnemonic=&Blu
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=&S\u00EC
+OptionPane.noButton.textAndMnemonic=&No
+OptionPane.okButton.textAndMnemonic=OK
+OptionPane.cancelButton.textAndMnemonic=Annulla
+OptionPane.title.textAndMnemonic=Selezionare una opzione
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=Input
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=Messaggio
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=Stampa in corso
+PrintingDialog.titleAborting.textAndMnemonic=Stampa in corso (operazione interrotta)
+
+PrintingDialog.contentInitial.textAndMnemonic=Stampa in corso...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=Pagina stampata {0}...
+
+PrintingDialog.contentAborting.textAndMnemonic=Interruzione della stampa in corso...
+
+PrintingDialog.abortButton.textAndMnemonic=&Interrompi
+PrintingDialog.abortButtonToolTip.textAndMnemonic=Interrompe la stampa
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=Riduce a icona
+InternalFrame.maxButtonToolTip=Ingrandisce
+InternalFrame.restoreButtonToolTip=Ripristina
+InternalFrame.closeButtonToolTip=Chiude
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=Ripristina
+InternalFrameTitlePane.moveButton.textAndMnemonic=Sposta
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Dimensiona
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Riduci a icona
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ingrandisci
+InternalFrameTitlePane.closeButton.textAndMnemonic=Chiudi
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=Sottometti query
+FormView.resetButton.textAndMnemonic=Reimposta
+FormView.browseFileButton.textAndMnemonic=Sfoglia...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=modifica di stile
+AbstractDocument.addition.textAndMnemonic=aggiunta
+AbstractDocument.deletion.textAndMnemonic=eliminazione
+AbstractDocument.undo.textAndMnemonic=Annulla
+AbstractDocument.redo.textAndMnemonic=Ripeti
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=fare clic
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=Annulla
+AbstractUndoableEdit.redo.textAndMnemonic=Ripeti
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=In corso...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=pulsante sinistro
+SplitPane.rightButton.textAndMnemonic=pulsante destro
+# Used for Isindex
+IsindexView.prompt=Questo \u00E8 un indice di ricerca. Immettere le parole chiave:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=Riduci a icona
+InternalFrameTitlePane.maximizeButtonAccessibleName=Ingrandisci
+InternalFrameTitlePane.closeButtonAccessibleName=Chiudi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,183 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=\u6C4E\u7528\u30D5\u30A1\u30A4\u30EB
+FileChooser.directoryDescription.textAndMnemonic=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA
+FileChooser.newFolderError.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u306E\u4F5C\u6210\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB
+FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
+FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openButton.textAndMnemonic=\u958B\u304F
+FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openDialogTitle.textAndMnemonic=\u958B\u304F
+FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0
+FileChooser.helpButton.textAndMnemonic=\u30D8\u30EB\u30D7
+FileChooser.directoryOpenButton.textAndMnemonic=\u958B\u304F
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openTitle.textAndMnemonic=\u958B\u304F
+FileChooser.newFolderExistsError.textAndMnemonic=\u305D\u306E\u540D\u524D\u306F\u3059\u3067\u306B\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059
+FileChooser.chooseButton.textAndMnemonic=\u9078\u629E
+
+FileChooser.newFolderButton.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
+FileChooser.newFolderTitle.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
+FileChooser.fileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=\u5225\u540D\u4FDD\u5B58:
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F:
+
+FileChooser.desktopName=\u30C7\u30B9\u30AF\u30C8\u30C3\u30D7
+FileChooser.newFolderPrompt.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0\u306E\u540D\u524D:
+FileChooser.untitledFolderName=\u7121\u984C\u306E\u30D5\u30A9\u30EB\u30C0
+FileChooser.untitledFileName=\u7121\u984C
+FileChooser.createButton.textAndMnemonic=\u4F5C\u6210
+
+FileChooser.byDate.textAndMnemonic=\u5909\u66F4\u65E5
+FileChooser.by.textAndMnemonic=\u540D\u524D
+FileChooser.newFolderAccessibleName=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
+
+FileChooser.mac.newFolder=\u7121\u984C\u306E\u30D5\u30A9\u30EB\u30C0
+FileChooser.mac.newFolder.subsequent=\u7121\u984C\u306E\u30D5\u30A9\u30EB\u30C0{0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=\u30D7\u30EC\u30D3\u30E5\u30FC
+ColorChooser.ok.textAndMnemonic=OK
+ColorChooser.cancel.textAndMnemonic=\u53D6\u6D88
+ColorChooser.reset.textAndMnemonic=\u30EA\u30BB\u30C3\u30C8(&R)
+ColorChooser.sample.textAndMnemonic=\u30B5\u30F3\u30D7\u30EB\u30FB\u30C6\u30AD\u30B9\u30C8 \u30B5\u30F3\u30D7\u30EB\u30FB\u30C6\u30AD\u30B9\u30C8
+ColorChooser.swatches.textAndMnemonic=\u30B5\u30F3\u30D7\u30EB(&S)
+ColorChooser.swatchesRecent.textAndMnemonic=\u6700\u65B0:
+ColorChooser.hsb.textAndMnemonic=HSB(&H)
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
+ColorChooser.rgbRed.textAndMnemonic=\u8D64(&D)
+ColorChooser.rgbGreen.textAndMnemonic=\u7DD1(&N)
+ColorChooser.rgbBlue.textAndMnemonic=\u9752(&B)
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=\u306F\u3044(&Y)
+OptionPane.noButton.textAndMnemonic=\u3044\u3044\u3048(&N)
+OptionPane.okButton.textAndMnemonic=OK
+OptionPane.cancelButton.textAndMnemonic=\u53D6\u6D88
+OptionPane.title.textAndMnemonic=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u9078\u629E
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=\u5165\u529B
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=\u30E1\u30C3\u30BB\u30FC\u30B8
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=\u5370\u5237\u3057\u3066\u3044\u307E\u3059
+PrintingDialog.titleAborting.textAndMnemonic=\u5370\u5237\u3092\u4E2D\u6B62\u3057\u3066\u3044\u307E\u3059
+
+PrintingDialog.contentInitial.textAndMnemonic=\u5370\u5237\u4E2D...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=\u30DA\u30FC\u30B8{0}\u3092\u5370\u5237\u3057\u307E\u3057\u305F...
+
+PrintingDialog.contentAborting.textAndMnemonic=\u5370\u5237\u3092\u4E2D\u6B62\u3057\u3066\u3044\u307E\u3059...
+
+PrintingDialog.abortButton.textAndMnemonic=\u4E2D\u6B62(&A)
+PrintingDialog.abortButtonToolTip.textAndMnemonic=\u5370\u5237\u306E\u4E2D\u6B62
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=\u6700\u5C0F\u5316
+InternalFrame.maxButtonToolTip=\u6700\u5927\u5316
+InternalFrame.restoreButtonToolTip=\u5FA9\u5143
+InternalFrame.closeButtonToolTip=\u9589\u3058\u308B
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u5143
+InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\u30B5\u30A4\u30BA
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316
+InternalFrameTitlePane.closeButton.textAndMnemonic=\u9589\u3058\u308B
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=\u554F\u5408\u305B\u306E\u5B9F\u884C
+FormView.resetButton.textAndMnemonic=\u30EA\u30BB\u30C3\u30C8
+FormView.browseFileButton.textAndMnemonic=\u53C2\u7167...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=\u30B9\u30BF\u30A4\u30EB\u5909\u66F4
+AbstractDocument.addition.textAndMnemonic=\u8FFD\u52A0
+AbstractDocument.deletion.textAndMnemonic=\u524A\u9664
+AbstractDocument.undo.textAndMnemonic=\u5143\u306B\u623B\u3059
+AbstractDocument.redo.textAndMnemonic=\u3084\u308A\u76F4\u3057
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=\u30AF\u30EA\u30C3\u30AF
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=\u5143\u306B\u623B\u3059
+AbstractUndoableEdit.redo.textAndMnemonic=\u3084\u308A\u76F4\u3057
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=\u30C8\u30B0\u30EB\u30FB\u30DD\u30C3\u30D7\u30A2\u30C3\u30D7
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=\u9032\u884C\u4E2D...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=\u5DE6\u30DC\u30BF\u30F3
+SplitPane.rightButton.textAndMnemonic=\u53F3\u30DC\u30BF\u30F3
+# Used for Isindex
+IsindexView.prompt=\u691C\u7D22\u7528\u306E\u7D22\u5F15\u3067\u3059\u3002\u691C\u7D22\u3059\u308B\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=\u30A2\u30A4\u30B3\u30F3\u5316
+InternalFrameTitlePane.maximizeButtonAccessibleName=\u6700\u5927\u5316
+InternalFrameTitlePane.closeButtonAccessibleName=\u9589\u3058\u308B
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_ko.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,183 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=\uC77C\uBC18 \uD30C\uC77C
+FileChooser.directoryDescription.textAndMnemonic=\uB514\uB809\uD1A0\uB9AC
+FileChooser.newFolderError.textAndMnemonic=\uD3F4\uB354 \uC0DD\uC131 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=\uBAA8\uB4E0 \uD30C\uC77C
+FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C
+FileChooser.saveButton.textAndMnemonic=\uC800\uC7A5
+FileChooser.openButton.textAndMnemonic=\uC5F4\uAE30
+FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5
+FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30
+FileChooser.updateButton.textAndMnemonic=\uAC31\uC2E0
+FileChooser.helpButton.textAndMnemonic=\uB3C4\uC6C0\uB9D0
+FileChooser.directoryOpenButton.textAndMnemonic=\uC5F4\uAE30
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=\uC800\uC7A5
+FileChooser.openTitle.textAndMnemonic=\uC5F4\uAE30
+FileChooser.newFolderExistsError.textAndMnemonic=\uD574\uB2F9 \uC774\uB984\uC740 \uC774\uBBF8 \uC0AC\uC6A9 \uC911\uC785\uB2C8\uB2E4.
+FileChooser.chooseButton.textAndMnemonic=\uC120\uD0DD
+
+FileChooser.newFolderButton.textAndMnemonic=\uC0C8 \uD3F4\uB354
+FileChooser.newFolderTitle.textAndMnemonic=\uC0C8 \uD3F4\uB354
+FileChooser.fileNameLabel.textAndMnemonic=\uD30C\uC77C:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=\uB2E4\uB978 \uC774\uB984\uC73C\uB85C \uC800\uC7A5:
+FileChooser.filesOfTypeLabel.textAndMnemonic=\uD30C\uC77C \uD615\uC2DD:
+
+FileChooser.desktopName=\uB370\uC2A4\uD06C\uD1B1
+FileChooser.newFolderPrompt.textAndMnemonic=\uC0C8 \uD3F4\uB354\uC758 \uC774\uB984:
+FileChooser.untitledFolderName=\uC81C\uBAA9 \uC5C6\uB294 \uD3F4\uB354
+FileChooser.untitledFileName=\uC81C\uBAA9 \uC5C6\uC74C
+FileChooser.createButton.textAndMnemonic=\uC0DD\uC131
+
+FileChooser.byDate.textAndMnemonic=\uC218\uC815\uB41C \uB0A0\uC9DC
+FileChooser.by.textAndMnemonic=\uC774\uB984
+FileChooser.newFolderAccessibleName=\uC0C8 \uD3F4\uB354
+
+FileChooser.mac.newFolder=\uC81C\uBAA9 \uC5C6\uB294 \uD3F4\uB354
+FileChooser.mac.newFolder.subsequent=\uC81C\uBAA9 \uC5C6\uB294 \uD3F4\uB354 {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=\uBBF8\uB9AC\uBCF4\uAE30
+ColorChooser.ok.textAndMnemonic=\uD655\uC778
+ColorChooser.cancel.textAndMnemonic=\uCDE8\uC18C
+ColorChooser.reset.textAndMnemonic=\uC7AC\uC124\uC815(&R)
+ColorChooser.sample.textAndMnemonic=\uC0D8\uD50C \uD14D\uC2A4\uD2B8 \uC0D8\uD50C \uD14D\uC2A4\uD2B8
+ColorChooser.swatches.textAndMnemonic=\uACAC\uBCF8(&S)
+ColorChooser.swatchesRecent.textAndMnemonic=\uCD5C\uADFC \uBAA9\uB85D:
+ColorChooser.hsb.textAndMnemonic=HSB(&H)
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
+ColorChooser.rgbRed.textAndMnemonic=\uBE68\uAC04\uC0C9(&D)
+ColorChooser.rgbGreen.textAndMnemonic=\uB179\uC0C9(&N)
+ColorChooser.rgbBlue.textAndMnemonic=\uD30C\uB780\uC0C9(&B)
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=\uC608(&Y)
+OptionPane.noButton.textAndMnemonic=\uC544\uB2C8\uC624(&N)
+OptionPane.okButton.textAndMnemonic=\uD655\uC778
+OptionPane.cancelButton.textAndMnemonic=\uCDE8\uC18C
+OptionPane.title.textAndMnemonic=\uC635\uC158 \uC120\uD0DD
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=\uC785\uB825
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=\uBA54\uC2DC\uC9C0
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=\uC778\uC1C4
+PrintingDialog.titleAborting.textAndMnemonic=\uC778\uC1C4(\uC911\uB2E8 \uC911)
+
+PrintingDialog.contentInitial.textAndMnemonic=\uC778\uC1C4 \uC9C4\uD589 \uC911...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=\uC778\uC1C4\uB41C \uD398\uC774\uC9C0 {0}...
+
+PrintingDialog.contentAborting.textAndMnemonic=\uC778\uC1C4 \uC911\uB2E8 \uC911...
+
+PrintingDialog.abortButton.textAndMnemonic=\uC911\uB2E8(&A)
+PrintingDialog.abortButtonToolTip.textAndMnemonic=\uC778\uC1C4 \uC911\uB2E8
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=\uCD5C\uC18C\uD654
+InternalFrame.maxButtonToolTip=\uCD5C\uB300\uD654
+InternalFrame.restoreButtonToolTip=\uBCF5\uC6D0
+InternalFrame.closeButtonToolTip=\uB2EB\uAE30
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\uBCF5\uC6D0
+InternalFrameTitlePane.moveButton.textAndMnemonic=\uC774\uB3D9
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\uD06C\uAE30
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\uCD5C\uC18C\uD654
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\uCD5C\uB300\uD654
+InternalFrameTitlePane.closeButton.textAndMnemonic=\uB2EB\uAE30
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=\uC9C8\uC758 \uC81C\uCD9C
+FormView.resetButton.textAndMnemonic=\uC7AC\uC124\uC815
+FormView.browseFileButton.textAndMnemonic=\uCC3E\uC544\uBCF4\uAE30...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=\uC2A4\uD0C0\uC77C \uBCC0\uACBD
+AbstractDocument.addition.textAndMnemonic=\uCD94\uAC00
+AbstractDocument.deletion.textAndMnemonic=\uC0AD\uC81C
+AbstractDocument.undo.textAndMnemonic=\uC2E4\uD589 \uCDE8\uC18C
+AbstractDocument.redo.textAndMnemonic=\uC7AC\uC2E4\uD589
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=\uB204\uB974\uAE30
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=\uC2E4\uD589 \uCDE8\uC18C
+AbstractUndoableEdit.redo.textAndMnemonic=\uC7AC\uC2E4\uD589
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=\uC9C4\uD589...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=\uC67C\uCABD \uB2E8\uCD94
+SplitPane.rightButton.textAndMnemonic=\uC624\uB978\uCABD \uB2E8\uCD94
+# Used for Isindex
+IsindexView.prompt=\uB2E4\uC74C\uC740 \uAC80\uC0C9 \uAC00\uB2A5\uD55C \uC778\uB371\uC2A4\uC785\uB2C8\uB2E4. \uAC80\uC0C9 \uD0A4\uC6CC\uB4DC \uC785\uB825:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=\uC544\uC774\uCF58\uD654
+InternalFrameTitlePane.maximizeButtonAccessibleName=\uCD5C\uB300\uD654
+InternalFrameTitlePane.closeButtonAccessibleName=\uB2EB\uAE30
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,183 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=Arquivo Gen\u00E9rico
+FileChooser.directoryDescription.textAndMnemonic=Diret\u00F3rio
+FileChooser.newFolderError.textAndMnemonic=Ocorreu um erro durante a cria\u00E7\u00E3o da pasta
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=Todos os Arquivos
+FileChooser.cancelButton.textAndMnemonic=Cancelar
+FileChooser.saveButton.textAndMnemonic=Salvar
+FileChooser.openButton.textAndMnemonic=Abrir
+FileChooser.saveDialogTitle.textAndMnemonic=Salvar
+FileChooser.openDialogTitle.textAndMnemonic=Abrir
+FileChooser.updateButton.textAndMnemonic=Atualizar
+FileChooser.helpButton.textAndMnemonic=Ajuda
+FileChooser.directoryOpenButton.textAndMnemonic=Abrir
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=Salvar
+FileChooser.openTitle.textAndMnemonic=Abrir
+FileChooser.newFolderExistsError.textAndMnemonic=Este nome j\u00E1 foi utilizado
+FileChooser.chooseButton.textAndMnemonic=Escolher
+
+FileChooser.newFolderButton.textAndMnemonic=Nova Pasta
+FileChooser.newFolderTitle.textAndMnemonic=Nova Pasta
+FileChooser.fileNameLabel.textAndMnemonic=Arquivo:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=Salvar como:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Formato do Arquivo:
+
+FileChooser.desktopName=\u00C1rea de Trabalho
+FileChooser.newFolderPrompt.textAndMnemonic=Nome da nova pasta:
+FileChooser.untitledFolderName=pasta sem t\u00EDtulo
+FileChooser.untitledFileName=sem t\u00EDtulo
+FileChooser.createButton.textAndMnemonic=Criar
+
+FileChooser.byDate.textAndMnemonic=Data da Modifica\u00E7\u00E3o
+FileChooser.by.textAndMnemonic=Nome
+FileChooser.newFolderAccessibleName=Nova Pasta
+
+FileChooser.mac.newFolder=pasta sem t\u00EDtulo
+FileChooser.mac.newFolder.subsequent=pasta sem t\u00EDtulo {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=Visualizar
+ColorChooser.ok.textAndMnemonic=OK
+ColorChooser.cancel.textAndMnemonic=Cancelar
+ColorChooser.reset.textAndMnemonic=&Redefinir
+ColorChooser.sample.textAndMnemonic=Texto de Amostra Texto de Amostra
+ColorChooser.swatches.textAndMnemonic=Amo&stras
+ColorChooser.swatchesRecent.textAndMnemonic=Recente:
+ColorChooser.hsb.textAndMnemonic=&HSB
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgbRed.textAndMnemonic=&Vermelho
+ColorChooser.rgbGreen.textAndMnemonic=&Verde
+ColorChooser.rgbBlue.textAndMnemonic=&Azul
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=&Sim
+OptionPane.noButton.textAndMnemonic=&N\u00E3o
+OptionPane.okButton.textAndMnemonic=OK
+OptionPane.cancelButton.textAndMnemonic=Cancelar
+OptionPane.title.textAndMnemonic=Selecionar uma Op\u00E7\u00E3o
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=Entrada
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=Mensagem
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=Impress\u00E3o
+PrintingDialog.titleAborting.textAndMnemonic=Impress\u00E3o (Abortando)
+
+PrintingDialog.contentInitial.textAndMnemonic=Impress\u00E3o em andamento...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=P\u00E1gina impressa {0}...
+
+PrintingDialog.contentAborting.textAndMnemonic=Abortando impress\u00E3o...
+
+PrintingDialog.abortButton.textAndMnemonic=&Abortar
+PrintingDialog.abortButtonToolTip.textAndMnemonic=Abortar Impress\u00E3o
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=Minimizar
+InternalFrame.maxButtonToolTip=Maximizar
+InternalFrame.restoreButtonToolTip=Restaurar
+InternalFrame.closeButtonToolTip=Fechar
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurar
+InternalFrameTitlePane.moveButton.textAndMnemonic=Mover
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Tamanho
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimizar
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximizar
+InternalFrameTitlePane.closeButton.textAndMnemonic=Fechar
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=Submeter Consulta
+FormView.resetButton.textAndMnemonic=Redefinir
+FormView.browseFileButton.textAndMnemonic=Procurar...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=altera\u00E7\u00E3o de estilo
+AbstractDocument.addition.textAndMnemonic=adi\u00E7\u00E3o
+AbstractDocument.deletion.textAndMnemonic=dele\u00E7\u00E3o
+AbstractDocument.undo.textAndMnemonic=Desfazer
+AbstractDocument.redo.textAndMnemonic=Refazer
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=clicar
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=Desfazer
+AbstractUndoableEdit.redo.textAndMnemonic=Refazer
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=Andamento...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=bot\u00E3o esquerdo
+SplitPane.rightButton.textAndMnemonic=bot\u00E3o direito
+# Used for Isindex
+IsindexView.prompt=Trata-se de um \u00EDndice pesquis\u00E1vel. Informe as palavras-chave de pesquisa:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=Iconizar
+InternalFrameTitlePane.maximizeButtonAccessibleName=Maximizar
+InternalFrameTitlePane.closeButtonAccessibleName=Fechar
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,183 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=Generisk fil
+FileChooser.directoryDescription.textAndMnemonic=Katalog
+FileChooser.newFolderError.textAndMnemonic=Ett fel intr\u00E4ffade n\u00E4r en mapp skulle skapas
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=Alla filer
+FileChooser.cancelButton.textAndMnemonic=Avbryt
+FileChooser.saveButton.textAndMnemonic=Spara
+FileChooser.openButton.textAndMnemonic=\u00D6ppna
+FileChooser.saveDialogTitle.textAndMnemonic=Spara
+FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna
+FileChooser.updateButton.textAndMnemonic=Uppdatera
+FileChooser.helpButton.textAndMnemonic=Hj\u00E4lp
+FileChooser.directoryOpenButton.textAndMnemonic=\u00D6ppna
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=Spara
+FileChooser.openTitle.textAndMnemonic=\u00D6ppna
+FileChooser.newFolderExistsError.textAndMnemonic=Namnet finns redan
+FileChooser.chooseButton.textAndMnemonic=V\u00E4lj
+
+FileChooser.newFolderButton.textAndMnemonic=Ny mapp
+FileChooser.newFolderTitle.textAndMnemonic=Ny mapp
+FileChooser.fileNameLabel.textAndMnemonic=Fil:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=Spara som:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Filformat:
+
+FileChooser.desktopName=Klientdator
+FileChooser.newFolderPrompt.textAndMnemonic=Namn p\u00E5 ny mapp:
+FileChooser.untitledFolderName=namnl\u00F6s mapp
+FileChooser.untitledFileName=namnl\u00F6s
+FileChooser.createButton.textAndMnemonic=Skapa
+
+FileChooser.byDate.textAndMnemonic=\u00C4ndringsdatum
+FileChooser.by.textAndMnemonic=Namn
+FileChooser.newFolderAccessibleName=Ny mapp
+
+FileChooser.mac.newFolder=namnl\u00F6s mapp
+FileChooser.mac.newFolder.subsequent=namnl\u00F6s mapp {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=F\u00F6rhandsgranska
+ColorChooser.ok.textAndMnemonic=OK
+ColorChooser.cancel.textAndMnemonic=Avbryt
+ColorChooser.reset.textAndMnemonic=&\u00C5terst\u00E4ll
+ColorChooser.sample.textAndMnemonic=Exempeltext Exempeltext
+ColorChooser.swatches.textAndMnemonic=&Prov
+ColorChooser.swatchesRecent.textAndMnemonic=Senaste:
+ColorChooser.hsb.textAndMnemonic=&HSB
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgbRed.textAndMnemonic=R\u00F6&d
+ColorChooser.rgbGreen.textAndMnemonic=Gr\u00F6&n
+ColorChooser.rgbBlue.textAndMnemonic=&Bl\u00E5
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=&Ja
+OptionPane.noButton.textAndMnemonic=&Nej
+OptionPane.okButton.textAndMnemonic=OK
+OptionPane.cancelButton.textAndMnemonic=Avbryt
+OptionPane.title.textAndMnemonic=V\u00E4lj ett alternativ
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=Indata
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=Meddelande
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=Skriver ut
+PrintingDialog.titleAborting.textAndMnemonic=Skriver ut (avbryter)
+
+PrintingDialog.contentInitial.textAndMnemonic=Utskrift p\u00E5g\u00E5r...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=Utskriven sida {0}...
+
+PrintingDialog.contentAborting.textAndMnemonic=Utskriften avbryts...
+
+PrintingDialog.abortButton.textAndMnemonic=&Avbryt
+PrintingDialog.abortButtonToolTip.textAndMnemonic=Avbryt utskrift
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=Minimera
+InternalFrame.maxButtonToolTip=Maximera
+InternalFrame.restoreButtonToolTip=\u00C5terst\u00E4ll
+InternalFrame.closeButtonToolTip=St\u00E4ng
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u00C5terst\u00E4ll
+InternalFrameTitlePane.moveButton.textAndMnemonic=Flytta
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Storlek
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimera
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximera
+InternalFrameTitlePane.closeButton.textAndMnemonic=St\u00E4ng
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=Skicka fr\u00E5ga
+FormView.resetButton.textAndMnemonic=\u00C5terst\u00E4ll
+FormView.browseFileButton.textAndMnemonic=Bl\u00E4ddra...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=format\u00E4ndring
+AbstractDocument.addition.textAndMnemonic=till\u00E4gg
+AbstractDocument.deletion.textAndMnemonic=borttagning
+AbstractDocument.undo.textAndMnemonic=\u00C5ngra
+AbstractDocument.redo.textAndMnemonic=G\u00F6r om
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=klicka
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=\u00C5ngra
+AbstractUndoableEdit.redo.textAndMnemonic=G\u00F6r om
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=v\u00E4xlaPopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=P\u00E5g\u00E5r...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=v\u00E4nster knapp
+SplitPane.rightButton.textAndMnemonic=h\u00F6ger knapp
+# Used for Isindex
+IsindexView.prompt=Detta \u00E4r ett s\u00F6kbart index. Ange s\u00F6kord:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=Minimera
+InternalFrameTitlePane.maximizeButtonAccessibleName=Maximera
+InternalFrameTitlePane.closeButtonAccessibleName=St\u00E4ng
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,183 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=\u901A\u7528\u6587\u4EF6
+FileChooser.directoryDescription.textAndMnemonic=\u76EE\u5F55
+FileChooser.newFolderError.textAndMnemonic=\u521B\u5EFA\u6587\u4EF6\u5939\u65F6\u51FA\u9519
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6587\u4EF6
+FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
+FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openButton.textAndMnemonic=\u6253\u5F00
+FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openDialogTitle.textAndMnemonic=\u6253\u5F00
+FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0
+FileChooser.helpButton.textAndMnemonic=\u5E2E\u52A9
+FileChooser.directoryOpenButton.textAndMnemonic=\u6253\u5F00
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openTitle.textAndMnemonic=\u6253\u5F00
+FileChooser.newFolderExistsError.textAndMnemonic=\u8BE5\u540D\u79F0\u5DF2\u88AB\u4F7F\u7528
+FileChooser.chooseButton.textAndMnemonic=\u9009\u62E9
+
+FileChooser.newFolderButton.textAndMnemonic=\u65B0\u5EFA\u6587\u4EF6\u5939
+FileChooser.newFolderTitle.textAndMnemonic=\u65B0\u5EFA\u6587\u4EF6\u5939
+FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=\u53E6\u5B58\u4E3A:
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u683C\u5F0F:
+
+FileChooser.desktopName=\u684C\u9762
+FileChooser.newFolderPrompt.textAndMnemonic=\u65B0\u6587\u4EF6\u5939\u7684\u540D\u79F0:
+FileChooser.untitledFolderName=\u65E0\u6807\u9898\u7684\u6587\u4EF6\u5939
+FileChooser.untitledFileName=\u65E0\u6807\u9898
+FileChooser.createButton.textAndMnemonic=\u521B\u5EFA
+
+FileChooser.byDate.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
+FileChooser.by.textAndMnemonic=\u540D\u79F0
+FileChooser.newFolderAccessibleName=\u65B0\u5EFA\u6587\u4EF6\u5939
+
+FileChooser.mac.newFolder=\u65E0\u6807\u9898\u7684\u6587\u4EF6\u5939
+FileChooser.mac.newFolder.subsequent=\u65E0\u6807\u9898\u7684\u6587\u4EF6\u5939 {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=\u9884\u89C8
+ColorChooser.ok.textAndMnemonic=\u786E\u5B9A
+ColorChooser.cancel.textAndMnemonic=\u53D6\u6D88
+ColorChooser.reset.textAndMnemonic=\u91CD\u7F6E(&R)
+ColorChooser.sample.textAndMnemonic=\u793A\u4F8B\u6587\u672C \u793A\u4F8B\u6587\u672C
+ColorChooser.swatches.textAndMnemonic=\u6837\u672C(&S)
+ColorChooser.swatchesRecent.textAndMnemonic=\u6700\u8FD1:
+ColorChooser.hsb.textAndMnemonic=HSB(&H)
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
+ColorChooser.rgbRed.textAndMnemonic=\u7EA2\u8272(&D)
+ColorChooser.rgbGreen.textAndMnemonic=\u7EFF\u8272(&N)
+ColorChooser.rgbBlue.textAndMnemonic=\u84DD\u8272(&B)
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=\u662F(&Y)
+OptionPane.noButton.textAndMnemonic=\u5426(&N)
+OptionPane.okButton.textAndMnemonic=\u786E\u5B9A
+OptionPane.cancelButton.textAndMnemonic=\u53D6\u6D88
+OptionPane.title.textAndMnemonic=\u9009\u62E9\u4E00\u4E2A\u9009\u9879
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=\u8F93\u5165
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=\u6D88\u606F
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=\u6253\u5370
+PrintingDialog.titleAborting.textAndMnemonic=\u6253\u5370 (\u6B63\u5728\u4E2D\u6B62)
+
+PrintingDialog.contentInitial.textAndMnemonic=\u6B63\u5728\u8FDB\u884C\u6253\u5370...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=\u5DF2\u6253\u5370\u9875 {0}...
+
+PrintingDialog.contentAborting.textAndMnemonic=\u6B63\u5728\u4E2D\u6B62\u6253\u5370...
+
+PrintingDialog.abortButton.textAndMnemonic=\u4E2D\u6B62(&A)
+PrintingDialog.abortButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6253\u5370
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=\u6700\u5C0F\u5316
+InternalFrame.maxButtonToolTip=\u6700\u5927\u5316
+InternalFrame.restoreButtonToolTip=\u8FD8\u539F
+InternalFrame.closeButtonToolTip=\u5173\u95ED
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u8FD8\u539F
+InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52A8
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316
+InternalFrameTitlePane.closeButton.textAndMnemonic=\u5173\u95ED
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=\u63D0\u4EA4\u67E5\u8BE2
+FormView.resetButton.textAndMnemonic=\u91CD\u7F6E
+FormView.browseFileButton.textAndMnemonic=\u6D4F\u89C8...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=\u6837\u5F0F\u66F4\u6539
+AbstractDocument.addition.textAndMnemonic=\u6DFB\u52A0
+AbstractDocument.deletion.textAndMnemonic=\u5220\u9664
+AbstractDocument.undo.textAndMnemonic=\u64A4\u6D88
+AbstractDocument.redo.textAndMnemonic=\u91CD\u505A
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=\u5355\u51FB
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=\u64A4\u6D88
+AbstractUndoableEdit.redo.textAndMnemonic=\u91CD\u505A
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=\u8FDB\u5EA6...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=\u5DE6\u952E
+SplitPane.rightButton.textAndMnemonic=\u53F3\u952E
+# Used for Isindex
+IsindexView.prompt=\u8FD9\u662F\u53EF\u641C\u7D22\u7D22\u5F15\u3002\u8BF7\u8F93\u5165\u641C\u7D22\u5173\u952E\u5B57:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=\u56FE\u6807\u5316
+InternalFrameTitlePane.maximizeButtonAccessibleName=\u6700\u5927\u5316
+InternalFrameTitlePane.closeButtonAccessibleName=\u5173\u95ED
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_zh_TW.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,183 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=\u4E00\u822C\u6A94\u6848
+FileChooser.directoryDescription.textAndMnemonic=\u76EE\u9304
+FileChooser.newFolderError.textAndMnemonic=\u5EFA\u7ACB\u8CC7\u6599\u593E\u6642\u767C\u751F\u932F\u8AA4
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6A94\u6848
+FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
+FileChooser.saveButton.textAndMnemonic=\u5132\u5B58
+FileChooser.openButton.textAndMnemonic=\u958B\u555F
+FileChooser.saveDialogTitle.textAndMnemonic=\u5132\u5B58
+FileChooser.openDialogTitle.textAndMnemonic=\u958B\u555F
+FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0
+FileChooser.helpButton.textAndMnemonic=\u8AAA\u660E
+FileChooser.directoryOpenButton.textAndMnemonic=\u958B\u555F
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=\u5132\u5B58
+FileChooser.openTitle.textAndMnemonic=\u958B\u555F
+FileChooser.newFolderExistsError.textAndMnemonic=\u8A72\u540D\u7A31\u5DF2\u7D93\u88AB\u4F7F\u7528
+FileChooser.chooseButton.textAndMnemonic=\u9078\u64C7
+
+FileChooser.newFolderButton.textAndMnemonic=\u65B0\u8CC7\u6599\u593E
+FileChooser.newFolderTitle.textAndMnemonic=\u65B0\u8CC7\u6599\u593E
+FileChooser.fileNameLabel.textAndMnemonic=\u6A94\u6848:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=\u53E6\u5B58\u65B0\u6A94:
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u6A94\u6848\u683C\u5F0F:
+
+FileChooser.desktopName=\u684C\u9762
+FileChooser.newFolderPrompt.textAndMnemonic=\u65B0\u8CC7\u6599\u593E\u540D\u7A31:
+FileChooser.untitledFolderName=\u672A\u547D\u540D\u7684\u8CC7\u6599\u593E
+FileChooser.untitledFileName=\u672A\u547D\u540D
+FileChooser.createButton.textAndMnemonic=\u5EFA\u7ACB
+
+FileChooser.byDate.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
+FileChooser.by.textAndMnemonic=\u540D\u7A31
+FileChooser.newFolderAccessibleName=\u65B0\u8CC7\u6599\u593E
+
+FileChooser.mac.newFolder=\u672A\u547D\u540D\u7684\u8CC7\u6599\u593E
+FileChooser.mac.newFolder.subsequent=\u672A\u547D\u540D\u7684\u8CC7\u6599\u593E {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=\u9810\u89BD
+ColorChooser.ok.textAndMnemonic=\u78BA\u5B9A
+ColorChooser.cancel.textAndMnemonic=\u53D6\u6D88
+ColorChooser.reset.textAndMnemonic=\u91CD\u8A2D(&R)
+ColorChooser.sample.textAndMnemonic=\u7BC4\u4F8B\u6587\u5B57 \u7BC4\u4F8B\u6587\u5B57
+ColorChooser.swatches.textAndMnemonic=\u8ABF\u8272\u677F(&S)
+ColorChooser.swatchesRecent.textAndMnemonic=\u6700\u65B0\u9078\u64C7:
+ColorChooser.hsb.textAndMnemonic=HSB(&H)
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
+ColorChooser.rgbRed.textAndMnemonic=\u7D05(&D)
+ColorChooser.rgbGreen.textAndMnemonic=\u7DA0(&N)
+ColorChooser.rgbBlue.textAndMnemonic=\u85CD(&B)
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=\u662F(&Y)
+OptionPane.noButton.textAndMnemonic=\u5426(&N)
+OptionPane.okButton.textAndMnemonic=\u78BA\u5B9A
+OptionPane.cancelButton.textAndMnemonic=\u53D6\u6D88
+OptionPane.title.textAndMnemonic=\u9078\u53D6\u4E00\u500B\u9078\u9805
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=\u8F38\u5165
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=\u8A0A\u606F
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=\u5217\u5370\u4E2D
+PrintingDialog.titleAborting.textAndMnemonic=\u5217\u5370 (\u4E2D\u6B62\u4E2D)
+
+PrintingDialog.contentInitial.textAndMnemonic=\u6B63\u5728\u5217\u5370...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=\u5DF2\u5217\u5370\u7B2C {0} \u9801...
+
+PrintingDialog.contentAborting.textAndMnemonic=\u6B63\u5728\u4E2D\u6B62\u5217\u5370...
+
+PrintingDialog.abortButton.textAndMnemonic=\u4E2D\u6B62(&A)
+PrintingDialog.abortButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u5217\u5370
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=\u6700\u5C0F\u5316
+InternalFrame.maxButtonToolTip=\u6700\u5927\u5316
+InternalFrame.restoreButtonToolTip=\u5FA9\u539F
+InternalFrame.closeButtonToolTip=\u95DC\u9589
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u539F
+InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316
+InternalFrameTitlePane.closeButton.textAndMnemonic=\u95DC\u9589
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=\u9001\u51FA\u67E5\u8A62
+FormView.resetButton.textAndMnemonic=\u91CD\u8A2D
+FormView.browseFileButton.textAndMnemonic=\u700F\u89BD...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=\u6A23\u5F0F\u8B8A\u66F4
+AbstractDocument.addition.textAndMnemonic=\u9644\u52A0
+AbstractDocument.deletion.textAndMnemonic=\u522A\u9664
+AbstractDocument.undo.textAndMnemonic=\u9084\u539F
+AbstractDocument.redo.textAndMnemonic=\u91CD\u505A
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=\u6309\u4E00\u4E0B
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=\u9084\u539F
+AbstractUndoableEdit.redo.textAndMnemonic=\u91CD\u505A
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=\u5207\u63DB\u5373\u73FE\u5F0F\u8996\u7A97
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=\u9032\u5EA6...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=\u5DE6\u6309\u9215
+SplitPane.rightButton.textAndMnemonic=\u53F3\u6309\u9215
+# Used for Isindex
+IsindexView.prompt=\u9019\u662F\u4E00\u500B\u53EF\u641C\u5C0B\u7684\u7D22\u5F15\u3002\u8F38\u5165\u641C\u5C0B\u95DC\u9375\u5B57:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=\u5716\u793A\u5316
+InternalFrameTitlePane.maximizeButtonAccessibleName=\u6700\u5927\u5316
+InternalFrameTitlePane.closeButtonAccessibleName=\u95DC\u9589
--- a/jdk/src/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -520,14 +520,22 @@
}
private static boolean isSupportedCalendarLocale(Locale locale) {
- Locale base = locale.stripExtensions();
+ Locale base = locale;
+
+ if (base.hasExtensions() || base.getVariant() != "") {
+ base = new Locale.Builder()
+ .setLocale(locale)
+ .clearExtensions()
+ .build();
+ }
+
if (!supportedLocaleSet.contains(base)) {
return false;
}
String requestedCalType = locale.getUnicodeLocaleType("ca");
String nativeCalType =
- getCalendarID(locale.toLanguageTag()).replaceFirst("gregorian", "gregory");
+ getCalendarID(base.toLanguageTag()).replaceFirst("gregorian", "gregory");
if (requestedCalType == null) {
return Calendar.getAvailableCalendarTypes().contains(nativeCalType);
--- a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -77,7 +77,7 @@
armed=armado
busy=ocupado
checked=selecionado
-collapsed=recolhido
+collapsed=contra\u00EDdo
editable=edit\u00E1vel
expandable=expans\u00EDvel
expanded=expandido
--- a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -27,8 +27,8 @@
glasspane=\u73BB\u7483\u7A97\u683C
filechooser=\u6587\u4EF6\u9009\u62E9\u5668
filler=\u6F0F\u6597
-frame=\u5E27
-internalframe=\u5185\u90E8\u5E27
+frame=\u6846\u67B6
+internalframe=\u5185\u90E8\u6846\u67B6
label=\u6807\u7B7E
layeredpane=\u5206\u5C42\u7A97\u683C
list=\u5217\u8868
--- a/jdk/src/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -241,14 +241,29 @@
int off = secret.length >> 1;
int seclen = off + (secret.length & 1);
+ byte[] secKey = secret;
+ int keyLen = seclen;
byte[] output = new byte[outputLength];
// P_MD5(S1, label + seed)
- expand(md5, 16, secret, 0, seclen, labelBytes, seed, output,
+ // If we have a long secret, digest it first.
+ if (seclen > 64) { // 64: block size of HMAC-MD5
+ md5.update(secret, 0, seclen);
+ secKey = md5.digest();
+ keyLen = secKey.length;
+ }
+ expand(md5, 16, secKey, 0, keyLen, labelBytes, seed, output,
HMAC_ipad64.clone(), HMAC_opad64.clone());
// P_SHA-1(S2, label + seed)
- expand(sha, 20, secret, off, seclen, labelBytes, seed, output,
+ // If we have a long secret, digest it first.
+ if (seclen > 64) { // 64: block size of HMAC-SHA1
+ sha.update(secret, off, seclen);
+ secKey = sha.digest();
+ keyLen = secKey.length;
+ off = 0;
+ }
+ expand(sha, 20, secKey, off, keyLen, labelBytes, seed, output,
HMAC_ipad64.clone(), HMAC_opad64.clone());
return output;
--- a/jdk/src/share/classes/com/sun/jarsigner/ContentSignerParameters.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jarsigner/ContentSignerParameters.java Wed May 01 11:34:06 2013 -0700
@@ -60,6 +60,13 @@
public X509Certificate getTimestampingAuthorityCertificate();
/**
+ * Retrieves the TSAPolicyID for a Timestamping Authority (TSA).
+ *
+ * @return The TSAPolicyID. May be null.
+ */
+ public String getTSAPolicyID();
+
+ /**
* Retrieves the JAR file's signature.
*
* @return The non-null array of signature bytes.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties Wed May 01 11:34:06 2013 -0700
@@ -1,59 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=>K-Farbauswahl
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Farbton:
-
-GTKColorChooserPanel.red.textAndMnemonic=&Rot:
-
-GTKColorChooserPanel.saturation.textAndMnemonic=S\u00E4ttigung(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=Gr\u00FCn(&G):
-
-GTKColorChooserPanel.value.textAndMnemonic=&Wert:
-
-GTKColorChooserPanel.blue.textAndMnemonic=&Blau:
-
-GTKColorChooserPanel.color.textAndMnemonic=Farb&name:
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=Alle Dateien
-FileChooser.newFolderButton.textAndMnemonic=&Neuer Ordner
-FileChooser.newFolderDialog.textAndMnemonic=Ordnername:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Fehler
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Fehler beim Erstellen von Verzeichnis "{0}": Datei oder Verzeichnis nicht vorhanden
-FileChooser.deleteFileButton.textAndMnemonic=Datei l\u00F6schen(&L)
-FileChooser.renameFileButton.textAndMnemonic=Datei &umbenennen
-FileChooser.cancelButton.textAndMnemonic=&Abbrechen
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=Speichern
-FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
-FileChooser.pathLabel.textAndMnemonic=Aus&wahl:
-FileChooser.filterLabel.textAndMnemonic=Filter:
-FileChooser.foldersLabel.textAndMnemonic=&Ordner
-FileChooser.filesLabel.textAndMnemonic=&Dateien
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen.
-FileChooser.saveButtonToolTip.textAndMnemonic=Ausgew\u00E4hlte Datei speichern.
-FileChooser.openButtonToolTip.textAndMnemonic=Ausgew\u00E4hlte Datei \u00F6ffnen.
-
-FileChooser.renameFileDialog.textAndMnemonic=Datei "{0}" umbenennen in
-FileChooser.renameFileError.titleAndMnemonic=Fehler
-FileChooser.renameFileError.textAndMnemonic=Fehler beim Umbenennen der Datei "{0}" in "{1}"
-
-# dummy resource added for translation automation
-OptionPane.okButton.textAndMnemonic=&OK
-# dummy resource added for translation automation
-OptionPane.cancelButton.textAndMnemonic=&Abbrechen
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=>K-Farbauswahl
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Farbton:
+
+GTKColorChooserPanel.red.textAndMnemonic=R&ot:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&S\u00E4ttigung:
+
+GTKColorChooserPanel.green.textAndMnemonic=&Gr\u00FCn:
+
+GTKColorChooserPanel.value.textAndMnemonic=&Wert:
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Blau:
+
+GTKColorChooserPanel.color.textAndMnemonic=Farb&name:
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=Alle Dateien
+FileChooser.newFolderButton.textAndMnemonic=&Neuer Ordner
+FileChooser.newFolderDialog.textAndMnemonic=Ordnername:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Fehler
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Fehler beim Erstellen von Verzeichnis "{0}": Datei oder Verzeichnis nicht vorhanden
+FileChooser.deleteFileButton.textAndMnemonic=Datei &l\u00F6schen
+FileChooser.renameFileButton.textAndMnemonic=Datei &umbenennen
+FileChooser.cancelButton.textAndMnemonic=&Abbrechen
+FileChooser.saveButton.textAndMnemonic=&OK
+FileChooser.openButton.textAndMnemonic=&OK
+FileChooser.saveDialogTitle.textAndMnemonic=Speichern
+FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
+FileChooser.pathLabel.textAndMnemonic=Aus&wahl:
+FileChooser.filterLabel.textAndMnemonic=Filter:
+FileChooser.foldersLabel.textAndMnemonic=&Ordner
+FileChooser.filesLabel.textAndMnemonic=&Dateien
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen.
+FileChooser.saveButtonToolTip.textAndMnemonic=Ausgew\u00E4hlte Datei speichern.
+FileChooser.openButtonToolTip.textAndMnemonic=Ausgew\u00E4hlte Datei \u00F6ffnen.
+
+FileChooser.renameFileDialog.textAndMnemonic=Datei "{0}" umbenennen in
+FileChooser.renameFileError.titleAndMnemonic=Fehler
+FileChooser.renameFileError.textAndMnemonic=Fehler beim Umbenennen der Datei "{0}" in "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties Wed May 01 11:34:06 2013 -0700
@@ -1,59 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=Selector de Color para >K
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Mat:
-
-GTKColorChooserPanel.red.textAndMnemonic=Ro&jo:
-
-GTKColorChooserPanel.saturation.textAndMnemonic=Saturaci\u00F3n(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=V&erde:
-
-GTKColorChooserPanel.value.textAndMnemonic=&Valor:
-
-GTKColorChooserPanel.blue.textAndMnemonic=&Azul:
-
-GTKColorChooserPanel.color.textAndMnemonic=&Nombre del Color:
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=Todos los Archivos
-FileChooser.newFolderButton.textAndMnemonic=&Nueva Carpeta
-FileChooser.newFolderDialog.textAndMnemonic=Nombre de la Carpeta:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error al crear el directorio "{0}": no existe dicho archivo o directorio
-FileChooser.deleteFileButton.textAndMnemonic=Su&primir Archivo
-FileChooser.renameFileButton.textAndMnemonic=Cambia&r Nombre de Archivo
-FileChooser.cancelButton.textAndMnemonic=&Cancelar
-FileChooser.saveButton.textAndMnemonic=&Aceptar
-FileChooser.openButton.textAndMnemonic=&Aceptar
-FileChooser.saveDialogTitle.textAndMnemonic=Guardar
-FileChooser.openDialogTitle.textAndMnemonic=Abrir
-FileChooser.pathLabel.textAndMnemonic=Selecci\u00F3n(&S):
-FileChooser.filterLabel.textAndMnemonic=Filtro:
-FileChooser.foldersLabel.textAndMnemonic=Carpe&tas
-FileChooser.filesLabel.textAndMnemonic=&Archivos
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar cuadro de di\u00E1logo del selector de archivos.
-FileChooser.saveButtonToolTip.textAndMnemonic=Guardar el archivo seleccionado.
-FileChooser.openButtonToolTip.textAndMnemonic=Abrir el archivo seleccionado.
-
-FileChooser.renameFileDialog.textAndMnemonic=Cambiar el nombre del archivo "{0}" por
-FileChooser.renameFileError.titleAndMnemonic=Error
-FileChooser.renameFileError.textAndMnemonic=Error al cambiar el nombre del archivo "{0}" a "{1}"
-
-# dummy resource added for translation automation
-OptionPane.okButton.textAndMnemonic=&Aceptar
-# dummy resource added for translation automation
-OptionPane.cancelButton.textAndMnemonic=&Cancelar
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=Selector de Color para >K
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Mat:
+
+GTKColorChooserPanel.red.textAndMnemonic=Ro&jo:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&Saturaci\u00F3n:
+
+GTKColorChooserPanel.green.textAndMnemonic=&Verde:
+
+GTKColorChooserPanel.value.textAndMnemonic=&Valor:
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Azul:
+
+GTKColorChooserPanel.color.textAndMnemonic=&Nombre del Color:
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=Todos los Archivos
+FileChooser.newFolderButton.textAndMnemonic=&Nueva Carpeta
+FileChooser.newFolderDialog.textAndMnemonic=Nombre de la Carpeta:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error al crear el directorio "{0}": no existe dicho archivo o directorio
+FileChooser.deleteFileButton.textAndMnemonic=Su&primir Archivo
+FileChooser.renameFileButton.textAndMnemonic=Cambiar Nomb&re de Archivo
+FileChooser.cancelButton.textAndMnemonic=&Cancelar
+FileChooser.saveButton.textAndMnemonic=&Aceptar
+FileChooser.openButton.textAndMnemonic=&Aceptar
+FileChooser.saveDialogTitle.textAndMnemonic=Guardar
+FileChooser.openDialogTitle.textAndMnemonic=Abrir
+FileChooser.pathLabel.textAndMnemonic=&Selecci\u00F3n:
+FileChooser.filterLabel.textAndMnemonic=Filtro:
+FileChooser.foldersLabel.textAndMnemonic=Carpe&tas
+FileChooser.filesLabel.textAndMnemonic=&Archivos
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar cuadro de di\u00E1logo del selector de archivos.
+FileChooser.saveButtonToolTip.textAndMnemonic=Guardar el archivo seleccionado.
+FileChooser.openButtonToolTip.textAndMnemonic=Abrir el archivo seleccionado.
+
+FileChooser.renameFileDialog.textAndMnemonic=Cambiar el nombre del archivo "{0}" por
+FileChooser.renameFileError.titleAndMnemonic=Error
+FileChooser.renameFileError.textAndMnemonic=Error al cambiar el nombre del archivo "{0}" a "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -1,59 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=S\u00E9lecteur de couleurs GTK(&G)
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Teinte :
-
-GTKColorChooserPanel.red.textAndMnemonic=Rouge\u00A0(&E):
-
-GTKColorChooserPanel.saturation.textAndMnemonic=&Saturation :
-
-GTKColorChooserPanel.green.textAndMnemonic=V&ert :
-
-GTKColorChooserPanel.value.textAndMnemonic=&Valeur :
-
-GTKColorChooserPanel.blue.textAndMnemonic=&Bleu :
-
-GTKColorChooserPanel.color.textAndMnemonic=&Nom de couleur :
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=Tous les fichiers
-FileChooser.newFolderButton.textAndMnemonic=&Nouveau dossier
-FileChooser.newFolderDialog.textAndMnemonic=Nom du dossier :
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Erreur
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Erreur lors de la cr\u00E9ation du r\u00E9pertoire "{0}" : ce fichier ou r\u00E9pertoire n''existe pas
-FileChooser.deleteFileButton.textAndMnemonic=Supprimer &le fichier
-FileChooser.renameFileButton.textAndMnemonic=&Renommer le fichier
-FileChooser.cancelButton.textAndMnemonic=&Annuler
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer
-FileChooser.openDialogTitle.textAndMnemonic=Ouvrir
-FileChooser.pathLabel.textAndMnemonic=S\u00E9lection (&S):
-FileChooser.filterLabel.textAndMnemonic=Filtre :
-FileChooser.foldersLabel.textAndMnemonic=&Dossiers
-FileChooser.filesLabel.textAndMnemonic=&Fichiers
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Ferme la bo\u00EEte de dialogue du s\u00E9lecteur de fichiers.
-FileChooser.saveButtonToolTip.textAndMnemonic=Enregistre le fichier s\u00E9lectionn\u00E9.
-FileChooser.openButtonToolTip.textAndMnemonic=Ouvre le fichier s\u00E9lectionn\u00E9.
-
-FileChooser.renameFileDialog.textAndMnemonic=Renomme le fichier "{0}" en
-FileChooser.renameFileError.titleAndMnemonic=Erreur
-FileChooser.renameFileError.textAndMnemonic=Erreur lors du changement de nom du fichier "{0}" en "{1}"
-
-# dummy resource added for translation automation
-OptionPane.okButton.textAndMnemonic=&OK
-# dummy resource added for translation automation
-OptionPane.cancelButton.textAndMnemonic=&Annuler
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=S\u00E9lecteur de couleurs >K
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Teinte :
+
+GTKColorChooserPanel.red.textAndMnemonic=Roug&e\u00A0:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&Saturation :
+
+GTKColorChooserPanel.green.textAndMnemonic=&Vert :
+
+GTKColorChooserPanel.value.textAndMnemonic=&Valeur :
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Bleu :
+
+GTKColorChooserPanel.color.textAndMnemonic=&Nom de couleur :
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=Tous les fichiers
+FileChooser.newFolderButton.textAndMnemonic=&Nouveau dossier
+FileChooser.newFolderDialog.textAndMnemonic=Nom du dossier :
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Erreur
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Erreur lors de la cr\u00E9ation du r\u00E9pertoire "{0}" : ce fichier ou r\u00E9pertoire n''existe pas
+FileChooser.deleteFileButton.textAndMnemonic=Supprimer &le fichier
+FileChooser.renameFileButton.textAndMnemonic=&Renommer le fichier
+FileChooser.cancelButton.textAndMnemonic=&Annuler
+FileChooser.saveButton.textAndMnemonic=&OK
+FileChooser.openButton.textAndMnemonic=&OK
+FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer
+FileChooser.openDialogTitle.textAndMnemonic=Ouvrir
+FileChooser.pathLabel.textAndMnemonic=&S\u00E9lection :
+FileChooser.filterLabel.textAndMnemonic=Filtre :
+FileChooser.foldersLabel.textAndMnemonic=&Dossiers
+FileChooser.filesLabel.textAndMnemonic=&Fichiers
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Ferme la bo\u00EEte de dialogue du s\u00E9lecteur de fichiers.
+FileChooser.saveButtonToolTip.textAndMnemonic=Enregistre le fichier s\u00E9lectionn\u00E9.
+FileChooser.openButtonToolTip.textAndMnemonic=Ouvre le fichier s\u00E9lectionn\u00E9.
+
+FileChooser.renameFileDialog.textAndMnemonic=Renomme le fichier "{0}" en
+FileChooser.renameFileError.titleAndMnemonic=Erreur
+FileChooser.renameFileError.textAndMnemonic=Erreur lors du changement de nom du fichier "{0}" en "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties Wed May 01 11:34:06 2013 -0700
@@ -1,59 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=Selezione colore >K
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Ton.:
-
-GTKColorChooserPanel.red.textAndMnemonic=R&osso:
-
-GTKColorChooserPanel.saturation.textAndMnemonic=&Saturazione:
-
-GTKColorChooserPanel.green.textAndMnemonic=V&erde:
-
-GTKColorChooserPanel.value.textAndMnemonic=&Valore:
-
-GTKColorChooserPanel.blue.textAndMnemonic=&Blu:
-
-GTKColorChooserPanel.color.textAndMnemonic=&Nome colore:
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=Tutti i file
-FileChooser.newFolderButton.textAndMnemonic=&Nuova cartella
-FileChooser.newFolderDialog.textAndMnemonic=Nome della cartella:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Errore
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Errore durante la creazione della directory "{0}": file o directory inesistente
-FileChooser.deleteFileButton.textAndMnemonic=E&limina file
-FileChooser.renameFileButton.textAndMnemonic=&Rinomina file
-FileChooser.cancelButton.textAndMnemonic=&Annulla
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=Salva
-FileChooser.openDialogTitle.textAndMnemonic=Apri
-FileChooser.pathLabel.textAndMnemonic=&Selezione:
-FileChooser.filterLabel.textAndMnemonic=Filtro:
-FileChooser.foldersLabel.textAndMnemonic=Car&telle
-FileChooser.filesLabel.textAndMnemonic=&File
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Chiude la finestra di dialogo di selezione file.
-FileChooser.saveButtonToolTip.textAndMnemonic=Salva il file selezionato.
-FileChooser.openButtonToolTip.textAndMnemonic=Apre il file selezionato.
-
-FileChooser.renameFileDialog.textAndMnemonic=Rinomina file "{0}" in
-FileChooser.renameFileError.titleAndMnemonic=Errore
-FileChooser.renameFileError.textAndMnemonic=Errore durante la ridenominazione del file "{0}" in "{1}"
-
-# dummy resource added for translation automation
-OptionPane.okButton.textAndMnemonic=&OK
-# dummy resource added for translation automation
-OptionPane.cancelButton.textAndMnemonic=&Annulla
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=Selezione colore >K
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Ton.:
+
+GTKColorChooserPanel.red.textAndMnemonic=R&osso:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&Saturazione:
+
+GTKColorChooserPanel.green.textAndMnemonic=&Verde:
+
+GTKColorChooserPanel.value.textAndMnemonic=&Valore:
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Blu:
+
+GTKColorChooserPanel.color.textAndMnemonic=&Nome colore:
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=Tutti i file
+FileChooser.newFolderButton.textAndMnemonic=&Nuova cartella
+FileChooser.newFolderDialog.textAndMnemonic=Nome della cartella:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Errore
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Errore durante la creazione della directory "{0}": file o directory inesistente
+FileChooser.deleteFileButton.textAndMnemonic=E&limina file
+FileChooser.renameFileButton.textAndMnemonic=&Rinomina file
+FileChooser.cancelButton.textAndMnemonic=&Annulla
+FileChooser.saveButton.textAndMnemonic=&OK
+FileChooser.openButton.textAndMnemonic=&OK
+FileChooser.saveDialogTitle.textAndMnemonic=Salva
+FileChooser.openDialogTitle.textAndMnemonic=Apri
+FileChooser.pathLabel.textAndMnemonic=&Selezione:
+FileChooser.filterLabel.textAndMnemonic=Filtro:
+FileChooser.foldersLabel.textAndMnemonic=Car&telle
+FileChooser.filesLabel.textAndMnemonic=&File
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Chiude la finestra di dialogo di selezione file.
+FileChooser.saveButtonToolTip.textAndMnemonic=Salva il file selezionato.
+FileChooser.openButtonToolTip.textAndMnemonic=Apre il file selezionato.
+
+FileChooser.renameFileDialog.textAndMnemonic=Rinomina file "{0}" in
+FileChooser.renameFileError.titleAndMnemonic=Errore
+FileChooser.renameFileError.textAndMnemonic=Errore durante la ridenominazione del file "{0}" in "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -1,55 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=GTK\u30AB\u30E9\u30FC\u30FB\u30C1\u30E5\u30FC\u30B6(&G)
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=\u8272\u76F8(&H):
-
-GTKColorChooserPanel.red.textAndMnemonic=\u8D64(&E):
-
-GTKColorChooserPanel.saturation.textAndMnemonic=\u5F69\u5EA6(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=\u7DD1(&G):
-
-GTKColorChooserPanel.value.textAndMnemonic=\u5024(&V):
-
-GTKColorChooserPanel.blue.textAndMnemonic=\u9752(&B):
-
-GTKColorChooserPanel.color.textAndMnemonic=\u8272\u540D(&N):
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB
-FileChooser.newFolderButton.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0(&N)
-FileChooser.newFolderDialog.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u30A8\u30E9\u30FC
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA"{0}"\u306E\u4F5C\u6210\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: \u3053\u306E\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\u5B58\u5728\u3057\u307E\u305B\u3093
-FileChooser.deleteFileButton.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u524A\u9664(&L)
-FileChooser.renameFileButton.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u5909\u66F4(&R)
-FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
-FileChooser.openDialogTitle.textAndMnemonic=\u958B\u304F
-FileChooser.pathLabel.textAndMnemonic=\u9078\u629E(&S):
-FileChooser.filterLabel.textAndMnemonic=\u30D5\u30A3\u30EB\u30BF:
-FileChooser.foldersLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0(&D)
-FileChooser.filesLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB(&F)
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u30FB\u30C1\u30E5\u30FC\u30B6\u30FB\u30C0\u30A4\u30A2\u30ED\u30B0\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002
-FileChooser.saveButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u4FDD\u5B58\u3057\u307E\u3059\u3002
-FileChooser.openButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304D\u307E\u3059\u3002
-
-FileChooser.renameFileDialog.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB"{0}"\u3092\u6B21\u306E\u540D\u524D\u306B\u5909\u66F4:
-FileChooser.renameFileError.titleAndMnemonic=\u30A8\u30E9\u30FC
-FileChooser.renameFileError.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB"{0}"\u306E"{1}"\u3078\u306E\u5909\u66F4\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
-
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=GTK\u30AB\u30E9\u30FC\u30FB\u30C1\u30E5\u30FC\u30B6(&G)
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=\u8272\u76F8(&H):
+
+GTKColorChooserPanel.red.textAndMnemonic=\u8D64(&E):
+
+GTKColorChooserPanel.saturation.textAndMnemonic=\u5F69\u5EA6(&S):
+
+GTKColorChooserPanel.green.textAndMnemonic=\u7DD1(&G):
+
+GTKColorChooserPanel.value.textAndMnemonic=\u5024(&V):
+
+GTKColorChooserPanel.blue.textAndMnemonic=\u9752(&B):
+
+GTKColorChooserPanel.color.textAndMnemonic=\u8272\u540D(&N):
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB
+FileChooser.newFolderButton.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0(&N)
+FileChooser.newFolderDialog.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u30A8\u30E9\u30FC
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA"{0}"\u306E\u4F5C\u6210\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: \u3053\u306E\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\u5B58\u5728\u3057\u307E\u305B\u3093
+FileChooser.deleteFileButton.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u524A\u9664(&L)
+FileChooser.renameFileButton.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u5909\u66F4(&R)
+FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
+FileChooser.saveButton.textAndMnemonic=OK(&O)
+FileChooser.openButton.textAndMnemonic=OK(&O)
+FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openDialogTitle.textAndMnemonic=\u958B\u304F
+FileChooser.pathLabel.textAndMnemonic=\u9078\u629E(&S):
+FileChooser.filterLabel.textAndMnemonic=\u30D5\u30A3\u30EB\u30BF:
+FileChooser.foldersLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0(&D)
+FileChooser.filesLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB(&F)
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u30FB\u30C1\u30E5\u30FC\u30B6\u30FB\u30C0\u30A4\u30A2\u30ED\u30B0\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002
+FileChooser.saveButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u4FDD\u5B58\u3057\u307E\u3059\u3002
+FileChooser.openButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304D\u307E\u3059\u3002
+
+FileChooser.renameFileDialog.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB"{0}"\u3092\u6B21\u306E\u540D\u524D\u306B\u5909\u66F4:
+FileChooser.renameFileError.titleAndMnemonic=\u30A8\u30E9\u30FC
+FileChooser.renameFileError.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB"{0}"\u306E"{1}"\u3078\u306E\u5909\u66F4\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties Wed May 01 11:34:06 2013 -0700
@@ -1,55 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=GTK \uC0C9\uC0C1 \uC120\uD0DD\uAE30(&G)
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=\uC0C9\uC870(&H):
-
-GTKColorChooserPanel.red.textAndMnemonic=\uBE68\uAC04\uC0C9(&E):
-
-GTKColorChooserPanel.saturation.textAndMnemonic=\uCC44\uB3C4(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=\uB179\uC0C9(&G):
-
-GTKColorChooserPanel.value.textAndMnemonic=\uAC12(&V):
-
-GTKColorChooserPanel.blue.textAndMnemonic=\uD30C\uB780\uC0C9(&B):
-
-GTKColorChooserPanel.color.textAndMnemonic=\uC0C9\uC0C1 \uC774\uB984(&N):
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=\uBAA8\uB4E0 \uD30C\uC77C
-FileChooser.newFolderButton.textAndMnemonic=\uC0C8 \uD3F4\uB354(&N)
-FileChooser.newFolderDialog.textAndMnemonic=\uD3F4\uB354 \uC774\uB984:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\uC624\uB958
-FileChooser.newFolderNoDirectoryError.textAndMnemonic="{0}" \uB514\uB809\uD1A0\uB9AC\uB97C \uC0DD\uC131\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: \uD574\uB2F9 \uD30C\uC77C \uB610\uB294 \uB514\uB809\uD1A0\uB9AC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.
-FileChooser.deleteFileButton.textAndMnemonic=\uD30C\uC77C \uC0AD\uC81C(&L)
-FileChooser.renameFileButton.textAndMnemonic=\uD30C\uC77C \uC774\uB984 \uBC14\uAFB8\uAE30(&R)
-FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C(&C)
-FileChooser.saveButton.textAndMnemonic=\uD655\uC778(&O)
-FileChooser.openButton.textAndMnemonic=\uD655\uC778(&O)
-FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5
-FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30
-FileChooser.pathLabel.textAndMnemonic=\uC120\uD0DD \uC0AC\uD56D(&S):
-FileChooser.filterLabel.textAndMnemonic=\uD544\uD130:
-FileChooser.foldersLabel.textAndMnemonic=\uD3F4\uB354(&D)
-FileChooser.filesLabel.textAndMnemonic=\uD30C\uC77C(&F)
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=\uD30C\uC77C \uC120\uD0DD\uAE30 \uB300\uD654\uC0C1\uC790\uB97C \uC911\uB2E8\uD569\uB2C8\uB2E4.
-FileChooser.saveButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC800\uC7A5\uD569\uB2C8\uB2E4.
-FileChooser.openButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC5FD\uB2C8\uB2E4.
-
-FileChooser.renameFileDialog.textAndMnemonic="{0}" \uD30C\uC77C\uC758 \uC774\uB984 \uBC14\uAFB8\uAE30
-FileChooser.renameFileError.titleAndMnemonic=\uC624\uB958
-FileChooser.renameFileError.textAndMnemonic="{0}" \uD30C\uC77C\uC758 \uC774\uB984\uC744 "{1}"(\uC73C)\uB85C \uBC14\uAFB8\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
-
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=GTK \uC0C9\uC0C1 \uC120\uD0DD\uAE30(&G)
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=\uC0C9\uC870(&H):
+
+GTKColorChooserPanel.red.textAndMnemonic=\uBE68\uAC04\uC0C9(&E):
+
+GTKColorChooserPanel.saturation.textAndMnemonic=\uCC44\uB3C4(&S):
+
+GTKColorChooserPanel.green.textAndMnemonic=\uB179\uC0C9(&G):
+
+GTKColorChooserPanel.value.textAndMnemonic=\uAC12(&V):
+
+GTKColorChooserPanel.blue.textAndMnemonic=\uD30C\uB780\uC0C9(&B):
+
+GTKColorChooserPanel.color.textAndMnemonic=\uC0C9\uC0C1 \uC774\uB984(&N):
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=\uBAA8\uB4E0 \uD30C\uC77C
+FileChooser.newFolderButton.textAndMnemonic=\uC0C8 \uD3F4\uB354(&N)
+FileChooser.newFolderDialog.textAndMnemonic=\uD3F4\uB354 \uC774\uB984:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\uC624\uB958
+FileChooser.newFolderNoDirectoryError.textAndMnemonic="{0}" \uB514\uB809\uD1A0\uB9AC\uB97C \uC0DD\uC131\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: \uD574\uB2F9 \uD30C\uC77C \uB610\uB294 \uB514\uB809\uD1A0\uB9AC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.
+FileChooser.deleteFileButton.textAndMnemonic=\uD30C\uC77C \uC0AD\uC81C(&L)
+FileChooser.renameFileButton.textAndMnemonic=\uD30C\uC77C \uC774\uB984 \uBC14\uAFB8\uAE30(&R)
+FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C(&C)
+FileChooser.saveButton.textAndMnemonic=\uD655\uC778(&O)
+FileChooser.openButton.textAndMnemonic=\uD655\uC778(&O)
+FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5
+FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30
+FileChooser.pathLabel.textAndMnemonic=\uC120\uD0DD \uC0AC\uD56D(&S):
+FileChooser.filterLabel.textAndMnemonic=\uD544\uD130:
+FileChooser.foldersLabel.textAndMnemonic=\uD3F4\uB354(&D)
+FileChooser.filesLabel.textAndMnemonic=\uD30C\uC77C(&F)
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=\uD30C\uC77C \uC120\uD0DD\uAE30 \uB300\uD654\uC0C1\uC790\uB97C \uC911\uB2E8\uD569\uB2C8\uB2E4.
+FileChooser.saveButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC800\uC7A5\uD569\uB2C8\uB2E4.
+FileChooser.openButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC5FD\uB2C8\uB2E4.
+
+FileChooser.renameFileDialog.textAndMnemonic="{0}" \uD30C\uC77C\uC758 \uC774\uB984 \uBC14\uAFB8\uAE30
+FileChooser.renameFileError.titleAndMnemonic=\uC624\uB958
+FileChooser.renameFileError.textAndMnemonic="{0}" \uD30C\uC77C\uC758 \uC774\uB984\uC744 "{1}"(\uC73C)\uB85C \uBC14\uAFB8\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -1,59 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=Seletor de Cores do >K
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Matiz:
-
-GTKColorChooserPanel.red.textAndMnemonic=V&ermelho:
-
-GTKColorChooserPanel.saturation.textAndMnemonic=Satura\u00E7\u00E3o(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=Ver&de:
-
-GTKColorChooserPanel.value.textAndMnemonic=&Valor:
-
-GTKColorChooserPanel.blue.textAndMnemonic=&Azul:
-
-GTKColorChooserPanel.color.textAndMnemonic=&Nome da Cor:
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=Todos os Arquivos
-FileChooser.newFolderButton.textAndMnemonic=&Nova Pasta
-FileChooser.newFolderDialog.textAndMnemonic=Nome da pasta:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Erro
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Erro ao criar o diret\u00F3rio "{0}": N\u00E3o h\u00E1 arquivo ou diret\u00F3rio
-FileChooser.deleteFileButton.textAndMnemonic=De&letar Arquivo
-FileChooser.renameFileButton.textAndMnemonic=&Renomear Arquivo
-FileChooser.cancelButton.textAndMnemonic=&Cancelar
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=Salvar
-FileChooser.openDialogTitle.textAndMnemonic=Abrir
-FileChooser.pathLabel.textAndMnemonic=Sele\u00E7\u00E3o(&S):
-FileChooser.filterLabel.textAndMnemonic=Filtro:
-FileChooser.foldersLabel.textAndMnemonic=&Pastas
-FileChooser.filesLabel.textAndMnemonic=&Arquivos
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar caixa de di\u00E1logo do seletor de arquivos.
-FileChooser.saveButtonToolTip.textAndMnemonic=Salvar arquivo selecionado.
-FileChooser.openButtonToolTip.textAndMnemonic=Abrir arquivo selecionado.
-
-FileChooser.renameFileDialog.textAndMnemonic=Renomear arquivo "{0}" por
-FileChooser.renameFileError.titleAndMnemonic=Erro
-FileChooser.renameFileError.textAndMnemonic=Erro ao renomear o arquivo "{0}" por "{1}"
-
-# dummy resource added for translation automation
-OptionPane.okButton.textAndMnemonic=&OK
-# dummy resource added for translation automation
-OptionPane.cancelButton.textAndMnemonic=&Cancelar
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=Seletor de Cores do >K
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Matiz:
+
+GTKColorChooserPanel.red.textAndMnemonic=V&ermelho:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&Satura\u00E7\u00E3o:
+
+GTKColorChooserPanel.green.textAndMnemonic=&Verde:
+
+GTKColorChooserPanel.value.textAndMnemonic=&Valor:
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Azul:
+
+GTKColorChooserPanel.color.textAndMnemonic=&Nome da Cor:
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=Todos os Arquivos
+FileChooser.newFolderButton.textAndMnemonic=&Nova Pasta
+FileChooser.newFolderDialog.textAndMnemonic=Nome da pasta:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Erro
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Erro ao criar o diret\u00F3rio "{0}": N\u00E3o h\u00E1 arquivo ou diret\u00F3rio
+FileChooser.deleteFileButton.textAndMnemonic=De&letar Arquivo
+FileChooser.renameFileButton.textAndMnemonic=&Renomear Arquivo
+FileChooser.cancelButton.textAndMnemonic=&Cancelar
+FileChooser.saveButton.textAndMnemonic=&OK
+FileChooser.openButton.textAndMnemonic=&OK
+FileChooser.saveDialogTitle.textAndMnemonic=Salvar
+FileChooser.openDialogTitle.textAndMnemonic=Abrir
+FileChooser.pathLabel.textAndMnemonic=&Sele\u00E7\u00E3o:
+FileChooser.filterLabel.textAndMnemonic=Filtro:
+FileChooser.foldersLabel.textAndMnemonic=&Pastas
+FileChooser.filesLabel.textAndMnemonic=&Arquivos
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar caixa de di\u00E1logo do seletor de arquivos.
+FileChooser.saveButtonToolTip.textAndMnemonic=Salvar arquivo selecionado.
+FileChooser.openButtonToolTip.textAndMnemonic=Abrir arquivo selecionado.
+
+FileChooser.renameFileDialog.textAndMnemonic=Renomear arquivo "{0}" por
+FileChooser.renameFileError.titleAndMnemonic=Erro
+FileChooser.renameFileError.textAndMnemonic=Erro ao renomear o arquivo "{0}" por "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -1,59 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=GTK-f\u00E4rgv\u00E4ljaren(&G)
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Nyans:
-
-GTKColorChooserPanel.red.textAndMnemonic=R\u00F6d(&R):
-
-GTKColorChooserPanel.saturation.textAndMnemonic=M\u00E4ttnad(&M):
-
-GTKColorChooserPanel.green.textAndMnemonic=Gr\u00F6n(&G):
-
-GTKColorChooserPanel.value.textAndMnemonic=V\u00E4rde(&V):
-
-GTKColorChooserPanel.blue.textAndMnemonic=Bl\u00E5(&B):
-
-GTKColorChooserPanel.color.textAndMnemonic=F\u00E4rgnamn(&F):
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=Alla filer
-FileChooser.newFolderButton.textAndMnemonic=&Ny mapp
-FileChooser.newFolderDialog.textAndMnemonic=Mapp:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Fel
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Ett fel intr\u00E4ffade vid f\u00F6rs\u00F6k att skapa katalogen "{0}": Filen eller katalogen finns inte
-FileChooser.deleteFileButton.textAndMnemonic=Ta &bort fil
-FileChooser.renameFileButton.textAndMnemonic=\u00C4ndra namn p\u00E5 filen(&R)
-FileChooser.cancelButton.textAndMnemonic=&Avbryt
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=Spara
-FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna
-FileChooser.pathLabel.textAndMnemonic=&Urval:
-FileChooser.filterLabel.textAndMnemonic=Filter:
-FileChooser.foldersLabel.textAndMnemonic=Ma&ppar
-FileChooser.filesLabel.textAndMnemonic=&Filer
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Avbryt dialogrutan Filv\u00E4ljare.
-FileChooser.saveButtonToolTip.textAndMnemonic=Spara vald fil.
-FileChooser.openButtonToolTip.textAndMnemonic=\u00D6ppna vald fil.
-
-FileChooser.renameFileDialog.textAndMnemonic=Namn\u00E4ndra fil "{0}" till
-FileChooser.renameFileError.titleAndMnemonic=Fel
-FileChooser.renameFileError.textAndMnemonic=Fel vid namn\u00E4ndring av fil "{0}" till "{1}"
-
-# dummy resource added for translation automation
-OptionPane.okButton.textAndMnemonic=&OK
-# dummy resource added for translation automation
-OptionPane.cancelButton.textAndMnemonic=&Avbryt
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=>K-f\u00E4rgv\u00E4ljaren
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Nyans:
+
+GTKColorChooserPanel.red.textAndMnemonic=R&\u00F6d:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&M\u00E4ttnad:
+
+GTKColorChooserPanel.green.textAndMnemonic=&Gr\u00F6n:
+
+GTKColorChooserPanel.value.textAndMnemonic=&V\u00E4rde:
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Bl\u00E5:
+
+GTKColorChooserPanel.color.textAndMnemonic=F\u00E4rg&namn:
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=Alla filer
+FileChooser.newFolderButton.textAndMnemonic=&Ny mapp
+FileChooser.newFolderDialog.textAndMnemonic=Mapp:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Fel
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Ett fel intr\u00E4ffade vid f\u00F6rs\u00F6k att skapa katalogen "{0}": Filen eller katalogen finns inte
+FileChooser.deleteFileButton.textAndMnemonic=Ta &bort fil
+FileChooser.renameFileButton.textAndMnemonic=&\u00C4ndra namn p\u00E5 filen
+FileChooser.cancelButton.textAndMnemonic=&Avbryt
+FileChooser.saveButton.textAndMnemonic=&OK
+FileChooser.openButton.textAndMnemonic=&OK
+FileChooser.saveDialogTitle.textAndMnemonic=Spara
+FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna
+FileChooser.pathLabel.textAndMnemonic=&Urval:
+FileChooser.filterLabel.textAndMnemonic=Filter:
+FileChooser.foldersLabel.textAndMnemonic=Map&par
+FileChooser.filesLabel.textAndMnemonic=&Filer
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Avbryt dialogrutan Filv\u00E4ljare.
+FileChooser.saveButtonToolTip.textAndMnemonic=Spara vald fil.
+FileChooser.openButtonToolTip.textAndMnemonic=\u00D6ppna vald fil.
+
+FileChooser.renameFileDialog.textAndMnemonic=Namn\u00E4ndra fil "{0}" till
+FileChooser.renameFileError.titleAndMnemonic=Fel
+FileChooser.renameFileError.textAndMnemonic=Fel vid namn\u00E4ndring av fil "{0}" till "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -1,55 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=GTK \u989C\u8272\u9009\u62E9\u5668(&G)
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=\u8272\u8C03(&H):
-
-GTKColorChooserPanel.red.textAndMnemonic=\u7EA2\u8272(&E):
-
-GTKColorChooserPanel.saturation.textAndMnemonic=\u9971\u548C\u5EA6(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=\u7EFF\u8272(&G):
-
-GTKColorChooserPanel.value.textAndMnemonic=\u503C(&V):
-
-GTKColorChooserPanel.blue.textAndMnemonic=\u84DD\u8272(&B):
-
-GTKColorChooserPanel.color.textAndMnemonic=\u989C\u8272\u540D(&N):
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6587\u4EF6
-FileChooser.newFolderButton.textAndMnemonic=\u65B0\u6587\u4EF6\u5939(&N)
-FileChooser.newFolderDialog.textAndMnemonic=\u6587\u4EF6\u5939\u540D:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u9519\u8BEF
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u521B\u5EFA\u76EE\u5F55 "{0}" \u65F6\u51FA\u9519: \u6CA1\u6709\u6B64\u7C7B\u6587\u4EF6\u6216\u76EE\u5F55
-FileChooser.deleteFileButton.textAndMnemonic=\u5220\u9664\u6587\u4EF6(&L)
-FileChooser.renameFileButton.textAndMnemonic=\u91CD\u547D\u540D\u6587\u4EF6(&R)
-FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
-FileChooser.saveButton.textAndMnemonic=\u786E\u5B9A(&O)
-FileChooser.openButton.textAndMnemonic=\u786E\u5B9A(&O)
-FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
-FileChooser.openDialogTitle.textAndMnemonic=\u6253\u5F00
-FileChooser.pathLabel.textAndMnemonic=\u9009\u5B9A\u5185\u5BB9(&S):
-FileChooser.filterLabel.textAndMnemonic=\u7B5B\u9009\u5668:
-FileChooser.foldersLabel.textAndMnemonic=\u6587\u4EF6\u5939(&D)
-FileChooser.filesLabel.textAndMnemonic=\u6587\u4EF6(&F)
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6587\u4EF6\u9009\u62E9\u5668\u5BF9\u8BDD\u6846\u3002
-FileChooser.saveButtonToolTip.textAndMnemonic=\u4FDD\u5B58\u6240\u9009\u6587\u4EF6\u3002
-FileChooser.openButtonToolTip.textAndMnemonic=\u6253\u5F00\u6240\u9009\u6587\u4EF6\u3002
-
-FileChooser.renameFileDialog.textAndMnemonic=\u5C06\u6587\u4EF6 "{0}" \u91CD\u547D\u540D\u4E3A
-FileChooser.renameFileError.titleAndMnemonic=\u9519\u8BEF
-FileChooser.renameFileError.textAndMnemonic=\u5C06\u6587\u4EF6 "{0}" \u91CD\u547D\u540D\u4E3A "{1}" \u65F6\u51FA\u9519
-
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=GTK \u989C\u8272\u9009\u62E9\u5668(&G)
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=\u8272\u8C03(&H):
+
+GTKColorChooserPanel.red.textAndMnemonic=\u7EA2\u8272(&E):
+
+GTKColorChooserPanel.saturation.textAndMnemonic=\u9971\u548C\u5EA6(&S):
+
+GTKColorChooserPanel.green.textAndMnemonic=\u7EFF\u8272(&G):
+
+GTKColorChooserPanel.value.textAndMnemonic=\u503C(&V):
+
+GTKColorChooserPanel.blue.textAndMnemonic=\u84DD\u8272(&B):
+
+GTKColorChooserPanel.color.textAndMnemonic=\u989C\u8272\u540D(&N):
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6587\u4EF6
+FileChooser.newFolderButton.textAndMnemonic=\u65B0\u6587\u4EF6\u5939(&N)
+FileChooser.newFolderDialog.textAndMnemonic=\u6587\u4EF6\u5939\u540D:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u9519\u8BEF
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u521B\u5EFA\u76EE\u5F55 "{0}" \u65F6\u51FA\u9519: \u6CA1\u6709\u6B64\u7C7B\u6587\u4EF6\u6216\u76EE\u5F55
+FileChooser.deleteFileButton.textAndMnemonic=\u5220\u9664\u6587\u4EF6(&L)
+FileChooser.renameFileButton.textAndMnemonic=\u91CD\u547D\u540D\u6587\u4EF6(&R)
+FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
+FileChooser.saveButton.textAndMnemonic=\u786E\u5B9A(&O)
+FileChooser.openButton.textAndMnemonic=\u786E\u5B9A(&O)
+FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openDialogTitle.textAndMnemonic=\u6253\u5F00
+FileChooser.pathLabel.textAndMnemonic=\u9009\u5B9A\u5185\u5BB9(&S):
+FileChooser.filterLabel.textAndMnemonic=\u7B5B\u9009\u5668:
+FileChooser.foldersLabel.textAndMnemonic=\u6587\u4EF6\u5939(&D)
+FileChooser.filesLabel.textAndMnemonic=\u6587\u4EF6(&F)
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6587\u4EF6\u9009\u62E9\u5668\u5BF9\u8BDD\u6846\u3002
+FileChooser.saveButtonToolTip.textAndMnemonic=\u4FDD\u5B58\u6240\u9009\u6587\u4EF6\u3002
+FileChooser.openButtonToolTip.textAndMnemonic=\u6253\u5F00\u6240\u9009\u6587\u4EF6\u3002
+
+FileChooser.renameFileDialog.textAndMnemonic=\u5C06\u6587\u4EF6 "{0}" \u91CD\u547D\u540D\u4E3A
+FileChooser.renameFileError.titleAndMnemonic=\u9519\u8BEF
+FileChooser.renameFileError.textAndMnemonic=\u5C06\u6587\u4EF6 "{0}" \u91CD\u547D\u540D\u4E3A "{1}" \u65F6\u51FA\u9519
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties Wed May 01 11:34:06 2013 -0700
@@ -1,55 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=GTK \u8272\u5F69\u9078\u64C7\u5668(&G)
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=\u8272\u8ABF(&H)\uFF1A
-
-GTKColorChooserPanel.red.textAndMnemonic=\u7D05(&E):
-
-GTKColorChooserPanel.saturation.textAndMnemonic=\u5F69\u5EA6(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=\u7DA0(&G):
-
-GTKColorChooserPanel.value.textAndMnemonic=\u503C(&V):
-
-GTKColorChooserPanel.blue.textAndMnemonic=\u85CD(&B):
-
-GTKColorChooserPanel.color.textAndMnemonic=\u984F\u8272\u540D\u7A31(&N):
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6A94\u6848
-FileChooser.newFolderButton.textAndMnemonic=\u65B0\u5EFA\u8CC7\u6599\u593E(&N)
-FileChooser.newFolderDialog.textAndMnemonic=\u8CC7\u6599\u593E\u540D\u7A31:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u932F\u8AA4
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u5EFA\u7ACB\u76EE\u9304 "{0}" \u6642\u767C\u751F\u932F\u8AA4: \u6C92\u6709\u6B64\u6A94\u6848\u6216\u76EE\u9304
-FileChooser.deleteFileButton.textAndMnemonic=\u522A\u9664\u6A94\u6848(&L)
-FileChooser.renameFileButton.textAndMnemonic=\u91CD\u65B0\u547D\u540D\u6A94\u6848(&R)
-FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
-FileChooser.saveButton.textAndMnemonic=\u78BA\u5B9A(&O)
-FileChooser.openButton.textAndMnemonic=\u78BA\u5B9A(&O)
-FileChooser.saveDialogTitle.textAndMnemonic=\u5132\u5B58
-FileChooser.openDialogTitle.textAndMnemonic=\u958B\u555F
-FileChooser.pathLabel.textAndMnemonic=\u9078\u53D6(&S):
-FileChooser.filterLabel.textAndMnemonic=\u7BE9\u9078:
-FileChooser.foldersLabel.textAndMnemonic=\u8CC7\u6599\u593E(&D)
-FileChooser.filesLabel.textAndMnemonic=\u6A94\u6848(&F)
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6A94\u6848\u9078\u64C7\u5668\u5C0D\u8A71\u65B9\u584A\u3002
-FileChooser.saveButtonToolTip.textAndMnemonic=\u5132\u5B58\u9078\u53D6\u7684\u6A94\u6848\u3002
-FileChooser.openButtonToolTip.textAndMnemonic=\u958B\u555F\u9078\u53D6\u7684\u6A94\u6848\u3002
-
-FileChooser.renameFileDialog.textAndMnemonic=\u5C07\u6A94\u6848 "{0}" \u91CD\u65B0\u547D\u540D\u70BA
-FileChooser.renameFileError.titleAndMnemonic=\u932F\u8AA4
-FileChooser.renameFileError.textAndMnemonic=\u5C07\u6A94\u6848 "{0}" \u91CD\u65B0\u547D\u540D\u70BA "{1}" \u6642\u51FA\u73FE\u932F\u8AA4
-
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=GTK \u8272\u5F69\u9078\u64C7\u5668(&G)
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=\u8272\u8ABF(&H):
+
+GTKColorChooserPanel.red.textAndMnemonic=\u7D05(&E):
+
+GTKColorChooserPanel.saturation.textAndMnemonic=\u5F69\u5EA6(&S):
+
+GTKColorChooserPanel.green.textAndMnemonic=\u7DA0(&G):
+
+GTKColorChooserPanel.value.textAndMnemonic=\u503C(&V):
+
+GTKColorChooserPanel.blue.textAndMnemonic=\u85CD(&B):
+
+GTKColorChooserPanel.color.textAndMnemonic=\u984F\u8272\u540D\u7A31(&N):
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6A94\u6848
+FileChooser.newFolderButton.textAndMnemonic=\u65B0\u5EFA\u8CC7\u6599\u593E(&N)
+FileChooser.newFolderDialog.textAndMnemonic=\u8CC7\u6599\u593E\u540D\u7A31:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u932F\u8AA4
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u5EFA\u7ACB\u76EE\u9304 "{0}" \u6642\u767C\u751F\u932F\u8AA4: \u6C92\u6709\u6B64\u6A94\u6848\u6216\u76EE\u9304
+FileChooser.deleteFileButton.textAndMnemonic=\u522A\u9664\u6A94\u6848(&L)
+FileChooser.renameFileButton.textAndMnemonic=\u91CD\u65B0\u547D\u540D\u6A94\u6848(&R)
+FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
+FileChooser.saveButton.textAndMnemonic=\u78BA\u5B9A(&O)
+FileChooser.openButton.textAndMnemonic=\u78BA\u5B9A(&O)
+FileChooser.saveDialogTitle.textAndMnemonic=\u5132\u5B58
+FileChooser.openDialogTitle.textAndMnemonic=\u958B\u555F
+FileChooser.pathLabel.textAndMnemonic=\u9078\u53D6(&S):
+FileChooser.filterLabel.textAndMnemonic=\u7BE9\u9078:
+FileChooser.foldersLabel.textAndMnemonic=\u8CC7\u6599\u593E(&D)
+FileChooser.filesLabel.textAndMnemonic=\u6A94\u6848(&F)
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6A94\u6848\u9078\u64C7\u5668\u5C0D\u8A71\u65B9\u584A\u3002
+FileChooser.saveButtonToolTip.textAndMnemonic=\u5132\u5B58\u9078\u53D6\u7684\u6A94\u6848\u3002
+FileChooser.openButtonToolTip.textAndMnemonic=\u958B\u555F\u9078\u53D6\u7684\u6A94\u6848\u3002
+
+FileChooser.renameFileDialog.textAndMnemonic=\u5C07\u6A94\u6848 "{0}" \u91CD\u65B0\u547D\u540D\u70BA
+FileChooser.renameFileError.titleAndMnemonic=\u932F\u8AA4
+FileChooser.renameFileError.textAndMnemonic=\u5C07\u6A94\u6848 "{0}" \u91CD\u65B0\u547D\u540D\u70BA "{1}" \u6642\u51FA\u73FE\u932F\u8AA4
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties Wed May 01 11:34:06 2013 -0700
@@ -26,11 +26,11 @@
FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
FileChooser.updateButton.textAndMnemonic=Aktualisieren
FileChooser.helpButton.textAndMnemonic=Hilfe
-FileChooser.pathLabel.textAndMnemonic=&Pfad- oder Ordnernamen eingeben:
+FileChooser.pathLabel.textAndMnemonic=&Pfad- oder Ordnername eingeben:
FileChooser.filterLabel.textAndMnemonic=Filte&r
-FileChooser.foldersLabel.textAndMnemonic=Ordner(&L)
+FileChooser.foldersLabel.textAndMnemonic=Ord&ner
FileChooser.filesLabel.textAndMnemonic=Date&ien
-FileChooser.enterFileNameLabel.textAndMnemonic=Datei&namen eingeben:
+FileChooser.enterFileNameLabel.textAndMnemonic=Dateiname ei&ngeben:
FileChooser.enterFolderNameLabel.textAndMnemonic=Ordnernamen eingeben:
FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties Wed May 01 11:34:06 2013 -0700
@@ -26,9 +26,9 @@
FileChooser.openDialogTitle.textAndMnemonic=Abrir
FileChooser.updateButton.textAndMnemonic=Actualizar
FileChooser.helpButton.textAndMnemonic=Ayuda
-FileChooser.pathLabel.textAndMnemonic=Introducir nombre de la ruta de acceso o car&peta:
+FileChooser.pathLabel.textAndMnemonic=Introducir nombre de ruta de acceso o car&peta:
FileChooser.filterLabel.textAndMnemonic=Filt&ro
-FileChooser.foldersLabel.textAndMnemonic=Carpetas(&L)
+FileChooser.foldersLabel.textAndMnemonic=Carpe&tas
FileChooser.filesLabel.textAndMnemonic=Arch&ivos
FileChooser.enterFileNameLabel.textAndMnemonic=I&ntroducir nombre de archivo:
FileChooser.enterFolderNameLabel.textAndMnemonic=Introducir nombre de carpeta:
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -26,9 +26,9 @@
FileChooser.openDialogTitle.textAndMnemonic=Ouvrir
FileChooser.updateButton.textAndMnemonic=Mettre \u00E0 jour
FileChooser.helpButton.textAndMnemonic=Aide
-FileChooser.pathLabel.textAndMnemonic=Entrez le chemin ou le nom du dossier (&P):
+FileChooser.pathLabel.textAndMnemonic=Entrez le c&hemin ou le nom du dossier :
FileChooser.filterLabel.textAndMnemonic=Filt&re
-FileChooser.foldersLabel.textAndMnemonic=Dossiers(&L)
+FileChooser.foldersLabel.textAndMnemonic=&Dossiers
FileChooser.filesLabel.textAndMnemonic=F&ichiers
FileChooser.enterFileNameLabel.textAndMnemonic=E&ntrez le nom du fichier :
FileChooser.enterFolderNameLabel.textAndMnemonic=Entrez le nom du dossier :
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties Wed May 01 11:34:06 2013 -0700
@@ -28,9 +28,9 @@
FileChooser.helpButton.textAndMnemonic=?
FileChooser.pathLabel.textAndMnemonic=&Percorso o nome cartella:
FileChooser.filterLabel.textAndMnemonic=Filt&ro
-FileChooser.foldersLabel.textAndMnemonic=Carte&lle
+FileChooser.foldersLabel.textAndMnemonic=Car&telle
FileChooser.filesLabel.textAndMnemonic=F&ile
-FileChooser.enterFileNameLabel.textAndMnemonic=&Nome file:
+FileChooser.enterFileNameLabel.textAndMnemonic=Immettere il &nome file:
FileChooser.enterFolderNameLabel.textAndMnemonic=Nome cartella:
FileChooser.cancelButtonToolTip.textAndMnemonic=Chiude la finestra di dialogo di selezione file.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -26,11 +26,11 @@
FileChooser.openDialogTitle.textAndMnemonic=Abrir
FileChooser.updateButton.textAndMnemonic=Atualizar
FileChooser.helpButton.textAndMnemonic=Ajuda
-FileChooser.pathLabel.textAndMnemonic=Informar caminho ou nome da &pasta:
+FileChooser.pathLabel.textAndMnemonic=Informar &caminho ou nome da pasta:
FileChooser.filterLabel.textAndMnemonic=Filt&ro
-FileChooser.foldersLabel.textAndMnemonic=Pastas(&L)
+FileChooser.foldersLabel.textAndMnemonic=Pa&stas
FileChooser.filesLabel.textAndMnemonic=Arqu&ivos
-FileChooser.enterFileNameLabel.textAndMnemonic=I&nformar nome do arquivo:
+FileChooser.enterFileNameLabel.textAndMnemonic=I&nforme o nome do arquivo:
FileChooser.enterFolderNameLabel.textAndMnemonic=Informar nome da pasta:
FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar caixa de di\u00E1logo do seletor de arquivos.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -26,9 +26,9 @@
FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna
FileChooser.updateButton.textAndMnemonic=Uppdatera
FileChooser.helpButton.textAndMnemonic=Hj\u00E4lp
-FileChooser.pathLabel.textAndMnemonic=Ange s\u00F6kv\u00E4g eller mappnamn(&P):
+FileChooser.pathLabel.textAndMnemonic=Ange &s\u00F6kv\u00E4g eller mappnamn:
FileChooser.filterLabel.textAndMnemonic=Filte&r
-FileChooser.foldersLabel.textAndMnemonic=Mappar(&L)
+FileChooser.foldersLabel.textAndMnemonic=Ma&ppar
FileChooser.filesLabel.textAndMnemonic=F&iler
FileChooser.enterFileNameLabel.textAndMnemonic=A&nge filnamn:
FileChooser.enterFolderNameLabel.textAndMnemonic=Ange ett mappnamn:
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -26,11 +26,11 @@
FileChooser.openDialogTitle.textAndMnemonic=\u6253\u5F00
FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0
FileChooser.helpButton.textAndMnemonic=\u5E2E\u52A9
-FileChooser.pathLabel.textAndMnemonic=\u952E\u5165\u8DEF\u5F84\u6216\u6587\u4EF6\u5939\u540D: (&P)
+FileChooser.pathLabel.textAndMnemonic=\u8F93\u5165\u8DEF\u5F84\u6216\u6587\u4EF6\u5939\u540D(&P):
FileChooser.filterLabel.textAndMnemonic=\u7B5B\u9009\u5668(&R)
FileChooser.foldersLabel.textAndMnemonic=\u6587\u4EF6\u5939(&L)
FileChooser.filesLabel.textAndMnemonic=\u6587\u4EF6(&I)
-FileChooser.enterFileNameLabel.textAndMnemonic=\u952E\u5165\u6587\u4EF6\u540D: (&N)
+FileChooser.enterFileNameLabel.textAndMnemonic=\u8F93\u5165\u6587\u4EF6\u540D(&N):
FileChooser.enterFolderNameLabel.textAndMnemonic=\u8F93\u5165\u6587\u4EF6\u5939\u540D:
FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6587\u4EF6\u9009\u62E9\u5668\u5BF9\u8BDD\u6846\u3002
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties Wed May 01 11:34:06 2013 -0700
@@ -20,9 +20,9 @@
FileChooser.lookInLabel.textAndMnemonic=Suchen &in:
FileChooser.saveInLabel.textAndMnemonic=Speichern in:
-FileChooser.fileNameLabel.textAndMnemonic=Datei&name:
-FileChooser.folderNameLabel.textAndMnemonic=Ord&nername:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Da&teityp:
+FileChooser.fileNameLabel.textAndMnemonic=&Dateiname:
+FileChooser.folderNameLabel.textAndMnemonic=Ordner&name:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Datei&typ:
FileChooser.upFolderToolTip.textAndMnemonic=Eine Ebene h\u00F6her
FileChooser.upFolderAccessibleName=Nach oben
FileChooser.homeFolderToolTip.textAndMnemonic=Home
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties Wed May 01 11:34:06 2013 -0700
@@ -18,11 +18,11 @@
############ FILE CHOOSER STRINGS #############
-FileChooser.lookInLabel.textAndMnemonic=Buscar en(&I):
+FileChooser.lookInLabel.textAndMnemonic=&Buscar en:
FileChooser.saveInLabel.textAndMnemonic=Guardar en:
-FileChooser.fileNameLabel.textAndMnemonic=&Nombre de Archivo:
-FileChooser.folderNameLabel.textAndMnemonic=&Nombre de la Carpeta:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &Tipo:
+FileChooser.fileNameLabel.textAndMnemonic=&Nombre de archivo:
+FileChooser.folderNameLabel.textAndMnemonic=&Nombre de carpeta:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &tipo:
FileChooser.upFolderToolTip.textAndMnemonic=Subir un Nivel
FileChooser.upFolderAccessibleName=Arriba
FileChooser.homeFolderToolTip.textAndMnemonic=Inicio
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -18,11 +18,11 @@
############ FILE CHOOSER STRINGS #############
-FileChooser.lookInLabel.textAndMnemonic=Rechercher dans (&I):
+FileChooser.lookInLabel.textAndMnemonic=Rechercher &dans :
FileChooser.saveInLabel.textAndMnemonic=Enregistrer dans :
FileChooser.fileNameLabel.textAndMnemonic=&Nom du fichier :
FileChooser.folderNameLabel.textAndMnemonic=&Nom du dossier :
-FileChooser.filesOfTypeLabel.textAndMnemonic=Fichiers de &type :
+FileChooser.filesOfTypeLabel.textAndMnemonic=&Type de fichier :
FileChooser.upFolderToolTip.textAndMnemonic=Remonte d'un niveau.
FileChooser.upFolderAccessibleName=Monter
FileChooser.homeFolderToolTip.textAndMnemonic=R\u00E9pertoire d'origine
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties Wed May 01 11:34:06 2013 -0700
@@ -21,7 +21,7 @@
FileChooser.lookInLabel.textAndMnemonic=Cerca &in:
FileChooser.saveInLabel.textAndMnemonic=Salva in:
FileChooser.fileNameLabel.textAndMnemonic=&Nome file:
-FileChooser.folderNameLabel.textAndMnemonic=&Nome della cartella:
+FileChooser.folderNameLabel.textAndMnemonic=&Nome cartella:
FileChooser.filesOfTypeLabel.textAndMnemonic=&Tipo file:
FileChooser.upFolderToolTip.textAndMnemonic=Cartella superiore
FileChooser.upFolderAccessibleName=Superiore
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -18,7 +18,7 @@
############ FILE CHOOSER STRINGS #############
-FileChooser.lookInLabel.textAndMnemonic=\u53C2\u7167(&I):
+FileChooser.lookInLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240(&I):
FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
FileChooser.fileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u540D(&N):
FileChooser.folderNameLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D(&N):
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties Wed May 01 11:34:06 2013 -0700
@@ -18,7 +18,7 @@
############ FILE CHOOSER STRINGS #############
-FileChooser.lookInLabel.textAndMnemonic=\uAC80\uC0C9 \uC704\uCE58(&I):
+FileChooser.lookInLabel.textAndMnemonic=\uCC3E\uB294 \uC704\uCE58(&I):
FileChooser.saveInLabel.textAndMnemonic=\uC800\uC7A5 \uC704\uCE58:
FileChooser.fileNameLabel.textAndMnemonic=\uD30C\uC77C \uC774\uB984(&N):
FileChooser.folderNameLabel.textAndMnemonic=\uD3F4\uB354 \uC774\uB984(&N):
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -18,7 +18,7 @@
############ FILE CHOOSER STRINGS #############
-FileChooser.lookInLabel.textAndMnemonic=Consultar em(&I):
+FileChooser.lookInLabel.textAndMnemonic=Pesquisar &em:
FileChooser.saveInLabel.textAndMnemonic=Salvar em:
FileChooser.fileNameLabel.textAndMnemonic=&Nome do arquivo:
FileChooser.folderNameLabel.textAndMnemonic=&Nome da pasta:
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -21,8 +21,8 @@
FileChooser.lookInLabel.textAndMnemonic=Leta &i:
FileChooser.saveInLabel.textAndMnemonic=Spara i:
FileChooser.fileNameLabel.textAndMnemonic=Fil&namn:
-FileChooser.folderNameLabel.textAndMnemonic=Mapp(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=Filforma&t:
+FileChooser.folderNameLabel.textAndMnemonic=Mapp&namn:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Filer av &typ:
FileChooser.upFolderToolTip.textAndMnemonic=Upp en niv\u00E5
FileChooser.upFolderAccessibleName=Upp
FileChooser.homeFolderToolTip.textAndMnemonic=Hem
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -18,11 +18,11 @@
############ FILE CHOOSER STRINGS #############
-FileChooser.lookInLabel.textAndMnemonic=\u67E5\u770B: (&I)
+FileChooser.lookInLabel.textAndMnemonic=\u67E5\u627E(&I):
FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
-FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6\u540D: (&N)
-FileChooser.folderNameLabel.textAndMnemonic=\u6587\u4EF6\u5939\u540D: (&N)
-FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u7C7B\u578B: (&T)
+FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6\u540D(&N):
+FileChooser.folderNameLabel.textAndMnemonic=\u6587\u4EF6\u5939\u540D(&N):
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u7C7B\u578B(&T):
FileChooser.upFolderToolTip.textAndMnemonic=\u5411\u4E0A\u4E00\u7EA7
FileChooser.upFolderAccessibleName=\u5411\u4E0A
FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u5F55
@@ -33,11 +33,11 @@
FileChooser.listViewButtonToolTip.textAndMnemonic=\u5217\u8868
FileChooser.listViewButtonAccessibleName=\u5217\u8868
FileChooser.listViewActionLabel.textAndMnemonic=\u5217\u8868
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599
-FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u8D44\u6599
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u4FE1\u606F
+FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u4FE1\u606F
FileChooser.viewMenuButtonToolTipText = \u67E5\u770B\u83DC\u5355
FileChooser.viewMenuButtonAccessibleName = \u67E5\u770B\u83DC\u5355
-FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599
+FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u4FE1\u606F
FileChooser.refreshActionLabel.textAndMnemonic=\u5237\u65B0
FileChooser.viewMenuLabel.textAndMnemonic=\u89C6\u56FE
FileChooser.fileNameHeader.textAndMnemonic=\u540D\u79F0
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -132,7 +132,12 @@
in0.close();
Utils.markJarFile(out);
} else {
- (new NativeUnpack(this)).run(in0, out);
+ try {
+ (new NativeUnpack(this)).run(in0, out);
+ } catch (UnsatisfiedLinkError ule) {
+ // failover to java implementation
+ (new DoUnpack()).run(in0, out);
+ }
in0.close();
Utils.markJarFile(out);
}
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_de.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_es.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_fr.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_it.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_it.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_ko.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_ko.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -85,7 +85,7 @@
webrowsetimpl.invalidrd = \uC77D\uAE30 \uD504\uB85C\uADF8\uB7A8\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
#FilteredRowSetImpl exceptions
-filteredrowsetimpl.relative = \uC0C1\uB300: \uCEE4\uC11C \uC791\uC5C5\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+filteredrowsetimpl.relative = \uC0C1\uB300: \uCEE4\uC11C \uC791\uC5C5\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
filteredrowsetimpl.absolute = \uC808\uB300: \uCEE4\uC11C \uC791\uC5C5\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
filteredrowsetimpl.notallowed = \uC774 \uAC12\uC740 \uD544\uD130\uB97C \uD1B5\uACFC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -140,7 +140,7 @@
#WebRowSetXmlReader exception
wrsxmlreader.invalidcp = Fim de RowSet atingido. Posi\u00E7\u00E3o inv\u00E1lida do cursor
wrsxmlreader.readxml = readXML : {0}
-wrsxmlreader.parseerr = ** Erro de Parse : {0} , linha : {1} , uri : {2}
+wrsxmlreader.parseerr = ** Erro de Parsing : {0} , linha : {1} , uri : {2}
#WebRowSetXmlWriter exceptions
wrsxmlwriter.ioex = IOException : {0}
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_sv.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_zh_TW.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_zh_TW.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java Wed May 01 11:34:06 2013 -0700
@@ -45,7 +45,6 @@
}
protected GSSContext secCtx = null;
- protected MessageProp msgProp; // QOP and privacy for unwrap
protected static final int JGSS_QOP = 0; // unrelated to SASL QOP mask
protected GssKrb5Base(Map<String, ?> props, String className)
@@ -74,6 +73,7 @@
}
try {
+ MessageProp msgProp = new MessageProp(JGSS_QOP, privacy);
byte[] answer = secCtx.unwrap(incoming, start, len, msgProp);
if (logger.isLoggable(Level.FINEST)) {
traceOutput(myClassName, "KRB501:Unwrap", "incoming: ",
@@ -99,6 +99,7 @@
// Generate GSS token
try {
+ MessageProp msgProp = new MessageProp(JGSS_QOP, privacy);
byte[] answer = secCtx.wrap(outgoing, start, len, msgProp);
if (logger.isLoggable(Level.FINEST)) {
traceOutput(myClassName, "KRB503:Wrap", "outgoing: ",
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java Wed May 01 11:34:06 2013 -0700
@@ -320,7 +320,6 @@
}
completed = true; // server authenticated
- msgProp = new MessageProp(JGSS_QOP, privacy);
return gssOutToken;
} catch (GSSException e) {
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java Wed May 01 11:34:06 2013 -0700
@@ -270,7 +270,6 @@
} else if ((selectedQop&INTEGRITY_ONLY_PROTECTION) != 0) {
integrity = true;
}
- msgProp = new MessageProp(JGSS_QOP, privacy);
// 2nd-4th octets specifies maximum buffer size expected by
// client (in network byte order). This is the server's send
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties Wed May 01 11:34:06 2013 -0700
@@ -39,16 +39,16 @@
FileChooser.newFolderParentDoesntExist.textAndMnemonic=Ordner kann nicht erstellt werden.\n\nSystem kann den angegebenen Pfad nicht finden.
FileChooser.renameErrorTitle.textAndMnemonic=Fehler beim Umbenennen von Datei oder Ordner
FileChooser.renameError.textAndMnemonic={0} kann nicht umbenannt werden
-FileChooser.renameErrorFileExists.textAndMnemonic={0} kann nicht umbenannt werden: Es ist bereits eine Datei mit dem angegebenen Namen vorhanden. Geben Sie einen anderen Dateinamen an.
+FileChooser.renameErrorFileExists.textAndMnemonic={0} kann nicht umbenannt werden: Es ist bereits eine Datei mit dem angegebenen Namen vorhanden. Geben Sie einen anderen Dateinamen an.
FileChooser.acceptAllFileFilter.textAndMnemonic=Alle Dateien
FileChooser.cancelButton.textAndMnemonic=Abbrechen
FileChooser.saveButton.textAndMnemonic=&Speichern
-FileChooser.openButton.textAndMnemonic=\u00D6ffnen(&F)
+FileChooser.openButton.textAndMnemonic=\u00D6&ffnen
FileChooser.saveDialogTitle.textAndMnemonic=Speichern
FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
FileChooser.updateButton.textAndMnemonic=A&ktualisieren
FileChooser.helpButton.textAndMnemonic=&Hilfe
-FileChooser.directoryOpenButton.textAndMnemonic=\u00D6ffnen(&F)
+FileChooser.directoryOpenButton.textAndMnemonic=\u00D6&ffnen
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
@@ -70,14 +70,14 @@
FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser-Hilfe
FileChooser.directoryOpenButtonToolTip.textAndMnemonic=Ausgew\u00E4hltes Verzeichnis \u00F6ffnen
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=Dateiliste
+FileChooser.filesDetailsAccessibleName=Dateidetails
############ COLOR CHOOSER STRINGS #############
ColorChooser.preview.textAndMnemonic=Vorschau
ColorChooser.ok.textAndMnemonic=OK
ColorChooser.cancel.textAndMnemonic=Abbrechen
-ColorChooser.reset.textAndMnemonic=Zur\u00FCcksetzen(&Z)
+ColorChooser.reset.textAndMnemonic=&Zur\u00FCcksetzen
ColorChooser.sample.textAndMnemonic=Beispieltext Beispieltext
ColorChooser.swatches.textAndMnemonic=&Swatches
ColorChooser.swatchesRecent.textAndMnemonic=Aktuell:
@@ -93,7 +93,7 @@
ColorChooser.hslTransparency.textAndMnemonic=Transparenz
ColorChooser.rgb.textAndMnemonic=R&GB
ColorChooser.rgbRed.textAndMnemonic=Ro&t
-ColorChooser.rgbGreen.textAndMnemonic=Gr\u00FCn(&N)
+ColorChooser.rgbGreen.textAndMnemonic=Gr\u00FC&n
ColorChooser.rgbBlue.textAndMnemonic=&Blau
ColorChooser.rgbAlpha.textAndMnemonic=Alpha
ColorChooser.rgbHexCode.textAndMnemonic=&Farbcode
@@ -109,8 +109,10 @@
# define mnemonics for any of the buttons.
OptionPane.yesButton.textAndMnemonic=&Ja
OptionPane.noButton.textAndMnemonic=&Nein
-OptionPane.okButton.textAndMnemonic=&OK
-OptionPane.cancelButton.textAndMnemonic=&Abbrechen
+OptionPane.okButton.textAndMnemonic=OK
+#OptionPane.okButtonMnemonic=0
+OptionPane.cancelButton.textAndMnemonic=Abbrechen
+#OptionPane.cancelButtonMnemonic=0
OptionPane.title.textAndMnemonic=Option ausw\u00E4hlen
# Title for the dialog for the showInputDialog methods. Only used if
# the developer uses one of the variants that doesn't take a title.
@@ -184,4 +186,3 @@
InternalFrameTitlePane.iconifyButtonAccessibleName=Als Symbol darstellen
InternalFrameTitlePane.maximizeButtonAccessibleName=Maximieren
InternalFrameTitlePane.closeButtonAccessibleName=Schlie\u00DFen
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties Wed May 01 11:34:06 2013 -0700
@@ -16,6 +16,7 @@
# Many of strings in this file are used by widgets that have a
# mnemonic, for example:
# ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
# Indicates that the tab in the ColorChooser for RGB colors will have
# the text 'RGB', further the mnemonic character will be 'g' and that
# a decoration will be provided under the 'G'. This will typically
@@ -38,11 +39,11 @@
FileChooser.newFolderParentDoesntExist.textAndMnemonic=No se ha podido crear la carpeta.\n\nEl sistema no puede encontrar la ruta de acceso especificada.
FileChooser.renameErrorTitle.textAndMnemonic=Error al cambiar el nombre del archivo o carpeta
FileChooser.renameError.textAndMnemonic=No se puede cambiar el nombre de {0}
-FileChooser.renameErrorFileExists.textAndMnemonic=No se puede cambiar el nombre de {0}: ya existe un archivo con el nombre especificado. Especifique otro nombre de archivo.
+FileChooser.renameErrorFileExists.textAndMnemonic=No se puede cambiar el nombre de {0}: ya existe un archivo con el nombre especificado. Especifique otro nombre de archivo.
FileChooser.acceptAllFileFilter.textAndMnemonic=Todos los Archivos
FileChooser.cancelButton.textAndMnemonic=Cancelar
FileChooser.saveButton.textAndMnemonic=&Guardar
-FileChooser.openButton.textAndMnemonic=A&brir
+FileChooser.openButton.textAndMnemonic=&Abrir
FileChooser.saveDialogTitle.textAndMnemonic=Guardar
FileChooser.openDialogTitle.textAndMnemonic=Abrir
FileChooser.updateButton.textAndMnemonic=Act&ualizar
@@ -69,11 +70,11 @@
FileChooser.helpButtonToolTip.textAndMnemonic=Ayuda del Selector de Archivos
FileChooser.directoryOpenButtonToolTip.textAndMnemonic=Abrir directorio seleccionado
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=Lista de archivos
+FileChooser.filesDetailsAccessibleName=Detalles de archivos
############ COLOR CHOOSER STRINGS #############
-ColorChooser.preview.textAndMnemonic=Presentaci\u00F3n Preliminar
+ColorChooser.preview.textAndMnemonic=Vista Previa
ColorChooser.ok.textAndMnemonic=Aceptar
ColorChooser.cancel.textAndMnemonic=Cancelar
ColorChooser.reset.textAndMnemonic=&Restablecer
@@ -95,7 +96,7 @@
ColorChooser.rgbGreen.textAndMnemonic=&Verde
ColorChooser.rgbBlue.textAndMnemonic=A&zul
ColorChooser.rgbAlpha.textAndMnemonic=Alfa
-ColorChooser.rgbHexCode.textAndMnemonic=C\u00F3digo de Color(&C)
+ColorChooser.rgbHexCode.textAndMnemonic=&C\u00F3digo de Color
ColorChooser.cmyk.textAndMnemonic=C&MYK
ColorChooser.cmykCyan.textAndMnemonic=Cian
ColorChooser.cmykMagenta.textAndMnemonic=Magenta
@@ -106,10 +107,12 @@
############ OPTION PANE STRINGS #############
# We only define mnemonics for YES/NO, but for completeness you can
# define mnemonics for any of the buttons.
-OptionPane.yesButton.textAndMnemonic=S\u00ED(&S)
+OptionPane.yesButton.textAndMnemonic=&S\u00ED
OptionPane.noButton.textAndMnemonic=&No
-OptionPane.okButton.textAndMnemonic=Aceptar(&O)
-OptionPane.cancelButton.textAndMnemonic=&Cancelar
+OptionPane.okButton.textAndMnemonic=Aceptar
+#OptionPane.okButtonMnemonic=0
+OptionPane.cancelButton.textAndMnemonic=Cancelar
+#OptionPane.cancelButtonMnemonic=0
OptionPane.title.textAndMnemonic=Seleccionar una Opci\u00F3n
# Title for the dialog for the showInputDialog methods. Only used if
# the developer uses one of the variants that doesn't take a title.
@@ -126,7 +129,7 @@
# The following string will be formatted by a MessageFormat
# and {0} will be replaced by page number being printed
-PrintingDialog.contentProgress.textAndMnemonic=P\u00E1gina impresa {0}...
+PrintingDialog.contentProgress.textAndMnemonic=P\u00E1gina {0} impresa...
PrintingDialog.contentAborting.textAndMnemonic=Abortando la impresi\u00F3n...
@@ -183,4 +186,3 @@
InternalFrameTitlePane.iconifyButtonAccessibleName=Convertir en Icono
InternalFrameTitlePane.maximizeButtonAccessibleName=Maximizar
InternalFrameTitlePane.closeButtonAccessibleName=Cerrar
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -16,6 +16,7 @@
# Many of strings in this file are used by widgets that have a
# mnemonic, for example:
# ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
# Indicates that the tab in the ColorChooser for RGB colors will have
# the text 'RGB', further the mnemonic character will be 'g' and that
# a decoration will be provided under the 'G'. This will typically
@@ -38,14 +39,14 @@
FileChooser.newFolderParentDoesntExist.textAndMnemonic=Impossible de cr\u00E9er le dossier.\n\nLe syst\u00E8me ne parvient pas \u00E0 trouver le chemin indiqu\u00E9.
FileChooser.renameErrorTitle.textAndMnemonic=Erreur lors du changement de nom du fichier ou du dossier
FileChooser.renameError.textAndMnemonic=Impossible de renommer {0}
-FileChooser.renameErrorFileExists.textAndMnemonic=Impossible de renommer {0} : il existe d\u00E9j\u00E0 un fichier portant le nom indiqu\u00E9. Indiquez-en un autre.
+FileChooser.renameErrorFileExists.textAndMnemonic=Impossible de renommer {0} : il existe d\u00E9j\u00E0 un fichier portant le nom indiqu\u00E9. Indiquez-en un autre.
FileChooser.acceptAllFileFilter.textAndMnemonic=Tous les fichiers
FileChooser.cancelButton.textAndMnemonic=Annuler
FileChooser.saveButton.textAndMnemonic=Enregi&strer
FileChooser.openButton.textAndMnemonic=&Ouvrir
FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer
FileChooser.openDialogTitle.textAndMnemonic=Ouvrir
-FileChooser.updateButton.textAndMnemonic=Mettre \u00E0 jour(&U)
+FileChooser.updateButton.textAndMnemonic=Mettre \u00E0 jo&ur
FileChooser.helpButton.textAndMnemonic=&Aide
FileChooser.directoryOpenButton.textAndMnemonic=&Ouvrir
@@ -69,14 +70,14 @@
FileChooser.helpButtonToolTip.textAndMnemonic=Aide du s\u00E9lecteur de fichiers
FileChooser.directoryOpenButtonToolTip.textAndMnemonic=Ouvre le r\u00E9pertoire s\u00E9lectionn\u00E9
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=Liste des fichiers
+FileChooser.filesDetailsAccessibleName=D\u00E9tails des fichiers
############ COLOR CHOOSER STRINGS #############
ColorChooser.preview.textAndMnemonic=Aper\u00E7u
ColorChooser.ok.textAndMnemonic=OK
ColorChooser.cancel.textAndMnemonic=Annuler
-ColorChooser.reset.textAndMnemonic=R\u00E9initialiser(&R)
+ColorChooser.reset.textAndMnemonic=&R\u00E9initialiser
ColorChooser.sample.textAndMnemonic=Echantillon de texte Echantillon de texte
ColorChooser.swatches.textAndMnemonic=&Echantillons
ColorChooser.swatchesRecent.textAndMnemonic=Dernier :
@@ -108,8 +109,10 @@
# define mnemonics for any of the buttons.
OptionPane.yesButton.textAndMnemonic=&Oui
OptionPane.noButton.textAndMnemonic=&Non
-OptionPane.okButton.textAndMnemonic=&OK
-OptionPane.cancelButton.textAndMnemonic=&Annuler
+OptionPane.okButton.textAndMnemonic=OK
+#OptionPane.okButtonMnemonic=0
+OptionPane.cancelButton.textAndMnemonic=Annuler
+#OptionPane.cancelButtonMnemonic=0
OptionPane.title.textAndMnemonic=S\u00E9lectionner une option
# Title for the dialog for the showInputDialog methods. Only used if
# the developer uses one of the variants that doesn't take a title.
@@ -183,4 +186,3 @@
InternalFrameTitlePane.iconifyButtonAccessibleName=R\u00E9duire
InternalFrameTitlePane.maximizeButtonAccessibleName=Agrandir
InternalFrameTitlePane.closeButtonAccessibleName=Fermer
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties Wed May 01 11:34:06 2013 -0700
@@ -16,6 +16,7 @@
# Many of strings in this file are used by widgets that have a
# mnemonic, for example:
# ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
# Indicates that the tab in the ColorChooser for RGB colors will have
# the text 'RGB', further the mnemonic character will be 'g' and that
# a decoration will be provided under the 'G'. This will typically
@@ -38,15 +39,15 @@
FileChooser.newFolderParentDoesntExist.textAndMnemonic=Impossibile creare la cartella.\n\nIl sistema non \u00E8 in grado di trovare il percorso specificato.
FileChooser.renameErrorTitle.textAndMnemonic=Errore durante la ridenominazione del file o della cartella
FileChooser.renameError.textAndMnemonic=Impossibile rinominare {0}
-FileChooser.renameErrorFileExists.textAndMnemonic=Impossibile rinominare {0}: esiste gi\u00E0 un file con il nome specificato. Specificare un altro nome.
+FileChooser.renameErrorFileExists.textAndMnemonic=Impossibile rinominare {0}: esiste gi\u00E0 un file con il nome specificato. Specificare un altro nome.
FileChooser.acceptAllFileFilter.textAndMnemonic=Tutti i file
FileChooser.cancelButton.textAndMnemonic=Annulla
FileChooser.saveButton.textAndMnemonic=Sal&va
-FileChooser.openButton.textAndMnemonic=A&pri
+FileChooser.openButton.textAndMnemonic=&Apri
FileChooser.saveDialogTitle.textAndMnemonic=Salva
FileChooser.openDialogTitle.textAndMnemonic=Apri
-FileChooser.updateButton.textAndMnemonic=A&ggiorna
-FileChooser.helpButton.textAndMnemonic=?(&H)
+FileChooser.updateButton.textAndMnemonic=Ag&giorna
+FileChooser.helpButton.textAndMnemonic=&?
FileChooser.directoryOpenButton.textAndMnemonic=&Apri
# File Size Units
@@ -69,8 +70,8 @@
FileChooser.helpButtonToolTip.textAndMnemonic=Guida FileChooser
FileChooser.directoryOpenButtonToolTip.textAndMnemonic=Apre la directory selezionata
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=Lista dei file
+FileChooser.filesDetailsAccessibleName=Dettagli file
############ COLOR CHOOSER STRINGS #############
ColorChooser.preview.textAndMnemonic=Anteprima
@@ -106,10 +107,12 @@
############ OPTION PANE STRINGS #############
# We only define mnemonics for YES/NO, but for completeness you can
# define mnemonics for any of the buttons.
-OptionPane.yesButton.textAndMnemonic=S\u00EC(&S)
+OptionPane.yesButton.textAndMnemonic=&S\u00EC
OptionPane.noButton.textAndMnemonic=&No
-OptionPane.okButton.textAndMnemonic=&OK
-OptionPane.cancelButton.textAndMnemonic=&Annulla
+OptionPane.okButton.textAndMnemonic=OK
+#OptionPane.okButtonMnemonic=0
+OptionPane.cancelButton.textAndMnemonic=Annulla
+#OptionPane.cancelButtonMnemonic=0
OptionPane.title.textAndMnemonic=Selezionare una opzione
# Title for the dialog for the showInputDialog methods. Only used if
# the developer uses one of the variants that doesn't take a title.
@@ -183,4 +186,3 @@
InternalFrameTitlePane.iconifyButtonAccessibleName=Riduci a icona
InternalFrameTitlePane.maximizeButtonAccessibleName=Ingrandisci
InternalFrameTitlePane.closeButtonAccessibleName=Chiudi
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -16,6 +16,7 @@
# Many of strings in this file are used by widgets that have a
# mnemonic, for example:
# ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
# Indicates that the tab in the ColorChooser for RGB colors will have
# the text 'RGB', further the mnemonic character will be 'g' and that
# a decoration will be provided under the 'G'. This will typically
@@ -38,7 +39,7 @@
FileChooser.newFolderParentDoesntExist.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3002\n\n\u6307\u5B9A\u3057\u305F\u30D1\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
FileChooser.renameErrorTitle.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30D5\u30A9\u30EB\u30C0\u306E\u540D\u524D\u5909\u66F4\u30A8\u30E9\u30FC
FileChooser.renameError.textAndMnemonic={0}\u306E\u540D\u524D\u3092\u5909\u66F4\u3067\u304D\u307E\u305B\u3093
-FileChooser.renameErrorFileExists.textAndMnemonic={0}\u306E\u540D\u524D\u3092\u5909\u66F4\u3067\u304D\u307E\u305B\u3093: \u6307\u5B9A\u3057\u305F\u540D\u524D\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u307E\u3059\u3002\u5225\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+FileChooser.renameErrorFileExists.textAndMnemonic={0}\u306E\u540D\u524D\u3092\u5909\u66F4\u3067\u304D\u307E\u305B\u3093: \u6307\u5B9A\u3057\u305F\u540D\u524D\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u307E\u3059\u3002\u5225\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002
FileChooser.acceptAllFileFilter.textAndMnemonic=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB
FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58(&S)
@@ -69,8 +70,8 @@
FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser\u306E\u30D8\u30EB\u30D7\u3067\u3059
FileChooser.directoryOpenButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u958B\u304D\u307E\u3059
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=\u30D5\u30A1\u30A4\u30EB\u30FB\u30EA\u30B9\u30C8
+FileChooser.filesDetailsAccessibleName=\u30D5\u30A1\u30A4\u30EB\u306E\u8A73\u7D30
############ COLOR CHOOSER STRINGS #############
ColorChooser.preview.textAndMnemonic=\u30D7\u30EC\u30D3\u30E5\u30FC
@@ -80,17 +81,17 @@
ColorChooser.sample.textAndMnemonic=\u30B5\u30F3\u30D7\u30EB\u30FB\u30C6\u30AD\u30B9\u30C8 \u30B5\u30F3\u30D7\u30EB\u30FB\u30C6\u30AD\u30B9\u30C8
ColorChooser.swatches.textAndMnemonic=\u30B5\u30F3\u30D7\u30EB(&S)
ColorChooser.swatchesRecent.textAndMnemonic=\u6700\u65B0:
-ColorChooser.hsv.textAndMnemonic=&HSV
+ColorChooser.hsv.textAndMnemonic=HSV(&H)
ColorChooser.hsvHue.textAndMnemonic=\u8272\u76F8
ColorChooser.hsvSaturation.textAndMnemonic=\u5F69\u5EA6
ColorChooser.hsvValue.textAndMnemonic=\u5024
ColorChooser.hsvTransparency.textAndMnemonic=\u900F\u660E\u5EA6
-ColorChooser.hsl.textAndMnemonic=HS&L
+ColorChooser.hsl.textAndMnemonic=HSL(&L)
ColorChooser.hslHue.textAndMnemonic=\u8272\u76F8
ColorChooser.hslSaturation.textAndMnemonic=\u5F69\u5EA6
ColorChooser.hslLightness.textAndMnemonic=\u660E\u5EA6
ColorChooser.hslTransparency.textAndMnemonic=\u900F\u660E\u5EA6
-ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
ColorChooser.rgbRed.textAndMnemonic=\u8D64(&D)
ColorChooser.rgbGreen.textAndMnemonic=\u7DD1(&N)
ColorChooser.rgbBlue.textAndMnemonic=\u9752(&B)
@@ -108,8 +109,10 @@
# define mnemonics for any of the buttons.
OptionPane.yesButton.textAndMnemonic=\u306F\u3044(&Y)
OptionPane.noButton.textAndMnemonic=\u3044\u3044\u3048(&N)
-OptionPane.okButton.textAndMnemonic=&OK
+OptionPane.okButton.textAndMnemonic=OK
+#OptionPane.okButtonMnemonic=0
OptionPane.cancelButton.textAndMnemonic=\u53D6\u6D88
+#OptionPane.cancelButtonMnemonic=0
OptionPane.title.textAndMnemonic=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u9078\u629E
# Title for the dialog for the showInputDialog methods. Only used if
# the developer uses one of the variants that doesn't take a title.
@@ -183,4 +186,3 @@
InternalFrameTitlePane.iconifyButtonAccessibleName=\u30A2\u30A4\u30B3\u30F3\u5316
InternalFrameTitlePane.maximizeButtonAccessibleName=\u6700\u5927\u5316
InternalFrameTitlePane.closeButtonAccessibleName=\u9589\u3058\u308B
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties Wed May 01 11:34:06 2013 -0700
@@ -16,6 +16,7 @@
# Many of strings in this file are used by widgets that have a
# mnemonic, for example:
# ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
# Indicates that the tab in the ColorChooser for RGB colors will have
# the text 'RGB', further the mnemonic character will be 'g' and that
# a decoration will be provided under the 'G'. This will typically
@@ -69,8 +70,8 @@
FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser \uB3C4\uC6C0\uB9D0
FileChooser.directoryOpenButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uB514\uB809\uD1A0\uB9AC \uC5F4\uAE30
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=\uD30C\uC77C \uBAA9\uB85D
+FileChooser.filesDetailsAccessibleName=\uD30C\uC77C \uC138\uBD80 \uC815\uBCF4
############ COLOR CHOOSER STRINGS #############
ColorChooser.preview.textAndMnemonic=\uBBF8\uB9AC\uBCF4\uAE30
@@ -80,17 +81,17 @@
ColorChooser.sample.textAndMnemonic=\uC0D8\uD50C \uD14D\uC2A4\uD2B8 \uC0D8\uD50C \uD14D\uC2A4\uD2B8
ColorChooser.swatches.textAndMnemonic=\uACAC\uBCF8(&S)
ColorChooser.swatchesRecent.textAndMnemonic=\uCD5C\uADFC \uBAA9\uB85D:
-ColorChooser.hsv.textAndMnemonic=&HSV
+ColorChooser.hsv.textAndMnemonic=HSV(&H)
ColorChooser.hsvHue.textAndMnemonic=\uC0C9\uC870
ColorChooser.hsvSaturation.textAndMnemonic=\uCC44\uB3C4
ColorChooser.hsvValue.textAndMnemonic=\uAC12
ColorChooser.hsvTransparency.textAndMnemonic=\uD22C\uBA85
-ColorChooser.hsl.textAndMnemonic=HS&L
+ColorChooser.hsl.textAndMnemonic=HSL(&L)
ColorChooser.hslHue.textAndMnemonic=\uC0C9\uC870
ColorChooser.hslSaturation.textAndMnemonic=\uCC44\uB3C4
ColorChooser.hslLightness.textAndMnemonic=\uBC1D\uAE30
ColorChooser.hslTransparency.textAndMnemonic=\uD22C\uBA85
-ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
ColorChooser.rgbRed.textAndMnemonic=\uBE68\uAC04\uC0C9(&D)
ColorChooser.rgbGreen.textAndMnemonic=\uB179\uC0C9(&N)
ColorChooser.rgbBlue.textAndMnemonic=\uD30C\uB780\uC0C9(&B)
@@ -108,8 +109,10 @@
# define mnemonics for any of the buttons.
OptionPane.yesButton.textAndMnemonic=\uC608(&Y)
OptionPane.noButton.textAndMnemonic=\uC544\uB2C8\uC624(&N)
-OptionPane.okButton.textAndMnemonic=\uD655\uC778(&O)
+OptionPane.okButton.textAndMnemonic=\uD655\uC778
+#OptionPane.okButtonMnemonic=0
OptionPane.cancelButton.textAndMnemonic=\uCDE8\uC18C
+#OptionPane.cancelButtonMnemonic=0
OptionPane.title.textAndMnemonic=\uC635\uC158 \uC120\uD0DD
# Title for the dialog for the showInputDialog methods. Only used if
# the developer uses one of the variants that doesn't take a title.
@@ -183,4 +186,3 @@
InternalFrameTitlePane.iconifyButtonAccessibleName=\uC544\uC774\uCF58\uD654
InternalFrameTitlePane.maximizeButtonAccessibleName=\uCD5C\uB300\uD654
InternalFrameTitlePane.closeButtonAccessibleName=\uB2EB\uAE30
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -16,6 +16,7 @@
# Many of strings in this file are used by widgets that have a
# mnemonic, for example:
# ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
# Indicates that the tab in the ColorChooser for RGB colors will have
# the text 'RGB', further the mnemonic character will be 'g' and that
# a decoration will be provided under the 'G'. This will typically
@@ -69,8 +70,8 @@
FileChooser.helpButtonToolTip.textAndMnemonic=Ajuda do FileChooser
FileChooser.directoryOpenButtonToolTip.textAndMnemonic=Abrir diret\u00F3rio selecionado
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=Lista de Arquivos
+FileChooser.filesDetailsAccessibleName=Detalhes do Arquivo
############ COLOR CHOOSER STRINGS #############
ColorChooser.preview.textAndMnemonic=Visualizar
@@ -95,7 +96,7 @@
ColorChooser.rgbGreen.textAndMnemonic=&Verde
ColorChooser.rgbBlue.textAndMnemonic=&Azul
ColorChooser.rgbAlpha.textAndMnemonic=Alfa
-ColorChooser.rgbHexCode.textAndMnemonic=C\u00F3digo da Cor(&C)
+ColorChooser.rgbHexCode.textAndMnemonic=&C\u00F3digo da Cor
ColorChooser.cmyk.textAndMnemonic=C&MYK
ColorChooser.cmykCyan.textAndMnemonic=Ciano
ColorChooser.cmykMagenta.textAndMnemonic=Magenta
@@ -107,9 +108,11 @@
# We only define mnemonics for YES/NO, but for completeness you can
# define mnemonics for any of the buttons.
OptionPane.yesButton.textAndMnemonic=&Sim
-OptionPane.noButton.textAndMnemonic=N\u00E3o(&N)
-OptionPane.okButton.textAndMnemonic=&OK
-OptionPane.cancelButton.textAndMnemonic=&Cancelar
+OptionPane.noButton.textAndMnemonic=&N\u00E3o
+OptionPane.okButton.textAndMnemonic=OK
+#OptionPane.okButtonMnemonic=0
+OptionPane.cancelButton.textAndMnemonic=Cancelar
+#OptionPane.cancelButtonMnemonic=0
OptionPane.title.textAndMnemonic=Selecionar uma Op\u00E7\u00E3o
# Title for the dialog for the showInputDialog methods. Only used if
# the developer uses one of the variants that doesn't take a title.
@@ -171,7 +174,7 @@
ComboBox.togglePopup.textAndMnemonic=togglePopup
############ Progress Monitor Strings ############
-ProgressMonitor.progress.textAndMnemonic=Progresso...
+ProgressMonitor.progress.textAndMnemonic=Andamento...
############ Split Pane Strings ############
SplitPane.leftButton.textAndMnemonic=bot\u00E3o esquerdo
@@ -180,7 +183,6 @@
IsindexView.prompt=Trata-se de um \u00EDndice pesquis\u00E1vel. Informe as palavras-chave de pesquisa:
############ InternalFrameTitlePane Strings ############
-InternalFrameTitlePane.iconifyButtonAccessibleName=Iconify
+InternalFrameTitlePane.iconifyButtonAccessibleName=Iconizar
InternalFrameTitlePane.maximizeButtonAccessibleName=Maximizar
InternalFrameTitlePane.closeButtonAccessibleName=Fechar
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -16,6 +16,7 @@
# Many of strings in this file are used by widgets that have a
# mnemonic, for example:
# ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
# Indicates that the tab in the ColorChooser for RGB colors will have
# the text 'RGB', further the mnemonic character will be 'g' and that
# a decoration will be provided under the 'G'. This will typically
@@ -38,16 +39,16 @@
FileChooser.newFolderParentDoesntExist.textAndMnemonic=Kan inte skapa mappen.\n\nSystemet kan inte hitta angiven s\u00F6kv\u00E4g.
FileChooser.renameErrorTitle.textAndMnemonic=Ett fel intr\u00E4ffade vid f\u00F6rs\u00F6k att \u00E4ndra namn p\u00E5 fil eller mapp
FileChooser.renameError.textAndMnemonic=Kan inte namn\u00E4ndra {0}
-FileChooser.renameErrorFileExists.textAndMnemonic=Kan inte namn\u00E4ndra {0}: En fil med angivet namn finns redan. Ange ett annat filnamn.
+FileChooser.renameErrorFileExists.textAndMnemonic=Kan inte namn\u00E4ndra {0}: En fil med angivet namn finns redan. Ange ett annat filnamn.
FileChooser.acceptAllFileFilter.textAndMnemonic=Alla filer
FileChooser.cancelButton.textAndMnemonic=Avbryt
FileChooser.saveButton.textAndMnemonic=&Spara
-FileChooser.openButton.textAndMnemonic=\u00D6ppna(&P)
+FileChooser.openButton.textAndMnemonic=&\u00D6ppna
FileChooser.saveDialogTitle.textAndMnemonic=Spara
FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna
FileChooser.updateButton.textAndMnemonic=Upp&datera
-FileChooser.helpButton.textAndMnemonic=Hj\u00E4lp(&H)
-FileChooser.directoryOpenButton.textAndMnemonic=\u00D6ppna(&P)
+FileChooser.helpButton.textAndMnemonic=&Hj\u00E4lp
+FileChooser.directoryOpenButton.textAndMnemonic=&\u00D6ppna
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
@@ -69,14 +70,14 @@
FileChooser.helpButtonToolTip.textAndMnemonic=Hj\u00E4lp - Filv\u00E4ljare
FileChooser.directoryOpenButtonToolTip.textAndMnemonic=\u00D6ppna vald katalog
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=Fillista
+FileChooser.filesDetailsAccessibleName=Fildetaljer
############ COLOR CHOOSER STRINGS #############
ColorChooser.preview.textAndMnemonic=Granska
ColorChooser.ok.textAndMnemonic=OK
ColorChooser.cancel.textAndMnemonic=Avbryt
-ColorChooser.reset.textAndMnemonic=\u00C5terst\u00E4ll(&T)
+ColorChooser.reset.textAndMnemonic=&\u00C5terst\u00E4ll
ColorChooser.sample.textAndMnemonic=Exempeltext Exempeltext
ColorChooser.swatches.textAndMnemonic=&Prov
ColorChooser.swatchesRecent.textAndMnemonic=Senaste:
@@ -91,11 +92,11 @@
ColorChooser.hslLightness.textAndMnemonic=Ljusstyrka
ColorChooser.hslTransparency.textAndMnemonic=Transparens
ColorChooser.rgb.textAndMnemonic=R&GB
-ColorChooser.rgbRed.textAndMnemonic=R\u00F6d(&D)
-ColorChooser.rgbGreen.textAndMnemonic=Gr\u00F6n(&N)
-ColorChooser.rgbBlue.textAndMnemonic=Bl\u00E5(&B)
+ColorChooser.rgbRed.textAndMnemonic=R\u00F6&d
+ColorChooser.rgbGreen.textAndMnemonic=Gr\u00F6&n
+ColorChooser.rgbBlue.textAndMnemonic=&Bl\u00E5
ColorChooser.rgbAlpha.textAndMnemonic=Alfa
-ColorChooser.rgbHexCode.textAndMnemonic=F\u00E4rgkod(&F)
+ColorChooser.rgbHexCode.textAndMnemonic=&F\u00E4rgkod
ColorChooser.cmyk.textAndMnemonic=C&MYK
ColorChooser.cmykCyan.textAndMnemonic=Cyan
ColorChooser.cmykMagenta.textAndMnemonic=Magenta
@@ -108,8 +109,10 @@
# define mnemonics for any of the buttons.
OptionPane.yesButton.textAndMnemonic=&Ja
OptionPane.noButton.textAndMnemonic=&Nej
-OptionPane.okButton.textAndMnemonic=&OK
-OptionPane.cancelButton.textAndMnemonic=&Avbryt
+OptionPane.okButton.textAndMnemonic=OK
+#OptionPane.okButtonMnemonic=0
+OptionPane.cancelButton.textAndMnemonic=Avbryt
+#OptionPane.cancelButtonMnemonic=0
OptionPane.title.textAndMnemonic=V\u00E4lj ett alternativ
# Title for the dialog for the showInputDialog methods. Only used if
# the developer uses one of the variants that doesn't take a title.
@@ -183,4 +186,3 @@
InternalFrameTitlePane.iconifyButtonAccessibleName=Minimera
InternalFrameTitlePane.maximizeButtonAccessibleName=Maximera
InternalFrameTitlePane.closeButtonAccessibleName=St\u00E4ng
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -16,6 +16,7 @@
# Many of strings in this file are used by widgets that have a
# mnemonic, for example:
# ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
# Indicates that the tab in the ColorChooser for RGB colors will have
# the text 'RGB', further the mnemonic character will be 'g' and that
# a decoration will be provided under the 'G'. This will typically
@@ -30,7 +31,7 @@
# @author Steve Wilson
############ FILE CHOOSER STRINGS #############
-FileChooser.fileDescription.textAndMnemonic=\u666E\u901A\u7684\u6587\u4EF6
+FileChooser.fileDescription.textAndMnemonic=\u901A\u7528\u6587\u4EF6
FileChooser.directoryDescription.textAndMnemonic=\u76EE\u5F55
FileChooser.newFolderError.textAndMnemonic=\u521B\u5EFA\u65B0\u7684\u6587\u4EF6\u5939\u65F6\u51FA\u9519
FileChooser.newFolderErrorSeparator= :
@@ -69,8 +70,8 @@
FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser \u5E2E\u52A9
FileChooser.directoryOpenButtonToolTip.textAndMnemonic=\u6253\u5F00\u9009\u62E9\u7684\u76EE\u5F55
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=\u6587\u4EF6\u5217\u8868
+FileChooser.filesDetailsAccessibleName=\u6587\u4EF6\u8BE6\u7EC6\u4FE1\u606F
############ COLOR CHOOSER STRINGS #############
ColorChooser.preview.textAndMnemonic=\u9884\u89C8
@@ -78,19 +79,19 @@
ColorChooser.cancel.textAndMnemonic=\u53D6\u6D88
ColorChooser.reset.textAndMnemonic=\u91CD\u7F6E(&R)
ColorChooser.sample.textAndMnemonic=\u793A\u4F8B\u6587\u672C \u793A\u4F8B\u6587\u672C
-ColorChooser.swatches.textAndMnemonic=\u793A\u4F8B(&S)
+ColorChooser.swatches.textAndMnemonic=\u6837\u672C(&S)
ColorChooser.swatchesRecent.textAndMnemonic=\u6700\u8FD1:
-ColorChooser.hsv.textAndMnemonic=&HSV
+ColorChooser.hsv.textAndMnemonic=HSV(&H)
ColorChooser.hsvHue.textAndMnemonic=\u8272\u8C03
ColorChooser.hsvSaturation.textAndMnemonic=\u9971\u548C\u5EA6
ColorChooser.hsvValue.textAndMnemonic=\u503C
ColorChooser.hsvTransparency.textAndMnemonic=\u900F\u660E\u5EA6
-ColorChooser.hsl.textAndMnemonic=HS&L
+ColorChooser.hsl.textAndMnemonic=HSL(&L)
ColorChooser.hslHue.textAndMnemonic=\u8272\u8C03
ColorChooser.hslSaturation.textAndMnemonic=\u9971\u548C\u5EA6
ColorChooser.hslLightness.textAndMnemonic=\u4EAE\u5EA6
ColorChooser.hslTransparency.textAndMnemonic=\u900F\u660E\u5EA6
-ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
ColorChooser.rgbRed.textAndMnemonic=\u7EA2\u8272(&D)
ColorChooser.rgbGreen.textAndMnemonic=\u7EFF\u8272(&N)
ColorChooser.rgbBlue.textAndMnemonic=\u84DD\u8272(&B)
@@ -108,8 +109,10 @@
# define mnemonics for any of the buttons.
OptionPane.yesButton.textAndMnemonic=\u662F(&Y)
OptionPane.noButton.textAndMnemonic=\u5426(&N)
-OptionPane.okButton.textAndMnemonic=\u786E\u5B9A(&O)
+OptionPane.okButton.textAndMnemonic=\u786E\u5B9A
+#OptionPane.okButtonMnemonic=0
OptionPane.cancelButton.textAndMnemonic=\u53D6\u6D88
+#OptionPane.cancelButtonMnemonic=0
OptionPane.title.textAndMnemonic=\u9009\u62E9\u4E00\u4E2A\u9009\u9879
# Title for the dialog for the showInputDialog methods. Only used if
# the developer uses one of the variants that doesn't take a title.
@@ -150,7 +153,7 @@
############ Text strings #############
# Used for html forms
FormView.submitButton.textAndMnemonic=\u63D0\u4EA4\u67E5\u8BE2
-FormView.resetButton.textAndMnemonic=\u91CD\u8BBE
+FormView.resetButton.textAndMnemonic=\u91CD\u7F6E
FormView.browseFileButton.textAndMnemonic=\u6D4F\u89C8...
############ Abstract Document Strings ############
@@ -177,10 +180,9 @@
SplitPane.leftButton.textAndMnemonic=\u5DE6\u952E
SplitPane.rightButton.textAndMnemonic=\u53F3\u952E
# Used for Isindex
-IsindexView.prompt=\u8FD9\u662F\u53EF\u641C\u7D22\u7D22\u5F15\u3002\u8BF7\u8F93\u5165\u641C\u7D22\u5173\u952E\u5B57:
+IsindexView.prompt=\u8FD9\u662F\u53EF\u641C\u7D22\u7D22\u5F15\u3002\u8BF7\u8F93\u5165\u641C\u7D22\u5173\u952E\u5B57:
############ InternalFrameTitlePane Strings ############
InternalFrameTitlePane.iconifyButtonAccessibleName=\u56FE\u6807\u5316
InternalFrameTitlePane.maximizeButtonAccessibleName=\u6700\u5927\u5316
InternalFrameTitlePane.closeButtonAccessibleName=\u5173\u95ED
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties Wed May 01 11:34:06 2013 -0700
@@ -16,6 +16,7 @@
# Many of strings in this file are used by widgets that have a
# mnemonic, for example:
# ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
# Indicates that the tab in the ColorChooser for RGB colors will have
# the text 'RGB', further the mnemonic character will be 'g' and that
# a decoration will be provided under the 'G'. This will typically
@@ -69,8 +70,8 @@
FileChooser.helpButtonToolTip.textAndMnemonic=\u300C\u6A94\u6848\u9078\u64C7\u5668\u300D\u8AAA\u660E
FileChooser.directoryOpenButtonToolTip.textAndMnemonic=\u958B\u555F\u9078\u53D6\u7684\u76EE\u9304
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=\u6A94\u6848\u6E05\u55AE
+FileChooser.filesDetailsAccessibleName=\u6A94\u6848\u8A73\u7D30\u8CC7\u8A0A
############ COLOR CHOOSER STRINGS #############
ColorChooser.preview.textAndMnemonic=\u9810\u89BD
@@ -80,17 +81,17 @@
ColorChooser.sample.textAndMnemonic=\u7BC4\u4F8B\u6587\u5B57 \u7BC4\u4F8B\u6587\u5B57
ColorChooser.swatches.textAndMnemonic=\u8ABF\u8272\u677F(&S)
ColorChooser.swatchesRecent.textAndMnemonic=\u6700\u65B0\u9078\u64C7:
-ColorChooser.hsv.textAndMnemonic=&HSV
+ColorChooser.hsv.textAndMnemonic=HSV(&H)
ColorChooser.hsvHue.textAndMnemonic=\u8272\u8ABF
ColorChooser.hsvSaturation.textAndMnemonic=\u5F69\u5EA6
ColorChooser.hsvValue.textAndMnemonic=\u6578\u503C
ColorChooser.hsvTransparency.textAndMnemonic=\u900F\u660E\u5EA6
-ColorChooser.hsl.textAndMnemonic=HS&L
+ColorChooser.hsl.textAndMnemonic=HSL(&L)
ColorChooser.hslHue.textAndMnemonic=\u8272\u8ABF
ColorChooser.hslSaturation.textAndMnemonic=\u5F69\u5EA6
ColorChooser.hslLightness.textAndMnemonic=\u4EAE\u5EA6
ColorChooser.hslTransparency.textAndMnemonic=\u900F\u660E\u5EA6
-ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
ColorChooser.rgbRed.textAndMnemonic=\u7D05(&D)
ColorChooser.rgbGreen.textAndMnemonic=\u7DA0(&N)
ColorChooser.rgbBlue.textAndMnemonic=\u85CD(&B)
@@ -108,8 +109,10 @@
# define mnemonics for any of the buttons.
OptionPane.yesButton.textAndMnemonic=\u662F(&Y)
OptionPane.noButton.textAndMnemonic=\u5426(&N)
-OptionPane.okButton.textAndMnemonic=\u78BA\u5B9A(&O)
+OptionPane.okButton.textAndMnemonic=\u78BA\u5B9A
+#OptionPane.okButtonMnemonic=0
OptionPane.cancelButton.textAndMnemonic=\u53D6\u6D88
+#OptionPane.cancelButtonMnemonic=0
OptionPane.title.textAndMnemonic=\u9078\u53D6\u4E00\u500B\u9078\u9805
# Title for the dialog for the showInputDialog methods. Only used if
# the developer uses one of the variants that doesn't take a title.
@@ -177,10 +180,9 @@
SplitPane.leftButton.textAndMnemonic=\u5DE6\u6309\u9215
SplitPane.rightButton.textAndMnemonic=\u53F3\u6309\u9215
# Used for Isindex
-IsindexView.prompt=\u9019\u662F\u4E00\u500B\u53EF\u641C\u5C0B\u7684\u7D22\u5F15\u3002\u8F38\u5165\u641C\u5C0B\u95DC\u9375\u5B57:
+IsindexView.prompt=\u9019\u662F\u4E00\u500B\u53EF\u641C\u5C0B\u7684\u7D22\u5F15\u3002\u8F38\u5165\u641C\u5C0B\u95DC\u9375\u5B57:
############ InternalFrameTitlePane Strings ############
InternalFrameTitlePane.iconifyButtonAccessibleName=\u5716\u793A\u5316
InternalFrameTitlePane.maximizeButtonAccessibleName=\u6700\u5927\u5316
InternalFrameTitlePane.closeButtonAccessibleName=\u95DC\u9589
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_de.properties Wed May 01 11:34:06 2013 -0700
@@ -20,9 +20,9 @@
FileChooser.lookInLabel.textAndMnemonic=Suchen &in:
FileChooser.saveInLabel.textAndMnemonic=Speichern in:
-FileChooser.fileNameLabel.textAndMnemonic=Datei&name:
-FileChooser.folderNameLabel.textAndMnemonic=Ord&nername:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Da&teityp:
+FileChooser.fileNameLabel.textAndMnemonic=&Dateiname:
+FileChooser.folderNameLabel.textAndMnemonic=Ordner&name:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Datei&typ:
FileChooser.upFolderToolTip.textAndMnemonic=Eine Ebene h\u00F6her
FileChooser.upFolderAccessibleName=Nach oben
FileChooser.homeFolderToolTip.textAndMnemonic=Home
@@ -50,5 +50,4 @@
MetalTitlePane.restore.titleAndMnemonic=&Wiederherstellen
MetalTitlePane.iconify.titleAndMnemonic=Minimie&ren
MetalTitlePane.maximize.titleAndMnemonic=Ma&ximieren
-MetalTitlePane.close.titleAndMnemonic=Schlie\u00DFen(&S)
-
+MetalTitlePane.close.titleAndMnemonic=&Schlie\u00DFen
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_es.properties Wed May 01 11:34:06 2013 -0700
@@ -18,11 +18,11 @@
############ FILE CHOOSER STRINGS #############
-FileChooser.lookInLabel.textAndMnemonic=Buscar en(&I):
+FileChooser.lookInLabel.textAndMnemonic=&Buscar en:
FileChooser.saveInLabel.textAndMnemonic=Guardar en:
-FileChooser.fileNameLabel.textAndMnemonic=&Nombre de Archivo:
-FileChooser.folderNameLabel.textAndMnemonic=&Nombre de la Carpeta:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &Tipo:
+FileChooser.fileNameLabel.textAndMnemonic=&Nombre de archivo:
+FileChooser.folderNameLabel.textAndMnemonic=&Nombre de carpeta:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &tipo:
FileChooser.upFolderToolTip.textAndMnemonic=Subir un Nivel
FileChooser.upFolderAccessibleName=Arriba
FileChooser.homeFolderToolTip.textAndMnemonic=Inicio
@@ -51,4 +51,3 @@
MetalTitlePane.iconify.titleAndMnemonic=Minimi&zar
MetalTitlePane.maximize.titleAndMnemonic=Ma&ximizar
MetalTitlePane.close.titleAndMnemonic=&Cerrar
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_fr.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -18,11 +18,11 @@
############ FILE CHOOSER STRINGS #############
-FileChooser.lookInLabel.textAndMnemonic=Rechercher dans (&I):
+FileChooser.lookInLabel.textAndMnemonic=Rechercher &dans :
FileChooser.saveInLabel.textAndMnemonic=Enregistrer dans :
FileChooser.fileNameLabel.textAndMnemonic=&Nom du fichier :
FileChooser.folderNameLabel.textAndMnemonic=&Nom du dossier :
-FileChooser.filesOfTypeLabel.textAndMnemonic=Fichiers de &type :
+FileChooser.filesOfTypeLabel.textAndMnemonic=&Type de fichier :
FileChooser.upFolderToolTip.textAndMnemonic=Remonte d'un niveau.
FileChooser.upFolderAccessibleName=Monter
FileChooser.homeFolderToolTip.textAndMnemonic=R\u00E9pertoire d'origine
@@ -48,7 +48,6 @@
############ Used by MetalTitlePane if rendering window decorations############
MetalTitlePane.restore.titleAndMnemonic=&Restaurer
-MetalTitlePane.iconify.titleAndMnemonic=R\u00E9duire(&D)
+MetalTitlePane.iconify.titleAndMnemonic=R\u00E9&duire
MetalTitlePane.maximize.titleAndMnemonic=&Agrandir
MetalTitlePane.close.titleAndMnemonic=&Fermer
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_it.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_it.properties Wed May 01 11:34:06 2013 -0700
@@ -21,8 +21,8 @@
FileChooser.lookInLabel.textAndMnemonic=Cerca &in:
FileChooser.saveInLabel.textAndMnemonic=Salva in:
FileChooser.fileNameLabel.textAndMnemonic=&Nome file:
-FileChooser.folderNameLabel.textAndMnemonic=&Nome della cartella:
-FileChooser.filesOfTypeLabel.textAndMnemonic=&Tipo file:
+FileChooser.folderNameLabel.textAndMnemonic=&Nome cartella:
+FileChooser.filesOfTypeLabel.textAndMnemonic=&Tipo di file:
FileChooser.upFolderToolTip.textAndMnemonic=Cartella superiore
FileChooser.upFolderAccessibleName=Superiore
FileChooser.homeFolderToolTip.textAndMnemonic=Home
@@ -51,4 +51,3 @@
MetalTitlePane.iconify.titleAndMnemonic=Rid&uci a icona
MetalTitlePane.maximize.titleAndMnemonic=In&grandisci
MetalTitlePane.close.titleAndMnemonic=&Chiudi
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -18,7 +18,7 @@
############ FILE CHOOSER STRINGS #############
-FileChooser.lookInLabel.textAndMnemonic=\u53C2\u7167(&I):
+FileChooser.lookInLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240(&I):
FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
FileChooser.fileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u540D(&N):
FileChooser.folderNameLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D(&N):
@@ -51,4 +51,3 @@
MetalTitlePane.iconify.titleAndMnemonic=\u6700\u5C0F\u5316(&E)
MetalTitlePane.maximize.titleAndMnemonic=\u6700\u5927\u5316(&X)
MetalTitlePane.close.titleAndMnemonic=\u9589\u3058\u308B(&C)
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ko.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ko.properties Wed May 01 11:34:06 2013 -0700
@@ -18,7 +18,7 @@
############ FILE CHOOSER STRINGS #############
-FileChooser.lookInLabel.textAndMnemonic=\uAC80\uC0C9 \uC704\uCE58(&I):
+FileChooser.lookInLabel.textAndMnemonic=\uCC3E\uB294 \uC704\uCE58(&I):
FileChooser.saveInLabel.textAndMnemonic=\uC800\uC7A5 \uC704\uCE58:
FileChooser.fileNameLabel.textAndMnemonic=\uD30C\uC77C \uC774\uB984(&N):
FileChooser.folderNameLabel.textAndMnemonic=\uD3F4\uB354 \uC774\uB984(&N):
@@ -51,4 +51,3 @@
MetalTitlePane.iconify.titleAndMnemonic=\uCD5C\uC18C\uD654(&E)
MetalTitlePane.maximize.titleAndMnemonic=\uCD5C\uB300\uD654(&X)
MetalTitlePane.close.titleAndMnemonic=\uB2EB\uAE30(&C)
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -18,7 +18,7 @@
############ FILE CHOOSER STRINGS #############
-FileChooser.lookInLabel.textAndMnemonic=Consultar Em(&I):
+FileChooser.lookInLabel.textAndMnemonic=Pesquisar &em:
FileChooser.saveInLabel.textAndMnemonic=Salvar Em:
FileChooser.fileNameLabel.textAndMnemonic=&Nome do Arquivo:
FileChooser.folderNameLabel.textAndMnemonic=&Nome da pasta:
@@ -51,4 +51,3 @@
MetalTitlePane.iconify.titleAndMnemonic=&Minimizar
MetalTitlePane.maximize.titleAndMnemonic=Ma&ximizar
MetalTitlePane.close.titleAndMnemonic=&Fechar
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -21,8 +21,8 @@
FileChooser.lookInLabel.textAndMnemonic=Leta &i:
FileChooser.saveInLabel.textAndMnemonic=Spara i:
FileChooser.fileNameLabel.textAndMnemonic=Fil&namn:
-FileChooser.folderNameLabel.textAndMnemonic=Mapp(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=Filforma&t:
+FileChooser.folderNameLabel.textAndMnemonic=Mapp&namn:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Mapp&namn:
FileChooser.upFolderToolTip.textAndMnemonic=Upp en niv\u00E5
FileChooser.upFolderAccessibleName=Upp
FileChooser.homeFolderToolTip.textAndMnemonic=Hem
@@ -47,8 +47,7 @@
FileChooser.openButton.textAndMnemonic=\u00D6ppna
############ Used by MetalTitlePane if rendering window decorations############
-MetalTitlePane.restore.titleAndMnemonic=\u00C5terst\u00E4ll(&R)
+MetalTitlePane.restore.titleAndMnemonic=&\u00C5terst\u00E4ll
MetalTitlePane.iconify.titleAndMnemonic=Minim&era
MetalTitlePane.maximize.titleAndMnemonic=Ma&ximera
-MetalTitlePane.close.titleAndMnemonic=St\u00E4ng(&S)
-
+MetalTitlePane.close.titleAndMnemonic=&St\u00E4ng
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -18,8 +18,8 @@
############ FILE CHOOSER STRINGS #############
-FileChooser.lookInLabel.textAndMnemonic=\u67E5\u770B(&I):
-FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
+FileChooser.lookInLabel.textAndMnemonic=\u67E5\u627E(&I):
+FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6\u540D(&N):
FileChooser.folderNameLabel.textAndMnemonic=\u6587\u4EF6\u5939\u540D(&N):
FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u7C7B\u578B(&T):
@@ -33,9 +33,9 @@
FileChooser.listViewButtonToolTip.textAndMnemonic=\u5217\u8868
FileChooser.listViewButtonAccessibleName=\u5217\u8868
FileChooser.listViewActionLabel.textAndMnemonic=\u5217\u8868
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599
-FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u8D44\u6599
-FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u4FE1\u606F
+FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u4FE1\u606F
+FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u4FE1\u606F
FileChooser.refreshActionLabel.textAndMnemonic=\u5237\u65B0
FileChooser.viewMenuLabel.textAndMnemonic=\u89C6\u56FE
FileChooser.fileNameHeader.textAndMnemonic=\u540D\u79F0
@@ -51,4 +51,3 @@
MetalTitlePane.iconify.titleAndMnemonic=\u6700\u5C0F\u5316(&E)
MetalTitlePane.maximize.titleAndMnemonic=\u6700\u5927\u5316(&X)
MetalTitlePane.close.titleAndMnemonic=\u5173\u95ED(&C)
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_TW.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_TW.properties Wed May 01 11:34:06 2013 -0700
@@ -19,7 +19,7 @@
############ FILE CHOOSER STRINGS #############
FileChooser.lookInLabel.textAndMnemonic=\u67E5\u8A62(&I):
-FileChooser.saveInLabel.textAndMnemonic=\u5132\u5B58\u65BC:
+FileChooser.saveInLabel.textAndMnemonic=\u5132\u5B58\u65BC:
FileChooser.fileNameLabel.textAndMnemonic=\u6A94\u6848\u540D\u7A31(&N):
FileChooser.folderNameLabel.textAndMnemonic=\u8CC7\u6599\u593E\u540D\u7A31(&N):
FileChooser.filesOfTypeLabel.textAndMnemonic=\u6A94\u6848\u985E\u578B(&T):
@@ -51,4 +51,3 @@
MetalTitlePane.iconify.titleAndMnemonic=\u6700\u5C0F\u5316(&E)
MetalTitlePane.maximize.titleAndMnemonic=\u6700\u5927\u5316(&X)
MetalTitlePane.close.titleAndMnemonic=\u95DC\u9589(&C)
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_de.properties Wed May 01 11:34:06 2013 -0700
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-# FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table. This is an implementation detail of the current
-# workings of Swing. DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Suchen &in:
-FileChooser.saveInLabel.textAndMnemonic=Speichern in:
-FileChooser.fileNameLabel.textAndMnemonic=Datei&name:
-FileChooser.folderNameLabel.textAndMnemonic=Ord&nername:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Da&teityp:
-FileChooser.upFolderToolTip.textAndMnemonic=Eine Ebene h\u00F6her
-FileChooser.upFolderAccessibleName=Nach oben
-FileChooser.homeFolderToolTip.textAndMnemonic=Home
-FileChooser.homeFolderAccessibleName=Home
-FileChooser.newFolderToolTip.textAndMnemonic=Neuen Ordner erstellen
-FileChooser.newFolderAccessibleName=Neuer Ordner
-FileChooser.newFolderActionLabel.textAndMnemonic=Neuer Ordner
-FileChooser.listViewButtonToolTip.textAndMnemonic=Liste
-FileChooser.listViewButtonAccessibleName=Liste
-FileChooser.listViewActionLabel.textAndMnemonic=Liste
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details
-FileChooser.detailsViewButtonAccessibleName=Details
-FileChooser.detailsViewActionLabel.textAndMnemonic=Details
-FileChooser.refreshActionLabel.textAndMnemonic=Aktualisieren
-FileChooser.viewMenuLabel.textAndMnemonic=Ansicht
-FileChooser.fileNameHeader.textAndMnemonic=Name
-FileChooser.fileSizeHeader.textAndMnemonic=Gr\u00F6\u00DFe
-FileChooser.fileTypeHeader.textAndMnemonic=Typ
-FileChooser.fileDateHeader.textAndMnemonic=Ge\u00E4ndert
-FileChooser.fileAttrHeader.textAndMnemonic=Attribute
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=Suchen &in:
+FileChooser.saveInLabel.textAndMnemonic=Speichern in:
+FileChooser.fileNameLabel.textAndMnemonic=&Dateiname:
+FileChooser.folderNameLabel.textAndMnemonic=&Ordnername:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Datei&typ:
+FileChooser.upFolderToolTip.textAndMnemonic=Eine Ebene h\u00F6her
+FileChooser.upFolderAccessibleName=Nach oben
+FileChooser.homeFolderToolTip.textAndMnemonic=Home
+FileChooser.homeFolderAccessibleName=Home
+FileChooser.newFolderToolTip.textAndMnemonic=Neuen Ordner erstellen
+FileChooser.newFolderAccessibleName=Neuer Ordner
+FileChooser.newFolderActionLabel.textAndMnemonic=Neuer Ordner
+FileChooser.listViewButtonToolTip.textAndMnemonic=Liste
+FileChooser.listViewButtonAccessibleName=Liste
+FileChooser.listViewActionLabel.textAndMnemonic=Liste
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details
+FileChooser.detailsViewButtonAccessibleName=Details
+FileChooser.detailsViewActionLabel.textAndMnemonic=Details
+FileChooser.refreshActionLabel.textAndMnemonic=Aktualisieren
+FileChooser.viewMenuLabel.textAndMnemonic=Ansicht
+FileChooser.fileNameHeader.textAndMnemonic=Name
+FileChooser.fileSizeHeader.textAndMnemonic=Gr\u00F6\u00DFe
+FileChooser.fileTypeHeader.textAndMnemonic=Typ
+FileChooser.fileDateHeader.textAndMnemonic=Ge\u00E4ndert
+FileChooser.fileAttrHeader.textAndMnemonic=Attribute
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_es.properties Wed May 01 11:34:06 2013 -0700
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-# FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table. This is an implementation detail of the current
-# workings of Swing. DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Buscar en(&I):
-FileChooser.saveInLabel.textAndMnemonic=Guardar en:
-FileChooser.fileNameLabel.textAndMnemonic=&Nombre de Archivo:
-FileChooser.folderNameLabel.textAndMnemonic=&Nombre de la Carpeta:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &Tipo:
-FileChooser.upFolderToolTip.textAndMnemonic=Subir un Nivel
-FileChooser.upFolderAccessibleName=Arriba
-FileChooser.homeFolderToolTip.textAndMnemonic=Inicio
-FileChooser.homeFolderAccessibleName=Inicio
-FileChooser.newFolderToolTip.textAndMnemonic=Crear Nueva Carpeta
-FileChooser.newFolderAccessibleName=Nueva Carpeta
-FileChooser.newFolderActionLabel.textAndMnemonic=Nueva Carpeta
-FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
-FileChooser.listViewButtonAccessibleName=Lista
-FileChooser.listViewActionLabel.textAndMnemonic=Lista
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detalles
-FileChooser.detailsViewButtonAccessibleName=Detalles
-FileChooser.detailsViewActionLabel.textAndMnemonic=Detalles
-FileChooser.refreshActionLabel.textAndMnemonic=Refrescar
-FileChooser.viewMenuLabel.textAndMnemonic=Ver
-FileChooser.fileNameHeader.textAndMnemonic=Nombre
-FileChooser.fileSizeHeader.textAndMnemonic=Tama\u00F1o
-FileChooser.fileTypeHeader.textAndMnemonic=Tipo
-FileChooser.fileDateHeader.textAndMnemonic=Modificado
-FileChooser.fileAttrHeader.textAndMnemonic=Atributos
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=&Buscar en:
+FileChooser.saveInLabel.textAndMnemonic=Guardar en:
+FileChooser.fileNameLabel.textAndMnemonic=&Nombre de archivo:
+FileChooser.folderNameLabel.textAndMnemonic=&Nombre de carpeta:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &tipo:
+FileChooser.upFolderToolTip.textAndMnemonic=Subir un Nivel
+FileChooser.upFolderAccessibleName=Arriba
+FileChooser.homeFolderToolTip.textAndMnemonic=Inicio
+FileChooser.homeFolderAccessibleName=Inicio
+FileChooser.newFolderToolTip.textAndMnemonic=Crear Nueva Carpeta
+FileChooser.newFolderAccessibleName=Nueva Carpeta
+FileChooser.newFolderActionLabel.textAndMnemonic=Nueva Carpeta
+FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
+FileChooser.listViewButtonAccessibleName=Lista
+FileChooser.listViewActionLabel.textAndMnemonic=Lista
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detalles
+FileChooser.detailsViewButtonAccessibleName=Detalles
+FileChooser.detailsViewActionLabel.textAndMnemonic=Detalles
+FileChooser.refreshActionLabel.textAndMnemonic=Refrescar
+FileChooser.viewMenuLabel.textAndMnemonic=Ver
+FileChooser.fileNameHeader.textAndMnemonic=Nombre
+FileChooser.fileSizeHeader.textAndMnemonic=Tama\u00F1o
+FileChooser.fileTypeHeader.textAndMnemonic=Tipo
+FileChooser.fileDateHeader.textAndMnemonic=Modificado
+FileChooser.fileAttrHeader.textAndMnemonic=Atributos
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_fr.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-# FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table. This is an implementation detail of the current
-# workings of Swing. DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Rechercher dans (&I):
-FileChooser.saveInLabel.textAndMnemonic=Enregistrer dans :
-FileChooser.fileNameLabel.textAndMnemonic=&Nom du fichier :
-FileChooser.folderNameLabel.textAndMnemonic=&Nom du dossier :
-FileChooser.filesOfTypeLabel.textAndMnemonic=Fichiers de &type :
-FileChooser.upFolderToolTip.textAndMnemonic=Remonte d'un niveau.
-FileChooser.upFolderAccessibleName=Monter
-FileChooser.homeFolderToolTip.textAndMnemonic=R\u00E9pertoire d'origine
-FileChooser.homeFolderAccessibleName=R\u00E9pertoire d'origine
-FileChooser.newFolderToolTip.textAndMnemonic=Cr\u00E9e un dossier.
-FileChooser.newFolderAccessibleName=Nouveau dossier
-FileChooser.newFolderActionLabel.textAndMnemonic=Nouveau dossier
-FileChooser.listViewButtonToolTip.textAndMnemonic=Liste
-FileChooser.listViewButtonAccessibleName=Liste
-FileChooser.listViewActionLabel.textAndMnemonic=Liste
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=D\u00E9tails
-FileChooser.detailsViewButtonAccessibleName=D\u00E9tails
-FileChooser.detailsViewActionLabel.textAndMnemonic=D\u00E9tails
-FileChooser.refreshActionLabel.textAndMnemonic=Actualiser
-FileChooser.viewMenuLabel.textAndMnemonic=Affichage
-FileChooser.fileNameHeader.textAndMnemonic=Nom
-FileChooser.fileSizeHeader.textAndMnemonic=Taille
-FileChooser.fileTypeHeader.textAndMnemonic=Type
-FileChooser.fileDateHeader.textAndMnemonic=Modifi\u00E9
-FileChooser.fileAttrHeader.textAndMnemonic=Attributs
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=Rechercher &dans :
+FileChooser.saveInLabel.textAndMnemonic=Enregistrer dans :
+FileChooser.fileNameLabel.textAndMnemonic=&Nom du fichier :
+FileChooser.folderNameLabel.textAndMnemonic=&Nom du dossier :
+FileChooser.filesOfTypeLabel.textAndMnemonic=&Type de fichier :
+FileChooser.upFolderToolTip.textAndMnemonic=Remonte d'un niveau.
+FileChooser.upFolderAccessibleName=Monter
+FileChooser.homeFolderToolTip.textAndMnemonic=R\u00E9pertoire d'origine
+FileChooser.homeFolderAccessibleName=R\u00E9pertoire d'origine
+FileChooser.newFolderToolTip.textAndMnemonic=Cr\u00E9e un dossier.
+FileChooser.newFolderAccessibleName=Nouveau dossier
+FileChooser.newFolderActionLabel.textAndMnemonic=Nouveau dossier
+FileChooser.listViewButtonToolTip.textAndMnemonic=Liste
+FileChooser.listViewButtonAccessibleName=Liste
+FileChooser.listViewActionLabel.textAndMnemonic=Liste
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=D\u00E9tails
+FileChooser.detailsViewButtonAccessibleName=D\u00E9tails
+FileChooser.detailsViewActionLabel.textAndMnemonic=D\u00E9tails
+FileChooser.refreshActionLabel.textAndMnemonic=Actualiser
+FileChooser.viewMenuLabel.textAndMnemonic=Affichage
+FileChooser.fileNameHeader.textAndMnemonic=Nom
+FileChooser.fileSizeHeader.textAndMnemonic=Taille
+FileChooser.fileTypeHeader.textAndMnemonic=Type
+FileChooser.fileDateHeader.textAndMnemonic=Modifi\u00E9
+FileChooser.fileAttrHeader.textAndMnemonic=Attributs
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_it.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_it.properties Wed May 01 11:34:06 2013 -0700
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-# FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table. This is an implementation detail of the current
-# workings of Swing. DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Cerca &in:
-FileChooser.saveInLabel.textAndMnemonic=Salva in:
-FileChooser.fileNameLabel.textAndMnemonic=&Nome file:
-FileChooser.folderNameLabel.textAndMnemonic=&Nome della cartella:
-FileChooser.filesOfTypeLabel.textAndMnemonic=&Tipo file:
-FileChooser.upFolderToolTip.textAndMnemonic=Cartella superiore
-FileChooser.upFolderAccessibleName=Superiore
-FileChooser.homeFolderToolTip.textAndMnemonic=Home
-FileChooser.homeFolderAccessibleName=Home
-FileChooser.newFolderToolTip.textAndMnemonic=Crea nuova cartella
-FileChooser.newFolderAccessibleName=Nuova cartella
-FileChooser.newFolderActionLabel.textAndMnemonic=Nuova cartella
-FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
-FileChooser.listViewButtonAccessibleName=Lista
-FileChooser.listViewActionLabel.textAndMnemonic=Lista
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=Dettagli
-FileChooser.detailsViewButtonAccessibleName=Dettagli
-FileChooser.detailsViewActionLabel.textAndMnemonic=Dettagli
-FileChooser.refreshActionLabel.textAndMnemonic=Aggiorna
-FileChooser.viewMenuLabel.textAndMnemonic=Visualizza
-FileChooser.fileNameHeader.textAndMnemonic=Nome
-FileChooser.fileSizeHeader.textAndMnemonic=Dimensioni
-FileChooser.fileTypeHeader.textAndMnemonic=Tipo
-FileChooser.fileDateHeader.textAndMnemonic=Modificato
-FileChooser.fileAttrHeader.textAndMnemonic=Attributi
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=Cerca &in:
+FileChooser.saveInLabel.textAndMnemonic=Salva in:
+FileChooser.fileNameLabel.textAndMnemonic=&Nome file:
+FileChooser.folderNameLabel.textAndMnemonic=&Nome cartella:
+FileChooser.filesOfTypeLabel.textAndMnemonic=&Tipo di file:
+FileChooser.upFolderToolTip.textAndMnemonic=Cartella superiore
+FileChooser.upFolderAccessibleName=Superiore
+FileChooser.homeFolderToolTip.textAndMnemonic=Home
+FileChooser.homeFolderAccessibleName=Home
+FileChooser.newFolderToolTip.textAndMnemonic=Crea nuova cartella
+FileChooser.newFolderAccessibleName=Nuova cartella
+FileChooser.newFolderActionLabel.textAndMnemonic=Nuova cartella
+FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
+FileChooser.listViewButtonAccessibleName=Lista
+FileChooser.listViewActionLabel.textAndMnemonic=Lista
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=Dettagli
+FileChooser.detailsViewButtonAccessibleName=Dettagli
+FileChooser.detailsViewActionLabel.textAndMnemonic=Dettagli
+FileChooser.refreshActionLabel.textAndMnemonic=Aggiorna
+FileChooser.viewMenuLabel.textAndMnemonic=Visualizza
+FileChooser.fileNameHeader.textAndMnemonic=Nome
+FileChooser.fileSizeHeader.textAndMnemonic=Dimensioni
+FileChooser.fileTypeHeader.textAndMnemonic=Tipo
+FileChooser.fileDateHeader.textAndMnemonic=Modificato
+FileChooser.fileAttrHeader.textAndMnemonic=Attributi
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-# FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table. This is an implementation detail of the current
-# workings of Swing. DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=\u53C2\u7167(&I):
-FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
-FileChooser.fileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u540D(&N):
-FileChooser.folderNameLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u30BF\u30A4\u30D7(&T):
-FileChooser.upFolderToolTip.textAndMnemonic=1\u30EC\u30D9\u30EB\u4E0A\u3078
-FileChooser.upFolderAccessibleName=\u4E0A\u3078
-FileChooser.homeFolderToolTip.textAndMnemonic=\u30DB\u30FC\u30E0
-FileChooser.homeFolderAccessibleName=\u30DB\u30FC\u30E0
-FileChooser.newFolderToolTip.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0\u306E\u4F5C\u6210
-FileChooser.newFolderAccessibleName=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
-FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
-FileChooser.listViewButtonToolTip.textAndMnemonic=\u30EA\u30B9\u30C8
-FileChooser.listViewButtonAccessibleName=\u30EA\u30B9\u30C8
-FileChooser.listViewActionLabel.textAndMnemonic=\u30EA\u30B9\u30C8
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8A73\u7D30
-FileChooser.detailsViewButtonAccessibleName=\u8A73\u7D30
-FileChooser.detailsViewActionLabel.textAndMnemonic=\u8A73\u7D30
-FileChooser.refreshActionLabel.textAndMnemonic=\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5
-FileChooser.viewMenuLabel.textAndMnemonic=\u8868\u793A
-FileChooser.fileNameHeader.textAndMnemonic=\u540D\u524D
-FileChooser.fileSizeHeader.textAndMnemonic=\u30B5\u30A4\u30BA
-FileChooser.fileTypeHeader.textAndMnemonic=\u30BF\u30A4\u30D7
-FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6B63\u65E5
-FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240(&I):
+FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
+FileChooser.fileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u540D(&N):
+FileChooser.folderNameLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D(&N):
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u30BF\u30A4\u30D7(&T):
+FileChooser.upFolderToolTip.textAndMnemonic=1\u30EC\u30D9\u30EB\u4E0A\u3078
+FileChooser.upFolderAccessibleName=\u4E0A\u3078
+FileChooser.homeFolderToolTip.textAndMnemonic=\u30DB\u30FC\u30E0
+FileChooser.homeFolderAccessibleName=\u30DB\u30FC\u30E0
+FileChooser.newFolderToolTip.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0\u306E\u4F5C\u6210
+FileChooser.newFolderAccessibleName=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
+FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
+FileChooser.listViewButtonToolTip.textAndMnemonic=\u30EA\u30B9\u30C8
+FileChooser.listViewButtonAccessibleName=\u30EA\u30B9\u30C8
+FileChooser.listViewActionLabel.textAndMnemonic=\u30EA\u30B9\u30C8
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8A73\u7D30
+FileChooser.detailsViewButtonAccessibleName=\u8A73\u7D30
+FileChooser.detailsViewActionLabel.textAndMnemonic=\u8A73\u7D30
+FileChooser.refreshActionLabel.textAndMnemonic=\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5
+FileChooser.viewMenuLabel.textAndMnemonic=\u8868\u793A
+FileChooser.fileNameHeader.textAndMnemonic=\u540D\u524D
+FileChooser.fileSizeHeader.textAndMnemonic=\u30B5\u30A4\u30BA
+FileChooser.fileTypeHeader.textAndMnemonic=\u30BF\u30A4\u30D7
+FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6B63\u65E5
+FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ko.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ko.properties Wed May 01 11:34:06 2013 -0700
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-# FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table. This is an implementation detail of the current
-# workings of Swing. DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=\uAC80\uC0C9 \uC704\uCE58(&I):
-FileChooser.saveInLabel.textAndMnemonic=\uC800\uC7A5 \uC704\uCE58:
-FileChooser.fileNameLabel.textAndMnemonic=\uD30C\uC77C \uC774\uB984(&N):
-FileChooser.folderNameLabel.textAndMnemonic=\uD3F4\uB354 \uC774\uB984(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=\uD30C\uC77C \uC720\uD615(&T):
-FileChooser.upFolderToolTip.textAndMnemonic=\uD55C \uB808\uBCA8 \uC704\uB85C
-FileChooser.upFolderAccessibleName=\uC704\uB85C
-FileChooser.homeFolderToolTip.textAndMnemonic=\uD648
-FileChooser.homeFolderAccessibleName=\uD648
-FileChooser.newFolderToolTip.textAndMnemonic=\uC0C8 \uD3F4\uB354 \uC0DD\uC131
-FileChooser.newFolderAccessibleName=\uC0C8 \uD3F4\uB354
-FileChooser.newFolderActionLabel.textAndMnemonic=\uC0C8 \uD3F4\uB354
-FileChooser.listViewButtonToolTip.textAndMnemonic=\uBAA9\uB85D
-FileChooser.listViewButtonAccessibleName=\uBAA9\uB85D
-FileChooser.listViewActionLabel.textAndMnemonic=\uBAA9\uB85D
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=\uC138\uBD80 \uC815\uBCF4
-FileChooser.detailsViewButtonAccessibleName=\uC138\uBD80 \uC815\uBCF4
-FileChooser.detailsViewActionLabel.textAndMnemonic=\uC138\uBD80 \uC815\uBCF4
-FileChooser.refreshActionLabel.textAndMnemonic=\uC0C8\uB85C \uACE0\uCE68
-FileChooser.viewMenuLabel.textAndMnemonic=\uBCF4\uAE30
-FileChooser.fileNameHeader.textAndMnemonic=\uC774\uB984
-FileChooser.fileSizeHeader.textAndMnemonic=\uD06C\uAE30
-FileChooser.fileTypeHeader.textAndMnemonic=\uC720\uD615
-FileChooser.fileDateHeader.textAndMnemonic=\uC218\uC815 \uB0A0\uC9DC
-FileChooser.fileAttrHeader.textAndMnemonic=\uC18D\uC131
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=\uCC3E\uB294 \uC704\uCE58(&I):
+FileChooser.saveInLabel.textAndMnemonic=\uC800\uC7A5 \uC704\uCE58:
+FileChooser.fileNameLabel.textAndMnemonic=\uD30C\uC77C \uC774\uB984(&N):
+FileChooser.folderNameLabel.textAndMnemonic=\uD3F4\uB354 \uC774\uB984(&N):
+FileChooser.filesOfTypeLabel.textAndMnemonic=\uD30C\uC77C \uC720\uD615(&T):
+FileChooser.upFolderToolTip.textAndMnemonic=\uD55C \uB808\uBCA8 \uC704\uB85C
+FileChooser.upFolderAccessibleName=\uC704\uB85C
+FileChooser.homeFolderToolTip.textAndMnemonic=\uD648
+FileChooser.homeFolderAccessibleName=\uD648
+FileChooser.newFolderToolTip.textAndMnemonic=\uC0C8 \uD3F4\uB354 \uC0DD\uC131
+FileChooser.newFolderAccessibleName=\uC0C8 \uD3F4\uB354
+FileChooser.newFolderActionLabel.textAndMnemonic=\uC0C8 \uD3F4\uB354
+FileChooser.listViewButtonToolTip.textAndMnemonic=\uBAA9\uB85D
+FileChooser.listViewButtonAccessibleName=\uBAA9\uB85D
+FileChooser.listViewActionLabel.textAndMnemonic=\uBAA9\uB85D
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=\uC138\uBD80 \uC815\uBCF4
+FileChooser.detailsViewButtonAccessibleName=\uC138\uBD80 \uC815\uBCF4
+FileChooser.detailsViewActionLabel.textAndMnemonic=\uC138\uBD80 \uC815\uBCF4
+FileChooser.refreshActionLabel.textAndMnemonic=\uC0C8\uB85C \uACE0\uCE68
+FileChooser.viewMenuLabel.textAndMnemonic=\uBCF4\uAE30
+FileChooser.fileNameHeader.textAndMnemonic=\uC774\uB984
+FileChooser.fileSizeHeader.textAndMnemonic=\uD06C\uAE30
+FileChooser.fileTypeHeader.textAndMnemonic=\uC720\uD615
+FileChooser.fileDateHeader.textAndMnemonic=\uC218\uC815 \uB0A0\uC9DC
+FileChooser.fileAttrHeader.textAndMnemonic=\uC18D\uC131
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-# FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table. This is an implementation detail of the current
-# workings of Swing. DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Consultar Em(&I):
-FileChooser.saveInLabel.textAndMnemonic=Salvar Em:
-FileChooser.fileNameLabel.textAndMnemonic=&Nome do Arquivo:
-FileChooser.folderNameLabel.textAndMnemonic=&Nome da pasta:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Arquivos do &Tipo:
-FileChooser.upFolderToolTip.textAndMnemonic=Um N\u00EDvel Acima
-FileChooser.upFolderAccessibleName=Acima
-FileChooser.homeFolderToolTip.textAndMnemonic=In\u00EDcio
-FileChooser.homeFolderAccessibleName=In\u00EDcio
-FileChooser.newFolderToolTip.textAndMnemonic=Criar Nova Pasta
-FileChooser.newFolderAccessibleName=Nova Pasta
-FileChooser.newFolderActionLabel.textAndMnemonic=Nova Pasta
-FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
-FileChooser.listViewButtonAccessibleName=Lista
-FileChooser.listViewActionLabel.textAndMnemonic=Lista
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detalhes
-FileChooser.detailsViewButtonAccessibleName=Detalhes
-FileChooser.detailsViewActionLabel.textAndMnemonic=Detalhes
-FileChooser.refreshActionLabel.textAndMnemonic=Atualizar
-FileChooser.viewMenuLabel.textAndMnemonic=Exibir
-FileChooser.fileNameHeader.textAndMnemonic=Nome
-FileChooser.fileSizeHeader.textAndMnemonic=Tamanho
-FileChooser.fileTypeHeader.textAndMnemonic=Tipo
-FileChooser.fileDateHeader.textAndMnemonic=Modificado
-FileChooser.fileAttrHeader.textAndMnemonic=Atributos
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=Pesquisar &em:
+FileChooser.saveInLabel.textAndMnemonic=Salvar Em:
+FileChooser.fileNameLabel.textAndMnemonic=&Nome do Arquivo:
+FileChooser.folderNameLabel.textAndMnemonic=&Nome da Pasta:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Arquivos do &Tipo:
+FileChooser.upFolderToolTip.textAndMnemonic=Um N\u00EDvel Acima
+FileChooser.upFolderAccessibleName=Acima
+FileChooser.homeFolderToolTip.textAndMnemonic=In\u00EDcio
+FileChooser.homeFolderAccessibleName=In\u00EDcio
+FileChooser.newFolderToolTip.textAndMnemonic=Criar Nova Pasta
+FileChooser.newFolderAccessibleName=Nova Pasta
+FileChooser.newFolderActionLabel.textAndMnemonic=Nova Pasta
+FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
+FileChooser.listViewButtonAccessibleName=Lista
+FileChooser.listViewActionLabel.textAndMnemonic=Lista
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detalhes
+FileChooser.detailsViewButtonAccessibleName=Detalhes
+FileChooser.detailsViewActionLabel.textAndMnemonic=Detalhes
+FileChooser.refreshActionLabel.textAndMnemonic=Atualizar
+FileChooser.viewMenuLabel.textAndMnemonic=Exibir
+FileChooser.fileNameHeader.textAndMnemonic=Nome
+FileChooser.fileSizeHeader.textAndMnemonic=Tamanho
+FileChooser.fileTypeHeader.textAndMnemonic=Tipo
+FileChooser.fileDateHeader.textAndMnemonic=Modificado
+FileChooser.fileAttrHeader.textAndMnemonic=Atributos
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_sv.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-# FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table. This is an implementation detail of the current
-# workings of Swing. DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Leta &i:
-FileChooser.saveInLabel.textAndMnemonic=Spara i:
-FileChooser.fileNameLabel.textAndMnemonic=Fil&namn:
-FileChooser.folderNameLabel.textAndMnemonic=Mapp(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=Filforma&t:
-FileChooser.upFolderToolTip.textAndMnemonic=Upp en niv\u00E5
-FileChooser.upFolderAccessibleName=Upp
-FileChooser.homeFolderToolTip.textAndMnemonic=Hem
-FileChooser.homeFolderAccessibleName=Hem
-FileChooser.newFolderToolTip.textAndMnemonic=Skapa ny mapp
-FileChooser.newFolderAccessibleName=Ny mapp
-FileChooser.newFolderActionLabel.textAndMnemonic=Ny mapp
-FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
-FileChooser.listViewButtonAccessibleName=Lista
-FileChooser.listViewActionLabel.textAndMnemonic=Lista
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detaljer
-FileChooser.detailsViewButtonAccessibleName=Detaljer
-FileChooser.detailsViewActionLabel.textAndMnemonic=Detaljer
-FileChooser.refreshActionLabel.textAndMnemonic=F\u00F6rnya
-FileChooser.viewMenuLabel.textAndMnemonic=Vy
-FileChooser.fileNameHeader.textAndMnemonic=Namn
-FileChooser.fileSizeHeader.textAndMnemonic=Storlek
-FileChooser.fileTypeHeader.textAndMnemonic=Typ
-FileChooser.fileDateHeader.textAndMnemonic=\u00C4ndrad
-FileChooser.fileAttrHeader.textAndMnemonic=Attribut
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=Leta &i:
+FileChooser.saveInLabel.textAndMnemonic=Spara i:
+FileChooser.fileNameLabel.textAndMnemonic=Fil&namn:
+FileChooser.folderNameLabel.textAndMnemonic=Mapp&namn:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Filer av &typ:
+FileChooser.upFolderToolTip.textAndMnemonic=Upp en niv\u00E5
+FileChooser.upFolderAccessibleName=Upp
+FileChooser.homeFolderToolTip.textAndMnemonic=Hem
+FileChooser.homeFolderAccessibleName=Hem
+FileChooser.newFolderToolTip.textAndMnemonic=Skapa ny mapp
+FileChooser.newFolderAccessibleName=Ny mapp
+FileChooser.newFolderActionLabel.textAndMnemonic=Ny mapp
+FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
+FileChooser.listViewButtonAccessibleName=Lista
+FileChooser.listViewActionLabel.textAndMnemonic=Lista
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detaljer
+FileChooser.detailsViewButtonAccessibleName=Detaljer
+FileChooser.detailsViewActionLabel.textAndMnemonic=Detaljer
+FileChooser.refreshActionLabel.textAndMnemonic=F\u00F6rnya
+FileChooser.viewMenuLabel.textAndMnemonic=Vy
+FileChooser.fileNameHeader.textAndMnemonic=Namn
+FileChooser.fileSizeHeader.textAndMnemonic=Storlek
+FileChooser.fileTypeHeader.textAndMnemonic=Typ
+FileChooser.fileDateHeader.textAndMnemonic=\u00C4ndrad
+FileChooser.fileAttrHeader.textAndMnemonic=Attribut
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-# FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table. This is an implementation detail of the current
-# workings of Swing. DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=\u67E5\u770B(&I):
-FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
-FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6\u540D(&N):
-FileChooser.folderNameLabel.textAndMnemonic=\u6587\u4EF6\u5939\u540D(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u7C7B\u578B(&T):
-FileChooser.upFolderToolTip.textAndMnemonic=\u5411\u4E0A\u4E00\u7EA7
-FileChooser.upFolderAccessibleName=\u5411\u4E0A
-FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u5F55
-FileChooser.homeFolderAccessibleName=\u4E3B\u76EE\u5F55
-FileChooser.newFolderToolTip.textAndMnemonic=\u521B\u5EFA\u65B0\u6587\u4EF6\u5939
-FileChooser.newFolderAccessibleName=\u65B0\u5EFA\u6587\u4EF6\u5939
-FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u5EFA\u6587\u4EF6\u5939
-FileChooser.listViewButtonToolTip.textAndMnemonic=\u5217\u8868
-FileChooser.listViewButtonAccessibleName=\u5217\u8868
-FileChooser.listViewActionLabel.textAndMnemonic=\u5217\u8868
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599
-FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u8D44\u6599
-FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599
-FileChooser.refreshActionLabel.textAndMnemonic=\u5237\u65B0
-FileChooser.viewMenuLabel.textAndMnemonic=\u89C6\u56FE
-FileChooser.fileNameHeader.textAndMnemonic=\u540D\u79F0
-FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F
-FileChooser.fileTypeHeader.textAndMnemonic=\u7C7B\u578B
-FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
-FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=\u67E5\u627E(&I):
+FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
+FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6\u540D(&N):
+FileChooser.folderNameLabel.textAndMnemonic=\u6587\u4EF6\u5939\u540D(&N):
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u7C7B\u578B(&T):
+FileChooser.upFolderToolTip.textAndMnemonic=\u5411\u4E0A\u4E00\u7EA7
+FileChooser.upFolderAccessibleName=\u5411\u4E0A
+FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u5F55
+FileChooser.homeFolderAccessibleName=\u4E3B\u76EE\u5F55
+FileChooser.newFolderToolTip.textAndMnemonic=\u521B\u5EFA\u65B0\u6587\u4EF6\u5939
+FileChooser.newFolderAccessibleName=\u65B0\u5EFA\u6587\u4EF6\u5939
+FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u5EFA\u6587\u4EF6\u5939
+FileChooser.listViewButtonToolTip.textAndMnemonic=\u5217\u8868
+FileChooser.listViewButtonAccessibleName=\u5217\u8868
+FileChooser.listViewActionLabel.textAndMnemonic=\u5217\u8868
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u4FE1\u606F
+FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u4FE1\u606F
+FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u4FE1\u606F
+FileChooser.refreshActionLabel.textAndMnemonic=\u5237\u65B0
+FileChooser.viewMenuLabel.textAndMnemonic=\u89C6\u56FE
+FileChooser.fileNameHeader.textAndMnemonic=\u540D\u79F0
+FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F
+FileChooser.fileTypeHeader.textAndMnemonic=\u7C7B\u578B
+FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
+FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_TW.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_TW.properties Wed May 01 11:34:06 2013 -0700
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-# FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table. This is an implementation detail of the current
-# workings of Swing. DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=\u67E5\u8A62(&I):
-FileChooser.saveInLabel.textAndMnemonic=\u5132\u5B58\u65BC:
-FileChooser.fileNameLabel.textAndMnemonic=\u6A94\u6848\u540D\u7A31(&N):
-FileChooser.folderNameLabel.textAndMnemonic=\u8CC7\u6599\u593E\u540D\u7A31(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=\u6A94\u6848\u985E\u578B(&T):
-FileChooser.upFolderToolTip.textAndMnemonic=\u5F80\u4E0A\u4E00\u5C64
-FileChooser.upFolderAccessibleName=\u5F80\u4E0A
-FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u9304
-FileChooser.homeFolderAccessibleName=\u4E3B\u76EE\u9304
-FileChooser.newFolderToolTip.textAndMnemonic=\u5EFA\u7ACB\u65B0\u8CC7\u6599\u593E
-FileChooser.newFolderAccessibleName=\u65B0\u8CC7\u6599\u593E
-FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u8CC7\u6599\u593E
-FileChooser.listViewButtonToolTip.textAndMnemonic=\u6E05\u55AE
-FileChooser.listViewButtonAccessibleName=\u6E05\u55AE
-FileChooser.listViewActionLabel.textAndMnemonic=\u6E05\u55AE
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8A73\u7D30\u8CC7\u8A0A
-FileChooser.detailsViewButtonAccessibleName=\u8A73\u7D30\u8CC7\u8A0A
-FileChooser.detailsViewActionLabel.textAndMnemonic=\u8A73\u7D30\u8CC7\u8A0A
-FileChooser.refreshActionLabel.textAndMnemonic=\u91CD\u65B0\u6574\u7406
-FileChooser.viewMenuLabel.textAndMnemonic=\u6AA2\u8996
-FileChooser.fileNameHeader.textAndMnemonic=\u540D\u7A31
-FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F
-FileChooser.fileTypeHeader.textAndMnemonic=\u985E\u578B
-FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
-FileChooser.fileAttrHeader.textAndMnemonic=\u5C6C\u6027
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+# FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=\u67E5\u8A62(&I):
+FileChooser.saveInLabel.textAndMnemonic=\u5132\u5B58\u65BC:
+FileChooser.fileNameLabel.textAndMnemonic=\u6A94\u6848\u540D\u7A31(&N):
+FileChooser.folderNameLabel.textAndMnemonic=\u8CC7\u6599\u593E\u540D\u7A31(&N):
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u6A94\u6848\u985E\u578B(&T):
+FileChooser.upFolderToolTip.textAndMnemonic=\u5F80\u4E0A\u4E00\u5C64
+FileChooser.upFolderAccessibleName=\u5F80\u4E0A
+FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u9304
+FileChooser.homeFolderAccessibleName=\u4E3B\u76EE\u9304
+FileChooser.newFolderToolTip.textAndMnemonic=\u5EFA\u7ACB\u65B0\u8CC7\u6599\u593E
+FileChooser.newFolderAccessibleName=\u65B0\u8CC7\u6599\u593E
+FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u8CC7\u6599\u593E
+FileChooser.listViewButtonToolTip.textAndMnemonic=\u6E05\u55AE
+FileChooser.listViewButtonAccessibleName=\u6E05\u55AE
+FileChooser.listViewActionLabel.textAndMnemonic=\u6E05\u55AE
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8A73\u7D30\u8CC7\u8A0A
+FileChooser.detailsViewButtonAccessibleName=\u8A73\u7D30\u8CC7\u8A0A
+FileChooser.detailsViewActionLabel.textAndMnemonic=\u8A73\u7D30\u8CC7\u8A0A
+FileChooser.refreshActionLabel.textAndMnemonic=\u91CD\u65B0\u6574\u7406
+FileChooser.viewMenuLabel.textAndMnemonic=\u6AA2\u8996
+FileChooser.fileNameHeader.textAndMnemonic=\u540D\u7A31
+FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F
+FileChooser.fileTypeHeader.textAndMnemonic=\u985E\u578B
+FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
+FileChooser.fileAttrHeader.textAndMnemonic=\u5C6C\u6027
--- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java Wed May 01 11:34:06 2013 -0700
@@ -201,7 +201,7 @@
{"No class named", "\u540D\u524D''{0}''\u306E\u30AF\u30E9\u30B9\u304C\u3042\u308A\u307E\u305B\u3093"},
{"No class specified.", "\u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
{"No classpath specified.", "\u30AF\u30E9\u30B9\u30D1\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
- {"No code at line", "{1}\u306E\u884C{0,number,integer}\u306B\u30B3\u30FC\u30C9\u304C\u3042\u308A\u307E\u305B\u3093"},
+ {"No code at line", "\u884C{0,number,integer} ({1}\u5185)\u306B\u30B3\u30FC\u30C9\u304C\u3042\u308A\u307E\u305B\u3093"},
{"No connect specification.", "\u63A5\u7D9A\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
{"No connector named:", "\u540D\u524D{0}\u306E\u30B3\u30CD\u30AF\u30BF\u304C\u3042\u308A\u307E\u305B\u3093"},
{"No current thread", "\u73FE\u5728\u306E\u30B9\u30EC\u30C3\u30C9\u304C\u3042\u308A\u307E\u305B\u3093"},
--- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java Wed May 01 11:34:06 2013 -0700
@@ -325,7 +325,7 @@
{"watch accesses of", "\u76D1\u89C6{0}.{1}\u7684\u8BBF\u95EE"},
{"watch modification of", "\u76D1\u89C6{0}.{1}\u7684\u4FEE\u6539"},
{"zz help text",
- "** \u547D\u4EE4\u5217\u8868 **\nconnectors -- \u5217\u51FA\u6B64 VM \u4E2D\u53EF\u7528\u7684\u8FDE\u63A5\u5668\u548C\u4F20\u8F93\n\nrun [class [args]] -- \u5F00\u59CB\u6267\u884C\u5E94\u7528\u7A0B\u5E8F\u7684\u4E3B\u7C7B\n\nthreads [threadgroup] -- \u5217\u51FA\u7EBF\u7A0B\nthread <thread id> -- \u8BBE\u7F6E\u9ED8\u8BA4\u7EBF\u7A0B\nsuspend [thread id(s)] -- \u6302\u8D77\u7EBF\u7A0B (\u9ED8\u8BA4\u503C: all)\nresume [thread id(s)] -- \u6062\u590D\u7EBF\u7A0B (\u9ED8\u8BA4\u503C: all)\nwhere [<thread id> | all] -- \u8F6C\u50A8\u7EBF\u7A0B\u7684\u5806\u6808\nwherei [<thread id> | all]-- \u8F6C\u50A8\u7EBF\u7A0B\u7684\u5806\u6808, \u4EE5\u53CA pc \u4FE1\u606F\nup [n frames] -- \u4E0A\u79FB\u7EBF\u7A0B\u7684\u5806\u6808\ndown [n frames] -- \u4E0B\u79FB\u7EBF\u7A0B\u7684\u5806\u6808\nkill <thread id> <expr> -- \u7EC8\u6B62\u5177\u6709\u7ED9\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF\u5BF9\u8C61\u7684\u7EBF\u7A0B\ninterrupt <thread id> -- \u4E2D\u65AD\u7EBF\u7A0B\n\nprint <expr> -- \u8F93\u51FA\u8868\u8FBE\u5F0F\u7684\u503C\ndump <expr> -- \u8F93\u51FA\u6240\u6709\u5BF9\u8C61\u4FE1\u606F\neval <expr> -- \u5BF9\u8868\u8FBE\u5F0F\u6C42\u503C (\u4E0E print \u76F8\u540C)\nset <lvalue> = <expr> -- \u5411\u5B57\u6BB5/\u53D8\u91CF/\u6570\u7EC4\u5143\u7D20\u5206\u914D\u65B0\u503C\nlocals -- \u8F93\u51FA\u5F53\u524D\u5806\u6808\u5E27\u4E2D\u7684\u6240\u6709\u672C\u5730\u53D8\u91CF\n\nclasses -- \u5217\u51FA\u5F53\u524D\u5DF2\u77E5\u7684\u7C7B\nclass <class id> -- \u663E\u793A\u5DF2\u547D\u540D\u7C7B\u7684\u8BE6\u7EC6\u8D44\u6599\nmethods <class id> -- \u5217\u51FA\u7C7B\u7684\u65B9\u6CD5\nfields <class id> -- \u5217\u51FA\u7C7B\u7684\u5B57\u6BB5\n\nthreadgroups -- \u5217\u51FA\u7EBF\u7A0B\u7EC4\nthreadgroup <name> -- \u8BBE\u7F6E\u5F53\u524D\u7EBF\u7A0B\u7EC4\n\nstop in <class id>.<method>[(argument_type,...)]\n -- \u5728\u65B9\u6CD5\u4E2D\u8BBE\u7F6E\u65AD\u70B9\nstop at <class id>:<line> -- \u5728\u884C\u4E2D\u8BBE\u7F6E\u65AD\u70B9\nclear <class id>.<method>[(argument_type,...)]\n -- \u6E05\u9664\u65B9\u6CD5\u4E2D\u7684\u65AD\u70B9\nclear <class id>:<line> -- \u6E05\u9664\u884C\u4E2D\u7684\u65AD\u70B9\nclear -- \u5217\u51FA\u65AD\u70B9\ncatch [uncaught|caught|all] <class id>|<class pattern>\n -- \u51FA\u73B0\u6307\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF\u65F6\u4E2D\u65AD\nignore [uncaught|caught|all] <class id>|<class pattern>\n -- \u5BF9\u4E8E\u6307\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF, \u53D6\u6D88 'catch'\nwatch [access|all] <class id>.<field name>\n -- \u76D1\u89C6\u5BF9\u5B57\u6BB5\u7684\u8BBF\u95EE/\u4FEE\u6539\nunwatch [access|all] <class id>.<field name>\n -- \u505C\u6B62\u76D1\u89C6\u5BF9\u5B57\u6BB5\u7684\u8BBF\u95EE/\u4FEE\u6539\ntrace [go] methods [thread]\n -- \u8DDF\u8E2A\u65B9\u6CD5\u8FDB\u5165\u548C\u9000\u51FA\u3002\n -- \u9664\u975E\u6307\u5B9A 'go', \u5426\u5219\u6302\u8D77\u6240\u6709\u7EBF\u7A0B\ntrace [go] method exit | exits [thread]\n -- \u8DDF\u8E2A\u5F53\u524D\u65B9\u6CD5\u7684\u9000\u51FA, \u6216\u8005\u6240\u6709\u65B9\u6CD5\u7684\u9000\u51FA\n -- \u9664\u975E\u6307\u5B9A 'go', \u5426\u5219\u6302\u8D77\u6240\u6709\u7EBF\u7A0B\nuntrace [methods] -- \u505C\u6B62\u8DDF\u8E2A\u65B9\u6CD5\u8FDB\u5165\u548C/\u6216\u9000\u51FA\nstep -- \u6267\u884C\u5F53\u524D\u884C\nstep up -- \u4E00\u76F4\u6267\u884C, \u76F4\u5230\u5F53\u524D\u65B9\u6CD5\u8FD4\u56DE\u5230\u5176\u8C03\u7528\u65B9\nstepi -- \u6267\u884C\u5F53\u524D\u6307\u4EE4\nnext -- \u6B65\u8FDB\u4E00\u884C (\u6B65\u8FC7\u8C03\u7528)\ncont -- \u4ECE\u65AD\u70B9\u5904\u7EE7\u7EED\u6267\u884C\n\nlist [line number|method] -- \u8F93\u51FA\u6E90\u4EE3\u7801\nuse (\u6216 sourcepath) [source file path]\n -- \u663E\u793A\u6216\u66F4\u6539\u6E90\u8DEF\u5F84\nexclude [<class pattern>, ... | \"none\"]\n -- \u5BF9\u4E8E\u6307\u5B9A\u7684\u7C7B, \u4E0D\u62A5\u544A\u6B65\u9AA4\u6216\u65B9\u6CD5\u4E8B\u4EF6\nclasspath -- \u4ECE\u76EE\u6807 VM \u8F93\u51FA\u7C7B\u8DEF\u5F84\u4FE1\u606F\n\nmonitor <command> -- \u6BCF\u6B21\u7A0B\u5E8F\u505C\u6B62\u65F6\u6267\u884C\u547D\u4EE4\nmonitor -- \u5217\u51FA\u76D1\u89C6\u5668\nunmonitor <monitor#> -- \u5220\u9664\u76D1\u89C6\u5668\nread <filename> -- \u8BFB\u53D6\u5E76\u6267\u884C\u547D\u4EE4\u6587\u4EF6\n\nlock <expr> -- \u8F93\u51FA\u5BF9\u8C61\u7684\u9501\u4FE1\u606F\nthreadlocks [thread id] -- \u8F93\u51FA\u7EBF\u7A0B\u7684\u9501\u4FE1\u606F\n\npop -- \u901A\u8FC7\u5F53\u524D\u5E27\u51FA\u6808, \u4E14\u5305\u542B\u5F53\u524D\u5E27\nreenter -- \u4E0E pop \u76F8\u540C, \u4F46\u91CD\u65B0\u8FDB\u5165\u5F53\u524D\u5E27\nredefine <class id> <class file name>\n -- \u91CD\u65B0\u5B9A\u4E49\u7C7B\u7684\u4EE3\u7801\n\ndisablegc <expr> -- \u7981\u6B62\u5BF9\u8C61\u7684\u5783\u573E\u6536\u96C6\nenablegc <expr> -- \u5141\u8BB8\u5BF9\u8C61\u7684\u5783\u573E\u6536\u96C6\n\n!! -- \u91CD\u590D\u6267\u884C\u6700\u540E\u4E00\u4E2A\u547D\u4EE4\n<n> <command> -- \u5C06\u547D\u4EE4\u91CD\u590D\u6267\u884C n \u6B21\n# <command> -- \u653E\u5F03 (\u65E0\u64CD\u4F5C)\nhelp (\u6216 ?) -- \u5217\u51FA\u547D\u4EE4\nversion -- \u8F93\u51FA\u7248\u672C\u4FE1\u606F\nexit (\u6216 quit) -- \u9000\u51FA\u8C03\u8BD5\u5668\n\n<class id>: \u5E26\u6709\u7A0B\u5E8F\u5305\u9650\u5B9A\u7B26\u7684\u5B8C\u6574\u7C7B\u540D\n<class pattern>: \u5E26\u6709\u524D\u5BFC\u6216\u5C3E\u968F\u901A\u914D\u7B26 ('*') \u7684\u7C7B\u540D\n<thread id>: 'threads' \u547D\u4EE4\u4E2D\u62A5\u544A\u7684\u7EBF\u7A0B\u7F16\u53F7\n<expr>: Java(TM) \u7F16\u7A0B\u8BED\u8A00\u8868\u8FBE\u5F0F\u3002\n\u652F\u6301\u5927\u591A\u6570\u5E38\u89C1\u8BED\u6CD5\u3002\n\n\u53EF\u4EE5\u5C06\u542F\u52A8\u547D\u4EE4\u7F6E\u4E8E \"jdb.ini\" \u6216 \".jdbrc\" \u4E2D\n\u4F4D\u4E8E user.home \u6216 user.dir \u4E2D"},
+ "** \u547D\u4EE4\u5217\u8868 **\nconnectors -- \u5217\u51FA\u6B64 VM \u4E2D\u53EF\u7528\u7684\u8FDE\u63A5\u5668\u548C\u4F20\u8F93\n\nrun [class [args]] -- \u5F00\u59CB\u6267\u884C\u5E94\u7528\u7A0B\u5E8F\u7684\u4E3B\u7C7B\n\nthreads [threadgroup] -- \u5217\u51FA\u7EBF\u7A0B\nthread <thread id> -- \u8BBE\u7F6E\u9ED8\u8BA4\u7EBF\u7A0B\nsuspend [thread id(s)] -- \u6302\u8D77\u7EBF\u7A0B (\u9ED8\u8BA4\u503C: all)\nresume [thread id(s)] -- \u6062\u590D\u7EBF\u7A0B (\u9ED8\u8BA4\u503C: all)\nwhere [<thread id> | all] -- \u8F6C\u50A8\u7EBF\u7A0B\u7684\u5806\u6808\nwherei [<thread id> | all]-- \u8F6C\u50A8\u7EBF\u7A0B\u7684\u5806\u6808, \u4EE5\u53CA pc \u4FE1\u606F\nup [n frames] -- \u4E0A\u79FB\u7EBF\u7A0B\u7684\u5806\u6808\ndown [n frames] -- \u4E0B\u79FB\u7EBF\u7A0B\u7684\u5806\u6808\nkill <thread id> <expr> -- \u7EC8\u6B62\u5177\u6709\u7ED9\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF\u5BF9\u8C61\u7684\u7EBF\u7A0B\ninterrupt <thread id> -- \u4E2D\u65AD\u7EBF\u7A0B\n\nprint <expr> -- \u8F93\u51FA\u8868\u8FBE\u5F0F\u7684\u503C\ndump <expr> -- \u8F93\u51FA\u6240\u6709\u5BF9\u8C61\u4FE1\u606F\neval <expr> -- \u5BF9\u8868\u8FBE\u5F0F\u6C42\u503C (\u4E0E print \u76F8\u540C)\nset <lvalue> = <expr> -- \u5411\u5B57\u6BB5/\u53D8\u91CF/\u6570\u7EC4\u5143\u7D20\u5206\u914D\u65B0\u503C\nlocals -- \u8F93\u51FA\u5F53\u524D\u5806\u6808\u5E27\u4E2D\u7684\u6240\u6709\u672C\u5730\u53D8\u91CF\n\nclasses -- \u5217\u51FA\u5F53\u524D\u5DF2\u77E5\u7684\u7C7B\nclass <class id> -- \u663E\u793A\u5DF2\u547D\u540D\u7C7B\u7684\u8BE6\u7EC6\u8D44\u6599\nmethods <class id> -- \u5217\u51FA\u7C7B\u7684\u65B9\u6CD5\nfields <class id> -- \u5217\u51FA\u7C7B\u7684\u5B57\u6BB5\n\nthreadgroups -- \u5217\u51FA\u7EBF\u7A0B\u7EC4\nthreadgroup <name> -- \u8BBE\u7F6E\u5F53\u524D\u7EBF\u7A0B\u7EC4\n\nstop in <class id>.<method>[(argument_type,...)]\n -- \u5728\u65B9\u6CD5\u4E2D\u8BBE\u7F6E\u65AD\u70B9\nstop at <class id>:<line> -- \u5728\u884C\u4E2D\u8BBE\u7F6E\u65AD\u70B9\nclear <class id>.<method>[(argument_type,...)]\n -- \u6E05\u9664\u65B9\u6CD5\u4E2D\u7684\u65AD\u70B9\nclear <class id>:<line> -- \u6E05\u9664\u884C\u4E2D\u7684\u65AD\u70B9\nclear -- \u5217\u51FA\u65AD\u70B9\ncatch [uncaught|caught|all] <class id>|<class pattern>\n -- \u51FA\u73B0\u6307\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF\u65F6\u4E2D\u65AD\nignore [uncaught|caught|all] <class id>|<class pattern>\n -- \u5BF9\u4E8E\u6307\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF, \u53D6\u6D88 'catch'\nwatch [access|all] <class id>.<field name>\n -- \u76D1\u89C6\u5BF9\u5B57\u6BB5\u7684\u8BBF\u95EE/\u4FEE\u6539\nunwatch [access|all] <class id>.<field name>\n -- \u505C\u6B62\u76D1\u89C6\u5BF9\u5B57\u6BB5\u7684\u8BBF\u95EE/\u4FEE\u6539\ntrace [go] methods [thread]\n -- \u8DDF\u8E2A\u65B9\u6CD5\u8FDB\u5165\u548C\u9000\u51FA\u3002\n -- \u9664\u975E\u6307\u5B9A 'go', \u5426\u5219\u6302\u8D77\u6240\u6709\u7EBF\u7A0B\ntrace [go] method exit | exits [thread]\n -- \u8DDF\u8E2A\u5F53\u524D\u65B9\u6CD5\u7684\u9000\u51FA, \u6216\u8005\u6240\u6709\u65B9\u6CD5\u7684\u9000\u51FA\n -- \u9664\u975E\u6307\u5B9A 'go', \u5426\u5219\u6302\u8D77\u6240\u6709\u7EBF\u7A0B\nuntrace [methods] -- \u505C\u6B62\u8DDF\u8E2A\u65B9\u6CD5\u8FDB\u5165\u548C/\u6216\u9000\u51FA\nstep -- \u6267\u884C\u5F53\u524D\u884C\nstep up -- \u4E00\u76F4\u6267\u884C, \u76F4\u5230\u5F53\u524D\u65B9\u6CD5\u8FD4\u56DE\u5230\u5176\u8C03\u7528\u65B9\nstepi -- \u6267\u884C\u5F53\u524D\u6307\u4EE4\n\u4E0B\u4E00\u6B65 -- \u6B65\u8FDB\u4E00\u884C (\u6B65\u8FC7\u8C03\u7528)\ncont -- \u4ECE\u65AD\u70B9\u5904\u7EE7\u7EED\u6267\u884C\n\nlist [line number|method] -- \u8F93\u51FA\u6E90\u4EE3\u7801\nuse (\u6216 sourcepath) [source file path]\n -- \u663E\u793A\u6216\u66F4\u6539\u6E90\u8DEF\u5F84\nexclude [<class pattern>, ... | \"none\"]\n -- \u5BF9\u4E8E\u6307\u5B9A\u7684\u7C7B, \u4E0D\u62A5\u544A\u6B65\u9AA4\u6216\u65B9\u6CD5\u4E8B\u4EF6\nclasspath -- \u4ECE\u76EE\u6807 VM \u8F93\u51FA\u7C7B\u8DEF\u5F84\u4FE1\u606F\n\nmonitor <command> -- \u6BCF\u6B21\u7A0B\u5E8F\u505C\u6B62\u65F6\u6267\u884C\u547D\u4EE4\nmonitor -- \u5217\u51FA\u76D1\u89C6\u5668\nunmonitor <monitor#> -- \u5220\u9664\u76D1\u89C6\u5668\nread <filename> -- \u8BFB\u53D6\u5E76\u6267\u884C\u547D\u4EE4\u6587\u4EF6\n\nlock <expr> -- \u8F93\u51FA\u5BF9\u8C61\u7684\u9501\u4FE1\u606F\nthreadlocks [thread id] -- \u8F93\u51FA\u7EBF\u7A0B\u7684\u9501\u4FE1\u606F\n\npop -- \u901A\u8FC7\u5F53\u524D\u5E27\u51FA\u6808, \u4E14\u5305\u542B\u5F53\u524D\u5E27\nreenter -- \u4E0E pop \u76F8\u540C, \u4F46\u91CD\u65B0\u8FDB\u5165\u5F53\u524D\u5E27\nredefine <class id> <class file name>\n -- \u91CD\u65B0\u5B9A\u4E49\u7C7B\u7684\u4EE3\u7801\n\ndisablegc <expr> -- \u7981\u6B62\u5BF9\u8C61\u7684\u5783\u573E\u6536\u96C6\nenablegc <expr> -- \u5141\u8BB8\u5BF9\u8C61\u7684\u5783\u573E\u6536\u96C6\n\n!! -- \u91CD\u590D\u6267\u884C\u6700\u540E\u4E00\u4E2A\u547D\u4EE4\n<n> <command> -- \u5C06\u547D\u4EE4\u91CD\u590D\u6267\u884C n \u6B21\n# <command> -- \u653E\u5F03 (\u65E0\u64CD\u4F5C)\nhelp (\u6216 ?) -- \u5217\u51FA\u547D\u4EE4\nversion -- \u8F93\u51FA\u7248\u672C\u4FE1\u606F\nexit (\u6216 quit) -- \u9000\u51FA\u8C03\u8BD5\u5668\n\n<class id>: \u5E26\u6709\u7A0B\u5E8F\u5305\u9650\u5B9A\u7B26\u7684\u5B8C\u6574\u7C7B\u540D\n<class pattern>: \u5E26\u6709\u524D\u5BFC\u6216\u5C3E\u968F\u901A\u914D\u7B26 ('*') \u7684\u7C7B\u540D\n<thread id>: 'threads' \u547D\u4EE4\u4E2D\u62A5\u544A\u7684\u7EBF\u7A0B\u7F16\u53F7\n<expr>: Java(TM) \u7F16\u7A0B\u8BED\u8A00\u8868\u8FBE\u5F0F\u3002\n\u652F\u6301\u5927\u591A\u6570\u5E38\u89C1\u8BED\u6CD5\u3002\n\n\u53EF\u4EE5\u5C06\u542F\u52A8\u547D\u4EE4\u7F6E\u4E8E \"jdb.ini\" \u6216 \".jdbrc\" \u4E2D\n\u4F4D\u4E8E user.home \u6216 user.dir \u4E2D"},
{"zz usage text",
"\u7528\u6CD5: {0} <options> <class> <arguments>\n\n\u5176\u4E2D, \u9009\u9879\u5305\u62EC:\n -help \u8F93\u51FA\u6B64\u6D88\u606F\u5E76\u9000\u51FA\n -sourcepath <\u7531 \"{1}\" \u5206\u9694\u7684\u76EE\u5F55>\n \u8981\u5728\u5176\u4E2D\u67E5\u627E\u6E90\u6587\u4EF6\u7684\u76EE\u5F55\n -attach <address>\n \u4F7F\u7528\u6807\u51C6\u8FDE\u63A5\u5668\u9644\u52A0\u5230\u6307\u5B9A\u5730\u5740\u5904\u6B63\u5728\u8FD0\u884C\u7684 VM\n -listen <address>\n \u7B49\u5F85\u6B63\u5728\u8FD0\u884C\u7684 VM \u4F7F\u7528\u6807\u51C6\u8FDE\u63A5\u5668\u5728\u6307\u5B9A\u5730\u5740\u5904\u8FDE\u63A5\n -listenany\n \u7B49\u5F85\u6B63\u5728\u8FD0\u884C\u7684 VM \u4F7F\u7528\u6807\u51C6\u8FDE\u63A5\u5668\u5728\u4EFB\u4F55\u53EF\u7528\u5730\u5740\u5904\u8FDE\u63A5\n -launch\n \u7ACB\u5373\u542F\u52A8 VM \u800C\u4E0D\u662F\u7B49\u5F85 ''run'' \u547D\u4EE4\n -listconnectors \u5217\u51FA\u6B64 VM \u4E2D\u7684\u53EF\u7528\u8FDE\u63A5\u5668\n -connect <connector-name>:<name1>=<value1>,...\n \u4F7F\u7528\u6240\u5217\u53C2\u6570\u503C\u901A\u8FC7\u6307\u5B9A\u7684\u8FDE\u63A5\u5668\u8FDE\u63A5\u5230\u76EE\u6807 VM\n -dbgtrace [flags] \u8F93\u51FA\u4FE1\u606F\u4F9B\u8C03\u8BD5{0}\n -tclient \u5728 HotSpot(TM) \u5BA2\u6237\u673A\u7F16\u8BD1\u5668\u4E2D\u8FD0\u884C\u5E94\u7528\u7A0B\u5E8F\n -tserver \u5728 HotSpot(TM) \u670D\u52A1\u5668\u7F16\u8BD1\u5668\u4E2D\u8FD0\u884C\u5E94\u7528\u7A0B\u5E8F\n\n\u8F6C\u53D1\u5230\u88AB\u8C03\u8BD5\u8FDB\u7A0B\u7684\u9009\u9879:\n -v -verbose[:class|gc|jni]\n \u542F\u7528\u8BE6\u7EC6\u6A21\u5F0F\n -D<name>=<value> \u8BBE\u7F6E\u7CFB\u7EDF\u5C5E\u6027\n -classpath <\u7531 \"{1}\" \u5206\u9694\u7684\u76EE\u5F55>\n \u5217\u51FA\u8981\u5728\u5176\u4E2D\u67E5\u627E\u7C7B\u7684\u76EE\u5F55\n -X<option> \u975E\u6807\u51C6\u76EE\u6807 VM \u9009\u9879\n\n<class> \u662F\u8981\u5F00\u59CB\u8C03\u8BD5\u7684\u7C7B\u7684\u540D\u79F0\n<arguments> \u662F\u4F20\u9012\u5230 <class> \u7684 main() \u65B9\u6CD5\u7684\u53C2\u6570\n\n\u8981\u83B7\u5F97\u547D\u4EE4\u7684\u5E2E\u52A9, \u8BF7\u5728{0}\u63D0\u793A\u4E0B\u952E\u5165 ''help''"},
// END OF MATERIAL TO LOCALIZE
--- a/jdk/src/share/classes/java/lang/CharSequence.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/lang/CharSequence.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,13 @@
package java.lang;
+import java.util.NoSuchElementException;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.IntConsumer;
+import java.util.stream.IntStream;
+import java.util.stream.StreamSupport;
/**
* A <tt>CharSequence</tt> is a readable sequence of <code>char</code> values. This
@@ -108,4 +115,95 @@
*/
public String toString();
+ /**
+ * Returns a stream of {@code int} zero-extending the {@code char} values
+ * from this sequence. Any char which maps to a <a
+ * href="{@docRoot}/java/lang/Character.html#unicode">surrogate code
+ * point</a> is passed through uninterpreted.
+ *
+ * <p>If the sequence is mutated while the stream is being read, the
+ * result is undefined.
+ *
+ * @return an IntStream of char values from this sequence
+ * @since 1.8
+ */
+ public default IntStream chars() {
+ class CharIterator implements PrimitiveIterator.OfInt {
+ int cur = 0;
+
+ public boolean hasNext() {
+ return cur < length();
+ }
+
+ public int nextInt() {
+ if (hasNext()) {
+ return charAt(cur++);
+ } else {
+ throw new NoSuchElementException();
+ }
+ }
+
+ @Override
+ public void forEachRemaining(IntConsumer block) {
+ for (; cur < length(); cur++) {
+ block.accept(charAt(cur));
+ }
+ }
+ }
+
+ return StreamSupport.intStream(() ->
+ Spliterators.spliterator(
+ new CharIterator(),
+ length(),
+ Spliterator.ORDERED),
+ Spliterator.SUBSIZED | Spliterator.SIZED | Spliterator.ORDERED);
+ }
+
+ /**
+ * Returns a stream of code point values from this sequence. Any surrogate
+ * pairs encountered in the sequence are combined as if by {@linkplain
+ * Character#toCodePoint Character.toCodePoint} and the result is passed
+ * to the stream. Any other code units, including ordinary BMP characters,
+ * unpaired surrogates, and undefined code units, are zero-extended to
+ * {@code int} values which are then passed to the stream.
+ *
+ * <p>If the sequence is mutated while the stream is being read, the result
+ * is undefined.
+ *
+ * @return an IntStream of Unicode code points from this sequence
+ * @since 1.8
+ */
+ public default IntStream codePoints() {
+ class CodePointIterator implements PrimitiveIterator.OfInt {
+ int cur = 0;
+
+ @Override
+ public void forEachRemaining(IntConsumer block) {
+ while (cur < length()) {
+ int cp = Character.codePointAt(CharSequence.this, cur);
+ cur += Character.charCount(cp);
+ block.accept(cp);
+ }
+ }
+
+ public boolean hasNext() {
+ return cur < length();
+ }
+
+ public int nextInt() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ int cp = Character.codePointAt(CharSequence.this, cur);
+ cur += Character.charCount(cp);
+ return cp;
+ }
+ }
+
+ return StreamSupport.intStream(() ->
+ Spliterators.spliteratorUnknownSize(
+ new CodePointIterator(),
+ Spliterator.ORDERED),
+ Spliterator.SUBSIZED | Spliterator.SIZED | Spliterator.ORDERED);
+ }
}
--- a/jdk/src/share/classes/java/lang/String.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/lang/String.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
import java.util.Formatter;
import java.util.Locale;
import java.util.Objects;
+import java.util.StringJoiner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -131,7 +132,7 @@
* string instance within the stream.
*/
private static final ObjectStreamField[] serialPersistentFields =
- new ObjectStreamField[0];
+ new ObjectStreamField[0];
/**
* Initializes a newly created {@code String} object so that it represents
@@ -970,7 +971,7 @@
return true;
}
if (anObject instanceof String) {
- String anotherString = (String) anObject;
+ String anotherString = (String)anObject;
int n = value.length;
if (n == anotherString.value.length) {
char v1[] = value;
@@ -978,7 +979,7 @@
int i = 0;
while (n-- != 0) {
if (v1[i] != v2[i])
- return false;
+ return false;
i++;
}
return true;
@@ -1003,7 +1004,7 @@
* @since 1.4
*/
public boolean contentEquals(StringBuffer sb) {
- return contentEquals((CharSequence) sb);
+ return contentEquals((CharSequence)sb);
}
private boolean nonSyncContentEquals(AbstractStringBuilder sb) {
@@ -1248,7 +1249,8 @@
* argument.
* <li>There is some nonnegative integer <i>k</i> less than {@code len}
* such that:
- * <code>this.charAt(toffset+<i>k</i>) != other.charAt(ooffset+<i>k</i>)</code>
+ * {@code this.charAt(toffset + }<i>k</i>{@code ) != other.charAt(ooffset + }
+ * <i>k</i>{@code )}
* </ul>
*
* @param toffset the starting offset of the subregion in this string.
@@ -1872,7 +1874,7 @@
int min = sourceOffset + targetCount - 1;
int i = min + fromIndex;
- startSearchForLastChar:
+ startSearchForLastChar:
while (true) {
while (i >= min && source[i] != strLastChar) {
i--;
@@ -1973,7 +1975,7 @@
* str.substring(begin, end)</pre></blockquote>
*
* This method is defined so that the {@code String} class can implement
- * the {@link CharSequence} interface. </p>
+ * the {@link CharSequence} interface.
*
* @param beginIndex the begin index, inclusive.
* @param endIndex the end index, exclusive.
@@ -2352,9 +2354,11 @@
// Construct result
int resultSize = list.size();
- if (limit == 0)
- while (resultSize > 0 && list.get(resultSize - 1).length() == 0)
+ if (limit == 0) {
+ while (resultSize > 0 && list.get(resultSize - 1).length() == 0) {
resultSize--;
+ }
+ }
String[] result = new String[resultSize];
return list.subList(0, resultSize).toArray(result);
}
@@ -2404,6 +2408,90 @@
}
/**
+ * Returns a new String composed of copies of the
+ * {@code CharSequence elements} joined together with a copy of
+ * the specified {@code delimiter}.
+ *
+ * <blockquote>For example,
+ * <pre>{@code
+ * String message = String.join("-", "Java", "is", "cool");
+ * // message returned is: "Java-is-cool"
+ * }</pre></blockquote>
+ *
+ * Note that if an element is null, then {@code "null"} is added.
+ *
+ * @param delimiter the delimiter that separates each element
+ * @param elements the elements to join together.
+ *
+ * @return a new {@code String} that is composed of the {@code elements}
+ * separated by the {@code delimiter}
+ *
+ * @throws NullPointerException If {@code delimiter} or {@code elements}
+ * is {@code null}
+ *
+ * @see java.util.StringJoiner
+ * @since 1.8
+ */
+ public static String join(CharSequence delimiter, CharSequence... elements) {
+ Objects.requireNonNull(delimiter);
+ Objects.requireNonNull(elements);
+ // Number of elements not likely worth Arrays.stream overhead.
+ StringJoiner joiner = new StringJoiner(delimiter);
+ for (CharSequence cs: elements) {
+ joiner.add(cs);
+ }
+ return joiner.toString();
+ }
+
+ /**
+ * Returns a new {@code String} composed of copies of the
+ * {@code CharSequence elements} joined together with a copy of the
+ * specified {@code delimiter}.
+ *
+ * <blockquote>For example,
+ * <pre>{@code
+ * List<String> strings = new LinkedList<>();
+ * strings.add("Java");strings.add("is");
+ * strings.add("cool");
+ * String message = String.join(" ", strings);
+ * //message returned is: "Java is cool"
+ *
+ * Set<String> strings = new HashSet<>();
+ * Strings.add("Java"); strings.add("is");
+ * strings.add("very"); strings.add("cool");
+ * String message = String.join("-", strings);
+ * //message returned is: "Java-is-very-cool"
+ * }</pre></blockquote>
+ *
+ * Note that if an individual element is {@code null}, then {@code "null"} is added.
+ *
+ * @param delimiter a sequence of characters that is used to separate each
+ * of the {@code elements} in the resulting {@code String}
+ * @param elements an {@code Iterable} that will have its {@code elements}
+ * joined together.
+ *
+ * @return a new {@code String} that is composed from the {@code elements}
+ * argument
+ *
+ * @throws NullPointerException If {@code delimiter} or {@code elements}
+ * is {@code null}
+ *
+ * @see #join(CharSequence,CharSequence...)
+ * @see java.util.StringJoiner
+ * @since 1.8
+ */
+ public static String join(CharSequence delimiter,
+ Iterable<? extends CharSequence> elements) {
+ Objects.requireNonNull(delimiter);
+ Objects.requireNonNull(elements);
+ StringJoiner joiner = new StringJoiner(delimiter);
+ for (CharSequence cs: elements) {
+ joiner.add(cs);
+ }
+ return joiner.toString();
+ }
+
+ /**
* Converts all of the characters in this {@code String} to lower
* case using the rules of the given {@code Locale}. Case mapping is based
* on the Unicode Standard version specified by the {@link java.lang.Character Character}
@@ -2650,9 +2738,9 @@
return this;
}
+ /* result may grow, so i+resultOffset is the write location in result */
+ int resultOffset = 0;
char[] result = new char[len]; /* may grow */
- int resultOffset = 0; /* result may grow, so i+resultOffset
- * is the write location in result */
/* Just copy the first few upperCase characters. */
System.arraycopy(value, 0, result, 0, firstLower);
@@ -2757,7 +2845,7 @@
* object is created, representing the substring of this string that
* begins with the character at index <i>k</i> and ends with the
* character at index <i>m</i>-that is, the result of
- * <code>this.substring(<i>k</i>, <i>m</i>+1)</code>.
+ * {@code this.substring(k, m + 1)}.
* <p>
* This method may be used to trim whitespace (as defined above) from
* the beginning and end of a string.
@@ -3143,8 +3231,8 @@
* programmer should be aware that producing distinct integer results
* for unequal objects may improve the performance of hash tables.
* </ul>
- * </p>
- * The hash value will never be zero.
+ *
+ * The hash value will never be zero.
*
* @return a hash code value for this object.
* @see java.lang.Object#equals(java.lang.Object)
--- a/jdk/src/share/classes/java/lang/Throwable.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Throwable.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -453,9 +453,10 @@
*/
public synchronized Throwable initCause(Throwable cause) {
if (this.cause != this)
- throw new IllegalStateException("Can't overwrite cause");
+ throw new IllegalStateException("Can't overwrite cause with " +
+ Objects.toString(cause, "a null"), this);
if (cause == this)
- throw new IllegalArgumentException("Self-causation not permitted");
+ throw new IllegalArgumentException("Self-causation not permitted", this);
this.cause = cause;
return this;
}
@@ -1039,7 +1040,7 @@
*/
public final synchronized void addSuppressed(Throwable exception) {
if (exception == this)
- throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE);
+ throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE, exception);
if (exception == null)
throw new NullPointerException(NULL_CAUSE_MESSAGE);
--- a/jdk/src/share/classes/java/lang/reflect/Executable.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Executable.java Wed May 01 11:34:06 2013 -0700
@@ -237,8 +237,8 @@
public abstract Class<?>[] getParameterTypes();
/**
- * Returns the number of formal parameters (including any
- * synthetic or synthesized parameters) for the executable
+ * Returns the number of formal parameters (whether explicitly
+ * declared or implicitly declared or neither) for the executable
* represented by this object.
*
* @return The number of formal parameters for the executable this
--- a/jdk/src/share/classes/java/lang/reflect/Parameter.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Parameter.java Wed May 01 11:34:06 2013 -0700
@@ -148,19 +148,15 @@
}
/**
- * Returns the name of the parameter. The names of the parameters
- * of a single executable must all the be distinct. When names
- * from the originating source are available, they are returned.
- * Otherwise, an implementation of this method is free to create a
- * name of this parameter, subject to the unquiness requirments.
+ * Returns the name of the parameter. If the parameter's name is
+ * defined in a class file, then that name will be returned by
+ * this method. Otherwise, this method will synthesize a name of
+ * the form argN, where N is the index of the parameter.
*/
public String getName() {
- // As per the spec, if a parameter has no name, return argX,
- // where x is the index.
- //
- // Note: spec updates now outlaw empty strings as parameter
- // names. The .equals("") is for compatibility with current
- // JVM behavior. It may be removed at some point.
+ // Note: empty strings as paramete names are now outlawed.
+ // The .equals("") is for compatibility with current JVM
+ // behavior. It may be removed at some point.
if(name == null || name.equals(""))
return "arg" + index;
else
@@ -311,6 +307,6 @@
declaredAnnotations.put(ann[i].annotationType(), ann[i]);
}
return declaredAnnotations;
- }
+ }
}
--- a/jdk/src/share/classes/java/lang/reflect/Proxy.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Proxy.java Wed May 01 11:34:06 2013 -0700
@@ -25,18 +25,14 @@
package java.lang.reflect;
-import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
+import java.util.IdentityHashMap;
import java.util.Map;
-import java.util.Set;
-import java.util.List;
-import java.util.WeakHashMap;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.BiFunction;
import sun.misc.ProxyGenerator;
import sun.misc.VM;
import sun.reflect.CallerSensitive;
@@ -232,27 +228,15 @@
private static final long serialVersionUID = -2222568056686623797L;
- /** prefix for all proxy class names */
- private final static String proxyClassNamePrefix = "$Proxy";
-
/** parameter types of a proxy class constructor */
- private final static Class[] constructorParams =
+ private static final Class<?>[] constructorParams =
{ InvocationHandler.class };
- /** maps a class loader to the proxy class cache for that loader */
- private static Map<ClassLoader, Map<List<String>, Object>> loaderToCache
- = new WeakHashMap<>();
-
- /** marks that a particular proxy class is currently being generated */
- private static Object pendingGenerationMarker = new Object();
-
- /** next number to use for generation of unique proxy class names */
- private static long nextUniqueNumber = 0;
- private static Object nextUniqueNumberLock = new Object();
-
- /** set of all generated proxy classes, for isProxyClass implementation */
- private static Map<Class<?>, Void> proxyClasses =
- Collections.synchronizedMap(new WeakHashMap<Class<?>, Void>());
+ /**
+ * a cache of proxy classes
+ */
+ private static final WeakCache<ClassLoader, Class<?>[], Class<?>>
+ proxyClassCache = new WeakCache<>(new KeyFactory(), new ProxyClassFactory());
/**
* the invocation handler for this proxy instance.
@@ -423,131 +407,190 @@
throw new IllegalArgumentException("interface limit exceeded");
}
- Class<?> proxyClass = null;
+ // If the proxy class defined by the given loader implementing
+ // the given interfaces exists, this will simply return the cached copy;
+ // otherwise, it will create the proxy class via the ProxyClassFactory
+ return proxyClassCache.get(loader, interfaces);
+ }
+
+ /*
+ * a key used for proxy class with 0 implemented interfaces
+ */
+ private static final Object key0 = new Object();
+
+ /*
+ * Key1 and Key2 are optimized for the common use of dynamic proxies
+ * that implement 1 or 2 interfaces.
+ */
- /* collect interface names to use as key for proxy class cache */
- String[] interfaceNames = new String[interfaces.length];
+ /*
+ * a key used for proxy class with 1 implemented interface
+ */
+ private static final class Key1 extends WeakReference<Class<?>> {
+ private final int hash;
+
+ Key1(Class<?> intf) {
+ super(intf);
+ this.hash = intf.hashCode();
+ }
- // for detecting duplicates
- Set<Class<?>> interfaceSet = new HashSet<>();
+ @Override
+ public int hashCode() {
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ Class<?> intf;
+ return this == obj ||
+ obj != null &&
+ obj.getClass() == Key1.class &&
+ (intf = get()) != null &&
+ intf == ((Key1) obj).get();
+ }
+ }
- for (int i = 0; i < interfaces.length; i++) {
- /*
- * Verify that the class loader resolves the name of this
- * interface to the same Class object.
- */
- String interfaceName = interfaces[i].getName();
- Class<?> interfaceClass = null;
- try {
- interfaceClass = Class.forName(interfaceName, false, loader);
- } catch (ClassNotFoundException e) {
+ /*
+ * a key used for proxy class with 2 implemented interfaces
+ */
+ private static final class Key2 extends WeakReference<Class<?>> {
+ private final int hash;
+ private final WeakReference<Class<?>> ref2;
+
+ Key2(Class<?> intf1, Class<?> intf2) {
+ super(intf1);
+ hash = 31 * intf1.hashCode() + intf2.hashCode();
+ ref2 = new WeakReference<Class<?>>(intf2);
+ }
+
+ @Override
+ public int hashCode() {
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ Class<?> intf1, intf2;
+ return this == obj ||
+ obj != null &&
+ obj.getClass() == Key2.class &&
+ (intf1 = get()) != null &&
+ intf1 == ((Key2) obj).get() &&
+ (intf2 = ref2.get()) != null &&
+ intf2 == ((Key2) obj).ref2.get();
+ }
+ }
+
+ /*
+ * a key used for proxy class with any number of implemented interfaces
+ * (used here for 3 or more only)
+ */
+ private static final class KeyX {
+ private final int hash;
+ private final WeakReference<Class<?>>[] refs;
+
+ KeyX(Class<?>[] interfaces) {
+ hash = Arrays.hashCode(interfaces);
+ refs = new WeakReference[interfaces.length];
+ for (int i = 0; i < interfaces.length; i++) {
+ refs[i] = new WeakReference<>(interfaces[i]);
}
- if (interfaceClass != interfaces[i]) {
- throw new IllegalArgumentException(
- interfaces[i] + " is not visible from class loader");
- }
-
- /*
- * Verify that the Class object actually represents an
- * interface.
- */
- if (!interfaceClass.isInterface()) {
- throw new IllegalArgumentException(
- interfaceClass.getName() + " is not an interface");
- }
-
- /*
- * Verify that this interface is not a duplicate.
- */
- if (interfaceSet.contains(interfaceClass)) {
- throw new IllegalArgumentException(
- "repeated interface: " + interfaceClass.getName());
- }
- interfaceSet.add(interfaceClass);
-
- interfaceNames[i] = interfaceName;
}
- /*
- * Using string representations of the proxy interfaces as
- * keys in the proxy class cache (instead of their Class
- * objects) is sufficient because we require the proxy
- * interfaces to be resolvable by name through the supplied
- * class loader, and it has the advantage that using a string
- * representation of a class makes for an implicit weak
- * reference to the class.
- */
- List<String> key = Arrays.asList(interfaceNames);
+ @Override
+ public int hashCode() {
+ return hash;
+ }
- /*
- * Find or create the proxy class cache for the class loader.
- */
- Map<List<String>, Object> cache;
- synchronized (loaderToCache) {
- cache = loaderToCache.get(loader);
- if (cache == null) {
- cache = new HashMap<>();
- loaderToCache.put(loader, cache);
- }
- /*
- * This mapping will remain valid for the duration of this
- * method, without further synchronization, because the mapping
- * will only be removed if the class loader becomes unreachable.
- */
+ @Override
+ public boolean equals(Object obj) {
+ return this == obj ||
+ obj != null &&
+ obj.getClass() == KeyX.class &&
+ equals(refs, ((KeyX) obj).refs);
}
- /*
- * Look up the list of interfaces in the proxy class cache using
- * the key. This lookup will result in one of three possible
- * kinds of values:
- * null, if there is currently no proxy class for the list of
- * interfaces in the class loader,
- * the pendingGenerationMarker object, if a proxy class for the
- * list of interfaces is currently being generated,
- * or a weak reference to a Class object, if a proxy class for
- * the list of interfaces has already been generated.
- */
- synchronized (cache) {
- /*
- * Note that we need not worry about reaping the cache for
- * entries with cleared weak references because if a proxy class
- * has been garbage collected, its class loader will have been
- * garbage collected as well, so the entire cache will be reaped
- * from the loaderToCache map.
- */
- do {
- Object value = cache.get(key);
- if (value instanceof Reference) {
- proxyClass = (Class<?>) ((Reference) value).get();
+ private static boolean equals(WeakReference<Class<?>>[] refs1,
+ WeakReference<Class<?>>[] refs2) {
+ if (refs1.length != refs2.length) {
+ return false;
+ }
+ for (int i = 0; i < refs1.length; i++) {
+ Class<?> intf = refs1[i].get();
+ if (intf == null || intf != refs2[i].get()) {
+ return false;
}
- if (proxyClass != null) {
- // proxy class already generated: return it
- return proxyClass;
- } else if (value == pendingGenerationMarker) {
- // proxy class being generated: wait for it
- try {
- cache.wait();
- } catch (InterruptedException e) {
- /*
- * The class generation that we are waiting for should
- * take a small, bounded time, so we can safely ignore
- * thread interrupts here.
- */
- }
- continue;
- } else {
- /*
- * No proxy class for this list of interfaces has been
- * generated or is being generated, so we will go and
- * generate it now. Mark it as pending generation.
- */
- cache.put(key, pendingGenerationMarker);
- break;
+ }
+ return true;
+ }
+ }
+
+ /**
+ * A function that maps an array of interfaces to an optimal key where
+ * Class objects representing interfaces are weakly referenced.
+ */
+ private static final class KeyFactory
+ implements BiFunction<ClassLoader, Class<?>[], Object>
+ {
+ @Override
+ public Object apply(ClassLoader classLoader, Class<?>[] interfaces) {
+ switch (interfaces.length) {
+ case 1: return new Key1(interfaces[0]); // the most frequent
+ case 2: return new Key2(interfaces[0], interfaces[1]);
+ case 0: return key0;
+ default: return new KeyX(interfaces);
+ }
+ }
+ }
+
+ /**
+ * A factory function that generates, defines and returns the proxy class given
+ * the ClassLoader and array of interfaces.
+ */
+ private static final class ProxyClassFactory
+ implements BiFunction<ClassLoader, Class<?>[], Class<?>>
+ {
+ // prefix for all proxy class names
+ private static final String proxyClassNamePrefix = "$Proxy";
+
+ // next number to use for generation of unique proxy class names
+ private static final AtomicLong nextUniqueNumber = new AtomicLong();
+
+ @Override
+ public Class<?> apply(ClassLoader loader, Class<?>[] interfaces) {
+
+ Map<Class<?>, Boolean> interfaceSet = new IdentityHashMap<>(interfaces.length);
+ for (Class<?> intf : interfaces) {
+ /*
+ * Verify that the class loader resolves the name of this
+ * interface to the same Class object.
+ */
+ Class<?> interfaceClass = null;
+ try {
+ interfaceClass = Class.forName(intf.getName(), false, loader);
+ } catch (ClassNotFoundException e) {
}
- } while (true);
- }
+ if (interfaceClass != intf) {
+ throw new IllegalArgumentException(
+ intf + " is not visible from class loader");
+ }
+ /*
+ * Verify that the Class object actually represents an
+ * interface.
+ */
+ if (!interfaceClass.isInterface()) {
+ throw new IllegalArgumentException(
+ interfaceClass.getName() + " is not an interface");
+ }
+ /*
+ * Verify that this interface is not a duplicate.
+ */
+ if (interfaceSet.put(interfaceClass, Boolean.TRUE) != null) {
+ throw new IllegalArgumentException(
+ "repeated interface: " + interfaceClass.getName());
+ }
+ }
- try {
String proxyPkg = null; // package to define proxy class in
int accessFlags = Modifier.PUBLIC | Modifier.FINAL;
@@ -556,11 +599,11 @@
* proxy class will be defined in the same package. Verify that
* all non-public proxy interfaces are in the same package.
*/
- for (int i = 0; i < interfaces.length; i++) {
- int flags = interfaces[i].getModifiers();
+ for (Class<?> intf : interfaces) {
+ int flags = intf.getModifiers();
if (!Modifier.isPublic(flags)) {
accessFlags = Modifier.FINAL;
- String name = interfaces[i].getName();
+ String name = intf.getName();
int n = name.lastIndexOf('.');
String pkg = ((n == -1) ? "" : name.substring(0, n + 1));
if (proxyPkg == null) {
@@ -577,60 +620,31 @@
proxyPkg = ReflectUtil.PROXY_PACKAGE + ".";
}
- {
+ /*
+ * Choose a name for the proxy class to generate.
+ */
+ long num = nextUniqueNumber.getAndIncrement();
+ String proxyName = proxyPkg + proxyClassNamePrefix + num;
+
+ /*
+ * Generate the specified proxy class.
+ */
+ byte[] proxyClassFile = ProxyGenerator.generateProxyClass(
+ proxyName, interfaces, accessFlags);
+ try {
+ return defineClass0(loader, proxyName,
+ proxyClassFile, 0, proxyClassFile.length);
+ } catch (ClassFormatError e) {
/*
- * Choose a name for the proxy class to generate.
- */
- long num;
- synchronized (nextUniqueNumberLock) {
- num = nextUniqueNumber++;
- }
- String proxyName = proxyPkg + proxyClassNamePrefix + num;
- /*
- * Verify that the class loader hasn't already
- * defined a class with the chosen name.
- */
-
- /*
- * Generate the specified proxy class.
+ * A ClassFormatError here means that (barring bugs in the
+ * proxy class generation code) there was some other
+ * invalid aspect of the arguments supplied to the proxy
+ * class creation (such as virtual machine limitations
+ * exceeded).
*/
- byte[] proxyClassFile = ProxyGenerator.generateProxyClass(
- proxyName, interfaces, accessFlags);
- try {
- proxyClass = defineClass0(loader, proxyName,
- proxyClassFile, 0, proxyClassFile.length);
- } catch (ClassFormatError e) {
- /*
- * A ClassFormatError here means that (barring bugs in the
- * proxy class generation code) there was some other
- * invalid aspect of the arguments supplied to the proxy
- * class creation (such as virtual machine limitations
- * exceeded).
- */
- throw new IllegalArgumentException(e.toString());
- }
- }
- // add to set of all generated proxy classes, for isProxyClass
- proxyClasses.put(proxyClass, null);
-
- } finally {
- /*
- * We must clean up the "pending generation" state of the proxy
- * class cache entry somehow. If a proxy class was successfully
- * generated, store it in the cache (with a weak reference);
- * otherwise, remove the reserved entry. In all cases, notify
- * all waiters on reserved entries in this cache.
- */
- synchronized (cache) {
- if (proxyClass != null) {
- cache.put(key, new WeakReference<Class<?>>(proxyClass));
- } else {
- cache.remove(key);
- }
- cache.notifyAll();
+ throw new IllegalArgumentException(e.toString());
}
}
- return proxyClass;
}
/**
@@ -757,21 +771,6 @@
}
}
- private static Object newInstance(Constructor<?> cons, InvocationHandler h) {
- try {
- return cons.newInstance(new Object[] {h} );
- } catch (IllegalAccessException | InstantiationException e) {
- throw new InternalError(e.toString(), e);
- } catch (InvocationTargetException e) {
- Throwable t = e.getCause();
- if (t instanceof RuntimeException) {
- throw (RuntimeException) t;
- } else {
- throw new InternalError(t.toString(), t);
- }
- }
- }
-
/**
* Returns true if and only if the specified class was dynamically
* generated to be a proxy class using the {@code getProxyClass}
@@ -787,11 +786,7 @@
* @throws NullPointerException if {@code cl} is {@code null}
*/
public static boolean isProxyClass(Class<?> cl) {
- if (cl == null) {
- throw new NullPointerException();
- }
-
- return proxyClasses.containsKey(cl);
+ return Proxy.class.isAssignableFrom(cl) && proxyClassCache.containsValue(cl);
}
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/reflect/WeakCache.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,379 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.lang.reflect;
+
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.BiFunction;
+import java.util.function.Supplier;
+
+/**
+ * Cache mapping pairs of {@code (key, sub-key) -> value}. Keys and values are
+ * weakly but sub-keys are strongly referenced. Keys are passed directly to
+ * {@link #get} method which also takes a {@code parameter}. Sub-keys are
+ * calculated from keys and parameters using the {@code subKeyFactory} function
+ * passed to the constructor. Values are calculated from keys and parameters
+ * using the {@code valueFactory} function passed to the constructor.
+ * Keys can be {@code null} and are compared by identity while sub-keys returned by
+ * {@code subKeyFactory} or values returned by {@code valueFactory}
+ * can not be null. Sub-keys are compared using their {@link #equals} method.
+ * Entries are expunged from cache lazily on each invocation to {@link #get},
+ * {@link #containsValue} or {@link #size} methods when the WeakReferences to
+ * keys are cleared. Cleared WeakReferences to individual values don't cause
+ * expunging, but such entries are logically treated as non-existent and
+ * trigger re-evaluation of {@code valueFactory} on request for their
+ * key/subKey.
+ *
+ * @author Peter Levart
+ * @param <K> type of keys
+ * @param <P> type of parameters
+ * @param <V> type of values
+ */
+final class WeakCache<K, P, V> {
+
+ private final ReferenceQueue<K> refQueue
+ = new ReferenceQueue<>();
+ // the key type is Object for supporting null key
+ private final ConcurrentMap<Object, ConcurrentMap<Object, Supplier<V>>> map
+ = new ConcurrentHashMap<>();
+ private final ConcurrentMap<Supplier<V>, Boolean> reverseMap
+ = new ConcurrentHashMap<>();
+ private final BiFunction<K, P, ?> subKeyFactory;
+ private final BiFunction<K, P, V> valueFactory;
+
+ /**
+ * Construct an instance of {@code WeakCache}
+ *
+ * @param subKeyFactory a function mapping a pair of
+ * {@code (key, parameter) -> sub-key}
+ * @param valueFactory a function mapping a pair of
+ * {@code (key, parameter) -> value}
+ * @throws NullPointerException if {@code subKeyFactory} or
+ * {@code valueFactory} is null.
+ */
+ public WeakCache(BiFunction<K, P, ?> subKeyFactory,
+ BiFunction<K, P, V> valueFactory) {
+ this.subKeyFactory = Objects.requireNonNull(subKeyFactory);
+ this.valueFactory = Objects.requireNonNull(valueFactory);
+ }
+
+ /**
+ * Look-up the value through the cache. This always evaluates the
+ * {@code subKeyFactory} function and optionally evaluates
+ * {@code valueFactory} function if there is no entry in the cache for given
+ * pair of (key, subKey) or the entry has already been cleared.
+ *
+ * @param key possibly null key
+ * @param parameter parameter used together with key to create sub-key and
+ * value (should not be null)
+ * @return the cached value (never null)
+ * @throws NullPointerException if {@code parameter} passed in or
+ * {@code sub-key} calculated by
+ * {@code subKeyFactory} or {@code value}
+ * calculated by {@code valueFactory} is null.
+ */
+ public V get(K key, P parameter) {
+ Objects.requireNonNull(parameter);
+
+ expungeStaleEntries();
+
+ Object cacheKey = CacheKey.valueOf(key, refQueue);
+
+ // lazily install the 2nd level valuesMap for the particular cacheKey
+ ConcurrentMap<Object, Supplier<V>> valuesMap = map.get(cacheKey);
+ if (valuesMap == null) {
+ ConcurrentMap<Object, Supplier<V>> oldValuesMap
+ = map.putIfAbsent(cacheKey,
+ valuesMap = new ConcurrentHashMap<>());
+ if (oldValuesMap != null) {
+ valuesMap = oldValuesMap;
+ }
+ }
+
+ // create subKey and retrieve the possible Supplier<V> stored by that
+ // subKey from valuesMap
+ Object subKey = Objects.requireNonNull(subKeyFactory.apply(key, parameter));
+ Supplier<V> supplier = valuesMap.get(subKey);
+ Factory factory = null;
+
+ while (true) {
+ if (supplier != null) {
+ // supplier might be a Factory or a CacheValue<V> instance
+ V value = supplier.get();
+ if (value != null) {
+ return value;
+ }
+ }
+ // else no supplier in cache
+ // or a supplier that returned null (could be a cleared CacheValue
+ // or a Factory that wasn't successful in installing the CacheValue)
+
+ // lazily construct a Factory
+ if (factory == null) {
+ factory = new Factory(key, parameter, subKey, valuesMap);
+ }
+
+ if (supplier == null) {
+ supplier = valuesMap.putIfAbsent(subKey, factory);
+ if (supplier == null) {
+ // successfully installed Factory
+ supplier = factory;
+ }
+ // else retry with winning supplier
+ } else {
+ if (valuesMap.replace(subKey, supplier, factory)) {
+ // successfully replaced
+ // cleared CacheEntry / unsuccessful Factory
+ // with our Factory
+ supplier = factory;
+ } else {
+ // retry with current supplier
+ supplier = valuesMap.get(subKey);
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks whether the specified non-null value is already present in this
+ * {@code WeakCache}. The check is made using identity comparison regardless
+ * of whether value's class overrides {@link Object#equals} or not.
+ *
+ * @param value the non-null value to check
+ * @return true if given {@code value} is already cached
+ * @throws NullPointerException if value is null
+ */
+ public boolean containsValue(V value) {
+ Objects.requireNonNull(value);
+
+ expungeStaleEntries();
+ return reverseMap.containsKey(new LookupValue<>(value));
+ }
+
+ /**
+ * Returns the current number of cached entries that
+ * can decrease over time when keys/values are GC-ed.
+ */
+ public int size() {
+ expungeStaleEntries();
+ return reverseMap.size();
+ }
+
+ private void expungeStaleEntries() {
+ CacheKey<K> cacheKey;
+ while ((cacheKey = (CacheKey<K>)refQueue.poll()) != null) {
+ cacheKey.expungeFrom(map, reverseMap);
+ }
+ }
+
+ /**
+ * A factory {@link Supplier} that implements the lazy synchronized
+ * construction of the value and installment of it into the cache.
+ */
+ private final class Factory implements Supplier<V> {
+
+ private final K key;
+ private final P parameter;
+ private final Object subKey;
+ private final ConcurrentMap<Object, Supplier<V>> valuesMap;
+
+ Factory(K key, P parameter, Object subKey,
+ ConcurrentMap<Object, Supplier<V>> valuesMap) {
+ this.key = key;
+ this.parameter = parameter;
+ this.subKey = subKey;
+ this.valuesMap = valuesMap;
+ }
+
+ @Override
+ public synchronized V get() { // serialize access
+ // re-check
+ Supplier<V> supplier = valuesMap.get(subKey);
+ if (supplier != this) {
+ // something changed while we were waiting:
+ // might be that we were replaced by a CacheValue
+ // or were removed because of failure ->
+ // return null to signal WeakCache.get() to retry
+ // the loop
+ return null;
+ }
+ // else still us (supplier == this)
+
+ // create new value
+ V value = null;
+ try {
+ value = Objects.requireNonNull(valueFactory.apply(key, parameter));
+ } finally {
+ if (value == null) { // remove us on failure
+ valuesMap.remove(subKey, this);
+ }
+ }
+ // the only path to reach here is with non-null value
+ assert value != null;
+
+ // wrap value with CacheValue (WeakReference)
+ CacheValue<V> cacheValue = new CacheValue<>(value);
+
+ // try replacing us with CacheValue (this should always succeed)
+ if (valuesMap.replace(subKey, this, cacheValue)) {
+ // put also in reverseMap
+ reverseMap.put(cacheValue, Boolean.TRUE);
+ } else {
+ throw new AssertionError("Should not reach here");
+ }
+
+ // successfully replaced us with new CacheValue -> return the value
+ // wrapped by it
+ return value;
+ }
+ }
+
+ /**
+ * Common type of value suppliers that are holding a referent.
+ * The {@link #equals} and {@link #hashCode} of implementations is defined
+ * to compare the referent by identity.
+ */
+ private interface Value<V> extends Supplier<V> {}
+
+ /**
+ * An optimized {@link Value} used to look-up the value in
+ * {@link WeakCache#containsValue} method so that we are not
+ * constructing the whole {@link CacheValue} just to look-up the referent.
+ */
+ private static final class LookupValue<V> implements Value<V> {
+ private final V value;
+
+ LookupValue(V value) {
+ this.value = value;
+ }
+
+ @Override
+ public V get() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return System.identityHashCode(value); // compare by identity
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return obj == this ||
+ obj instanceof Value &&
+ this.value == ((Value<?>) obj).get(); // compare by identity
+ }
+ }
+
+ /**
+ * A {@link Value} that weakly references the referent.
+ */
+ private static final class CacheValue<V>
+ extends WeakReference<V> implements Value<V>
+ {
+ private final int hash;
+
+ CacheValue(V value) {
+ super(value);
+ this.hash = System.identityHashCode(value); // compare by identity
+ }
+
+ @Override
+ public int hashCode() {
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ V value;
+ return obj == this ||
+ obj instanceof Value &&
+ // cleared CacheValue is only equal to itself
+ (value = get()) != null &&
+ value == ((Value<?>) obj).get(); // compare by identity
+ }
+ }
+
+ /**
+ * CacheKey containing a weakly referenced {@code key}. It registers
+ * itself with the {@code refQueue} so that it can be used to expunge
+ * the entry when the {@link WeakReference} is cleared.
+ */
+ private static final class CacheKey<K> extends WeakReference<K> {
+
+ // a replacement for null keys
+ private static final Object NULL_KEY = new Object();
+
+ static <K> Object valueOf(K key, ReferenceQueue<K> refQueue) {
+ return key == null
+ // null key means we can't weakly reference it,
+ // so we use a NULL_KEY singleton as cache key
+ ? NULL_KEY
+ // non-null key requires wrapping with a WeakReference
+ : new CacheKey<>(key, refQueue);
+ }
+
+ private final int hash;
+
+ private CacheKey(K key, ReferenceQueue<K> refQueue) {
+ super(key, refQueue);
+ this.hash = System.identityHashCode(key); // compare by identity
+ }
+
+ @Override
+ public int hashCode() {
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ K key;
+ return obj == this ||
+ obj != null &&
+ obj.getClass() == this.getClass() &&
+ // cleared CacheKey is only equal to itself
+ (key = this.get()) != null &&
+ // compare key by identity
+ key == ((CacheKey<K>) obj).get();
+ }
+
+ void expungeFrom(ConcurrentMap<?, ? extends ConcurrentMap<?, ?>> map,
+ ConcurrentMap<?, Boolean> reverseMap) {
+ // removing just by key is always safe here because after a CacheKey
+ // is cleared and enqueue-ed it is only equal to itself
+ // (see equals method)...
+ ConcurrentMap<?, ?> valuesMap = map.remove(this);
+ // remove also from reverseMap if needed
+ if (valuesMap != null) {
+ for (Object cacheValue : valuesMap.values()) {
+ reverseMap.remove(cacheValue);
+ }
+ }
+ }
+ }
+}
--- a/jdk/src/share/classes/java/net/Inet6Address.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/net/Inet6Address.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -203,6 +203,12 @@
*/
private transient NetworkInterface scope_ifname; // null
+ /**
+ * set if the object is constructed with a scoped
+ * interface instead of a numeric scope id.
+ */
+ private boolean scope_ifname_set; // false;
+
private static final long serialVersionUID = 6880410070516793377L;
// Perform native initialization
@@ -332,7 +338,7 @@
}
}
- private void initif(String hostName, byte addr[],NetworkInterface nif)
+ private void initif(String hostName, byte addr[], NetworkInterface nif)
throws UnknownHostException
{
holder().hostName = hostName;
@@ -344,6 +350,7 @@
scope_ifname = nif;
scope_id = deriveNumericScope(nif);
scope_id_set = true;
+ scope_ifname_set = true; // for consistency
}
}
@@ -431,6 +438,7 @@
try {
scope_ifname = NetworkInterface.getByName(ifname);
if (scope_ifname != null) {
+ scope_ifname_set = true;
try {
scope_id = deriveNumericScope(scope_ifname);
} catch (UnknownHostException e) {
@@ -438,6 +446,12 @@
// the machine being used for deserialization has
// the same interface name but without IPv6 configured.
}
+ } else {
+ /* the interface does not exist on this system, so we clear
+ * the scope information completely */
+ scope_id_set = false;
+ scope_ifname_set = false;
+ scope_id = 0;
}
} catch (SocketException e) {}
@@ -784,8 +798,10 @@
private synchronized void writeObject(java.io.ObjectOutputStream s)
throws IOException
{
- if (scope_ifname != null)
+ if (scope_ifname != null) {
ifname = scope_ifname.getName();
+ scope_ifname_set = true;
+ }
s.defaultWriteObject();
}
}
--- a/jdk/src/share/classes/java/nio/file/FileTreeWalker.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/FileTreeWalker.java Wed May 01 11:34:06 2013 -0700
@@ -25,27 +25,147 @@
package java.nio.file;
-import java.nio.file.attribute.*;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.io.Closeable;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayDeque;
+import java.util.Iterator;
+import java.util.Set;
import sun.nio.fs.BasicFileAttributesHolder;
/**
- * Simple file tree walker that works in a similar manner to nftw(3C).
+ * Walks a file tree, generating a sequence of events corresponding to the files
+ * in the tree.
+ *
+ * <pre>{@code
+ * Path top = ...
+ * Set<FileVisitOption> options = ...
+ * int maxDepth = ...
+ *
+ * try (FileTreeWalker walker = new FileTreeWalker(options, maxDepth)) {
+ * FileTreeWalker.Event ev = walker.walk(top);
+ * do {
+ * process(ev);
+ * ev = walker.next();
+ * } while (ev != null);
+ * }
+ * }</pre>
*
* @see Files#walkFileTree
*/
-class FileTreeWalker {
+class FileTreeWalker implements Closeable {
private final boolean followLinks;
private final LinkOption[] linkOptions;
- private final FileVisitor<? super Path> visitor;
private final int maxDepth;
+ private final ArrayDeque<DirectoryNode> stack = new ArrayDeque<>();
+ private boolean closed;
+
+ /**
+ * The element on the walking stack corresponding to a directory node.
+ */
+ private static class DirectoryNode {
+ private final Path dir;
+ private final Object key;
+ private final DirectoryStream<Path> stream;
+ private final Iterator<Path> iterator;
+ private boolean skipped;
+
+ DirectoryNode(Path dir, Object key, DirectoryStream<Path> stream) {
+ this.dir = dir;
+ this.key = key;
+ this.stream = stream;
+ this.iterator = stream.iterator();
+ }
+
+ Path directory() {
+ return dir;
+ }
+
+ Object key() {
+ return key;
+ }
+
+ DirectoryStream<Path> stream() {
+ return stream;
+ }
+
+ Iterator<Path> iterator() {
+ return iterator;
+ }
+
+ void skip() {
+ skipped = true;
+ }
+
+ boolean skipped() {
+ return skipped;
+ }
+ }
- FileTreeWalker(Set<FileVisitOption> options,
- FileVisitor<? super Path> visitor,
- int maxDepth)
- {
+ /**
+ * The event types.
+ */
+ static enum EventType {
+ /**
+ * Start of a directory
+ */
+ START_DIRECTORY,
+ /**
+ * End of a directory
+ */
+ END_DIRECTORY,
+ /**
+ * An entry in a directory
+ */
+ ENTRY;
+ }
+
+ /**
+ * Events returned by the {@link #walk} and {@link #next} methods.
+ */
+ static class Event {
+ private final EventType type;
+ private final Path file;
+ private final BasicFileAttributes attrs;
+ private final IOException ioe;
+
+ private Event(EventType type, Path file, BasicFileAttributes attrs, IOException ioe) {
+ this.type = type;
+ this.file = file;
+ this.attrs = attrs;
+ this.ioe = ioe;
+ }
+
+ Event(EventType type, Path file, BasicFileAttributes attrs) {
+ this(type, file, attrs, null);
+ }
+
+ Event(EventType type, Path file, IOException ioe) {
+ this(type, file, null, ioe);
+ }
+
+ EventType type() {
+ return type;
+ }
+
+ Path file() {
+ return file;
+ }
+
+ BasicFileAttributes attributes() {
+ return attrs;
+ }
+
+ IOException ioeException() {
+ return ioe;
+ }
+ }
+
+ /**
+ * Creates a {@code FileTreeWalker}.
+ */
+ FileTreeWalker(Set<FileVisitOption> options, int maxDepth) {
boolean fl = false;
for (FileVisitOption option: options) {
// will throw NPE if options contains null
@@ -58,191 +178,236 @@
this.followLinks = fl;
this.linkOptions = (fl) ? new LinkOption[0] :
new LinkOption[] { LinkOption.NOFOLLOW_LINKS };
- this.visitor = visitor;
this.maxDepth = maxDepth;
}
/**
- * Walk file tree starting at the given file
+ * Returns the attributes of the given file, taking into account whether
+ * the walk is following sym links is not. The {@code canUseCached}
+ * argument determines whether this method can use cached attributes.
*/
- void walk(Path start) throws IOException {
- FileVisitResult result = walk(start,
- 0,
- new ArrayList<AncestorDirectory>());
- Objects.requireNonNull(result, "FileVisitor returned null");
- }
-
- /**
- * @param file
- * the directory to visit
- * @param depth
- * depth remaining
- * @param ancestors
- * use when cycle detection is enabled
- */
- private FileVisitResult walk(Path file,
- int depth,
- List<AncestorDirectory> ancestors)
+ private BasicFileAttributes getAttributes(Path file, boolean canUseCached)
throws IOException
{
// if attributes are cached then use them if possible
- BasicFileAttributes attrs = null;
- if ((depth > 0) &&
+ if (canUseCached &&
(file instanceof BasicFileAttributesHolder) &&
(System.getSecurityManager() == null))
{
BasicFileAttributes cached = ((BasicFileAttributesHolder)file).get();
- if (cached != null && (!followLinks || !cached.isSymbolicLink()))
- attrs = cached;
- }
- IOException exc = null;
-
- // attempt to get attributes of file. If fails and we are following
- // links then a link target might not exist so get attributes of link
- if (attrs == null) {
- try {
- try {
- attrs = Files.readAttributes(file, BasicFileAttributes.class, linkOptions);
- } catch (IOException x1) {
- if (followLinks) {
- try {
- attrs = Files.readAttributes(file,
- BasicFileAttributes.class,
- LinkOption.NOFOLLOW_LINKS);
- } catch (IOException x2) {
- exc = x2;
- }
- } else {
- exc = x1;
- }
- }
- } catch (SecurityException x) {
- // If access to starting file is denied then SecurityException
- // is thrown, otherwise the file is ignored.
- if (depth == 0)
- throw x;
- return FileVisitResult.CONTINUE;
+ if (cached != null && (!followLinks || !cached.isSymbolicLink())) {
+ return cached;
}
}
- // unable to get attributes of file
- if (exc != null) {
- return visitor.visitFileFailed(file, exc);
+ // attempt to get attributes of file. If fails and we are following
+ // links then a link target might not exist so get attributes of link
+ BasicFileAttributes attrs;
+ try {
+ attrs = Files.readAttributes(file, BasicFileAttributes.class, linkOptions);
+ } catch (IOException ioe) {
+ if (!followLinks)
+ throw ioe;
+
+ // attempt to get attrmptes without following links
+ attrs = Files.readAttributes(file,
+ BasicFileAttributes.class,
+ LinkOption.NOFOLLOW_LINKS);
+ }
+ return attrs;
+ }
+
+ /**
+ * Returns true if walking into the given directory would result in a
+ * file system loop/cycle.
+ */
+ private boolean wouldLoop(Path dir, Object key) {
+ // if this directory and ancestor has a file key then we compare
+ // them; otherwise we use less efficient isSameFile test.
+ for (DirectoryNode ancestor: stack) {
+ Object ancestorKey = ancestor.key();
+ if (key != null && ancestorKey != null) {
+ if (key.equals(ancestorKey)) {
+ // cycle detected
+ return true;
+ }
+ } else {
+ try {
+ if (Files.isSameFile(dir, ancestor.directory())) {
+ // cycle detected
+ return true;
+ }
+ } catch (IOException | SecurityException x) {
+ // ignore
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Visits the given file, returning the {@code Event} corresponding to that
+ * visit.
+ *
+ * The {@code ignoreSecurityException} parameter determines whether
+ * any SecurityException should be ignored or not. If a SecurityException
+ * is thrown, and is ignored, then this method returns {@code null} to
+ * mean that there is no event corresponding to a visit to the file.
+ *
+ * The {@code canUseCached} parameter determines whether cached attributes
+ * for the file can be used or not.
+ */
+ private Event visit(Path entry, boolean ignoreSecurityException, boolean canUseCached) {
+ // need the file attributes
+ BasicFileAttributes attrs;
+ try {
+ attrs = getAttributes(entry, canUseCached);
+ } catch (IOException ioe) {
+ return new Event(EventType.ENTRY, entry, ioe);
+ } catch (SecurityException se) {
+ if (ignoreSecurityException)
+ return null;
+ throw se;
}
// at maximum depth or file is not a directory
+ int depth = stack.size();
if (depth >= maxDepth || !attrs.isDirectory()) {
- return visitor.visitFile(file, attrs);
+ return new Event(EventType.ENTRY, entry, attrs);
}
// check for cycles when following links
- if (followLinks) {
- Object key = attrs.fileKey();
+ if (followLinks && wouldLoop(entry, attrs.fileKey())) {
+ return new Event(EventType.ENTRY, entry,
+ new FileSystemLoopException(entry.toString()));
+ }
+
+ // file is a directory, attempt to open it
+ DirectoryStream<Path> stream = null;
+ try {
+ stream = Files.newDirectoryStream(entry);
+ } catch (IOException ioe) {
+ return new Event(EventType.ENTRY, entry, ioe);
+ } catch (SecurityException se) {
+ if (ignoreSecurityException)
+ return null;
+ throw se;
+ }
+
+ // push a directory node to the stack and return an event
+ stack.push(new DirectoryNode(entry, attrs.fileKey(), stream));
+ return new Event(EventType.START_DIRECTORY, entry, attrs);
+ }
+
- // if this directory and ancestor has a file key then we compare
- // them; otherwise we use less efficient isSameFile test.
- for (AncestorDirectory ancestor: ancestors) {
- Object ancestorKey = ancestor.fileKey();
- if (key != null && ancestorKey != null) {
- if (key.equals(ancestorKey)) {
- // cycle detected
- return visitor.visitFileFailed(file,
- new FileSystemLoopException(file.toString()));
+ /**
+ * Start walking from the given file.
+ */
+ Event walk(Path file) {
+ if (closed)
+ throw new IllegalStateException("Closed");
+
+ Event ev = visit(file,
+ false, // ignoreSecurityException
+ false); // canUseCached
+ assert ev != null;
+ return ev;
+ }
+
+ /**
+ * Returns the next Event or {@code null} if there are no more events or
+ * the walker is closed.
+ */
+ Event next() {
+ DirectoryNode top = stack.peek();
+ if (top == null)
+ return null; // stack is empty, we are done
+
+ // continue iteration of the directory at the top of the stack
+ Event ev;
+ do {
+ Path entry = null;
+ IOException ioe = null;
+
+ // get next entry in the directory
+ if (!top.skipped()) {
+ Iterator<Path> iterator = top.iterator();
+ try {
+ if (iterator.hasNext()) {
+ entry = iterator.next();
}
- } else {
- boolean isSameFile = false;
- try {
- isSameFile = Files.isSameFile(file, ancestor.file());
- } catch (IOException x) {
- // ignore
- } catch (SecurityException x) {
- // ignore
- }
- if (isSameFile) {
- // cycle detected
- return visitor.visitFileFailed(file,
- new FileSystemLoopException(file.toString()));
- }
+ } catch (DirectoryIteratorException x) {
+ ioe = x.getCause();
}
}
- ancestors.add(new AncestorDirectory(file, key));
- }
-
- // visit directory
- try {
- DirectoryStream<Path> stream = null;
- FileVisitResult result;
-
- // open the directory
- try {
- stream = Files.newDirectoryStream(file);
- } catch (IOException x) {
- return visitor.visitFileFailed(file, x);
- } catch (SecurityException x) {
- // ignore, as per spec
- return FileVisitResult.CONTINUE;
+ // no next entry so close and pop directory, creating corresponding event
+ if (entry == null) {
+ try {
+ top.stream().close();
+ } catch (IOException e) {
+ if (ioe != null) {
+ ioe = e;
+ } else {
+ ioe.addSuppressed(e);
+ }
+ }
+ stack.pop();
+ return new Event(EventType.END_DIRECTORY, top.directory(), ioe);
}
- // the exception notified to the postVisitDirectory method
- IOException ioe = null;
+ // visit the entry
+ ev = visit(entry,
+ true, // ignoreSecurityException
+ true); // canUseCached
- // invoke preVisitDirectory and then visit each entry
- try {
- result = visitor.preVisitDirectory(file, attrs);
- if (result != FileVisitResult.CONTINUE) {
- return result;
- }
+ } while (ev == null);
- try {
- for (Path entry: stream) {
- result = walk(entry, depth+1, ancestors);
-
- // returning null will cause NPE to be thrown
- if (result == null || result == FileVisitResult.TERMINATE)
- return result;
+ return ev;
+ }
- // skip remaining siblings in this directory
- if (result == FileVisitResult.SKIP_SIBLINGS)
- break;
- }
- } catch (DirectoryIteratorException e) {
- // IOException will be notified to postVisitDirectory
- ioe = e.getCause();
- }
- } finally {
- try {
- stream.close();
- } catch (IOException e) {
- // IOException will be notified to postVisitDirectory
- if (ioe == null)
- ioe = e;
- }
- }
-
- // invoke postVisitDirectory last
- return visitor.postVisitDirectory(file, ioe);
-
- } finally {
- // remove key from trail if doing cycle detection
- if (followLinks) {
- ancestors.remove(ancestors.size()-1);
- }
+ /**
+ * Pops the directory node that is the current top of the stack so that
+ * there are no more events for the directory (including no END_DIRECTORY)
+ * event. This method is a no-op if the stack is empty or the walker is
+ * closed.
+ */
+ void pop() {
+ if (!stack.isEmpty()) {
+ DirectoryNode node = stack.pop();
+ try {
+ node.stream().close();
+ } catch (IOException ignore) { }
}
}
- private static class AncestorDirectory {
- private final Path dir;
- private final Object key;
- AncestorDirectory(Path dir, Object key) {
- this.dir = dir;
- this.key = key;
+ /**
+ * Skips the remaining entries in the directory at the top of the stack.
+ * This method is a no-op if the stack is empty or the walker is closed.
+ */
+ void skipRemainingSiblings() {
+ if (!stack.isEmpty()) {
+ stack.peek().skip();
}
- Path file() {
- return dir;
- }
- Object fileKey() {
- return key;
+ }
+
+ /**
+ * Returns {@code true} if the walker is open.
+ */
+ boolean isOpen() {
+ return !closed;
+ }
+
+ /**
+ * Closes/pops all directories on the stack.
+ */
+ @Override
+ public void close() {
+ if (!closed) {
+ while (!stack.isEmpty()) {
+ pop();
+ }
+ closed = true;
}
}
}
--- a/jdk/src/share/classes/java/nio/file/Files.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/Files.java Wed May 01 11:34:06 2013 -0700
@@ -2589,7 +2589,60 @@
{
if (maxDepth < 0)
throw new IllegalArgumentException("'maxDepth' is negative");
- new FileTreeWalker(options, visitor, maxDepth).walk(start);
+
+ /**
+ * Create a FileTreeWalker to walk the file tree, invoking the visitor
+ * for each event.
+ */
+ try (FileTreeWalker walker = new FileTreeWalker(options, maxDepth)) {
+ FileTreeWalker.Event ev = walker.walk(start);
+ do {
+ FileVisitResult result;
+ switch (ev.type()) {
+ case ENTRY :
+ IOException ioe = ev.ioeException();
+ if (ioe == null) {
+ assert ev.attributes() != null;
+ result = visitor.visitFile(ev.file(), ev.attributes());
+ } else {
+ result = visitor.visitFileFailed(ev.file(), ioe);
+ }
+ break;
+
+ case START_DIRECTORY :
+ result = visitor.preVisitDirectory(ev.file(), ev.attributes());
+
+ // if SKIP_SIBLINGS and SKIP_SUBTREE is returned then
+ // there shouldn't be any more events for the current
+ // directory.
+ if (result == FileVisitResult.SKIP_SUBTREE ||
+ result == FileVisitResult.SKIP_SIBLINGS)
+ walker.pop();
+ break;
+
+ case END_DIRECTORY :
+ result = visitor.postVisitDirectory(ev.file(), ev.ioeException());
+
+ // SKIP_SIBLINGS is a no-op for postVisitDirectory
+ if (result == FileVisitResult.SKIP_SIBLINGS)
+ result = FileVisitResult.CONTINUE;
+ break;
+
+ default :
+ throw new AssertionError("Should not get here");
+ }
+
+ if (Objects.requireNonNull(result) != FileVisitResult.CONTINUE) {
+ if (result == FileVisitResult.TERMINATE) {
+ break;
+ } else if (result == FileVisitResult.SKIP_SIBLINGS) {
+ walker.skipRemainingSiblings();
+ }
+ }
+ ev = walker.next();
+ } while (ev != null);
+ }
+
return start;
}
--- a/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java Wed May 01 11:34:06 2013 -0700
@@ -147,11 +147,11 @@
* this method has no effect.
*
* <p> <b>Usage Example:</b>
- * Suppose we want to change a file's creation time.
+ * Suppose we want to change a file's last access time.
* <pre>
* Path path = ...
* FileTime time = ...
- * Files.getFileAttributeView(path, BasicFileAttributeView.class).setTimes(null, null, time);
+ * Files.getFileAttributeView(path, BasicFileAttributeView.class).setTimes(null, time, null);
* </pre>
*
* @param lastModifiedTime
--- a/jdk/src/share/classes/java/nio/file/attribute/FileTime.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/attribute/FileTime.java Wed May 01 11:34:06 2013 -0700
@@ -219,8 +219,8 @@
*
* <p> {@code FileTime} can store points on the time-line further in the
* future and further in the past than {@code Instant}. Conversion
- * from such further time points saturates to {@link Instant.MIN} if
- * earlier than {@code Instant.MIN} or {@link Instant.MAX} if later
+ * from such further time points saturates to {@link Instant#MIN} if
+ * earlier than {@code Instant.MIN} or {@link Instant#MAX} if later
* than {@code Instant.MAX}.
*
* @return an instant representing the same point on the time-line as
--- a/jdk/src/share/classes/java/sql/Driver.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/sql/Driver.java Wed May 01 11:34:06 2013 -0700
@@ -44,13 +44,16 @@
*
* <P>When a Driver class is loaded, it should create an instance of
* itself and register it with the DriverManager. This means that a
- * user can load and register a driver by calling
- * <pre>
- * <code>Class.forName("foo.bah.Driver")</code>
- * </pre>
- *
+ * user can load and register a driver by calling:
+ * <p>
+ * {@code Class.forName("foo.bah.Driver")}
+ * <p>
+ * A JDBC driver may create a {@linkplain DriverAction} implementation in order
+ * to receive notifications when {@linkplain DriverManager#deregisterDriver} has
+ * been called.
* @see DriverManager
* @see Connection
+ * @see DriverAction
*/
public interface Driver {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/sql/DriverAction.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.sql;
+
+/**
+ * An interface that must be implemented when a {@linkplain Driver} wants to be
+ * notified by {@code DriverManager}.
+ *<P>
+ * A {@code DriverAction} implementation is not intended to be used
+ * directly by applications. A JDBC Driver may choose
+ * to create its {@code DriverAction} implementation in a private class
+ * to avoid it being called directly.
+ * <o>
+ * The JDBC driver's static initialization block must call
+ * {@linkplain DriverManager#registerDriver(java.sql.Driver, java.sql.DriverAction) } in order
+ * to inform {@code DriverManager} which {@code DriverAction} implementation to
+ * call when the JDBC driver is de-registered.
+ * @since 1.8
+ */
+public interface DriverAction {
+ /**
+ * Method called by
+ * {@linkplain DriverManager#deregisterDriver(Driver) }
+ * to notify the JDBC driver that it was de-registered.
+ * <p>
+ * The {@code deregister} method is intended only to be used by JDBC Drivers
+ * and not by applications. JDBC drivers are recommended to not implement
+ * {@code DriverAction} in a public class. If there are active
+ * connections to the database at the time that the {@code deregister}
+ * method is called, it is implementation specific as to whether the
+ * connections are closed or allowed to continue. Once this method is
+ * called, it is implementation specific as to whether the driver may
+ * limit the ability to create new connections to the database, invoke
+ * other {@code Driver} methods or throw a {@code SQLException}.
+ * Consult your JDBC driver's documentation for additional information
+ * on its behavior.
+ * @see DriverManager#registerDriver(java.sql.Driver, java.sql.DriverAction)
+ * @see DriverManager#deregisterDriver(Driver)
+ * @since 1.8
+ */
+ void deregister();
+
+}
--- a/jdk/src/share/classes/java/sql/DriverManager.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/sql/DriverManager.java Wed May 01 11:34:06 2013 -0700
@@ -110,6 +110,14 @@
final static SQLPermission SET_LOG_PERMISSION =
new SQLPermission("setLog");
+ /**
+ * The {@code SQLPermission} constant that allows the
+ * un-register a registered JDBC driver.
+ * @since 1.8
+ */
+ final static SQLPermission DEREGISTER_DRIVER_PERMISSION =
+ new SQLPermission("deregisterDriver");
+
//--------------------------JDBC 2.0-----------------------------
/**
@@ -309,21 +317,42 @@
/**
- * Registers the given driver with the <code>DriverManager</code>.
+ * Registers the given driver with the {@code DriverManager}.
* A newly-loaded driver class should call
- * the method <code>registerDriver</code> to make itself
- * known to the <code>DriverManager</code>.
+ * the method {@code registerDriver} to make itself
+ * known to the {@code DriverManager}. If the driver had previously been
+ * registered, no action is taken.
*
* @param driver the new JDBC Driver that is to be registered with the
- * <code>DriverManager</code>
+ * {@code DriverManager}
* @exception SQLException if a database access error occurs
*/
public static synchronized void registerDriver(java.sql.Driver driver)
throws SQLException {
+ registerDriver(driver, null);
+ }
+
+ /**
+ * Registers the given driver with the {@code DriverManager}.
+ * A newly-loaded driver class should call
+ * the method {@code registerDriver} to make itself
+ * known to the {@code DriverManager}. If the driver had previously been
+ * registered, no action is taken.
+ *
+ * @param driver the new JDBC Driver that is to be registered with the
+ * {@code DriverManager}
+ * @param da the {@code DriverAction} implementation to be used when
+ * {@code DriverManager#deregisterDriver} is called
+ * @exception SQLException if a database access error occurs
+ */
+ public static synchronized void registerDriver(java.sql.Driver driver,
+ DriverAction da)
+ throws SQLException {
+
/* Register the driver if it has not already been added to our list */
if(driver != null) {
- registeredDrivers.addIfAbsent(new DriverInfo(driver));
+ registeredDrivers.addIfAbsent(new DriverInfo(driver, da));
} else {
// This is for compatibility with the original DriverManager
throw new NullPointerException();
@@ -334,11 +363,29 @@
}
/**
- * Drops a driver from the <code>DriverManager</code>'s list.
- * Applets can only deregister drivers from their own classloaders.
+ * Removes the specified driver from the {@code DriverManager}'s list of
+ * registered drivers.
+ * <p>
+ * If a {@code null} value is specified for the driver to be removed, then no
+ * action is taken.
+ * <p>
+ * If a security manager exists and its {@code checkPermission} denies
+ * permission, then a {@code SecurityException} will be thrown.
+ * <p>
+ * If the specified driver is not found in the list of registered drivers,
+ * then no action is taken. If the driver was found, it will be removed
+ * from the list of registered drivers.
+ * <p>
+ * If a {@code DriverAction} instance was specified when the JDBC driver was
+ * registered, its deregister method will be called
+ * prior to the driver being removed from the list of registered drivers.
*
- * @param driver the JDBC Driver to drop
+ * @param driver the JDBC Driver to remove
* @exception SQLException if a database access error occurs
+ * @throws SecurityException if a security manager exists and its
+ * {@code checkPermission} method denies permission to deregister a driver.
+ *
+ * @see SecurityManager#checkPermission
*/
@CallerSensitive
public static synchronized void deregisterDriver(Driver driver)
@@ -347,11 +394,22 @@
return;
}
+ SecurityManager sec = System.getSecurityManager();
+ if (sec != null) {
+ sec.checkPermission(DEREGISTER_DRIVER_PERMISSION);
+ }
+
println("DriverManager.deregisterDriver: " + driver);
- DriverInfo aDriver = new DriverInfo(driver);
+ DriverInfo aDriver = new DriverInfo(driver, null);
if(registeredDrivers.contains(aDriver)) {
if (isDriverAllowed(driver, Reflection.getCallerClass())) {
+ DriverInfo di = registeredDrivers.get(registeredDrivers.indexOf(aDriver));
+ // If a DriverAction was specified, Call it to notify the
+ // driver that it has been deregistered
+ if(di.action() != null) {
+ di.action().deregister();
+ }
registeredDrivers.remove(aDriver);
} else {
// If the caller does not have permission to load the driver then
@@ -639,8 +697,10 @@
class DriverInfo {
final Driver driver;
- DriverInfo(Driver driver) {
+ DriverAction da;
+ DriverInfo(Driver driver, DriverAction action) {
this.driver = driver;
+ da = action;
}
@Override
@@ -658,4 +718,8 @@
public String toString() {
return ("driver[className=" + driver + "]");
}
+
+ DriverAction action() {
+ return da;
+ }
}
--- a/jdk/src/share/classes/java/sql/SQLPermission.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLPermission.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,8 +30,9 @@
/**
* The permission for which the <code>SecurityManager</code> will check
- * when code that is running in an applet, or an application with a
+ * when code that is running an application with a
* <code>SecurityManager</code> enabled, calls the
+ * {@code DriverManager.deregisterDriver} method,
* <code>DriverManager.setLogWriter</code> method,
* <code>DriverManager.setLogStream</code> (deprecated) method,
* {@code SyncFactory.setJNDIContext} method,
@@ -95,14 +96,16 @@
* <code>Connection</code> or
* objects created from the <code>Connection</code>
* will wait for the database to reply to any one request.</td>
+ * <tr>
+ * <td>deregisterDriver</td>
+ * <td>Allows the invocation of the {@code DriverManager}
+ * method {@code deregisterDriver}</td>
+ * <td>Permits an application to remove a JDBC driver from the list of
+ * registered Drivers and release its resources.</td>
+ * </tr>
* </tr>
* </table>
*<p>
- * The person running an applet decides what permissions to allow
- * and will run the <code>Policy Tool</code> to create an
- * <code>SQLPermission</code> in a policy file. A programmer does
- * not use a constructor directly to create an instance of <code>SQLPermission</code>
- * but rather uses a tool.
* @since 1.3
* @see java.security.BasicPermission
* @see java.security.Permission
--- a/jdk/src/share/classes/java/text/CalendarBuilder.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/text/CalendarBuilder.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -91,6 +91,15 @@
return field[index] > UNSET;
}
+ CalendarBuilder clear(int index) {
+ if (index == ISO_DAY_OF_WEEK) {
+ index = DAY_OF_WEEK;
+ }
+ field[index] = UNSET;
+ field[MAX_FIELD + index] = 0;
+ return this;
+ }
+
Calendar establish(Calendar cal) {
boolean weekDate = isSet(WEEK_YEAR)
&& field[WEEK_YEAR] > field[YEAR];
--- a/jdk/src/share/classes/java/text/SimpleDateFormat.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/text/SimpleDateFormat.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1719,7 +1719,7 @@
// determine the local time. (6645292)
int dstAmount = (nameIndex >= 3) ? tz.getDSTSavings() : 0;
if (!(useSameName || (nameIndex >= 3 && dstAmount == 0))) {
- calb.set(Calendar.DST_OFFSET, dstAmount);
+ calb.clear(Calendar.ZONE_OFFSET).set(Calendar.DST_OFFSET, dstAmount);
}
return (start + zoneNames[nameIndex].length());
}
--- a/jdk/src/share/classes/java/util/ArrayDeque.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/ArrayDeque.java Wed May 01 11:34:06 2013 -0700
@@ -33,7 +33,9 @@
*/
package java.util;
-import java.io.*;
+
+import java.io.Serializable;
+import java.util.function.Consumer;
/**
* Resizable-array implementation of the {@link Deque} interface. Array
@@ -44,16 +46,16 @@
* {@link Stack} when used as a stack, and faster than {@link LinkedList}
* when used as a queue.
*
- * <p>Most <tt>ArrayDeque</tt> operations run in amortized constant time.
+ * <p>Most {@code ArrayDeque} operations run in amortized constant time.
* Exceptions include {@link #remove(Object) remove}, {@link
* #removeFirstOccurrence removeFirstOccurrence}, {@link #removeLastOccurrence
* removeLastOccurrence}, {@link #contains contains}, {@link #iterator
* iterator.remove()}, and the bulk operations, all of which run in linear
* time.
*
- * <p>The iterators returned by this class's <tt>iterator</tt> method are
+ * <p>The iterators returned by this class's {@code iterator} method are
* <i>fail-fast</i>: If the deque is modified at any time after the iterator
- * is created, in any way except through the iterator's own <tt>remove</tt>
+ * is created, in any way except through the iterator's own {@code remove}
* method, the iterator will generally throw a {@link
* ConcurrentModificationException}. Thus, in the face of concurrent
* modification, the iterator fails quickly and cleanly, rather than risking
@@ -63,7 +65,7 @@
* <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
* as it is, generally speaking, impossible to make any hard guarantees in the
* presence of unsynchronized concurrent modification. Fail-fast iterators
- * throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
+ * throw {@code ConcurrentModificationException} on a best-effort basis.
* Therefore, it would be wrong to write a program that depended on this
* exception for its correctness: <i>the fail-fast behavior of iterators
* should be used only to detect bugs.</i>
@@ -93,20 +95,20 @@
* other. We also guarantee that all array cells not holding
* deque elements are always null.
*/
- private transient E[] elements;
+ transient Object[] elements; // non-private to simplify nested class access
/**
* The index of the element at the head of the deque (which is the
* element that would be removed by remove() or pop()); or an
* arbitrary number equal to tail if the deque is empty.
*/
- private transient int head;
+ transient int head;
/**
* The index at which the next element would be added to the tail
* of the deque (via addLast(E), add(E), or push(E)).
*/
- private transient int tail;
+ transient int tail;
/**
* The minimum capacity that we'll use for a newly created deque.
@@ -117,11 +119,10 @@
// ****** Array allocation and resizing utilities ******
/**
- * Allocate empty array to hold the given number of elements.
+ * Allocates empty array to hold the given number of elements.
*
* @param numElements the number of elements to hold
*/
- @SuppressWarnings("unchecked")
private void allocateElements(int numElements) {
int initialCapacity = MIN_INITIAL_CAPACITY;
// Find the best power of two to hold elements.
@@ -138,11 +139,11 @@
if (initialCapacity < 0) // Too many elements, must back off
initialCapacity >>>= 1;// Good luck allocating 2 ^ 30 elements
}
- elements = (E[]) new Object[initialCapacity];
+ elements = new Object[initialCapacity];
}
/**
- * Double the capacity of this deque. Call only when full, i.e.,
+ * Doubles the capacity of this deque. Call only when full, i.e.,
* when head and tail have wrapped around to become equal.
*/
private void doubleCapacity() {
@@ -153,8 +154,7 @@
int newCapacity = n << 1;
if (newCapacity < 0)
throw new IllegalStateException("Sorry, deque too big");
- @SuppressWarnings("unchecked")
- E[] a = (E[]) new Object[newCapacity];
+ Object[] a = new Object[newCapacity];
System.arraycopy(elements, p, a, 0, r);
System.arraycopy(elements, 0, a, r, p);
elements = a;
@@ -184,9 +184,8 @@
* Constructs an empty array deque with an initial capacity
* sufficient to hold 16 elements.
*/
- @SuppressWarnings("unchecked")
public ArrayDeque() {
- elements = (E[]) new Object[16];
+ elements = new Object[16];
}
/**
@@ -252,7 +251,7 @@
* Inserts the specified element at the front of this deque.
*
* @param e the element to add
- * @return <tt>true</tt> (as specified by {@link Deque#offerFirst})
+ * @return {@code true} (as specified by {@link Deque#offerFirst})
* @throws NullPointerException if the specified element is null
*/
public boolean offerFirst(E e) {
@@ -264,7 +263,7 @@
* Inserts the specified element at the end of this deque.
*
* @param e the element to add
- * @return <tt>true</tt> (as specified by {@link Deque#offerLast})
+ * @return {@code true} (as specified by {@link Deque#offerLast})
* @throws NullPointerException if the specified element is null
*/
public boolean offerLast(E e) {
@@ -294,7 +293,9 @@
public E pollFirst() {
int h = head;
- E result = elements[h]; // Element is null if deque empty
+ @SuppressWarnings("unchecked")
+ E result = (E) elements[h];
+ // Element is null if deque empty
if (result == null)
return null;
elements[h] = null; // Must null out slot
@@ -304,7 +305,8 @@
public E pollLast() {
int t = (tail - 1) & (elements.length - 1);
- E result = elements[t];
+ @SuppressWarnings("unchecked")
+ E result = (E) elements[t];
if (result == null)
return null;
elements[t] = null;
@@ -316,48 +318,53 @@
* @throws NoSuchElementException {@inheritDoc}
*/
public E getFirst() {
- E x = elements[head];
- if (x == null)
+ @SuppressWarnings("unchecked")
+ E result = (E) elements[head];
+ if (result == null)
throw new NoSuchElementException();
- return x;
+ return result;
}
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getLast() {
- E x = elements[(tail - 1) & (elements.length - 1)];
- if (x == null)
+ @SuppressWarnings("unchecked")
+ E result = (E) elements[(tail - 1) & (elements.length - 1)];
+ if (result == null)
throw new NoSuchElementException();
- return x;
+ return result;
}
+ @SuppressWarnings("unchecked")
public E peekFirst() {
- return elements[head]; // elements[head] is null if deque empty
+ // elements[head] is null if deque empty
+ return (E) elements[head];
}
+ @SuppressWarnings("unchecked")
public E peekLast() {
- return elements[(tail - 1) & (elements.length - 1)];
+ return (E) elements[(tail - 1) & (elements.length - 1)];
}
/**
* Removes the first occurrence of the specified element in this
* deque (when traversing the deque from head to tail).
* If the deque does not contain the element, it is unchanged.
- * More formally, removes the first element <tt>e</tt> such that
- * <tt>o.equals(e)</tt> (if such an element exists).
- * Returns <tt>true</tt> if this deque contained the specified element
+ * More formally, removes the first element {@code e} such that
+ * {@code o.equals(e)} (if such an element exists).
+ * Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
* @param o element to be removed from this deque, if present
- * @return <tt>true</tt> if the deque contained the specified element
+ * @return {@code true} if the deque contained the specified element
*/
public boolean removeFirstOccurrence(Object o) {
if (o == null)
return false;
int mask = elements.length - 1;
int i = head;
- E x;
+ Object x;
while ( (x = elements[i]) != null) {
if (o.equals(x)) {
delete(i);
@@ -372,20 +379,20 @@
* Removes the last occurrence of the specified element in this
* deque (when traversing the deque from head to tail).
* If the deque does not contain the element, it is unchanged.
- * More formally, removes the last element <tt>e</tt> such that
- * <tt>o.equals(e)</tt> (if such an element exists).
- * Returns <tt>true</tt> if this deque contained the specified element
+ * More formally, removes the last element {@code e} such that
+ * {@code o.equals(e)} (if such an element exists).
+ * Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
* @param o element to be removed from this deque, if present
- * @return <tt>true</tt> if the deque contained the specified element
+ * @return {@code true} if the deque contained the specified element
*/
public boolean removeLastOccurrence(Object o) {
if (o == null)
return false;
int mask = elements.length - 1;
int i = (tail - 1) & mask;
- E x;
+ Object x;
while ( (x = elements[i]) != null) {
if (o.equals(x)) {
delete(i);
@@ -404,7 +411,7 @@
* <p>This method is equivalent to {@link #addLast}.
*
* @param e the element to add
- * @return <tt>true</tt> (as specified by {@link Collection#add})
+ * @return {@code true} (as specified by {@link Collection#add})
* @throws NullPointerException if the specified element is null
*/
public boolean add(E e) {
@@ -418,7 +425,7 @@
* <p>This method is equivalent to {@link #offerLast}.
*
* @param e the element to add
- * @return <tt>true</tt> (as specified by {@link Queue#offer})
+ * @return {@code true} (as specified by {@link Queue#offer})
* @throws NullPointerException if the specified element is null
*/
public boolean offer(E e) {
@@ -443,12 +450,12 @@
/**
* Retrieves and removes the head of the queue represented by this deque
* (in other words, the first element of this deque), or returns
- * <tt>null</tt> if this deque is empty.
+ * {@code null} if this deque is empty.
*
* <p>This method is equivalent to {@link #pollFirst}.
*
* @return the head of the queue represented by this deque, or
- * <tt>null</tt> if this deque is empty
+ * {@code null} if this deque is empty
*/
public E poll() {
return pollFirst();
@@ -470,12 +477,12 @@
/**
* Retrieves, but does not remove, the head of the queue represented by
- * this deque, or returns <tt>null</tt> if this deque is empty.
+ * this deque, or returns {@code null} if this deque is empty.
*
* <p>This method is equivalent to {@link #peekFirst}.
*
* @return the head of the queue represented by this deque, or
- * <tt>null</tt> if this deque is empty
+ * {@code null} if this deque is empty
*/
public E peek() {
return peekFirst();
@@ -530,7 +537,7 @@
*/
private boolean delete(int i) {
checkInvariants();
- final E[] elements = this.elements;
+ final Object[] elements = this.elements;
final int mask = elements.length - 1;
final int h = head;
final int t = tail;
@@ -579,9 +586,9 @@
}
/**
- * Returns <tt>true</tt> if this deque contains no elements.
+ * Returns {@code true} if this deque contains no elements.
*
- * @return <tt>true</tt> if this deque contains no elements
+ * @return {@code true} if this deque contains no elements
*/
public boolean isEmpty() {
return head == tail;
@@ -628,7 +635,8 @@
public E next() {
if (cursor == fence)
throw new NoSuchElementException();
- E result = elements[cursor];
+ @SuppressWarnings("unchecked")
+ E result = (E) elements[cursor];
// This check doesn't catch all possible comodifications,
// but does catch the ones that corrupt traversal
if (tail != fence || result == null)
@@ -647,6 +655,20 @@
}
lastRet = -1;
}
+
+ public void forEachRemaining(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ Object[] a = elements;
+ int m = a.length - 1, f = fence, i = cursor;
+ cursor = f;
+ while (i != f) {
+ @SuppressWarnings("unchecked") E e = (E)a[i];
+ i = (i + 1) & m;
+ if (e == null)
+ throw new ConcurrentModificationException();
+ action.accept(e);
+ }
+ }
}
private class DescendingIterator implements Iterator<E> {
@@ -667,7 +689,8 @@
if (cursor == fence)
throw new NoSuchElementException();
cursor = (cursor - 1) & (elements.length - 1);
- E result = elements[cursor];
+ @SuppressWarnings("unchecked")
+ E result = (E) elements[cursor];
if (head != fence || result == null)
throw new ConcurrentModificationException();
lastRet = cursor;
@@ -686,19 +709,19 @@
}
/**
- * Returns <tt>true</tt> if this deque contains the specified element.
- * More formally, returns <tt>true</tt> if and only if this deque contains
- * at least one element <tt>e</tt> such that <tt>o.equals(e)</tt>.
+ * Returns {@code true} if this deque contains the specified element.
+ * More formally, returns {@code true} if and only if this deque contains
+ * at least one element {@code e} such that {@code o.equals(e)}.
*
* @param o object to be checked for containment in this deque
- * @return <tt>true</tt> if this deque contains the specified element
+ * @return {@code true} if this deque contains the specified element
*/
public boolean contains(Object o) {
if (o == null)
return false;
int mask = elements.length - 1;
int i = head;
- E x;
+ Object x;
while ( (x = elements[i]) != null) {
if (o.equals(x))
return true;
@@ -710,15 +733,15 @@
/**
* Removes a single instance of the specified element from this deque.
* If the deque does not contain the element, it is unchanged.
- * More formally, removes the first element <tt>e</tt> such that
- * <tt>o.equals(e)</tt> (if such an element exists).
- * Returns <tt>true</tt> if this deque contained the specified element
+ * More formally, removes the first element {@code e} such that
+ * {@code o.equals(e)} (if such an element exists).
+ * Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
- * <p>This method is equivalent to {@link #removeFirstOccurrence}.
+ * <p>This method is equivalent to {@link #removeFirstOccurrence(Object)}.
*
* @param o element to be removed from this deque, if present
- * @return <tt>true</tt> if this deque contained the specified element
+ * @return {@code true} if this deque contained the specified element
*/
public boolean remove(Object o) {
return removeFirstOccurrence(o);
@@ -770,22 +793,21 @@
* <p>If this deque fits in the specified array with room to spare
* (i.e., the array has more elements than this deque), the element in
* the array immediately following the end of the deque is set to
- * <tt>null</tt>.
+ * {@code null}.
*
* <p>Like the {@link #toArray()} method, this method acts as bridge between
* array-based and collection-based APIs. Further, this method allows
* precise control over the runtime type of the output array, and may,
* under certain circumstances, be used to save allocation costs.
*
- * <p>Suppose <tt>x</tt> is a deque known to contain only strings.
+ * <p>Suppose {@code x} is a deque known to contain only strings.
* The following code can be used to dump the deque into a newly
- * allocated array of <tt>String</tt>:
+ * allocated array of {@code String}:
*
- * <pre>
- * String[] y = x.toArray(new String[0]);</pre>
+ * <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
*
- * Note that <tt>toArray(new Object[0])</tt> is identical in function to
- * <tt>toArray()</tt>.
+ * Note that {@code toArray(new Object[0])} is identical in function to
+ * {@code toArray()}.
*
* @param a the array into which the elements of the deque are to
* be stored, if it is big enough; otherwise, a new array of the
@@ -818,28 +840,25 @@
public ArrayDeque<E> clone() {
try {
@SuppressWarnings("unchecked")
- ArrayDeque<E> result = (ArrayDeque<E>) super.clone();
+ ArrayDeque<E> result = (ArrayDeque<E>) super.clone();
result.elements = Arrays.copyOf(elements, elements.length);
return result;
-
} catch (CloneNotSupportedException e) {
throw new AssertionError();
}
}
- /**
- * Appease the serialization gods.
- */
private static final long serialVersionUID = 2340985798034038923L;
/**
- * Serialize this deque.
+ * Saves this deque to a stream (that is, serializes it).
*
- * @serialData The current size (<tt>int</tt>) of the deque,
+ * @serialData The current size ({@code int}) of the deque,
* followed by all of its elements (each an object reference) in
* first-to-last order.
*/
- private void writeObject(ObjectOutputStream s) throws IOException {
+ private void writeObject(java.io.ObjectOutputStream s)
+ throws java.io.IOException {
s.defaultWriteObject();
// Write out size
@@ -852,11 +871,10 @@
}
/**
- * Deserialize this deque.
+ * Reconstitutes this deque from a stream (that is, deserializes it).
*/
- @SuppressWarnings("unchecked")
- private void readObject(ObjectInputStream s)
- throws IOException, ClassNotFoundException {
+ private void readObject(java.io.ObjectInputStream s)
+ throws java.io.IOException, ClassNotFoundException {
s.defaultReadObject();
// Read in size and allocate array
@@ -867,6 +885,88 @@
// Read in all elements in the proper order.
for (int i = 0; i < size; i++)
- elements[i] = (E)s.readObject();
+ elements[i] = s.readObject();
+ }
+
+ public Spliterator<E> spliterator() {
+ return new DeqSpliterator<E>(this, -1, -1);
}
+
+ static final class DeqSpliterator<E> implements Spliterator<E> {
+ private final ArrayDeque<E> deq;
+ private int fence; // -1 until first use
+ private int index; // current index, modified on traverse/split
+
+ /** Creates new spliterator covering the given array and range */
+ DeqSpliterator(ArrayDeque<E> deq, int origin, int fence) {
+ this.deq = deq;
+ this.index = origin;
+ this.fence = fence;
+ }
+
+ private int getFence() { // force initialization
+ int t;
+ if ((t = fence) < 0) {
+ t = fence = deq.tail;
+ index = deq.head;
+ }
+ return t;
+ }
+
+ public DeqSpliterator<E> trySplit() {
+ int t = getFence(), h = index, n = deq.elements.length;
+ if (h != t && ((h + 1) & (n - 1)) != t) {
+ if (h > t)
+ t += n;
+ int m = ((h + t) >>> 1) & (n - 1);
+ return new DeqSpliterator<>(deq, h, index = m);
+ }
+ return null;
+ }
+
+ public void forEachRemaining(Consumer<? super E> consumer) {
+ if (consumer == null)
+ throw new NullPointerException();
+ Object[] a = deq.elements;
+ int m = a.length - 1, f = getFence(), i = index;
+ index = f;
+ while (i != f) {
+ @SuppressWarnings("unchecked") E e = (E)a[i];
+ i = (i + 1) & m;
+ if (e == null)
+ throw new ConcurrentModificationException();
+ consumer.accept(e);
+ }
+ }
+
+ public boolean tryAdvance(Consumer<? super E> consumer) {
+ if (consumer == null)
+ throw new NullPointerException();
+ Object[] a = deq.elements;
+ int m = a.length - 1, f = getFence(), i = index;
+ if (i != fence) {
+ @SuppressWarnings("unchecked") E e = (E)a[i];
+ index = (i + 1) & m;
+ if (e == null)
+ throw new ConcurrentModificationException();
+ consumer.accept(e);
+ return true;
+ }
+ return false;
+ }
+
+ public long estimateSize() {
+ int n = getFence() - index;
+ if (n < 0)
+ n += deq.elements.length;
+ return (long) n;
+ }
+
+ @Override
+ public int characteristics() {
+ return Spliterator.ORDERED | Spliterator.SIZED |
+ Spliterator.NONNULL | Spliterator.SUBSIZED;
+ }
+ }
+
}
--- a/jdk/src/share/classes/java/util/ArrayList.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/ArrayList.java Wed May 01 11:34:06 2013 -0700
@@ -25,6 +25,10 @@
package java.util;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
+
/**
* Resizable-array implementation of the <tt>List</tt> interface. Implements
* all optional list operations, and permits all elements, including
@@ -120,7 +124,7 @@
* empty ArrayList with elementData == EMPTY_ELEMENTDATA will be expanded to
* DEFAULT_CAPACITY when the first element is added.
*/
- private transient Object[] elementData;
+ transient Object[] elementData; // non-private to simplify nested class access
/**
* The size of the ArrayList (the number of elements it contains).
@@ -853,6 +857,27 @@
}
}
+ @Override
+ @SuppressWarnings("unchecked")
+ public void forEachRemaining(Consumer<? super E> consumer) {
+ Objects.requireNonNull(consumer);
+ final int size = ArrayList.this.size;
+ int i = cursor;
+ if (i >= size) {
+ return;
+ }
+ final Object[] elementData = ArrayList.this.elementData;
+ if (i >= elementData.length) {
+ throw new ConcurrentModificationException();
+ }
+ while (i != size && modCount == expectedModCount) {
+ consumer.accept((E) elementData[i++]);
+ }
+ // update once at end of iteration to reduce heap write traffic
+ lastRet = cursor = i;
+ checkForComodification();
+ }
+
final void checkForComodification() {
if (modCount != expectedModCount)
throw new ConcurrentModificationException();
@@ -1088,6 +1113,26 @@
return (E) elementData[offset + (lastRet = i)];
}
+ @SuppressWarnings("unchecked")
+ public void forEachRemaining(Consumer<? super E> consumer) {
+ Objects.requireNonNull(consumer);
+ final int size = SubList.this.size;
+ int i = cursor;
+ if (i >= size) {
+ return;
+ }
+ final Object[] elementData = ArrayList.this.elementData;
+ if (offset + i >= elementData.length) {
+ throw new ConcurrentModificationException();
+ }
+ while (i != size && modCount == expectedModCount) {
+ consumer.accept((E) elementData[offset + (i++)]);
+ }
+ // update once at end of iteration to reduce heap write traffic
+ lastRet = cursor = i;
+ checkForComodification();
+ }
+
public int nextIndex() {
return cursor;
}
@@ -1167,5 +1212,217 @@
if (ArrayList.this.modCount != this.modCount)
throw new ConcurrentModificationException();
}
+
+ public Spliterator<E> spliterator() {
+ checkForComodification();
+ return new ArrayListSpliterator<E>(ArrayList.this, offset,
+ offset + this.size, this.modCount);
+ }
+ }
+
+ @Override
+ public void forEach(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ final int expectedModCount = modCount;
+ @SuppressWarnings("unchecked")
+ final E[] elementData = (E[]) this.elementData;
+ final int size = this.size;
+ for (int i=0; modCount == expectedModCount && i < size; i++) {
+ action.accept(elementData[i]);
+ }
+ if (modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ public Spliterator<E> spliterator() {
+ return new ArrayListSpliterator<>(this, 0, -1, 0);
+ }
+
+ /** Index-based split-by-two, lazily initialized Spliterator */
+ static final class ArrayListSpliterator<E> implements Spliterator<E> {
+
+ /*
+ * If ArrayLists were immutable, or structurally immutable (no
+ * adds, removes, etc), we could implement their spliterators
+ * with Arrays.spliterator. Instead we detect as much
+ * interference during traversal as practical without
+ * sacrificing much performance. We rely primarily on
+ * modCounts. These are not guaranteed to detect concurrency
+ * violations, and are sometimes overly conservative about
+ * within-thread interference, but detect enough problems to
+ * be worthwhile in practice. To carry this out, we (1) lazily
+ * initialize fence and expectedModCount until the latest
+ * point that we need to commit to the state we are checking
+ * against; thus improving precision. (This doesn't apply to
+ * SubLists, that create spliterators with current non-lazy
+ * values). (2) We perform only a single
+ * ConcurrentModificationException check at the end of forEach
+ * (the most performance-sensitive method). When using forEach
+ * (as opposed to iterators), we can normally only detect
+ * interference after actions, not before. Further
+ * CME-triggering checks apply to all other possible
+ * violations of assumptions for example null or too-small
+ * elementData array given its size(), that could only have
+ * occurred due to interference. This allows the inner loop
+ * of forEach to run without any further checks, and
+ * simplifies lambda-resolution. While this does entail a
+ * number of checks, note that in the common case of
+ * list.stream().forEach(a), no checks or other computation
+ * occur anywhere other than inside forEach itself. The other
+ * less-often-used methods cannot take advantage of most of
+ * these streamlinings.
+ */
+
+ private final ArrayList<E> list;
+ private int index; // current index, modified on advance/split
+ private int fence; // -1 until used; then one past last index
+ private int expectedModCount; // initialized when fence set
+
+ /** Create new spliterator covering the given range */
+ ArrayListSpliterator(ArrayList<E> list, int origin, int fence,
+ int expectedModCount) {
+ this.list = list; // OK if null unless traversed
+ this.index = origin;
+ this.fence = fence;
+ this.expectedModCount = expectedModCount;
+ }
+
+ private int getFence() { // initialize fence to size on first use
+ int hi; // (a specialized variant appears in method forEach)
+ ArrayList<E> lst;
+ if ((hi = fence) < 0) {
+ if ((lst = list) == null)
+ hi = fence = 0;
+ else {
+ expectedModCount = lst.modCount;
+ hi = fence = lst.size;
+ }
+ }
+ return hi;
+ }
+
+ public ArrayListSpliterator<E> trySplit() {
+ int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+ return (lo >= mid) ? null : // divide range in half unless too small
+ new ArrayListSpliterator<E>(list, lo, index = mid,
+ expectedModCount);
+ }
+
+ public boolean tryAdvance(Consumer<? super E> action) {
+ if (action == null)
+ throw new NullPointerException();
+ int hi = getFence(), i = index;
+ if (i < hi) {
+ index = i + 1;
+ @SuppressWarnings("unchecked") E e = (E)list.elementData[i];
+ action.accept(e);
+ if (list.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ return false;
+ }
+
+ public void forEachRemaining(Consumer<? super E> action) {
+ int i, hi, mc; // hoist accesses and checks from loop
+ ArrayList<E> lst; Object[] a;
+ if (action == null)
+ throw new NullPointerException();
+ if ((lst = list) != null && (a = lst.elementData) != null) {
+ if ((hi = fence) < 0) {
+ mc = lst.modCount;
+ hi = lst.size;
+ }
+ else
+ mc = expectedModCount;
+ if ((i = index) >= 0 && (index = hi) <= a.length) {
+ for (; i < hi; ++i) {
+ @SuppressWarnings("unchecked") E e = (E) a[i];
+ action.accept(e);
+ }
+ if (lst.modCount == mc)
+ return;
+ }
+ }
+ throw new ConcurrentModificationException();
+ }
+
+ public long estimateSize() {
+ return (long) (getFence() - index);
+ }
+
+ public int characteristics() {
+ return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED;
+ }
+ }
+
+ @Override
+ public boolean removeIf(Predicate<? super E> filter) {
+ Objects.requireNonNull(filter);
+ // figure out which elements are to be removed
+ // any exception thrown from the filter predicate at this stage
+ // will leave the collection unmodified
+ int removeCount = 0;
+ final BitSet removeSet = new BitSet(size);
+ final int expectedModCount = modCount;
+ final int size = this.size;
+ for (int i=0; modCount == expectedModCount && i < size; i++) {
+ @SuppressWarnings("unchecked")
+ final E element = (E) elementData[i];
+ if (filter.test(element)) {
+ removeSet.set(i);
+ removeCount++;
+ }
+ }
+ if (modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+
+ // shift surviving elements left over the spaces left by removed elements
+ final boolean anyToRemove = removeCount > 0;
+ if (anyToRemove) {
+ final int newSize = size - removeCount;
+ for (int i=0, j=0; (i < size) && (j < newSize); i++, j++) {
+ i = removeSet.nextClearBit(i);
+ elementData[j] = elementData[i];
+ }
+ for (int k=newSize; k < size; k++) {
+ elementData[k] = null; // Let gc do its work
+ }
+ this.size = newSize;
+ if (modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ modCount++;
+ }
+
+ return anyToRemove;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void replaceAll(UnaryOperator<E> operator) {
+ Objects.requireNonNull(operator);
+ final int expectedModCount = modCount;
+ final int size = this.size;
+ for (int i=0; modCount == expectedModCount && i < size; i++) {
+ elementData[i] = operator.apply((E) elementData[i]);
+ }
+ if (modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ modCount++;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void sort(Comparator<? super E> c) {
+ final int expectedModCount = modCount;
+ Arrays.sort((E[]) elementData, 0, size, c);
+ if (modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ modCount++;
}
}
--- a/jdk/src/share/classes/java/util/Arrays.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/Arrays.java Wed May 01 11:34:06 2013 -0700
@@ -25,7 +25,21 @@
package java.util;
-import java.lang.reflect.*;
+import java.lang.reflect.Array;
+import java.util.concurrent.ForkJoinPool;
+import java.util.function.BinaryOperator;
+import java.util.function.DoubleBinaryOperator;
+import java.util.function.IntBinaryOperator;
+import java.util.function.IntFunction;
+import java.util.function.IntToDoubleFunction;
+import java.util.function.IntToLongFunction;
+import java.util.function.IntUnaryOperator;
+import java.util.function.LongBinaryOperator;
+import java.util.stream.DoubleStream;
+import java.util.stream.IntStream;
+import java.util.stream.LongStream;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
import static java.util.ArraysParallelSortHelpers.*;
/**
@@ -4306,17 +4320,171 @@
dejaVu.remove(a);
}
+
/**
- * Creates a {@link Spliterator} covering all of the specified array.
+ * Set all elements of the specified array, using the provided
+ * generator function to compute each element.
+ *
+ * <p>If the generator function throws an exception, it is relayed to
+ * the caller and the array is left in an indeterminate state.
+ *
+ * @param <T> type of elements of the array
+ * @param array array to be initialized
+ * @param generator a function accepting an index and producing the desired
+ * value for that position
+ * @throws NullPointerException if the generator is null
+ * @since 1.8
+ */
+ public static <T> void setAll(T[] array, IntFunction<? extends T> generator) {
+ Objects.requireNonNull(generator);
+ for (int i = 0; i < array.length; i++)
+ array[i] = generator.apply(i);
+ }
+
+ /**
+ * Set all elements of the specified array, in parallel, using the
+ * provided generator function to compute each element.
+ *
+ * <p>If the generator function throws an exception, an unchecked exception
+ * is thrown from {@code parallelSetAll} and the array is left in an
+ * indeterminate state.
+ *
+ * @param <T> type of elements of the array
+ * @param array array to be initialized
+ * @param generator a function accepting an index and producing the desired
+ * value for that position
+ * @throws NullPointerException if the generator is null
+ * @since 1.8
+ */
+ public static <T> void parallelSetAll(T[] array, IntFunction<? extends T> generator) {
+ Objects.requireNonNull(generator);
+ IntStream.range(0, array.length).parallel().forEach(i -> { array[i] = generator.apply(i); });
+ }
+
+ /**
+ * Set all elements of the specified array, using the provided
+ * generator function to compute each element.
+ *
+ * <p>If the generator function throws an exception, it is relayed to
+ * the caller and the array is left in an indeterminate state.
+ *
+ * @param array array to be initialized
+ * @param generator a function accepting an index and producing the desired
+ * value for that position
+ * @throws NullPointerException if the generator is null
+ * @since 1.8
+ */
+ public static void setAll(int[] array, IntUnaryOperator generator) {
+ Objects.requireNonNull(generator);
+ for (int i = 0; i < array.length; i++)
+ array[i] = generator.applyAsInt(i);
+ }
+
+ /**
+ * Set all elements of the specified array, in parallel, using the
+ * provided generator function to compute each element.
+ *
+ * <p>If the generator function throws an exception, an unchecked exception
+ * is thrown from {@code parallelSetAll} and the array is left in an
+ * indeterminate state.
+ *
+ * @param array array to be initialized
+ * @param generator a function accepting an index and producing the desired
+ * value for that position
+ * @throws NullPointerException if the generator is null
+ * @since 1.8
+ */
+ public static void parallelSetAll(int[] array, IntUnaryOperator generator) {
+ Objects.requireNonNull(generator);
+ IntStream.range(0, array.length).parallel().forEach(i -> { array[i] = generator.applyAsInt(i); });
+ }
+
+ /**
+ * Set all elements of the specified array, using the provided
+ * generator function to compute each element.
+ *
+ * <p>If the generator function throws an exception, it is relayed to
+ * the caller and the array is left in an indeterminate state.
+ *
+ * @param array array to be initialized
+ * @param generator a function accepting an index and producing the desired
+ * value for that position
+ * @throws NullPointerException if the generator is null
+ * @since 1.8
+ */
+ public static void setAll(long[] array, IntToLongFunction generator) {
+ Objects.requireNonNull(generator);
+ for (int i = 0; i < array.length; i++)
+ array[i] = generator.applyAsLong(i);
+ }
+
+ /**
+ * Set all elements of the specified array, in parallel, using the
+ * provided generator function to compute each element.
+ *
+ * <p>If the generator function throws an exception, an unchecked exception
+ * is thrown from {@code parallelSetAll} and the array is left in an
+ * indeterminate state.
+ *
+ * @param array array to be initialized
+ * @param generator a function accepting an index and producing the desired
+ * value for that position
+ * @throws NullPointerException if the generator is null
+ * @since 1.8
+ */
+ public static void parallelSetAll(long[] array, IntToLongFunction generator) {
+ Objects.requireNonNull(generator);
+ IntStream.range(0, array.length).parallel().forEach(i -> { array[i] = generator.applyAsLong(i); });
+ }
+
+ /**
+ * Set all elements of the specified array, using the provided
+ * generator function to compute each element.
+ *
+ * <p>If the generator function throws an exception, it is relayed to
+ * the caller and the array is left in an indeterminate state.
+ *
+ * @param array array to be initialized
+ * @param generator a function accepting an index and producing the desired
+ * value for that position
+ * @throws NullPointerException if the generator is null
+ * @since 1.8
+ */
+ public static void setAll(double[] array, IntToDoubleFunction generator) {
+ Objects.requireNonNull(generator);
+ for (int i = 0; i < array.length; i++)
+ array[i] = generator.applyAsDouble(i);
+ }
+
+ /**
+ * Set all elements of the specified array, in parallel, using the
+ * provided generator function to compute each element.
+ *
+ * <p>If the generator function throws an exception, an unchecked exception
+ * is thrown from {@code parallelSetAll} and the array is left in an
+ * indeterminate state.
+ *
+ * @param array array to be initialized
+ * @param generator a function accepting an index and producing the desired
+ * value for that position
+ * @throws NullPointerException if the generator is null
+ * @since 1.8
+ */
+ public static void parallelSetAll(double[] array, IntToDoubleFunction generator) {
+ Objects.requireNonNull(generator);
+ IntStream.range(0, array.length).parallel().forEach(i -> { array[i] = generator.applyAsDouble(i); });
+ }
+
+ /**
+ * Returns a {@link Spliterator} covering all of the specified array.
*
* <p>The spliterator reports {@link Spliterator#SIZED},
* {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
* {@link Spliterator#IMMUTABLE}.
*
- * @param <T> Type of elements
- * @param array The array, assumed to be unmodified during use
- * @return A spliterator from the array
- * @throws NullPointerException if the specified array is {@code null}
+ * @param <T> type of elements
+ * @param array the array, assumed to be unmodified during use
+ * @return a spliterator for the array elements
* @since 1.8
*/
public static <T> Spliterator<T> spliterator(T[] array) {
@@ -4325,39 +4493,38 @@
}
/**
- * Creates a {@link Spliterator} covering the specified range of the
+ * Returns a {@link Spliterator} covering the specified range of the
* specified array.
*
* <p>The spliterator reports {@link Spliterator#SIZED},
* {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
* {@link Spliterator#IMMUTABLE}.
*
- * @param <T> Type of elements
- * @param array The array, assumed to be unmodified during use
- * @param fromIndex The least index (inclusive) to cover
- * @param toIndex One past the greatest index to cover
- * @return A spliterator from the array
- * @throws NullPointerException if the specified array is {@code null}
- * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
- * {@code toIndex} is less than {@code fromIndex}, or
- * {@code toIndex} is greater than the array size
+ * @param <T> type of elements
+ * @param array the array, assumed to be unmodified during use
+ * @param startInclusive the first index to cover, inclusive
+ * @param endExclusive index immediately past the last index to cover
+ * @return a spliterator for the array elements
+ * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+ * negative, {@code endExclusive} is less than
+ * {@code startInclusive}, or {@code endExclusive} is greater than
+ * the array size
* @since 1.8
*/
- public static <T> Spliterator<T> spliterator(T[] array, int fromIndex, int toIndex) {
- return Spliterators.spliterator(array, fromIndex, toIndex,
+ public static <T> Spliterator<T> spliterator(T[] array, int startInclusive, int endExclusive) {
+ return Spliterators.spliterator(array, startInclusive, endExclusive,
Spliterator.ORDERED | Spliterator.IMMUTABLE);
}
/**
- * Creates a {@link Spliterator.OfInt} covering all of the specified array.
+ * Returns a {@link Spliterator.OfInt} covering all of the specified array.
*
* <p>The spliterator reports {@link Spliterator#SIZED},
* {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
* {@link Spliterator#IMMUTABLE}.
*
- * @param array The array, assumed to be unmodified during use
- * @return A spliterator from the array
- * @throws NullPointerException if the specified array is {@code null}
+ * @param array the array, assumed to be unmodified during use
+ * @return a spliterator for the array elements
* @since 1.8
*/
public static Spliterator.OfInt spliterator(int[] array) {
@@ -4366,38 +4533,37 @@
}
/**
- * Creates a {@link Spliterator.OfInt} covering the specified range of the
+ * Returns a {@link Spliterator.OfInt} covering the specified range of the
* specified array.
*
* <p>The spliterator reports {@link Spliterator#SIZED},
* {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
* {@link Spliterator#IMMUTABLE}.
*
- * @param array The array, assumed to be unmodified during use
- * @param fromIndex The least index (inclusive) to cover
- * @param toIndex One past the greatest index to cover
- * @return A spliterator from the array
- * @throws NullPointerException if the specified array is {@code null}
- * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
- * {@code toIndex} is less than {@code fromIndex}, or
- * {@code toIndex} is greater than the array size
+ * @param array the array, assumed to be unmodified during use
+ * @param startInclusive the first index to cover, inclusive
+ * @param endExclusive index immediately past the last index to cover
+ * @return a spliterator for the array elements
+ * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+ * negative, {@code endExclusive} is less than
+ * {@code startInclusive}, or {@code endExclusive} is greater than
+ * the array size
* @since 1.8
*/
- public static Spliterator.OfInt spliterator(int[] array, int fromIndex, int toIndex) {
- return Spliterators.spliterator(array, fromIndex, toIndex,
+ public static Spliterator.OfInt spliterator(int[] array, int startInclusive, int endExclusive) {
+ return Spliterators.spliterator(array, startInclusive, endExclusive,
Spliterator.ORDERED | Spliterator.IMMUTABLE);
}
/**
- * Creates a {@link Spliterator.OfLong} covering all of the specified array.
+ * Returns a {@link Spliterator.OfLong} covering all of the specified array.
*
* <p>The spliterator reports {@link Spliterator#SIZED},
* {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
* {@link Spliterator#IMMUTABLE}.
*
- * @param array The array, assumed to be unmodified during use
- * @return A spliterator from the array
- * @throws NullPointerException if the specified array is {@code null}
+ * @param array the array, assumed to be unmodified during use
+ * @return the spliterator for the array elements
* @since 1.8
*/
public static Spliterator.OfLong spliterator(long[] array) {
@@ -4406,39 +4572,38 @@
}
/**
- * Creates a {@link Spliterator.OfLong} covering the specified range of the
+ * Returns a {@link Spliterator.OfLong} covering the specified range of the
* specified array.
*
* <p>The spliterator reports {@link Spliterator#SIZED},
* {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
* {@link Spliterator#IMMUTABLE}.
*
- * @param array The array, assumed to be unmodified during use
- * @param fromIndex The least index (inclusive) to cover
- * @param toIndex One past the greatest index to cover
- * @return A spliterator from the array
- * @throws NullPointerException if the specified array is {@code null}
- * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
- * {@code toIndex} is less than {@code fromIndex}, or
- * {@code toIndex} is greater than the array size
+ * @param array the array, assumed to be unmodified during use
+ * @param startInclusive the first index to cover, inclusive
+ * @param endExclusive index immediately past the last index to cover
+ * @return a spliterator for the array elements
+ * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+ * negative, {@code endExclusive} is less than
+ * {@code startInclusive}, or {@code endExclusive} is greater than
+ * the array size
* @since 1.8
*/
- public static Spliterator.OfLong spliterator(long[] array, int fromIndex, int toIndex) {
- return Spliterators.spliterator(array, fromIndex, toIndex,
+ public static Spliterator.OfLong spliterator(long[] array, int startInclusive, int endExclusive) {
+ return Spliterators.spliterator(array, startInclusive, endExclusive,
Spliterator.ORDERED | Spliterator.IMMUTABLE);
}
/**
- * Creates a {@link Spliterator.OfDouble} covering all of the specified
+ * Returns a {@link Spliterator.OfDouble} covering all of the specified
* array.
*
* <p>The spliterator reports {@link Spliterator#SIZED},
* {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
* {@link Spliterator#IMMUTABLE}.
*
- * @param array The array, assumed to be unmodified during use
- * @return A spliterator from the array
- * @throws NullPointerException if the specified array is {@code null}
+ * @param array the array, assumed to be unmodified during use
+ * @return a spliterator for the array elements
* @since 1.8
*/
public static Spliterator.OfDouble spliterator(double[] array) {
@@ -4447,25 +4612,147 @@
}
/**
- * Creates a {@link Spliterator.OfDouble} covering the specified range of
+ * Returns a {@link Spliterator.OfDouble} covering the specified range of
* the specified array.
*
* <p>The spliterator reports {@link Spliterator#SIZED},
* {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
* {@link Spliterator#IMMUTABLE}.
*
+ * @param array the array, assumed to be unmodified during use
+ * @param startInclusive the first index to cover, inclusive
+ * @param endExclusive index immediately past the last index to cover
+ * @return a spliterator for the array elements
+ * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+ * negative, {@code endExclusive} is less than
+ * {@code startInclusive}, or {@code endExclusive} is greater than
+ * the array size
+ * @since 1.8
+ */
+ public static Spliterator.OfDouble spliterator(double[] array, int startInclusive, int endExclusive) {
+ return Spliterators.spliterator(array, startInclusive, endExclusive,
+ Spliterator.ORDERED | Spliterator.IMMUTABLE);
+ }
+
+ /**
+ * Returns a sequential {@link Stream} with the specified array as its
+ * source.
+ *
+ * @param <T> The type of the array elements
* @param array The array, assumed to be unmodified during use
- * @param fromIndex The least index (inclusive) to cover
- * @param toIndex One past the greatest index to cover
- * @return A spliterator from the array
- * @throws NullPointerException if the specified array is {@code null}
- * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
- * {@code toIndex} is less than {@code fromIndex}, or
- * {@code toIndex} is greater than the array size
+ * @return a {@code Stream} for the array
+ * @since 1.8
+ */
+ public static <T> Stream<T> stream(T[] array) {
+ return stream(array, 0, array.length);
+ }
+
+ /**
+ * Returns a sequential {@link Stream} with the specified range of the
+ * specified array as its source.
+ *
+ * @param <T> the type of the array elements
+ * @param array the array, assumed to be unmodified during use
+ * @param startInclusive the first index to cover, inclusive
+ * @param endExclusive index immediately past the last index to cover
+ * @return a {@code Stream} for the array range
+ * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+ * negative, {@code endExclusive} is less than
+ * {@code startInclusive}, or {@code endExclusive} is greater than
+ * the array size
+ * @since 1.8
+ */
+ public static <T> Stream<T> stream(T[] array, int startInclusive, int endExclusive) {
+ return StreamSupport.stream(spliterator(array, startInclusive, endExclusive));
+ }
+
+ /**
+ * Returns a sequential {@link IntStream} with the specified array as its
+ * source.
+ *
+ * @param array the array, assumed to be unmodified during use
+ * @return an {@code IntStream} for the array
* @since 1.8
*/
- public static Spliterator.OfDouble spliterator(double[] array, int fromIndex, int toIndex) {
- return Spliterators.spliterator(array, fromIndex, toIndex,
- Spliterator.ORDERED | Spliterator.IMMUTABLE);
+ public static IntStream stream(int[] array) {
+ return stream(array, 0, array.length);
+ }
+
+ /**
+ * Returns a sequential {@link IntStream} with the specified range of the
+ * specified array as its source.
+ *
+ * @param array the array, assumed to be unmodified during use
+ * @param startInclusive the first index to cover, inclusive
+ * @param endExclusive index immediately past the last index to cover
+ * @return an {@code IntStream} for the array range
+ * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+ * negative, {@code endExclusive} is less than
+ * {@code startInclusive}, or {@code endExclusive} is greater than
+ * the array size
+ * @since 1.8
+ */
+ public static IntStream stream(int[] array, int startInclusive, int endExclusive) {
+ return StreamSupport.intStream(spliterator(array, startInclusive, endExclusive));
+ }
+
+ /**
+ * Returns a sequential {@link LongStream} with the specified array as its
+ * source.
+ *
+ * @param array the array, assumed to be unmodified during use
+ * @return a {@code LongStream} for the array
+ * @since 1.8
+ */
+ public static LongStream stream(long[] array) {
+ return stream(array, 0, array.length);
+ }
+
+ /**
+ * Returns a sequential {@link LongStream} with the specified range of the
+ * specified array as its source.
+ *
+ * @param array the array, assumed to be unmodified during use
+ * @param startInclusive the first index to cover, inclusive
+ * @param endExclusive index immediately past the last index to cover
+ * @return a {@code LongStream} for the array range
+ * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+ * negative, {@code endExclusive} is less than
+ * {@code startInclusive}, or {@code endExclusive} is greater than
+ * the array size
+ * @since 1.8
+ */
+ public static LongStream stream(long[] array, int startInclusive, int endExclusive) {
+ return StreamSupport.longStream(spliterator(array, startInclusive, endExclusive));
+ }
+
+ /**
+ * Returns a sequential {@link DoubleStream} with the specified array as its
+ * source.
+ *
+ * @param array the array, assumed to be unmodified during use
+ * @return a {@code DoubleStream} for the array
+ * @since 1.8
+ */
+ public static DoubleStream stream(double[] array) {
+ return stream(array, 0, array.length);
+ }
+
+ /**
+ * Returns a sequential {@link DoubleStream} with the specified range of the
+ * specified array as its source.
+ *
+ * @param array the array, assumed to be unmodified during use
+ * @param startInclusive the first index to cover, inclusive
+ * @param endExclusive index immediately past the last index to cover
+ * @return a {@code DoubleStream} for the array range
+ * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+ * negative, {@code endExclusive} is less than
+ * {@code startInclusive}, or {@code endExclusive} is greater than
+ * the array size
+ * @since 1.8
+ */
+ public static DoubleStream stream(double[] array, int startInclusive, int endExclusive) {
+ return StreamSupport.doubleStream(spliterator(array, startInclusive, endExclusive));
}
}
--- a/jdk/src/share/classes/java/util/Base64.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/Base64.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -139,6 +139,9 @@
throw new IllegalArgumentException(
"Illegal base64 line separator character 0x" + Integer.toString(b, 16));
}
+ if (lineLength <= 0) {
+ return Encoder.RFC4648;
+ }
return new Encoder(false, lineSeparator, lineLength >> 2 << 2);
}
--- a/jdk/src/share/classes/java/util/Collection.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/Collection.java Wed May 01 11:34:06 2013 -0700
@@ -25,6 +25,10 @@
package java.util;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
/**
* The root interface in the <i>collection hierarchy</i>. A collection
* represents a group of objects, known as its <i>elements</i>. Some
@@ -373,6 +377,40 @@
boolean removeAll(Collection<?> c);
/**
+ * Removes all of the elements of this collection that satisfy the given
+ * predicate. Errors or runtime exceptions thrown by the predicate are
+ * relayed to the caller.
+ *
+ * @implSpec
+ * The default implementation traverses all elements of the collection using
+ * its {@link #iterator}. Each matching element is removed using
+ * {@link Iterator#remove()}. If the collection's iterator does not
+ * support removal then an {@code UnsupportedOperationException} will be
+ * thrown on the first matching element.
+ *
+ * @param filter a predicate which returns {@code true} for elements to be
+ * removed
+ * @return {@code true} if any elements were removed
+ * @throws NullPointerException if the specified filter is null
+ * @throws UnsupportedOperationException if the {@code remove}
+ * method is not supported by this collection's
+ * {@link #iterator}
+ * @since 1.8
+ */
+ default boolean removeIf(Predicate<? super E> filter) {
+ Objects.requireNonNull(filter);
+ boolean removed = false;
+ final Iterator<E> each = iterator();
+ while (each.hasNext()) {
+ if (filter.test(each.next())) {
+ each.remove();
+ removed = true;
+ }
+ }
+ return removed;
+ }
+
+ /**
* Retains only the elements in this collection that are contained in the
* specified collection (optional operation). In other words, removes from
* this collection all of its elements that are not contained in the
@@ -463,9 +501,28 @@
/**
* Creates a {@link Spliterator} over the elements in this collection.
*
- * <p>The {@code Spliterator} reports {@link Spliterator#SIZED}.
- * Implementations should document the reporting of additional
- * characteristic values.
+ * <p>The returned {@code Spliterator} must report the characteristic
+ * {@link Spliterator#SIZED}; implementations should document any additional
+ * characteristic values reported by the returned Spliterator.
+ *
+ * <p>The default implementation should be overridden by subclasses that
+ * can return a more efficient spliterator. In order to
+ * preserve expected laziness behavior for the {@link #stream()} and
+ * {@link #parallelStream()}} methods, spliterators should either have the
+ * characteristic of {@code IMMUTABLE} or {@code CONCURRENT}, or be
+ * <em><a href="Spliterator.html#binding">late-binding</a></em>.
+ * If none of these is practical, the overriding class should describe the
+ * spliterator's documented policy of binding and structural interference,
+ * and should override the {@link #stream()} and {@link #parallelStream()}
+ * methods to create streams using a {@code Supplier} of the spliterator,
+ * as in:
+ * <pre>{@code
+ * Stream<E> s = StreamSupport.stream(() -> spliterator(), spliteratorCharacteristics)
+ * }</pre>
+ * <p>These requirements ensure that streams produced by the
+ * {@link #stream()} and {@link #parallelStream()} methods will reflect the
+ * contents of the collection as of initiation of the terminal stream
+ * operation.
*
* @implSpec
* The default implementation creates a
@@ -474,7 +531,7 @@
* <em>fail-fast</em> properties of the collection's iterator.
*
* @implNote
- * The created {@code Spliterator} additionally reports
+ * The returned {@code Spliterator} additionally reports
* {@link Spliterator#SUBSIZED}.
*
* @return a {@code Spliterator} over the elements in this collection
@@ -483,4 +540,44 @@
default Spliterator<E> spliterator() {
return Spliterators.spliterator(this, 0);
}
+
+ /**
+ * Returns a sequential {@code Stream} with this collection as its source.
+ *
+ * <p>This method should be overridden when the {@link #spliterator()}
+ * method cannot return a spliterator that is {@code IMMUTABLE},
+ * {@code CONCURRENT}, or <em>late-binding</em>. (See {@link #spliterator()}
+ * for details.)
+ *
+ * @implSpec
+ * The default implementation creates a sequential {@code Stream} from the
+ * collection's {@code Spliterator}.
+ *
+ * @return a sequential {@code Stream} over the elements in this collection
+ * @since 1.8
+ */
+ default Stream<E> stream() {
+ return StreamSupport.stream(spliterator());
+ }
+
+ /**
+ * Returns a possibly parallel {@code Stream} with this collection as its
+ * source. It is allowable for this method to return a sequential stream.
+ *
+ * <p>This method should be overridden when the {@link #spliterator()}
+ * method cannot return a spliterator that is {@code IMMUTABLE},
+ * {@code CONCURRENT}, or <em>late-binding</em>. (See {@link #spliterator()}
+ * for details.)
+ *
+ * @implSpec
+ * The default implementation creates a parallel {@code Stream} from the
+ * collection's {@code Spliterator}.
+ *
+ * @return a possibly parallel {@code Stream} over the elements in this
+ * collection
+ * @since 1.8
+ */
+ default Stream<E> parallelStream() {
+ return StreamSupport.parallelStream(spliterator());
+ }
}
--- a/jdk/src/share/classes/java/util/Collections.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/Collections.java Wed May 01 11:34:06 2013 -0700
@@ -30,7 +30,10 @@
import java.lang.reflect.Array;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
+import java.util.function.Consumer;
import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
/**
* This class consists exclusively of static methods that operate on or return
@@ -1085,6 +1088,11 @@
public void remove() {
throw new UnsupportedOperationException();
}
+ @Override
+ public void forEachRemaining(Consumer<? super E> action) {
+ // Use backing collection version
+ i.forEachRemaining(action);
+ }
};
}
@@ -1110,6 +1118,21 @@
public void clear() {
throw new UnsupportedOperationException();
}
+
+ // Override default methods in Collection
+ @Override
+ public void forEach(Consumer<? super E> action) {
+ c.forEach(action);
+ }
+ @Override
+ public boolean removeIf(Predicate<? super E> filter) {
+ throw new UnsupportedOperationException();
+ }
+ @Override
+ public Spliterator<E> spliterator() {
+ return (Spliterator<E>)c.spliterator();
+ }
+
}
/**
@@ -1240,6 +1263,16 @@
public boolean addAll(int index, Collection<? extends E> c) {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public void replaceAll(UnaryOperator<E> operator) {
+ throw new UnsupportedOperationException();
+ }
+ @Override
+ public void sort(Comparator<? super E> c) {
+ throw new UnsupportedOperationException();
+ }
+
public ListIterator<E> listIterator() {return listIterator(0);}
public ListIterator<E> listIterator(final int index) {
@@ -1263,6 +1296,11 @@
public void add(E e) {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public void forEachRemaining(Consumer<? super E> action) {
+ i.forEachRemaining(action);
+ }
};
}
@@ -1642,7 +1680,8 @@
* through the returned collection.<p>
*
* It is imperative that the user manually synchronize on the returned
- * collection when iterating over it:
+ * collection when traversing it via {@link Iterator} or
+ * {@link Spliterator}:
* <pre>
* Collection c = Collections.synchronizedCollection(myCollection);
* ...
@@ -1739,6 +1778,19 @@
public String toString() {
synchronized (mutex) {return c.toString();}
}
+ // Override default methods in Collection
+ @Override
+ public void forEach(Consumer<? super E> consumer) {
+ synchronized (mutex) {c.forEach(consumer);}
+ }
+ @Override
+ public boolean removeIf(Predicate<? super E> filter) {
+ synchronized (mutex) {return c.removeIf(filter);}
+ }
+ @Override
+ public Spliterator<E> spliterator() {
+ return c.spliterator(); // Must be manually synched by user!
+ }
private void writeObject(ObjectOutputStream s) throws IOException {
synchronized (mutex) {s.defaultWriteObject();}
}
@@ -1996,6 +2048,15 @@
}
}
+ @Override
+ public void replaceAll(UnaryOperator<E> operator) {
+ synchronized (mutex) {list.replaceAll(operator);}
+ }
+ @Override
+ public void sort(Comparator<? super E> c) {
+ synchronized (mutex) {list.sort(c);}
+ }
+
/**
* SynchronizedRandomAccessList instances are serialized as
* SynchronizedList instances to allow them to be deserialized
@@ -2492,6 +2553,16 @@
// element as we added it)
return c.addAll(checkedCopyOf(coll));
}
+
+ // Override default methods in Collection
+ @Override
+ public void forEach(Consumer<? super E> action) {c.forEach(action);}
+ @Override
+ public boolean removeIf(Predicate<? super E> filter) {
+ return c.removeIf(filter);
+ }
+ @Override
+ public Spliterator<E> spliterator() {return c.spliterator();}
}
/**
@@ -2747,12 +2818,26 @@
typeCheck(e);
i.add(e);
}
+
+ @Override
+ public void forEachRemaining(Consumer<? super E> action) {
+ i.forEachRemaining(action);
+ }
};
}
public List<E> subList(int fromIndex, int toIndex) {
return new CheckedList<>(list.subList(fromIndex, toIndex), type);
}
+
+ @Override
+ public void replaceAll(UnaryOperator<E> operator) {
+ list.replaceAll(operator);
+ }
+ @Override
+ public void sort(Comparator<? super E> c) {
+ list.sort(c);
+ }
}
/**
@@ -3276,6 +3361,10 @@
public boolean hasNext() { return false; }
public E next() { throw new NoSuchElementException(); }
public void remove() { throw new IllegalStateException(); }
+ @Override
+ public void forEachRemaining(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ }
}
/**
@@ -3416,6 +3505,19 @@
return a;
}
+ // Override default methods in Collection
+ @Override
+ public void forEach(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ }
+ @Override
+ public boolean removeIf(Predicate<? super E> filter) {
+ Objects.requireNonNull(filter);
+ return false;
+ }
+ @Override
+ public Spliterator<E> spliterator() { return Spliterators.emptySpliterator(); }
+
// Preserves singleton property
private Object readResolve() {
return EMPTY_SET;
@@ -3523,6 +3625,21 @@
public E last() {
throw new NoSuchElementException();
}
+
+ // Override default methods in Collection
+ @Override
+ public void forEach(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ }
+
+ @Override
+ public boolean removeIf(Predicate<? super E> filter) {
+ Objects.requireNonNull(filter);
+ return false;
+ }
+
+ @Override
+ public Spliterator<E> spliterator() { return Spliterators.emptySpliterator(); }
}
/**
@@ -3592,6 +3709,29 @@
public int hashCode() { return 1; }
+ @Override
+ public boolean removeIf(Predicate<? super E> filter) {
+ Objects.requireNonNull(filter);
+ return false;
+ }
+ @Override
+ public void replaceAll(UnaryOperator<E> operator) {
+ Objects.requireNonNull(operator);
+ }
+ @Override
+ public void sort(Comparator<? super E> c) {
+ Objects.requireNonNull(c);
+ }
+
+ // Override default methods in Collection
+ @Override
+ public void forEach(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ }
+
+ @Override
+ public Spliterator<E> spliterator() { return Spliterators.emptySpliterator(); }
+
// Preserves singleton property
private Object readResolve() {
return EMPTY_LIST;
@@ -3747,6 +3887,60 @@
public void remove() {
throw new UnsupportedOperationException();
}
+ @Override
+ public void forEachRemaining(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ if (hasNext) {
+ action.accept(e);
+ hasNext = false;
+ }
+ }
+ };
+ }
+
+ /**
+ * Creates a {@code Spliterator} with only the specified element
+ *
+ * @param <T> Type of elements
+ * @return A singleton {@code Spliterator}
+ */
+ static <T> Spliterator<T> singletonSpliterator(final T element) {
+ return new Spliterator<T>() {
+ long est = 1;
+
+ @Override
+ public Spliterator<T> trySplit() {
+ return null;
+ }
+
+ @Override
+ public boolean tryAdvance(Consumer<? super T> consumer) {
+ Objects.requireNonNull(consumer);
+ if (est > 0) {
+ est--;
+ consumer.accept(element);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void forEachRemaining(Consumer<? super T> consumer) {
+ tryAdvance(consumer);
+ }
+
+ @Override
+ public long estimateSize() {
+ return est;
+ }
+
+ @Override
+ public int characteristics() {
+ int value = (element != null) ? Spliterator.NONNULL : 0;
+
+ return value | Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.IMMUTABLE |
+ Spliterator.DISTINCT | Spliterator.ORDERED;
+ }
};
}
@@ -3770,6 +3964,20 @@
public int size() {return 1;}
public boolean contains(Object o) {return eq(o, element);}
+
+ // Override default methods for Collection
+ @Override
+ public void forEach(Consumer<? super E> action) {
+ action.accept(element);
+ }
+ @Override
+ public Spliterator<E> spliterator() {
+ return singletonSpliterator(element);
+ }
+ @Override
+ public boolean removeIf(Predicate<? super E> filter) {
+ throw new UnsupportedOperationException();
+ }
}
/**
@@ -3810,6 +4018,27 @@
throw new IndexOutOfBoundsException("Index: "+index+", Size: 1");
return element;
}
+
+ // Override default methods for Collection
+ @Override
+ public void forEach(Consumer<? super E> action) {
+ action.accept(element);
+ }
+ @Override
+ public boolean removeIf(Predicate<? super E> filter) {
+ throw new UnsupportedOperationException();
+ }
+ @Override
+ public void replaceAll(UnaryOperator<E> operator) {
+ throw new UnsupportedOperationException();
+ }
+ @Override
+ public void sort(Comparator<? super E> c) {
+ }
+ @Override
+ public Spliterator<E> spliterator() {
+ return singletonSpliterator(element);
+ }
}
/**
@@ -4408,6 +4637,19 @@
public boolean retainAll(Collection<?> c) {return s.retainAll(c);}
// addAll is the only inherited implementation
+ // Override default methods in Collection
+ @Override
+ public void forEach(Consumer<? super E> action) {
+ s.forEach(action);
+ }
+ @Override
+ public boolean removeIf(Predicate<? super E> filter) {
+ return s.removeIf(filter);
+ }
+
+ @Override
+ public Spliterator<E> spliterator() {return s.spliterator();}
+
private static final long serialVersionUID = 2454657854757543876L;
private void readObject(java.io.ObjectInputStream stream)
@@ -4466,5 +4708,15 @@
public boolean removeAll(Collection<?> c) {return q.removeAll(c);}
public boolean retainAll(Collection<?> c) {return q.retainAll(c);}
// We use inherited addAll; forwarding addAll would be wrong
+
+ // Override default methods in Collection
+ @Override
+ public void forEach(Consumer<? super E> action) {q.forEach(action);}
+ @Override
+ public Spliterator<E> spliterator() {return q.spliterator();}
+ @Override
+ public boolean removeIf(Predicate<? super E> filter) {
+ return q.removeIf(filter);
+ }
}
}
--- a/jdk/src/share/classes/java/util/Currency.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/Currency.java Wed May 01 11:34:06 2013 -0700
@@ -47,9 +47,8 @@
/**
* Represents a currency. Currencies are identified by their ISO 4217 currency
- * codes. Visit the <a href="http://www.iso.org/iso/en/prods-services/popstds/currencycodes.html">
- * ISO web site</a> for more information, including a table of
- * currency codes.
+ * codes. Visit the <a href="http://www.iso.org/iso/home/standards/currency_codes.htm">
+ * ISO web site</a> for more information.
* <p>
* The class is designed so that there's never more than one
* <code>Currency</code> instance for any given currency. Therefore, there's
--- a/jdk/src/share/classes/java/util/HashMap.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/HashMap.java Wed May 01 11:34:06 2013 -0700
@@ -1230,6 +1230,14 @@
public void clear() {
HashMap.this.clear();
}
+
+ public Spliterator<K> spliterator() {
+ if (HashMap.this.getClass() == HashMap.class)
+ return new KeySpliterator<K,V>(HashMap.this, 0, -1, 0, 0);
+ else
+ return Spliterators.spliterator
+ (this, Spliterator.SIZED | Spliterator.DISTINCT);
+ }
}
/**
@@ -1263,6 +1271,14 @@
public void clear() {
HashMap.this.clear();
}
+
+ public Spliterator<V> spliterator() {
+ if (HashMap.this.getClass() == HashMap.class)
+ return new ValueSpliterator<K,V>(HashMap.this, 0, -1, 0, 0);
+ else
+ return Spliterators.spliterator
+ (this, Spliterator.SIZED);
+ }
}
/**
@@ -1310,6 +1326,14 @@
public void clear() {
HashMap.this.clear();
}
+
+ public Spliterator<Map.Entry<K,V>> spliterator() {
+ if (HashMap.this.getClass() == HashMap.class)
+ return new EntrySpliterator<K,V>(HashMap.this, 0, -1, 0, 0);
+ else
+ return Spliterators.spliterator
+ (this, Spliterator.SIZED | Spliterator.DISTINCT);
+ }
}
/**
@@ -1406,4 +1430,257 @@
// These methods are used when serializing HashSets
int capacity() { return table.length; }
float loadFactor() { return loadFactor; }
+
+ /**
+ * Standin until HM overhaul; based loosely on Weak and Identity HM.
+ */
+ static class HashMapSpliterator<K,V> {
+ final HashMap<K,V> map;
+ HashMap.Entry<K,V> current; // current node
+ int index; // current index, modified on advance/split
+ int fence; // one past last index
+ int est; // size estimate
+ int expectedModCount; // for comodification checks
+
+ HashMapSpliterator(HashMap<K,V> m, int origin,
+ int fence, int est,
+ int expectedModCount) {
+ this.map = m;
+ this.index = origin;
+ this.fence = fence;
+ this.est = est;
+ this.expectedModCount = expectedModCount;
+ }
+
+ final int getFence() { // initialize fence and size on first use
+ int hi;
+ if ((hi = fence) < 0) {
+ HashMap<K,V> m = map;
+ est = m.size;
+ expectedModCount = m.modCount;
+ hi = fence = m.table.length;
+ }
+ return hi;
+ }
+
+ public final long estimateSize() {
+ getFence(); // force init
+ return (long) est;
+ }
+ }
+
+ static final class KeySpliterator<K,V>
+ extends HashMapSpliterator<K,V>
+ implements Spliterator<K> {
+ KeySpliterator(HashMap<K,V> m, int origin, int fence, int est,
+ int expectedModCount) {
+ super(m, origin, fence, est, expectedModCount);
+ }
+
+ public KeySpliterator<K,V> trySplit() {
+ int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+ return (lo >= mid || current != null) ? null :
+ new KeySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+ expectedModCount);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void forEachRemaining(Consumer<? super K> action) {
+ int i, hi, mc;
+ if (action == null)
+ throw new NullPointerException();
+ HashMap<K,V> m = map;
+ HashMap.Entry<K,V>[] tab = (HashMap.Entry<K,V>[])m.table;
+ if ((hi = fence) < 0) {
+ mc = expectedModCount = m.modCount;
+ hi = fence = tab.length;
+ }
+ else
+ mc = expectedModCount;
+ if (tab.length >= hi && (i = index) >= 0 && i < (index = hi)) {
+ HashMap.Entry<K,V> p = current;
+ do {
+ if (p == null)
+ p = tab[i++];
+ else {
+ action.accept(p.getKey());
+ p = p.next;
+ }
+ } while (p != null || i < hi);
+ if (m.modCount != mc)
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean tryAdvance(Consumer<? super K> action) {
+ int hi;
+ if (action == null)
+ throw new NullPointerException();
+ HashMap.Entry<K,V>[] tab = (HashMap.Entry<K,V>[])map.table;
+ if (tab.length >= (hi = getFence()) && index >= 0) {
+ while (current != null || index < hi) {
+ if (current == null)
+ current = tab[index++];
+ else {
+ K k = current.getKey();
+ current = current.next;
+ action.accept(k);
+ if (map.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public int characteristics() {
+ return (fence < 0 || est == map.size ? Spliterator.SIZED : 0) |
+ Spliterator.DISTINCT;
+ }
+ }
+
+ static final class ValueSpliterator<K,V>
+ extends HashMapSpliterator<K,V>
+ implements Spliterator<V> {
+ ValueSpliterator(HashMap<K,V> m, int origin, int fence, int est,
+ int expectedModCount) {
+ super(m, origin, fence, est, expectedModCount);
+ }
+
+ public ValueSpliterator<K,V> trySplit() {
+ int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+ return (lo >= mid || current != null) ? null :
+ new ValueSpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+ expectedModCount);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void forEachRemaining(Consumer<? super V> action) {
+ int i, hi, mc;
+ if (action == null)
+ throw new NullPointerException();
+ HashMap<K,V> m = map;
+ HashMap.Entry<K,V>[] tab = (HashMap.Entry<K,V>[])m.table;
+ if ((hi = fence) < 0) {
+ mc = expectedModCount = m.modCount;
+ hi = fence = tab.length;
+ }
+ else
+ mc = expectedModCount;
+ if (tab.length >= hi && (i = index) >= 0 && i < (index = hi)) {
+ HashMap.Entry<K,V> p = current;
+ do {
+ if (p == null)
+ p = tab[i++];
+ else {
+ action.accept(p.getValue());
+ p = p.next;
+ }
+ } while (p != null || i < hi);
+ if (m.modCount != mc)
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean tryAdvance(Consumer<? super V> action) {
+ int hi;
+ if (action == null)
+ throw new NullPointerException();
+ HashMap.Entry<K,V>[] tab = (HashMap.Entry<K,V>[])map.table;
+ if (tab.length >= (hi = getFence()) && index >= 0) {
+ while (current != null || index < hi) {
+ if (current == null)
+ current = tab[index++];
+ else {
+ V v = current.getValue();
+ current = current.next;
+ action.accept(v);
+ if (map.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public int characteristics() {
+ return (fence < 0 || est == map.size ? Spliterator.SIZED : 0);
+ }
+ }
+
+ static final class EntrySpliterator<K,V>
+ extends HashMapSpliterator<K,V>
+ implements Spliterator<Map.Entry<K,V>> {
+ EntrySpliterator(HashMap<K,V> m, int origin, int fence, int est,
+ int expectedModCount) {
+ super(m, origin, fence, est, expectedModCount);
+ }
+
+ public EntrySpliterator<K,V> trySplit() {
+ int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+ return (lo >= mid || current != null) ? null :
+ new EntrySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+ expectedModCount);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void forEachRemaining(Consumer<? super Map.Entry<K,V>> action) {
+ int i, hi, mc;
+ if (action == null)
+ throw new NullPointerException();
+ HashMap<K,V> m = map;
+ HashMap.Entry<K,V>[] tab = (HashMap.Entry<K,V>[])m.table;
+ if ((hi = fence) < 0) {
+ mc = expectedModCount = m.modCount;
+ hi = fence = tab.length;
+ }
+ else
+ mc = expectedModCount;
+ if (tab.length >= hi && (i = index) >= 0 && i < (index = hi)) {
+ HashMap.Entry<K,V> p = current;
+ do {
+ if (p == null)
+ p = tab[i++];
+ else {
+ action.accept(p);
+ p = p.next;
+ }
+ } while (p != null || i < hi);
+ if (m.modCount != mc)
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean tryAdvance(Consumer<? super Map.Entry<K,V>> action) {
+ int hi;
+ if (action == null)
+ throw new NullPointerException();
+ HashMap.Entry<K,V>[] tab = (HashMap.Entry<K,V>[])map.table;
+ if (tab.length >= (hi = getFence()) && index >= 0) {
+ while (current != null || index < hi) {
+ if (current == null)
+ current = tab[index++];
+ else {
+ HashMap.Entry<K,V> e = current;
+ current = current.next;
+ action.accept(e);
+ if (map.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public int characteristics() {
+ return (fence < 0 || est == map.size ? Spliterator.SIZED : 0) |
+ Spliterator.DISTINCT;
+ }
+ }
}
--- a/jdk/src/share/classes/java/util/HashSet.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/HashSet.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -311,4 +311,8 @@
map.put(e, PRESENT);
}
}
+
+ public Spliterator<E> spliterator() {
+ return new HashMap.KeySpliterator<E,Object>(map, 0, -1, 0, 0);
+ }
}
--- a/jdk/src/share/classes/java/util/IdentityHashMap.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/IdentityHashMap.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,10 @@
*/
package java.util;
+
import java.io.*;
import java.lang.reflect.Array;
+import java.util.function.Consumer;
/**
* This class implements the <tt>Map</tt> interface with a hash table, using
@@ -162,19 +164,19 @@
/**
* The table, resized as necessary. Length MUST always be a power of two.
*/
- private transient Object[] table;
+ transient Object[] table; // non-private to simplify nested class access
/**
* The number of key-value mappings contained in this identity hash map.
*
* @serial
*/
- private int size;
+ int size;
/**
* The number of modifications, to support fast-fail iterators
*/
- private transient int modCount;
+ transient int modCount;
/**
* The next size value at which to resize (capacity * load factor).
@@ -184,7 +186,7 @@
/**
* Value representing null keys inside tables.
*/
- private static final Object NULL_KEY = new Object();
+ static final Object NULL_KEY = new Object();
/**
* Use NULL_KEY for key if it is null.
@@ -196,7 +198,7 @@
/**
* Returns internal representation of null key back to caller as null.
*/
- private static Object unmaskNull(Object key) {
+ static final Object unmaskNull(Object key) {
return (key == NULL_KEY ? null : key);
}
@@ -1012,7 +1014,7 @@
return result;
}
public Object[] toArray() {
- return toArray(new Object[size()]);
+ return toArray(new Object[0]);
}
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
@@ -1042,6 +1044,10 @@
}
return a;
}
+
+ public Spliterator<K> spliterator() {
+ return new KeySpliterator<>(IdentityHashMap.this, 0, -1, 0, 0);
+ }
}
/**
@@ -1095,7 +1101,7 @@
IdentityHashMap.this.clear();
}
public Object[] toArray() {
- return toArray(new Object[size()]);
+ return toArray(new Object[0]);
}
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
@@ -1124,6 +1130,10 @@
}
return a;
}
+
+ public Spliterator<V> spliterator() {
+ return new ValueSpliterator<>(IdentityHashMap.this, 0, -1, 0, 0);
+ }
}
/**
@@ -1211,7 +1221,7 @@
}
public Object[] toArray() {
- return toArray(new Object[size()]);
+ return toArray(new Object[0]);
}
@SuppressWarnings("unchecked")
@@ -1242,6 +1252,10 @@
}
return a;
}
+
+ public Spliterator<Map.Entry<K,V>> spliterator() {
+ return new EntrySpliterator<>(IdentityHashMap.this, 0, -1, 0, 0);
+ }
}
@@ -1322,4 +1336,223 @@
tab[i] = k;
tab[i + 1] = value;
}
+
+ /**
+ * Similar form as array-based Spliterators, but skips blank elements,
+ * and guestimates size as decreasing by half per split.
+ */
+ static class IdentityHashMapSpliterator<K,V> {
+ final IdentityHashMap<K,V> map;
+ int index; // current index, modified on advance/split
+ int fence; // -1 until first use; then one past last index
+ int est; // size estimate
+ int expectedModCount; // initialized when fence set
+
+ IdentityHashMapSpliterator(IdentityHashMap<K,V> map, int origin,
+ int fence, int est, int expectedModCount) {
+ this.map = map;
+ this.index = origin;
+ this.fence = fence;
+ this.est = est;
+ this.expectedModCount = expectedModCount;
+ }
+
+ final int getFence() { // initialize fence and size on first use
+ int hi;
+ if ((hi = fence) < 0) {
+ est = map.size;
+ expectedModCount = map.modCount;
+ hi = fence = map.table.length;
+ }
+ return hi;
+ }
+
+ public final long estimateSize() {
+ getFence(); // force init
+ return (long) est;
+ }
+ }
+
+ static final class KeySpliterator<K,V>
+ extends IdentityHashMapSpliterator<K,V>
+ implements Spliterator<K> {
+ KeySpliterator(IdentityHashMap<K,V> map, int origin, int fence, int est,
+ int expectedModCount) {
+ super(map, origin, fence, est, expectedModCount);
+ }
+
+ public KeySpliterator<K,V> trySplit() {
+ int hi = getFence(), lo = index, mid = ((lo + hi) >>> 1) & ~1;
+ return (lo >= mid) ? null :
+ new KeySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+ expectedModCount);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void forEachRemaining(Consumer<? super K> action) {
+ if (action == null)
+ throw new NullPointerException();
+ int i, hi, mc; Object key;
+ IdentityHashMap<K,V> m; Object[] a;
+ if ((m = map) != null && (a = m.table) != null &&
+ (i = index) >= 0 && (index = hi = getFence()) <= a.length) {
+ for (; i < hi; i += 2) {
+ if ((key = a[i]) != null)
+ action.accept((K)unmaskNull(key));
+ }
+ if (m.modCount == expectedModCount)
+ return;
+ }
+ throw new ConcurrentModificationException();
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean tryAdvance(Consumer<? super K> action) {
+ if (action == null)
+ throw new NullPointerException();
+ Object[] a = map.table;
+ int hi = getFence();
+ while (index < hi) {
+ Object key = a[index];
+ index += 2;
+ if (key != null) {
+ action.accept((K)unmaskNull(key));
+ if (map.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public int characteristics() {
+ return (fence < 0 || est == map.size ? SIZED : 0) | Spliterator.DISTINCT;
+ }
+ }
+
+ static final class ValueSpliterator<K,V>
+ extends IdentityHashMapSpliterator<K,V>
+ implements Spliterator<V> {
+ ValueSpliterator(IdentityHashMap<K,V> m, int origin, int fence, int est,
+ int expectedModCount) {
+ super(m, origin, fence, est, expectedModCount);
+ }
+
+ public ValueSpliterator<K,V> trySplit() {
+ int hi = getFence(), lo = index, mid = ((lo + hi) >>> 1) & ~1;
+ return (lo >= mid) ? null :
+ new ValueSpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+ expectedModCount);
+ }
+
+ public void forEachRemaining(Consumer<? super V> action) {
+ if (action == null)
+ throw new NullPointerException();
+ int i, hi, mc;
+ IdentityHashMap<K,V> m; Object[] a;
+ if ((m = map) != null && (a = m.table) != null &&
+ (i = index) >= 0 && (index = hi = getFence()) <= a.length) {
+ for (; i < hi; i += 2) {
+ if (a[i] != null) {
+ @SuppressWarnings("unchecked") V v = (V)a[i+1];
+ action.accept(v);
+ }
+ }
+ if (m.modCount == expectedModCount)
+ return;
+ }
+ throw new ConcurrentModificationException();
+ }
+
+ public boolean tryAdvance(Consumer<? super V> action) {
+ if (action == null)
+ throw new NullPointerException();
+ Object[] a = map.table;
+ int hi = getFence();
+ while (index < hi) {
+ Object key = a[index];
+ @SuppressWarnings("unchecked") V v = (V)a[index+1];
+ index += 2;
+ if (key != null) {
+ action.accept(v);
+ if (map.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public int characteristics() {
+ return (fence < 0 || est == map.size ? SIZED : 0);
+ }
+
+ }
+
+ static final class EntrySpliterator<K,V>
+ extends IdentityHashMapSpliterator<K,V>
+ implements Spliterator<Map.Entry<K,V>> {
+ EntrySpliterator(IdentityHashMap<K,V> m, int origin, int fence, int est,
+ int expectedModCount) {
+ super(m, origin, fence, est, expectedModCount);
+ }
+
+ public EntrySpliterator<K,V> trySplit() {
+ int hi = getFence(), lo = index, mid = ((lo + hi) >>> 1) & ~1;
+ return (lo >= mid) ? null :
+ new EntrySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+ expectedModCount);
+ }
+
+ public void forEachRemaining(Consumer<? super Map.Entry<K, V>> action) {
+ if (action == null)
+ throw new NullPointerException();
+ int i, hi, mc;
+ IdentityHashMap<K,V> m; Object[] a;
+ if ((m = map) != null && (a = m.table) != null &&
+ (i = index) >= 0 && (index = hi = getFence()) <= a.length) {
+ for (; i < hi; i += 2) {
+ Object key = a[i];
+ if (key != null) {
+ @SuppressWarnings("unchecked") K k =
+ (K)unmaskNull(key);
+ @SuppressWarnings("unchecked") V v = (V)a[i+1];
+ action.accept
+ (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
+
+ }
+ }
+ if (m.modCount == expectedModCount)
+ return;
+ }
+ throw new ConcurrentModificationException();
+ }
+
+ public boolean tryAdvance(Consumer<? super Map.Entry<K,V>> action) {
+ if (action == null)
+ throw new NullPointerException();
+ Object[] a = map.table;
+ int hi = getFence();
+ while (index < hi) {
+ Object key = a[index];
+ @SuppressWarnings("unchecked") V v = (V)a[index+1];
+ index += 2;
+ if (key != null) {
+ @SuppressWarnings("unchecked") K k =
+ (K)unmaskNull(key);
+ action.accept
+ (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
+ if (map.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public int characteristics() {
+ return (fence < 0 || est == map.size ? SIZED : 0) | Spliterator.DISTINCT;
+ }
+ }
+
}
--- a/jdk/src/share/classes/java/util/LinkedHashSet.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/LinkedHashSet.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -168,4 +168,18 @@
super(Math.max(2*c.size(), 11), .75f, true);
addAll(c);
}
+
+ /**
+ * Creates a {@code Spliterator}, over the elements in this set, that
+ * reports {@code SIZED}, {@code DISTINCT} and {@code ORDERED}.
+ * Overriding implementations are expected to document if the
+ * {@code Spliterator} reports any additional and relevant characteristic
+ * values.
+ *
+ * @return a {@code Spliterator} over the elements in this set
+ */
+ @Override
+ public Spliterator<E> spliterator() {
+ return Spliterators.spliterator(this, Spliterator.DISTINCT | Spliterator.ORDERED);
+ }
}
--- a/jdk/src/share/classes/java/util/LinkedList.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/LinkedList.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
package java.util;
+import java.util.function.Consumer;
+
/**
* Doubly-linked list implementation of the {@code List} and {@code Deque}
* interfaces. Implements all optional list operations, and permits all
@@ -948,6 +950,17 @@
expectedModCount++;
}
+ public void forEachRemaining(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ while (modCount == expectedModCount && nextIndex < size) {
+ action.accept(next.item);
+ next = next.next;
+ nextIndex++;
+ }
+ lastReturned = next;
+ checkForComodification();
+ }
+
final void checkForComodification() {
if (modCount != expectedModCount)
throw new ConcurrentModificationException();
@@ -1135,4 +1148,103 @@
for (int i = 0; i < size; i++)
linkLast((E)s.readObject());
}
+
+ public Spliterator<E> spliterator() {
+ return new LLSpliterator<E>(this, -1, 0);
+ }
+
+ /** A customized variant of Spliterators.IteratorSpliterator */
+ static final class LLSpliterator<E> implements Spliterator<E> {
+ static final int BATCH_UNIT = 1 << 10; // batch array size increment
+ static final int MAX_BATCH = 1 << 25; // max batch array size;
+ final LinkedList<E> list; // null OK unless traversed
+ Node<E> current; // current node; null until initialized
+ int est; // size estimate; -1 until first needed
+ int expectedModCount; // initialized when est set
+ int batch; // batch size for splits
+
+ LLSpliterator(LinkedList<E> list, int est, int expectedModCount) {
+ this.list = list;
+ this.est = est;
+ this.expectedModCount = expectedModCount;
+ }
+
+ final int getEst() {
+ int s; // force initialization
+ final LinkedList<E> lst;
+ if ((s = est) < 0) {
+ if ((lst = list) == null)
+ s = est = 0;
+ else {
+ expectedModCount = lst.modCount;
+ current = lst.first;
+ s = est = lst.size;
+ }
+ }
+ return s;
+ }
+
+ public long estimateSize() { return (long) getEst(); }
+
+ public Spliterator<E> trySplit() {
+ Node<E> p;
+ int s = getEst();
+ if (s > 1 && (p = current) != null) {
+ int n = batch + BATCH_UNIT;
+ if (n > s)
+ n = s;
+ if (n > MAX_BATCH)
+ n = MAX_BATCH;
+ Object[] a;
+ try {
+ a = new Object[n];
+ } catch (OutOfMemoryError oome) {
+ return null;
+ }
+ int j = 0;
+ do { a[j++] = p.item; } while ((p = p.next) != null && j < n);
+ current = p;
+ batch = j;
+ est = s - j;
+ return Spliterators.spliterator(a, 0, j, Spliterator.ORDERED);
+ }
+ return null;
+ }
+
+ public void forEachRemaining(Consumer<? super E> action) {
+ Node<E> p; int n;
+ if (action == null) throw new NullPointerException();
+ if ((n = getEst()) > 0 && (p = current) != null) {
+ current = null;
+ est = 0;
+ do {
+ E e = p.item;
+ p = p.next;
+ action.accept(e);
+ } while (p != null && --n > 0);
+ }
+ if (list.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ }
+
+ public boolean tryAdvance(Consumer<? super E> action) {
+ Node<E> p;
+ if (action == null) throw new NullPointerException();
+ if (getEst() > 0 && (p = current) != null) {
+ --est;
+ E e = p.item;
+ current = p.next;
+ action.accept(e);
+ if (list.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ return false;
+ }
+
+ public int characteristics() {
+ return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED;
+ }
+ }
+
}
--- a/jdk/src/share/classes/java/util/List.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/List.java Wed May 01 11:34:06 2013 -0700
@@ -25,6 +25,8 @@
package java.util;
+import java.util.function.UnaryOperator;
+
/**
* An ordered collection (also known as a <i>sequence</i>). The user of this
* interface has precise control over where in the list each element is
@@ -375,6 +377,64 @@
boolean retainAll(Collection<?> c);
/**
+ * Replaces each element of this list with the result of applying the
+ * operator to that element. Errors or runtime exceptions thrown by
+ * the operator are relayed to the caller.
+ *
+ * @implSpec
+ * The default implementation is equivalent to, for this {@code list}:
+ * <pre>
+ * final ListIterator<E> li = list.listIterator();
+ * while (li.hasNext()) {
+ * li.set(operator.apply(li.next()));
+ * }
+ * </pre>
+ * If the list's list-iterator does not support the {@code set} operation
+ * then an {@code UnsupportedOperationException} will be thrown when
+ * replacing the first element.
+ *
+ * @param operator the operator to apply to each element
+ * @throws UnsupportedOperationException if the {@code set}
+ * operation is not supported by this list
+ * @throws NullPointerException if the specified operator is null or
+ * if the element is replaced with a null value and this list
+ * does not permit null elements
+ * (<a href="Collection.html#optional-restrictions">optional</a>)
+ * @since 1.8
+ */
+ default void replaceAll(UnaryOperator<E> operator) {
+ Objects.requireNonNull(operator);
+ final ListIterator<E> li = this.listIterator();
+ while (li.hasNext()) {
+ li.set(operator.apply(li.next()));
+ }
+ }
+
+ /**
+ * Sorts this list using the supplied {@code Comparator} to compare elements.
+ *
+ * @implSpec
+ * The default implementation is equivalent to, for this {@code list}:
+ * <pre>Collections.sort(list, c)</pre>
+ *
+ * @param c the {@code Comparator} used to compare list elements.
+ * A {@code null} value indicates that the elements'
+ * {@linkplain Comparable natural ordering} should be used
+ * @throws ClassCastException if the list contains elements that are not
+ * <i>mutually comparable</i> using the specified comparator
+ * @throws UnsupportedOperationException if the list's list-iterator does
+ * not support the {@code set} operation
+ * @throws IllegalArgumentException
+ * (<a href="Collection.html#optional-restrictions">optional</a>)
+ * if the comparator is found to violate the {@link Comparator}
+ * contract
+ * @since 1.8
+ */
+ default void sort(Comparator<? super E> c) {
+ Collections.sort(this, c);
+ }
+
+ /**
* Removes all of the elements from this list (optional operation).
* The list will be empty after this call returns.
*
--- a/jdk/src/share/classes/java/util/PriorityQueue.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/PriorityQueue.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
package java.util;
+import java.util.function.Consumer;
+
/**
* An unbounded priority {@linkplain Queue queue} based on a priority heap.
* The elements of the priority queue are ordered according to their
@@ -56,7 +58,7 @@
* the priority queue in any particular order. If you need ordered
* traversal, consider using {@code Arrays.sort(pq.toArray())}.
*
- * <p> <strong>Note that this implementation is not synchronized.</strong>
+ * <p><strong>Note that this implementation is not synchronized.</strong>
* Multiple threads should not access a {@code PriorityQueue}
* instance concurrently if any of the threads modifies the queue.
* Instead, use the thread-safe {@link
@@ -92,7 +94,7 @@
* heap and each descendant d of n, n <= d. The element with the
* lowest value is in queue[0], assuming the queue is nonempty.
*/
- private transient Object[] queue;
+ transient Object[] queue; // non-private to simplify nested class access
/**
* The number of elements in the priority queue.
@@ -109,7 +111,7 @@
* The number of times this priority queue has been
* <i>structurally modified</i>. See AbstractList for gory details.
*/
- private transient int modCount = 0;
+ transient int modCount = 0; // non-private to simplify nested class access
/**
* Creates a {@code PriorityQueue} with the default initial
@@ -332,9 +334,7 @@
@SuppressWarnings("unchecked")
public E peek() {
- if (size == 0)
- return null;
- return (E) queue[0];
+ return (size == 0) ? null : (E) queue[0];
}
private int indexOf(Object o) {
@@ -431,15 +431,14 @@
* precise control over the runtime type of the output array, and may,
* under certain circumstances, be used to save allocation costs.
*
- * <p>Suppose <tt>x</tt> is a queue known to contain only strings.
+ * <p>Suppose {@code x} is a queue known to contain only strings.
* The following code can be used to dump the queue into a newly
- * allocated array of <tt>String</tt>:
+ * allocated array of {@code String}:
*
- * <pre>
- * String[] y = x.toArray(new String[0]);</pre>
+ * <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
*
- * Note that <tt>toArray(new Object[0])</tt> is identical in function to
- * <tt>toArray()</tt>.
+ * Note that {@code toArray(new Object[0])} is identical in function to
+ * {@code toArray()}.
*
* @param a the array into which the elements of the queue are to
* be stored, if it is big enough; otherwise, a new array of the
@@ -452,6 +451,7 @@
*/
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
+ final int size = this.size;
if (a.length < size)
// Make a new array of a's runtime type, but my contents:
return (T[]) Arrays.copyOf(queue, size, a.getClass());
@@ -569,15 +569,14 @@
size = 0;
}
+ @SuppressWarnings("unchecked")
public E poll() {
if (size == 0)
return null;
int s = --size;
modCount++;
- @SuppressWarnings("unchecked")
- E result = (E) queue[0];
- @SuppressWarnings("unchecked")
- E x = (E) queue[s];
+ E result = (E) queue[0];
+ E x = (E) queue[s];
queue[s] = null;
if (s != 0)
siftDown(0, x);
@@ -596,15 +595,15 @@
* position before i. This fact is used by iterator.remove so as to
* avoid missing traversing elements.
*/
+ @SuppressWarnings("unchecked")
private E removeAt(int i) {
- assert i >= 0 && i < size;
+ // assert i >= 0 && i < size;
modCount++;
int s = --size;
if (s == i) // removed last element
queue[i] = null;
else {
- @SuppressWarnings("unchecked")
- E moved = (E) queue[s];
+ E moved = (E) queue[s];
queue[s] = null;
siftDown(i, moved);
if (queue[i] == moved) {
@@ -649,12 +648,12 @@
queue[k] = key;
}
+ @SuppressWarnings("unchecked")
private void siftUpUsingComparator(int k, E x) {
while (k > 0) {
int parent = (k - 1) >>> 1;
- @SuppressWarnings("unchecked")
- E e = (E) queue[parent];
- if (comparator.compare(x, e) >= 0)
+ Object e = queue[parent];
+ if (comparator.compare(x, (E) e) >= 0)
break;
queue[k] = e;
k = parent;
@@ -738,8 +737,7 @@
}
/**
- * Saves the state of the instance to a stream (that
- * is, serializes it).
+ * Saves this queue to a stream (that is, serializes it).
*
* @serialData The length of the array backing the instance is
* emitted (int), followed by all of its elements
@@ -747,7 +745,7 @@
* @param s the stream
*/
private void writeObject(java.io.ObjectOutputStream s)
- throws java.io.IOException{
+ throws java.io.IOException {
// Write out element count, and any hidden stuff
s.defaultWriteObject();
@@ -783,4 +781,99 @@
// spec has never explained what that might be.
heapify();
}
+
+ public final Spliterator<E> spliterator() {
+ return new PriorityQueueSpliterator<E>(this, 0, -1, 0);
+ }
+
+ static final class PriorityQueueSpliterator<E> implements Spliterator<E> {
+ /*
+ * This is very similar to ArrayList Spliterator, except for
+ * extra null checks.
+ */
+ private final PriorityQueue<E> pq;
+ private int index; // current index, modified on advance/split
+ private int fence; // -1 until first use
+ private int expectedModCount; // initialized when fence set
+
+ /** Creates new spliterator covering the given range */
+ PriorityQueueSpliterator(PriorityQueue<E> pq, int origin, int fence,
+ int expectedModCount) {
+ this.pq = pq;
+ this.index = origin;
+ this.fence = fence;
+ this.expectedModCount = expectedModCount;
+ }
+
+ private int getFence() { // initialize fence to size on first use
+ int hi;
+ if ((hi = fence) < 0) {
+ expectedModCount = pq.modCount;
+ hi = fence = pq.size;
+ }
+ return hi;
+ }
+
+ public PriorityQueueSpliterator<E> trySplit() {
+ int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+ return (lo >= mid) ? null :
+ new PriorityQueueSpliterator<E>(pq, lo, index = mid,
+ expectedModCount);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void forEachRemaining(Consumer<? super E> action) {
+ int i, hi, mc; // hoist accesses and checks from loop
+ PriorityQueue<E> q; Object[] a;
+ if (action == null)
+ throw new NullPointerException();
+ if ((q = pq) != null && (a = q.queue) != null) {
+ if ((hi = fence) < 0) {
+ mc = q.modCount;
+ hi = q.size;
+ }
+ else
+ mc = expectedModCount;
+ if ((i = index) >= 0 && (index = hi) <= a.length) {
+ for (E e;; ++i) {
+ if (i < hi) {
+ if ((e = (E) a[i]) == null) // must be CME
+ break;
+ action.accept(e);
+ }
+ else if (q.modCount != mc)
+ break;
+ else
+ return;
+ }
+ }
+ }
+ throw new ConcurrentModificationException();
+ }
+
+ public boolean tryAdvance(Consumer<? super E> action) {
+ if (action == null)
+ throw new NullPointerException();
+ int hi = getFence(), lo = index;
+ if (lo >= 0 && lo < hi) {
+ index = lo + 1;
+ @SuppressWarnings("unchecked") E e = (E)pq.queue[lo];
+ if (e == null)
+ throw new ConcurrentModificationException();
+ action.accept(e);
+ if (pq.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ return false;
+ }
+
+ public long estimateSize() {
+ return (long) (getFence() - index);
+ }
+
+ public int characteristics() {
+ return Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.NONNULL;
+ }
+ }
}
--- a/jdk/src/share/classes/java/util/Spliterator.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/Spliterator.java Wed May 01 11:34:06 2013 -0700
@@ -438,7 +438,7 @@
/**
* If this Spliterator's source is {@link #SORTED} by a {@link Comparator},
* returns that {@code Comparator}. If the source is {@code SORTED} in
- * {@linkplain Comparable natural order, returns {@code null}. Otherwise,
+ * {@linkplain Comparable natural order}, returns {@code null}. Otherwise,
* if the source is not {@code SORTED}, throws {@link IllegalStateException}.
*
* @implSpec
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/StringJoiner.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util;
+
+/**
+ * {@code StringJoiner} is used to construct a sequence of characters separated
+ * by a delimiter and optionally starting with a supplied prefix
+ * and ending with a supplied suffix.
+ * <p>
+ * For example, the String {@code "[George:Sally:Fred]"} may
+ * be constructed as follows:
+ * <pre> {@code
+ * StringJoiner sj = new StringJoiner(":", "[", "]");
+ * sj.add("George").add("Sally").add("Fred");
+ * String desiredString = sj.toString();
+ * }</pre>
+ * <p>
+ * Prior to adding something to the {@code StringJoiner}, its
+ * {@code sj.toString()} method will, by default, return {@code prefix + suffix}.
+ * However, if the {@code setEmptyValue} method is called, the {@code emptyValue}
+ * supplied will be returned instead. This can be used, for example, when
+ * creating a string using set notation to indicate an empty set, i.e.
+ * <code>"{}"</code>, where the {@code prefix} is <code>"{"</code>, the
+ * {@code suffix} is <code>"}"</code> and nothing has been added to the
+ * {@code StringJoiner}.
+ * <p>
+ * A {@code StringJoiner} may be employed to create formatted output from a
+ * collection using lambda expressions as shown in the following example.
+ *
+ * <pre> {@code
+ * List<Person> people = ...
+ * String commaSeparatedNames =
+ * people.map(p -> p.getName()).into(new StringJoiner(", ")).toString();
+ * }</pre>
+ *
+ * @author Jim Gish
+ * @since 1.8
+*/
+public final class StringJoiner {
+ private final String prefix;
+ private final String delimiter;
+ private final String suffix;
+
+ /*
+ * StringBuilder value -- at any time, the characters constructed from the
+ * prefix, the added element separated by the delimiter, but without the
+ * suffix, so that we can more easily add elements without having to jigger
+ * the suffix each time.
+ */
+ private StringBuilder value;
+
+ /*
+ * By default, the string consisting of prefix+suffix, returned by
+ * toString(), or properties of value, when no elements have yet been added,
+ * i.e. when it is empty. This may be overridden by the user to be some
+ * other value including the empty String.
+ */
+ private String emptyValue;
+
+ /**
+ * Constructs a {@code StringJoiner} with no characters in it, with no
+ * {@code prefix} or {@code suffix}, and a copy of the supplied
+ * {@code delimiter}.
+ * If no characters are added to the {@code StringJoiner} and methods
+ * accessing the value of it are invoked, it will not return a
+ * {@code prefix} or {@code suffix} (or properties thereof) in the result,
+ * unless {@code setEmptyValue} has first been called.
+ *
+ * @param delimiter the sequence of characters to be used between each
+ * element added to the {@code StringJoiner} value
+ * @throws NullPointerException if {@code delimiter} is {@code null}
+ */
+ public StringJoiner(CharSequence delimiter) {
+ this(delimiter, "", "");
+ }
+
+ /**
+ * Constructs a {@code StringJoiner} with no characters in it using copies
+ * of the supplied {@code prefix}, {@code delimiter} and {@code suffix}.
+ * If no characters are added to the {@code StringJoiner} and methods
+ * accessing the string value of it are invoked, it will return the
+ * {@code prefix + suffix} (or properties thereof) in the result, unless
+ * {@code setEmptyValue} has first been called.
+ *
+ * @param delimiter the sequence of characters to be used between each
+ * element added to the {@code StringJoiner}
+ * @param prefix the sequence of characters to be used at the beginning
+ * @param suffix the sequence of characters to be used at the end
+ * @throws NullPointerException if {@code prefix}, {@code delimiter}, or
+ * {@code suffix} is {@code null}
+ */
+ public StringJoiner(CharSequence delimiter, CharSequence prefix,
+ CharSequence suffix) {
+ Objects.requireNonNull(prefix, "The prefix must not be null");
+ Objects.requireNonNull(delimiter, "The delimiter must not be null");
+ Objects.requireNonNull(suffix, "The suffix must not be null");
+ // make defensive copies of arguments
+ this.prefix = prefix.toString();
+ this.delimiter = delimiter.toString();
+ this.suffix = suffix.toString();
+ this.emptyValue = this.prefix + this.suffix;
+ }
+
+ /**
+ * Sets the sequence of characters to be used when determining the string
+ * representation of this {@code StringJoiner} and no elements have been
+ * added yet, i.e. when it is empty. A copy of the {@code emptyValue}
+ * parameter is made for this purpose. Note that once an add method has been
+ * called, the {@code StringJoiner} is no longer considered empty, even if
+ * the element(s) added correspond to the empty {@code String}.
+ *
+ * @param emptyValue the characters to return as the value of an empty
+ * {@code StringJoiner}
+ * @return this {@code StringJoiner} itself so the calls may be chained
+ * @throws NullPointerException when the {@code emptyValue} parameter is
+ * {@code null}
+ */
+ public StringJoiner setEmptyValue(CharSequence emptyValue) {
+ this.emptyValue = Objects.requireNonNull(emptyValue,
+ "The empty value must not be null").toString();
+ return this;
+ }
+
+ /**
+ * Returns the current value, consisting of the {@code prefix}, the values
+ * added so far separated by the {@code delimiter}, and the {@code suffix},
+ * unless no elements have been added in which case, the
+ * {@code prefix + suffix} or the {@code emptyValue} characters are returned
+ *
+ * @return the string representation of this {@code StringJoiner}
+ */
+ @Override
+ public String toString() {
+ if (value == null) {
+ return emptyValue;
+ } else {
+ if (suffix.equals("")) {
+ return value.toString();
+ } else {
+ int initialLength = value.length();
+ String result = value.append(suffix).toString();
+ // reset value to pre-append initialLength
+ value.setLength(initialLength);
+ return result;
+ }
+ }
+ }
+
+ /**
+ * Add the a copy of the supplied {@code CharSequence} value as the next
+ * element of the {@code StringJoiner} value. If {@code newElement} is
+ * {@code null}, then {@code "null"} is added.
+ *
+ * @param newElement The element to add
+ * @return a reference to this {@code StringJoiner}
+ */
+ public StringJoiner add(CharSequence newElement) {
+ prepareBuilder().append(newElement);
+ return this;
+ }
+
+ private StringBuilder prepareBuilder() {
+ if (value != null) {
+ value.append(delimiter);
+ } else {
+ value = new StringBuilder().append(prefix);
+ }
+ return value;
+ }
+
+ /**
+ * The length of the {@code StringJoiner} value, i.e. the length of
+ * {@code String} representation of the {@code StringJoiner}. Note that if
+ * no add methods have been called, then the length of the {@code String}
+ * representation (either {@code prefix + suffix} or {@code emptyValue})
+ * will be returned. The value should be equivalent to
+ * {@code toString().length()}.
+ *
+ * @return the length of the current value of {@code StringJoiner}
+ */
+ public int length() {
+ // Remember that we never actually append the suffix unless we return
+ // the full (present) value or some sub-string or length of it, so that
+ // we can add on more if we need to.
+ return (value != null ? value.length() + suffix.length() :
+ emptyValue.length());
+ }
+}
--- a/jdk/src/share/classes/java/util/TreeMap.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/TreeMap.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
package java.util;
+import java.util.function.Consumer;
+
/**
* A Red-Black tree based {@link NavigableMap} implementation.
* The map is sorted according to the {@linkplain Comparable natural
@@ -971,6 +973,10 @@
public void clear() {
TreeMap.this.clear();
}
+
+ public Spliterator<V> spliterator() {
+ return new ValueSpliterator<K,V>(TreeMap.this, null, null, 0, -1, 0);
+ }
}
class EntrySet extends AbstractSet<Map.Entry<K,V>> {
@@ -1007,6 +1013,10 @@
public void clear() {
TreeMap.this.clear();
}
+
+ public Spliterator<Map.Entry<K,V>> spliterator() {
+ return new EntrySpliterator<K,V>(TreeMap.this, null, null, 0, -1, 0);
+ }
}
/*
@@ -1090,6 +1100,10 @@
public NavigableSet<E> descendingSet() {
return new KeySet<>(m.descendingMap());
}
+
+ public Spliterator<E> spliterator() {
+ return keySpliteratorFor(m);
+ }
}
/**
@@ -1389,6 +1403,8 @@
/** Returns ascending iterator from the perspective of this submap */
abstract Iterator<K> keyIterator();
+ abstract Spliterator<K> keySpliterator();
+
/** Returns descending iterator from the perspective of this submap */
abstract Iterator<K> descendingKeyIterator();
@@ -1650,19 +1666,6 @@
}
}
- final class SubMapKeyIterator extends SubMapIterator<K> {
- SubMapKeyIterator(TreeMap.Entry<K,V> first,
- TreeMap.Entry<K,V> fence) {
- super(first, fence);
- }
- public K next() {
- return nextEntry().key;
- }
- public void remove() {
- removeAscending();
- }
- }
-
final class DescendingSubMapEntryIterator extends SubMapIterator<Map.Entry<K,V>> {
DescendingSubMapEntryIterator(TreeMap.Entry<K,V> last,
TreeMap.Entry<K,V> fence) {
@@ -1677,7 +1680,47 @@
}
}
- final class DescendingSubMapKeyIterator extends SubMapIterator<K> {
+ // Implement minimal Spliterator as KeySpliterator backup
+ final class SubMapKeyIterator extends SubMapIterator<K>
+ implements Spliterator<K> {
+ SubMapKeyIterator(TreeMap.Entry<K,V> first,
+ TreeMap.Entry<K,V> fence) {
+ super(first, fence);
+ }
+ public K next() {
+ return nextEntry().key;
+ }
+ public void remove() {
+ removeAscending();
+ }
+ public Spliterator<K> trySplit() {
+ return null;
+ }
+ public void forEachRemaining(Consumer<? super K> action) {
+ while (hasNext())
+ action.accept(next());
+ }
+ public boolean tryAdvance(Consumer<? super K> action) {
+ if (hasNext()) {
+ action.accept(next());
+ return true;
+ }
+ return false;
+ }
+ public long estimateSize() {
+ return Long.MAX_VALUE;
+ }
+ public int characteristics() {
+ return Spliterator.DISTINCT | Spliterator.ORDERED |
+ Spliterator.SORTED;
+ }
+ public final Comparator<? super K> getComparator() {
+ return NavigableSubMap.this.comparator();
+ }
+ }
+
+ final class DescendingSubMapKeyIterator extends SubMapIterator<K>
+ implements Spliterator<K> {
DescendingSubMapKeyIterator(TreeMap.Entry<K,V> last,
TreeMap.Entry<K,V> fence) {
super(last, fence);
@@ -1688,6 +1731,26 @@
public void remove() {
removeDescending();
}
+ public Spliterator<K> trySplit() {
+ return null;
+ }
+ public void forEachRemaining(Consumer<? super K> action) {
+ while (hasNext())
+ action.accept(next());
+ }
+ public boolean tryAdvance(Consumer<? super K> action) {
+ if (hasNext()) {
+ action.accept(next());
+ return true;
+ }
+ return false;
+ }
+ public long estimateSize() {
+ return Long.MAX_VALUE;
+ }
+ public int characteristics() {
+ return Spliterator.DISTINCT | Spliterator.ORDERED;
+ }
}
}
@@ -1747,6 +1810,10 @@
return new SubMapKeyIterator(absLowest(), absHighFence());
}
+ Spliterator<K> keySpliterator() {
+ return new SubMapKeyIterator(absLowest(), absHighFence());
+ }
+
Iterator<K> descendingKeyIterator() {
return new DescendingSubMapKeyIterator(absHighest(), absLowFence());
}
@@ -1828,6 +1895,10 @@
return new DescendingSubMapKeyIterator(absHighest(), absLowFence());
}
+ Spliterator<K> keySpliterator() {
+ return new DescendingSubMapKeyIterator(absHighest(), absLowFence());
+ }
+
Iterator<K> descendingKeyIterator() {
return new SubMapKeyIterator(absLowest(), absHighFence());
}
@@ -2444,4 +2515,407 @@
level++;
return level;
}
+
+ /**
+ * Currently, we support Spliterator-based versions only for the
+ * full map, in either plain of descending form, otherwise relying
+ * on defaults because size estimation for submaps would dominate
+ * costs. The type tests needed to check these for key views are
+ * not very nice but avoid disrupting existing class
+ * structures. Callers must use plain default spliterators if this
+ * returns null.
+ */
+ static <K> Spliterator<K> keySpliteratorFor(NavigableMap<K,?> m) {
+ if (m instanceof TreeMap) {
+ @SuppressWarnings("unchecked") TreeMap<K,Object> t =
+ (TreeMap<K,Object>) m;
+ return t.keySpliterator();
+ }
+ if (m instanceof DescendingSubMap) {
+ @SuppressWarnings("unchecked") DescendingSubMap<K,?> dm =
+ (DescendingSubMap<K,?>) m;
+ TreeMap<K,?> tm = dm.m;
+ if (dm == tm.descendingMap) {
+ @SuppressWarnings("unchecked") TreeMap<K,Object> t =
+ (TreeMap<K,Object>) tm;
+ return t.descendingKeySpliterator();
+ }
+ }
+ @SuppressWarnings("unchecked") NavigableSubMap<K,?> sm =
+ (NavigableSubMap<K,?>) m;
+ return sm.keySpliterator();
+ }
+
+ final Spliterator<K> keySpliterator() {
+ return new KeySpliterator<K,V>(this, null, null, 0, -1, 0);
+ }
+
+ final Spliterator<K> descendingKeySpliterator() {
+ return new DescendingKeySpliterator<K,V>(this, null, null, 0, -2, 0);
+ }
+
+ /**
+ * Base class for spliterators. Iteration starts at a given
+ * origin and continues up to but not including a given fence (or
+ * null for end). At top-level, for ascending cases, the first
+ * split uses the root as left-fence/right-origin. From there,
+ * right-hand splits replace the current fence with its left
+ * child, also serving as origin for the split-off spliterator.
+ * Left-hands are symmetric. Descending versions place the origin
+ * at the end and invert ascending split rules. This base class
+ * is non-commital about directionality, or whether the top-level
+ * spliterator covers the whole tree. This means that the actual
+ * split mechanics are located in subclasses. Some of the subclass
+ * trySplit methods are identical (except for return types), but
+ * not nicely factorable.
+ *
+ * Currently, subclass versions exist only for the full map
+ * (including descending keys via its descendingMap). Others are
+ * possible but currently not worthwhile because submaps require
+ * O(n) computations to determine size, which substantially limits
+ * potential speed-ups of using custom Spliterators versus default
+ * mechanics.
+ *
+ * To boostrap initialization, external constructors use
+ * negative size estimates: -1 for ascend, -2 for descend.
+ */
+ static class TreeMapSpliterator<K,V> {
+ final TreeMap<K,V> tree;
+ TreeMap.Entry<K,V> current; // traverser; initially first node in range
+ TreeMap.Entry<K,V> fence; // one past last, or null
+ int side; // 0: top, -1: is a left split, +1: right
+ int est; // size estimate (exact only for top-level)
+ int expectedModCount; // for CME checks
+
+ TreeMapSpliterator(TreeMap<K,V> tree,
+ TreeMap.Entry<K,V> origin, TreeMap.Entry<K,V> fence,
+ int side, int est, int expectedModCount) {
+ this.tree = tree;
+ this.current = origin;
+ this.fence = fence;
+ this.side = side;
+ this.est = est;
+ this.expectedModCount = expectedModCount;
+ }
+
+ final int getEstimate() { // force initialization
+ int s; TreeMap<K,V> t;
+ if ((s = est) < 0) {
+ if ((t = tree) != null) {
+ current = (s == -1) ? t.getFirstEntry() : t.getLastEntry();
+ s = est = t.size;
+ expectedModCount = t.modCount;
+ }
+ else
+ s = est = 0;
+ }
+ return s;
+ }
+
+ public final long estimateSize() {
+ return (long)getEstimate();
+ }
+ }
+
+ static final class KeySpliterator<K,V>
+ extends TreeMapSpliterator<K,V>
+ implements Spliterator<K> {
+ KeySpliterator(TreeMap<K,V> tree,
+ TreeMap.Entry<K,V> origin, TreeMap.Entry<K,V> fence,
+ int side, int est, int expectedModCount) {
+ super(tree, origin, fence, side, est, expectedModCount);
+ }
+
+ public KeySpliterator<K,V> trySplit() {
+ if (est < 0)
+ getEstimate(); // force initialization
+ int d = side;
+ TreeMap.Entry<K,V> e = current, f = fence,
+ s = ((e == null || e == f) ? null : // empty
+ (d == 0) ? tree.root : // was top
+ (d > 0) ? e.right : // was right
+ (d < 0 && f != null) ? f.left : // was left
+ null);
+ if (s != null && s != e && s != f &&
+ tree.compare(e.key, s.key) < 0) { // e not already past s
+ side = 1;
+ return new KeySpliterator<>
+ (tree, e, current = s, -1, est >>>= 1, expectedModCount);
+ }
+ return null;
+ }
+
+ public void forEachRemaining(Consumer<? super K> action) {
+ if (action == null)
+ throw new NullPointerException();
+ if (est < 0)
+ getEstimate(); // force initialization
+ TreeMap.Entry<K,V> f = fence, e, p, pl;
+ if ((e = current) != null && e != f) {
+ current = f; // exhaust
+ do {
+ action.accept(e.key);
+ if ((p = e.right) != null) {
+ while ((pl = p.left) != null)
+ p = pl;
+ }
+ else {
+ while ((p = e.parent) != null && e == p.right)
+ e = p;
+ }
+ } while ((e = p) != null && e != f);
+ if (tree.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ public boolean tryAdvance(Consumer<? super K> action) {
+ TreeMap.Entry<K,V> e;
+ if (action == null)
+ throw new NullPointerException();
+ if (est < 0)
+ getEstimate(); // force initialization
+ if ((e = current) == null || e == fence)
+ return false;
+ current = successor(e);
+ action.accept(e.key);
+ if (tree.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+
+ public int characteristics() {
+ return (side == 0 ? Spliterator.SIZED : 0) |
+ Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED;
+ }
+
+ public final Comparator<? super K> getComparator() {
+ return tree.comparator;
+ }
+
+ }
+
+ static final class DescendingKeySpliterator<K,V>
+ extends TreeMapSpliterator<K,V>
+ implements Spliterator<K> {
+ DescendingKeySpliterator(TreeMap<K,V> tree,
+ TreeMap.Entry<K,V> origin, TreeMap.Entry<K,V> fence,
+ int side, int est, int expectedModCount) {
+ super(tree, origin, fence, side, est, expectedModCount);
+ }
+
+ public DescendingKeySpliterator<K,V> trySplit() {
+ if (est < 0)
+ getEstimate(); // force initialization
+ int d = side;
+ TreeMap.Entry<K,V> e = current, f = fence,
+ s = ((e == null || e == f) ? null : // empty
+ (d == 0) ? tree.root : // was top
+ (d < 0) ? e.left : // was left
+ (d > 0 && f != null) ? f.right : // was right
+ null);
+ if (s != null && s != e && s != f &&
+ tree.compare(e.key, s.key) > 0) { // e not already past s
+ side = 1;
+ return new DescendingKeySpliterator<>
+ (tree, e, current = s, -1, est >>>= 1, expectedModCount);
+ }
+ return null;
+ }
+
+ public void forEachRemaining(Consumer<? super K> action) {
+ if (action == null)
+ throw new NullPointerException();
+ if (est < 0)
+ getEstimate(); // force initialization
+ TreeMap.Entry<K,V> f = fence, e, p, pr;
+ if ((e = current) != null && e != f) {
+ current = f; // exhaust
+ do {
+ action.accept(e.key);
+ if ((p = e.left) != null) {
+ while ((pr = p.right) != null)
+ p = pr;
+ }
+ else {
+ while ((p = e.parent) != null && e == p.left)
+ e = p;
+ }
+ } while ((e = p) != null && e != f);
+ if (tree.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ public boolean tryAdvance(Consumer<? super K> action) {
+ TreeMap.Entry<K,V> e;
+ if (action == null)
+ throw new NullPointerException();
+ if (est < 0)
+ getEstimate(); // force initialization
+ if ((e = current) == null || e == fence)
+ return false;
+ current = predecessor(e);
+ action.accept(e.key);
+ if (tree.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+
+ public int characteristics() {
+ return (side == 0 ? Spliterator.SIZED : 0) |
+ Spliterator.DISTINCT | Spliterator.ORDERED;
+ }
+ }
+
+ static final class ValueSpliterator<K,V>
+ extends TreeMapSpliterator<K,V>
+ implements Spliterator<V> {
+ ValueSpliterator(TreeMap<K,V> tree,
+ TreeMap.Entry<K,V> origin, TreeMap.Entry<K,V> fence,
+ int side, int est, int expectedModCount) {
+ super(tree, origin, fence, side, est, expectedModCount);
+ }
+
+ public ValueSpliterator<K,V> trySplit() {
+ if (est < 0)
+ getEstimate(); // force initialization
+ int d = side;
+ TreeMap.Entry<K,V> e = current, f = fence,
+ s = ((e == null || e == f) ? null : // empty
+ (d == 0) ? tree.root : // was top
+ (d > 0) ? e.right : // was right
+ (d < 0 && f != null) ? f.left : // was left
+ null);
+ if (s != null && s != e && s != f &&
+ tree.compare(e.key, s.key) < 0) { // e not already past s
+ side = 1;
+ return new ValueSpliterator<>
+ (tree, e, current = s, -1, est >>>= 1, expectedModCount);
+ }
+ return null;
+ }
+
+ public void forEachRemaining(Consumer<? super V> action) {
+ if (action == null)
+ throw new NullPointerException();
+ if (est < 0)
+ getEstimate(); // force initialization
+ TreeMap.Entry<K,V> f = fence, e, p, pl;
+ if ((e = current) != null && e != f) {
+ current = f; // exhaust
+ do {
+ action.accept(e.value);
+ if ((p = e.right) != null) {
+ while ((pl = p.left) != null)
+ p = pl;
+ }
+ else {
+ while ((p = e.parent) != null && e == p.right)
+ e = p;
+ }
+ } while ((e = p) != null && e != f);
+ if (tree.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ public boolean tryAdvance(Consumer<? super V> action) {
+ TreeMap.Entry<K,V> e;
+ if (action == null)
+ throw new NullPointerException();
+ if (est < 0)
+ getEstimate(); // force initialization
+ if ((e = current) == null || e == fence)
+ return false;
+ current = successor(e);
+ action.accept(e.value);
+ if (tree.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+
+ public int characteristics() {
+ return (side == 0 ? Spliterator.SIZED : 0);
+ }
+ }
+
+ static final class EntrySpliterator<K,V>
+ extends TreeMapSpliterator<K,V>
+ implements Spliterator<Map.Entry<K,V>> {
+ EntrySpliterator(TreeMap<K,V> tree,
+ TreeMap.Entry<K,V> origin, TreeMap.Entry<K,V> fence,
+ int side, int est, int expectedModCount) {
+ super(tree, origin, fence, side, est, expectedModCount);
+ }
+
+ public EntrySpliterator<K,V> trySplit() {
+ if (est < 0)
+ getEstimate(); // force initialization
+ int d = side;
+ TreeMap.Entry<K,V> e = current, f = fence,
+ s = ((e == null || e == f) ? null : // empty
+ (d == 0) ? tree.root : // was top
+ (d > 0) ? e.right : // was right
+ (d < 0 && f != null) ? f.left : // was left
+ null);
+ if (s != null && s != e && s != f &&
+ tree.compare(e.key, s.key) < 0) { // e not already past s
+ side = 1;
+ return new EntrySpliterator<>
+ (tree, e, current = s, -1, est >>>= 1, expectedModCount);
+ }
+ return null;
+ }
+
+ public void forEachRemaining(Consumer<? super Map.Entry<K, V>> action) {
+ if (action == null)
+ throw new NullPointerException();
+ if (est < 0)
+ getEstimate(); // force initialization
+ TreeMap.Entry<K,V> f = fence, e, p, pl;
+ if ((e = current) != null && e != f) {
+ current = f; // exhaust
+ do {
+ action.accept(e);
+ if ((p = e.right) != null) {
+ while ((pl = p.left) != null)
+ p = pl;
+ }
+ else {
+ while ((p = e.parent) != null && e == p.right)
+ e = p;
+ }
+ } while ((e = p) != null && e != f);
+ if (tree.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ public boolean tryAdvance(Consumer<? super Map.Entry<K,V>> action) {
+ TreeMap.Entry<K,V> e;
+ if (action == null)
+ throw new NullPointerException();
+ if (est < 0)
+ getEstimate(); // force initialization
+ if ((e = current) == null || e == fence)
+ return false;
+ current = successor(e);
+ action.accept(e);
+ if (tree.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+
+ public int characteristics() {
+ return (side == 0 ? Spliterator.SIZED : 0) |
+ Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED;
+ }
+
+ @Override
+ public Comparator<? super Map.Entry<K, V>> getComparator() {
+ return tree.comparator != null ?
+ Comparators.byKey(tree.comparator) : null;
+ }
+ }
}
--- a/jdk/src/share/classes/java/util/TreeSet.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/TreeSet.java Wed May 01 11:34:06 2013 -0700
@@ -533,5 +533,9 @@
tm.readTreeSet(size, s, PRESENT);
}
+ public Spliterator<E> spliterator() {
+ return TreeMap.keySpliteratorFor(m);
+ }
+
private static final long serialVersionUID = -2479143000061671589L;
}
--- a/jdk/src/share/classes/java/util/Vector.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/Vector.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,10 @@
package java.util;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
+
/**
* The {@code Vector} class implements a growable array of
* objects. Like an array, it contains components that can be
@@ -1151,6 +1155,28 @@
lastRet = -1;
}
+ @Override
+ public void forEachRemaining(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ synchronized (Vector.this) {
+ final int size = elementCount;
+ int i = cursor;
+ if (i >= size) {
+ return;
+ }
+ final Object[] elementData = Vector.this.elementData;
+ if (i >= elementData.length) {
+ throw new ConcurrentModificationException();
+ }
+ while (i != size && modCount == expectedModCount) {
+ action.accept((E) elementData[i++]);
+ }
+ // update once at end of iteration to reduce heap write traffic
+ lastRet = cursor = i;
+ checkForComodification();
+ }
+ }
+
final void checkForComodification() {
if (modCount != expectedModCount)
throw new ConcurrentModificationException();
@@ -1209,4 +1235,181 @@
lastRet = -1;
}
}
+
+ @Override
+ public synchronized void forEach(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ final int expectedModCount = modCount;
+ @SuppressWarnings("unchecked")
+ final E[] elementData = (E[]) this.elementData;
+ final int elementCount = this.elementCount;
+ for (int i=0; modCount == expectedModCount && i < elementCount; i++) {
+ action.accept(elementData[i]);
+ }
+ if (modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public synchronized boolean removeIf(Predicate<? super E> filter) {
+ Objects.requireNonNull(filter);
+ // figure out which elements are to be removed
+ // any exception thrown from the filter predicate at this stage
+ // will leave the collection unmodified
+ int removeCount = 0;
+ final int size = elementCount;
+ final BitSet removeSet = new BitSet(size);
+ final int expectedModCount = modCount;
+ for (int i=0; modCount == expectedModCount && i < size; i++) {
+ @SuppressWarnings("unchecked")
+ final E element = (E) elementData[i];
+ if (filter.test(element)) {
+ removeSet.set(i);
+ removeCount++;
+ }
+ }
+ if (modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+
+ // shift surviving elements left over the spaces left by removed elements
+ final boolean anyToRemove = removeCount > 0;
+ if (anyToRemove) {
+ final int newSize = size - removeCount;
+ for (int i=0, j=0; (i < size) && (j < newSize); i++, j++) {
+ i = removeSet.nextClearBit(i);
+ elementData[j] = elementData[i];
+ }
+ for (int k=newSize; k < size; k++) {
+ elementData[k] = null; // Let gc do its work
+ }
+ elementCount = newSize;
+ if (modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ modCount++;
+ }
+
+ return anyToRemove;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public synchronized void replaceAll(UnaryOperator<E> operator) {
+ Objects.requireNonNull(operator);
+ final int expectedModCount = modCount;
+ final int size = elementCount;
+ for (int i=0; modCount == expectedModCount && i < size; i++) {
+ elementData[i] = operator.apply((E) elementData[i]);
+ }
+ if (modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ modCount++;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public synchronized void sort(Comparator<? super E> c) {
+ final int expectedModCount = modCount;
+ Arrays.sort((E[]) elementData, 0, elementCount, c);
+ if (modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ modCount++;
+ }
+
+ @Override
+ public Spliterator<E> spliterator() {
+ return new VectorSpliterator<>(this, null, 0, -1, 0);
+ }
+
+ /** Similar to ArrayList Spliterator */
+ static final class VectorSpliterator<E> implements Spliterator<E> {
+ private final Vector<E> list;
+ private Object[] array;
+ private int index; // current index, modified on advance/split
+ private int fence; // -1 until used; then one past last index
+ private int expectedModCount; // initialized when fence set
+
+ /** Create new spliterator covering the given range */
+ VectorSpliterator(Vector<E> list, Object[] array, int origin, int fence,
+ int expectedModCount) {
+ this.list = list;
+ this.array = array;
+ this.index = origin;
+ this.fence = fence;
+ this.expectedModCount = expectedModCount;
+ }
+
+ private int getFence() { // initialize on first use
+ int hi;
+ if ((hi = fence) < 0) {
+ synchronized(list) {
+ array = list.elementData;
+ expectedModCount = list.modCount;
+ hi = fence = list.elementCount;
+ }
+ }
+ return hi;
+ }
+
+ public Spliterator<E> trySplit() {
+ int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+ return (lo >= mid) ? null :
+ new VectorSpliterator<E>(list, array, lo, index = mid,
+ expectedModCount);
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean tryAdvance(Consumer<? super E> action) {
+ int i;
+ if (action == null)
+ throw new NullPointerException();
+ if (getFence() > (i = index)) {
+ index = i + 1;
+ action.accept((E)array[i]);
+ if (list.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void forEachRemaining(Consumer<? super E> action) {
+ int i, hi; // hoist accesses and checks from loop
+ Vector<E> lst; Object[] a;
+ if (action == null)
+ throw new NullPointerException();
+ if ((lst = list) != null) {
+ if ((hi = fence) < 0) {
+ synchronized(lst) {
+ expectedModCount = lst.modCount;
+ a = array = lst.elementData;
+ hi = fence = lst.elementCount;
+ }
+ }
+ else
+ a = array;
+ if (a != null && (i = index) >= 0 && (index = hi) <= a.length) {
+ while (i < hi)
+ action.accept((E) a[i++]);
+ if (lst.modCount == expectedModCount)
+ return;
+ }
+ }
+ throw new ConcurrentModificationException();
+ }
+
+ public long estimateSize() {
+ return (long) (getFence() - index);
+ }
+
+ public int characteristics() {
+ return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED;
+ }
+ }
}
--- a/jdk/src/share/classes/java/util/WeakHashMap.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/WeakHashMap.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,10 @@
*/
package java.util;
+
import java.lang.ref.WeakReference;
import java.lang.ref.ReferenceQueue;
+import java.util.function.Consumer;
/**
@@ -898,6 +900,10 @@
public void clear() {
WeakHashMap.this.clear();
}
+
+ public Spliterator<K> spliterator() {
+ return new KeySpliterator<>(WeakHashMap.this, 0, -1, 0, 0);
+ }
}
/**
@@ -934,6 +940,10 @@
public void clear() {
WeakHashMap.this.clear();
}
+
+ public Spliterator<V> spliterator() {
+ return new ValueSpliterator<>(WeakHashMap.this, 0, -1, 0, 0);
+ }
}
/**
@@ -994,5 +1004,288 @@
public <T> T[] toArray(T[] a) {
return deepCopy().toArray(a);
}
+
+ public Spliterator<Map.Entry<K,V>> spliterator() {
+ return new EntrySpliterator<>(WeakHashMap.this, 0, -1, 0, 0);
+ }
}
+
+ /**
+ * Similar form as other hash Spliterators, but skips dead
+ * elements.
+ */
+ static class WeakHashMapSpliterator<K,V> {
+ final WeakHashMap<K,V> map;
+ WeakHashMap.Entry<K,V> current; // current node
+ int index; // current index, modified on advance/split
+ int fence; // -1 until first use; then one past last index
+ int est; // size estimate
+ int expectedModCount; // for comodification checks
+
+ WeakHashMapSpliterator(WeakHashMap<K,V> m, int origin,
+ int fence, int est,
+ int expectedModCount) {
+ this.map = m;
+ this.index = origin;
+ this.fence = fence;
+ this.est = est;
+ this.expectedModCount = expectedModCount;
+ }
+
+ final int getFence() { // initialize fence and size on first use
+ int hi;
+ if ((hi = fence) < 0) {
+ WeakHashMap<K,V> m = map;
+ est = m.size();
+ expectedModCount = m.modCount;
+ hi = fence = m.table.length;
+ }
+ return hi;
+ }
+
+ public final long estimateSize() {
+ getFence(); // force init
+ return (long) est;
+ }
+ }
+
+ static final class KeySpliterator<K,V>
+ extends WeakHashMapSpliterator<K,V>
+ implements Spliterator<K> {
+ KeySpliterator(WeakHashMap<K,V> m, int origin, int fence, int est,
+ int expectedModCount) {
+ super(m, origin, fence, est, expectedModCount);
+ }
+
+ public KeySpliterator<K,V> trySplit() {
+ int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+ return (lo >= mid) ? null :
+ new KeySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+ expectedModCount);
+ }
+
+ public void forEachRemaining(Consumer<? super K> action) {
+ int i, hi, mc;
+ if (action == null)
+ throw new NullPointerException();
+ WeakHashMap<K,V> m = map;
+ WeakHashMap.Entry<K,V>[] tab = m.table;
+ if ((hi = fence) < 0) {
+ mc = expectedModCount = m.modCount;
+ hi = fence = tab.length;
+ }
+ else
+ mc = expectedModCount;
+ if (tab.length >= hi && (i = index) >= 0 && i < hi) {
+ index = hi;
+ WeakHashMap.Entry<K,V> p = current;
+ do {
+ if (p == null)
+ p = tab[i++];
+ else {
+ Object x = p.get();
+ p = p.next;
+ if (x != null) {
+ @SuppressWarnings("unchecked") K k =
+ (K) WeakHashMap.unmaskNull(x);
+ action.accept(k);
+ }
+ }
+ } while (p != null || i < hi);
+ }
+ if (m.modCount != mc)
+ throw new ConcurrentModificationException();
+ }
+
+ public boolean tryAdvance(Consumer<? super K> action) {
+ int hi;
+ if (action == null)
+ throw new NullPointerException();
+ WeakHashMap.Entry<K,V>[] tab = map.table;
+ if (tab.length >= (hi = getFence()) && index >= 0) {
+ while (current != null || index < hi) {
+ if (current == null)
+ current = tab[index++];
+ else {
+ Object x = current.get();
+ current = current.next;
+ if (x != null) {
+ @SuppressWarnings("unchecked") K k =
+ (K) WeakHashMap.unmaskNull(x);
+ action.accept(k);
+ if (map.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public int characteristics() {
+ return Spliterator.DISTINCT;
+ }
+ }
+
+ static final class ValueSpliterator<K,V>
+ extends WeakHashMapSpliterator<K,V>
+ implements Spliterator<V> {
+ ValueSpliterator(WeakHashMap<K,V> m, int origin, int fence, int est,
+ int expectedModCount) {
+ super(m, origin, fence, est, expectedModCount);
+ }
+
+ public ValueSpliterator<K,V> trySplit() {
+ int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+ return (lo >= mid) ? null :
+ new ValueSpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+ expectedModCount);
+ }
+
+ public void forEachRemaining(Consumer<? super V> action) {
+ int i, hi, mc;
+ if (action == null)
+ throw new NullPointerException();
+ WeakHashMap<K,V> m = map;
+ WeakHashMap.Entry<K,V>[] tab = m.table;
+ if ((hi = fence) < 0) {
+ mc = expectedModCount = m.modCount;
+ hi = fence = tab.length;
+ }
+ else
+ mc = expectedModCount;
+ if (tab.length >= hi && (i = index) >= 0 && i < hi) {
+ index = hi;
+ WeakHashMap.Entry<K,V> p = current;
+ do {
+ if (p == null)
+ p = tab[i++];
+ else {
+ Object x = p.get();
+ V v = p.value;
+ p = p.next;
+ if (x != null)
+ action.accept(v);
+ }
+ } while (p != null || i < hi);
+ }
+ if (m.modCount != mc)
+ throw new ConcurrentModificationException();
+ }
+
+ public boolean tryAdvance(Consumer<? super V> action) {
+ int hi;
+ if (action == null)
+ throw new NullPointerException();
+ WeakHashMap.Entry<K,V>[] tab = map.table;
+ if (tab.length >= (hi = getFence()) && index >= 0) {
+ while (current != null || index < hi) {
+ if (current == null)
+ current = tab[index++];
+ else {
+ Object x = current.get();
+ V v = current.value;
+ current = current.next;
+ if (x != null) {
+ action.accept(v);
+ if (map.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public int characteristics() {
+ return 0;
+ }
+ }
+
+ static final class EntrySpliterator<K,V>
+ extends WeakHashMapSpliterator<K,V>
+ implements Spliterator<Map.Entry<K,V>> {
+ EntrySpliterator(WeakHashMap<K,V> m, int origin, int fence, int est,
+ int expectedModCount) {
+ super(m, origin, fence, est, expectedModCount);
+ }
+
+ public EntrySpliterator<K,V> trySplit() {
+ int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+ return (lo >= mid) ? null :
+ new EntrySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+ expectedModCount);
+ }
+
+
+ public void forEachRemaining(Consumer<? super Map.Entry<K, V>> action) {
+ int i, hi, mc;
+ if (action == null)
+ throw new NullPointerException();
+ WeakHashMap<K,V> m = map;
+ WeakHashMap.Entry<K,V>[] tab = m.table;
+ if ((hi = fence) < 0) {
+ mc = expectedModCount = m.modCount;
+ hi = fence = tab.length;
+ }
+ else
+ mc = expectedModCount;
+ if (tab.length >= hi && (i = index) >= 0 && i < hi) {
+ index = hi;
+ WeakHashMap.Entry<K,V> p = current;
+ do {
+ if (p == null)
+ p = tab[i++];
+ else {
+ Object x = p.get();
+ V v = p.value;
+ p = p.next;
+ if (x != null) {
+ @SuppressWarnings("unchecked") K k =
+ (K) WeakHashMap.unmaskNull(x);
+ action.accept
+ (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
+ }
+ }
+ } while (p != null || i < hi);
+ }
+ if (m.modCount != mc)
+ throw new ConcurrentModificationException();
+ }
+
+ public boolean tryAdvance(Consumer<? super Map.Entry<K,V>> action) {
+ int hi;
+ if (action == null)
+ throw new NullPointerException();
+ WeakHashMap.Entry<K,V>[] tab = map.table;
+ if (tab.length >= (hi = getFence()) && index >= 0) {
+ while (current != null || index < hi) {
+ if (current == null)
+ current = tab[index++];
+ else {
+ Object x = current.get();
+ V v = current.value;
+ current = current.next;
+ if (x != null) {
+ @SuppressWarnings("unchecked") K k =
+ (K) WeakHashMap.unmaskNull(x);
+ action.accept
+ (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
+ if (map.modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public int characteristics() {
+ return Spliterator.DISTINCT;
+ }
+ }
+
}
--- a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java Wed May 01 11:34:06 2013 -0700
@@ -36,6 +36,9 @@
package java.util.concurrent;
import java.util.*;
import java.util.concurrent.locks.ReentrantLock;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
/**
* A thread-safe variant of {@link java.util.ArrayList} in which all mutative
@@ -1056,6 +1059,17 @@
public void add(E e) {
throw new UnsupportedOperationException();
}
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void forEachRemaining(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ final int size = snapshot.length;
+ for (int i=cursor; i < size; i++) {
+ action.accept((E) snapshot[i]);
+ }
+ cursor = size;
+ }
}
/**
@@ -1260,9 +1274,58 @@
}
}
+ @Override
+ public void forEach(Consumer<? super E> action) {
+ @SuppressWarnings("unchecked")
+ final E[] elements = (E[]) l.getArray();
+ checkForComodification();
+ l.forEach(action, elements, offset, offset + size);
+ }
+
+ @Override
+ public void sort(Comparator<? super E> c) {
+ final ReentrantLock lock = l.lock;
+ lock.lock();
+ try {
+ checkForComodification();
+ l.sort(c, offset, offset + size);
+ expectedArray = l.getArray();
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ @Override
+ public boolean removeIf(Predicate<? super E> filter) {
+ Objects.requireNonNull(filter);
+ final ReentrantLock lock = l.lock;
+ lock.lock();
+ try {
+ checkForComodification();
+ final int removeCount =
+ l.removeIf(filter, offset, offset + size);
+ expectedArray = l.getArray();
+ size -= removeCount;
+ return removeCount > 0;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ @Override
+ public void replaceAll(UnaryOperator<E> operator) {
+ final ReentrantLock lock = l.lock;
+ lock.lock();
+ try {
+ checkForComodification();
+ l.replaceAll(operator, offset, offset + size);
+ expectedArray = l.getArray();
+ } finally {
+ lock.unlock();
+ }
+ }
}
-
private static class COWSubListIterator<E> implements ListIterator<E> {
private final ListIterator<E> it;
private final int offset;
@@ -1315,6 +1378,15 @@
public void add(E e) {
throw new UnsupportedOperationException();
}
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void forEachRemaining(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ while (nextIndex() < size) {
+ action.accept(it.next());
+ }
+ }
}
// Support for resetting lock while deserializing
@@ -1333,4 +1405,139 @@
throw new Error(e);
}
}
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void forEach(Consumer<? super E> action) {
+ forEach(action, (E[]) getArray(), 0, size());
+ }
+
+ private void forEach(Consumer<? super E> action,
+ final E[] elements,
+ final int from, final int to) {
+ Objects.requireNonNull(action);
+ for (int i = from; i < to; i++) {
+ action.accept(elements[i]);
+ }
+ }
+
+ @Override
+ public void sort(Comparator<? super E> c) {
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ sort(c, 0, size());
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ // must be called with this.lock held
+ @SuppressWarnings("unchecked")
+ private void sort(Comparator<? super E> c, final int from, final int to) {
+ final E[] elements = (E[]) getArray();
+ final E[] newElements = Arrays.copyOf(elements, elements.length);
+ // only elements [from, to) are sorted
+ Arrays.sort(newElements, from, to, c);
+ setArray(newElements);
+ }
+
+ @Override
+ public boolean removeIf(Predicate<? super E> filter) {
+ Objects.requireNonNull(filter);
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ return removeIf(filter, 0, size()) > 0;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ // must be called with this.lock held
+ private int removeIf(Predicate<? super E> filter, final int from, final int to) {
+ Objects.requireNonNull(filter);
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ @SuppressWarnings("unchecked")
+ final E[] elements = (E[]) getArray();
+
+ // figure out which elements are to be removed
+ // any exception thrown from the filter predicate at this stage
+ // will leave the collection unmodified
+ int removeCount = 0;
+ final int range = to - from;
+ final BitSet removeSet = new BitSet(range);
+ for (int i = 0; i < range; i++) {
+ final E element = elements[from + i];
+ if (filter.test(element)) {
+ // removeSet is zero-based to keep its size small
+ removeSet.set(i);
+ removeCount++;
+ }
+ }
+
+ // copy surviving elements into a new array
+ if (removeCount > 0) {
+ final int newSize = elements.length - removeCount;
+ final int newRange = newSize - from;
+ @SuppressWarnings("unchecked")
+ final E[] newElements = (E[]) new Object[newSize];
+ // copy elements before [from, to) unmodified
+ for (int i = 0; i < from; i++) {
+ newElements[i] = elements[i];
+ }
+ // elements [from, to) are subject to removal
+ int j = 0;
+ for (int i = 0; (i < range) && (j < newRange); i++) {
+ i = removeSet.nextClearBit(i);
+ if (i >= range) {
+ break;
+ }
+ newElements[from + (j++)] = elements[from + i];
+ }
+ // copy any remaining elements beyond [from, to)
+ j += from;
+ for (int i = to; (i < elements.length) && (j < newSize); i++) {
+ newElements[j++] = elements[i];
+ }
+ setArray(newElements);
+ }
+
+ return removeCount;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ @Override
+ public void replaceAll(UnaryOperator<E> operator) {
+ Objects.requireNonNull(operator);
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ replaceAll(operator, 0, size());
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ // must be called with this.lock held
+ @SuppressWarnings("unchecked")
+ private void replaceAll(UnaryOperator<E> operator, final int from, final int to) {
+ final E[] elements = (E[]) getArray();
+ final E[] newElements = (E[]) new Object[elements.length];
+ for (int i = 0; i < from; i++) {
+ newElements[i] = elements[i];
+ }
+ // the operator is only applied to elements [from, to)
+ for (int i = from; i < to; i++) {
+ newElements[i] = operator.apply(elements[i]);
+ }
+ for (int i = to; i < elements.length; i++) {
+ newElements[i] = elements[i];
+ }
+ setArray(newElements);
+ }
}
--- a/jdk/src/share/classes/java/util/logging/LogManager.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,10 +35,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.beans.PropertyChangeListener;
-import java.net.URL;
import sun.misc.JavaAWTAccess;
import sun.misc.SharedSecrets;
-import sun.security.action.GetPropertyAction;
/**
* There is a single global LogManager object that is used to
@@ -148,7 +146,6 @@
// The global LogManager object
private static LogManager manager;
- private final static Handler[] emptyHandlers = { };
private Properties props = new Properties();
private final static Level defaultLevel = Level.INFO;
@@ -547,13 +544,10 @@
throw new NullPointerException();
}
- // cleanup some Loggers that have been GC'ed
- manager.drainLoggerRefQueueBounded();
-
LoggerWeakRef ref = namedLoggers.get(name);
if (ref != null) {
if (ref.get() == null) {
- // It's possible that the Logger was GC'ed after the
+ // It's possible that the Logger was GC'ed after a
// drainLoggerRefQueueBounded() call above so allow
// a new one to be registered.
removeLogger(name);
@@ -605,6 +599,8 @@
return true;
}
+ // note: all calls to removeLogger are synchronized on LogManager's
+ // intrinsic lock
void removeLogger(String name) {
namedLoggers.remove(name);
}
@@ -887,6 +883,7 @@
if (name == null) {
throw new NullPointerException();
}
+ drainLoggerRefQueueBounded();
LoggerContext cx = getUserContext();
if (cx.addLocalLogger(logger)) {
// Do we have a per logger handler too?
--- a/jdk/src/share/classes/java/util/regex/Pattern.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/java/util/regex/Pattern.java Wed May 01 11:34:06 2013 -0700
@@ -4334,7 +4334,6 @@
info.deterministic = detm;
else
info.deterministic = false;
-
return next.study(info);
}
}
@@ -4415,6 +4414,8 @@
}
// Aggressive group match
boolean match0(Matcher matcher, int i, int j, CharSequence seq) {
+ // don't back off passing the starting "j"
+ int min = j;
int[] groups = matcher.groups;
int save0 = 0;
int save1 = 0;
@@ -4452,7 +4453,7 @@
break;
}
}
- while (j > cmin) {
+ while (j > min) {
if (next.match(matcher, i, seq)) {
if (capture) {
groups[groupIndex+1] = i;
@@ -4544,7 +4545,6 @@
} else {
info.deterministic = false;
}
-
return next.study(info);
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/AbstractPipeline.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,674 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.function.IntFunction;
+import java.util.function.Supplier;
+
+/**
+ * Abstract base class for "pipeline" classes, which are the core
+ * implementations of the Stream interface and its primitive specializations.
+ * Manages construction and evaluation of stream pipelines.
+ *
+ * <p>An {@code AbstractPipeline} represents an initial portion of a stream
+ * pipeline, encapsulating a stream source and zero or more intermediate
+ * operations. The individual {@code AbstractPipeline} objects are often
+ * referred to as <em>stages</em>, where each stage describes either the stream
+ * source or an intermediate operation.
+ *
+ * <p>A concrete intermediate stage is generally built from an
+ * {@code AbstractPipeline}, a shape-specific pipeline class which extends it
+ * (e.g., {@code IntPipeline}) which is also abstract, and an operation-specific
+ * concrete class which extends that. {@code AbstractPipeline} contains most of
+ * the mechanics of evaluating the pipeline, and implements methods that will be
+ * used by the operation; the shape-specific classes add helper methods for
+ * dealing with collection of results into the appropriate shape-specific
+ * containers.
+ *
+ * <p>After chaining a new intermediate operation, or executing a terminal
+ * operation, the stream is considered to be consumed, and no more intermediate
+ * or terminal operations are permitted on this stream instance.
+ *
+ * <p>{@code AbstractPipeline} implements a number of methods that are
+ * specified in {@link BaseStream}, though it does not implement
+ * {@code BaseStream} directly. Subclasses of {@code AbstractPipeline}
+ * will generally implement {@code BaseStream}.
+ *
+ * @implNote
+ * <p>For sequential streams, and parallel streams without
+ * <a href="package-summary.html#StreamOps">stateful intermediate
+ * operations</a>, parallel streams, pipeline evaluation is done in a single
+ * pass that "jams" all the operations together. For parallel streams with
+ * stateful operations, execution is divided into segments, where each
+ * stateful operations marks the end of a segment, and each segment is
+ * evaluated separately and the result used as the input to the next
+ * segment. In all cases, the source data is not consumed until a terminal
+ * operation begins.
+ *
+ * @param <E_IN> type of input elements
+ * @param <E_OUT> type of output elements
+ * @param <S> type of the subclass implementing {@code BaseStream}
+ * @since 1.8
+ */
+abstract class AbstractPipeline<E_IN, E_OUT, S extends BaseStream<E_OUT, S>>
+ extends PipelineHelper<E_OUT> {
+ /**
+ * Backlink to the head of the pipeline chain (self if this is the source
+ * stage).
+ */
+ private final AbstractPipeline sourceStage;
+
+ /**
+ * The "upstream" pipeline, or null if this is the source stage.
+ */
+ private final AbstractPipeline previousStage;
+
+ /**
+ * The operation flags for the intermediate operation represented by this
+ * pipeline object.
+ */
+ protected final int sourceOrOpFlags;
+
+ /**
+ * The next stage in the pipeline, or null if this is the last stage.
+ * Effectively final at the point of linking to the next pipeline.
+ */
+ private AbstractPipeline nextStage;
+
+ /**
+ * The number of intermediate operations between this pipeline object
+ * and the stream source if sequential, or the previous stateful if parallel.
+ * Valid at the point of pipeline preparation for evaluation.
+ */
+ private int depth;
+
+ /**
+ * The combined source and operation flags for the source and all operations
+ * up to and including the operation represented by this pipeline object.
+ * Valid at the point of pipeline preparation for evaluation.
+ */
+ private int combinedFlags;
+
+ /**
+ * The source spliterator. Only valid for the head pipeline.
+ * Before the pipeline is consumed if non-null then {@code sourceSupplier}
+ * must be null. After the pipeline is consumed if non-null then is set to
+ * null.
+ */
+ private Spliterator<?> sourceSpliterator;
+
+ /**
+ * The source supplier. Only valid for the head pipeline. Before the
+ * pipeline is consumed if non-null then {@code sourceSpliterator} must be
+ * null. After the pipeline is consumed if non-null then is set to null.
+ */
+ private Supplier<? extends Spliterator<?>> sourceSupplier;
+
+ /**
+ * True if this pipeline has been linked or consumed
+ */
+ private boolean linkedOrConsumed;
+
+ /**
+ * True if there are any stateful ops in the pipeline; only valid for the
+ * source stage.
+ */
+ private boolean sourceAnyStateful;
+
+ /**
+ * True if pipeline is parallel, otherwise the pipeline is sequential; only
+ * valid for the source stage.
+ */
+ private boolean parallel;
+
+ /**
+ * Constructor for the head of a stream pipeline.
+ *
+ * @param source {@code Supplier<Spliterator>} describing the stream source
+ * @param sourceFlags The source flags for the stream source, described in
+ * {@link StreamOpFlag}
+ * @param parallel True if the pipeline is parallel
+ */
+ AbstractPipeline(Supplier<? extends Spliterator<?>> source,
+ int sourceFlags, boolean parallel) {
+ this.previousStage = null;
+ this.sourceSupplier = source;
+ this.sourceStage = this;
+ this.sourceOrOpFlags = sourceFlags & StreamOpFlag.STREAM_MASK;
+ // The following is an optimization of:
+ // StreamOpFlag.combineOpFlags(sourceOrOpFlags, StreamOpFlag.INITIAL_OPS_VALUE);
+ this.combinedFlags = (~(sourceOrOpFlags << 1)) & StreamOpFlag.INITIAL_OPS_VALUE;
+ this.depth = 0;
+ this.parallel = parallel;
+ }
+
+ /**
+ * Constructor for the head of a stream pipeline.
+ *
+ * @param source {@code Spliterator} describing the stream source
+ * @param sourceFlags the source flags for the stream source, described in
+ * {@link StreamOpFlag}
+ * @param parallel {@code true} if the pipeline is parallel
+ */
+ AbstractPipeline(Spliterator<?> source,
+ int sourceFlags, boolean parallel) {
+ this.previousStage = null;
+ this.sourceSpliterator = source;
+ this.sourceStage = this;
+ this.sourceOrOpFlags = sourceFlags & StreamOpFlag.STREAM_MASK;
+ // The following is an optimization of:
+ // StreamOpFlag.combineOpFlags(sourceOrOpFlags, StreamOpFlag.INITIAL_OPS_VALUE);
+ this.combinedFlags = (~(sourceOrOpFlags << 1)) & StreamOpFlag.INITIAL_OPS_VALUE;
+ this.depth = 0;
+ this.parallel = parallel;
+ }
+
+ /**
+ * Constructor for appending an intermediate operation stage onto an
+ * existing pipeline.
+ *
+ * @param previousStage the upstream pipeline stage
+ * @param opFlags the operation flags for the new stage, described in
+ * {@link StreamOpFlag}
+ */
+ AbstractPipeline(AbstractPipeline<?, E_IN, ?> previousStage, int opFlags) {
+ if (previousStage.linkedOrConsumed)
+ throw new IllegalStateException("stream has already been operated upon");
+ previousStage.linkedOrConsumed = true;
+ previousStage.nextStage = this;
+
+ this.previousStage = previousStage;
+ this.sourceOrOpFlags = opFlags & StreamOpFlag.OP_MASK;
+ this.combinedFlags = StreamOpFlag.combineOpFlags(opFlags, previousStage.combinedFlags);
+ this.sourceStage = previousStage.sourceStage;
+ if (opIsStateful())
+ sourceStage.sourceAnyStateful = true;
+ this.depth = previousStage.depth + 1;
+ }
+
+
+ // Terminal evaluation methods
+
+ /**
+ * Evaluate the pipeline with a terminal operation to produce a result.
+ *
+ * @param <R> the type of result
+ * @param terminalOp the terminal operation to be applied to the pipeline.
+ * @return the result
+ */
+ final <R> R evaluate(TerminalOp<E_OUT, R> terminalOp) {
+ assert getOutputShape() == terminalOp.inputShape();
+ if (linkedOrConsumed)
+ throw new IllegalStateException("stream has already been operated upon");
+ linkedOrConsumed = true;
+
+ return isParallel()
+ ? (R) terminalOp.evaluateParallel(this, sourceSpliterator(terminalOp.getOpFlags()))
+ : (R) terminalOp.evaluateSequential(this, sourceSpliterator(terminalOp.getOpFlags()));
+ }
+
+ /**
+ * Collect the elements output from the pipeline stage.
+ *
+ * @param generator the array generator to be used to create array instances
+ * @return a flat array-backed Node that holds the collected output elements
+ */
+ final Node<E_OUT> evaluateToArrayNode(IntFunction<E_OUT[]> generator) {
+ if (linkedOrConsumed)
+ throw new IllegalStateException("stream has already been operated upon");
+ linkedOrConsumed = true;
+
+ // If the last intermediate operation is stateful then
+ // evaluate directly to avoid an extra collection step
+ if (isParallel() && previousStage != null && opIsStateful()) {
+ return opEvaluateParallel(previousStage, previousStage.sourceSpliterator(0), generator);
+ }
+ else {
+ return evaluate(sourceSpliterator(0), true, generator);
+ }
+ }
+
+ /**
+ * Gets the source stage spliterator if this pipeline stage is the source
+ * stage. The pipeline is consumed after this method is called and
+ * returns successfully.
+ *
+ * @return the source stage spliterator
+ * @throws IllegalStateException if this pipeline stage is not the source
+ * stage.
+ */
+ final Spliterator<E_OUT> sourceStageSpliterator() {
+ if (this != sourceStage)
+ throw new IllegalStateException();
+
+ if (linkedOrConsumed)
+ throw new IllegalStateException("stream has already been operated upon");
+ linkedOrConsumed = true;
+
+ if (sourceStage.sourceSpliterator != null) {
+ Spliterator<E_OUT> s = sourceStage.sourceSpliterator;
+ sourceStage.sourceSpliterator = null;
+ return s;
+ }
+ else if (sourceStage.sourceSupplier != null) {
+ Spliterator<E_OUT> s = (Spliterator<E_OUT>) sourceStage.sourceSupplier.get();
+ sourceStage.sourceSupplier = null;
+ return s;
+ }
+ else {
+ throw new IllegalStateException("source already consumed");
+ }
+ }
+
+ // BaseStream
+
+ /**
+ * Implements {@link BaseStream#sequential()}
+ */
+ public final S sequential() {
+ sourceStage.parallel = false;
+ return (S) this;
+ }
+
+ /**
+ * Implements {@link BaseStream#parallel()}
+ */
+ public final S parallel() {
+ sourceStage.parallel = true;
+ return (S) this;
+ }
+
+ // Primitive specialization use co-variant overrides, hence is not final
+ /**
+ * Implements {@link BaseStream#spliterator()}
+ */
+ public Spliterator<E_OUT> spliterator() {
+ if (linkedOrConsumed)
+ throw new IllegalStateException("stream has already been operated upon");
+ linkedOrConsumed = true;
+
+ if (this == sourceStage) {
+ if (sourceStage.sourceSpliterator != null) {
+ Spliterator<E_OUT> s = sourceStage.sourceSpliterator;
+ sourceStage.sourceSpliterator = null;
+ return s;
+ }
+ else if (sourceStage.sourceSupplier != null) {
+ Supplier<Spliterator<E_OUT>> s = sourceStage.sourceSupplier;
+ sourceStage.sourceSupplier = null;
+ return lazySpliterator(s);
+ }
+ else {
+ throw new IllegalStateException("source already consumed");
+ }
+ }
+ else {
+ return wrap(this, () -> sourceSpliterator(0), isParallel());
+ }
+ }
+
+ /**
+ * Implements {@link BaseStream#isParallel()}
+ */
+ public final boolean isParallel() {
+ return sourceStage.parallel;
+ }
+
+
+ /**
+ * Returns the composition of stream flags of the stream source and all
+ * intermediate operations.
+ *
+ * @return the composition of stream flags of the stream source and all
+ * intermediate operations
+ * @see StreamOpFlag
+ */
+ final int getStreamFlags() {
+ return StreamOpFlag.toStreamFlags(combinedFlags);
+ }
+
+ /**
+ * Prepare the pipeline for a parallel execution. As the pipeline is built,
+ * the flags and depth indicators are set up for a sequential execution.
+ * If the execution is parallel, and there are any stateful operations, then
+ * some of these need to be adjusted, as well as adjusting for flags from
+ * the terminal operation (such as back-propagating UNORDERED).
+ * Need not be called for a sequential execution.
+ *
+ * @param terminalFlags Operation flags for the terminal operation
+ */
+ private void parallelPrepare(int terminalFlags) {
+ AbstractPipeline backPropagationHead = sourceStage;
+ if (sourceStage.sourceAnyStateful) {
+ int depth = 1;
+ for (AbstractPipeline u = sourceStage, p = sourceStage.nextStage;
+ p != null;
+ u = p, p = p.nextStage) {
+ int thisOpFlags = p.sourceOrOpFlags;
+ if (p.opIsStateful()) {
+ // If the stateful operation is a short-circuit operation
+ // then move the back propagation head forwards
+ // NOTE: there are no size-injecting ops
+ if (StreamOpFlag.SHORT_CIRCUIT.isKnown(thisOpFlags)) {
+ backPropagationHead = p;
+ }
+
+ depth = 0;
+ // The following injects size, it is equivalent to:
+ // StreamOpFlag.combineOpFlags(StreamOpFlag.IS_SIZED, p.combinedFlags);
+ thisOpFlags = (thisOpFlags & ~StreamOpFlag.NOT_SIZED) | StreamOpFlag.IS_SIZED;
+ }
+ p.depth = depth++;
+ p.combinedFlags = StreamOpFlag.combineOpFlags(thisOpFlags, u.combinedFlags);
+ }
+ }
+
+ // Apply the upstream terminal flags
+ if (terminalFlags != 0) {
+ int upstreamTerminalFlags = terminalFlags & StreamOpFlag.UPSTREAM_TERMINAL_OP_MASK;
+ for (AbstractPipeline p = backPropagationHead; p.nextStage != null; p = p.nextStage) {
+ p.combinedFlags = StreamOpFlag.combineOpFlags(upstreamTerminalFlags, p.combinedFlags);
+ }
+
+ combinedFlags = StreamOpFlag.combineOpFlags(terminalFlags, combinedFlags);
+ }
+ }
+
+ /**
+ * Get the source spliterator for this pipeline stage. For a sequential or
+ * stateless parallel pipeline, this is the source spliterator. For a
+ * stateful parallel pipeline, this is a spliterator describing the results
+ * of all computations up to and including the most recent stateful
+ * operation.
+ */
+ private Spliterator<?> sourceSpliterator(int terminalFlags) {
+ // Get the source spliterator of the pipeline
+ Spliterator<?> spliterator = null;
+ if (sourceStage.sourceSpliterator != null) {
+ spliterator = sourceStage.sourceSpliterator;
+ sourceStage.sourceSpliterator = null;
+ }
+ else if (sourceStage.sourceSupplier != null) {
+ spliterator = (Spliterator<?>) sourceStage.sourceSupplier.get();
+ sourceStage.sourceSupplier = null;
+ }
+ else {
+ throw new IllegalStateException("source already consumed");
+ }
+
+ if (isParallel()) {
+ // @@@ Merge parallelPrepare with the loop below and use the
+ // spliterator characteristics to determine if SIZED
+ // should be injected
+ parallelPrepare(terminalFlags);
+
+ // Adapt the source spliterator, evaluating each stateful op
+ // in the pipeline up to and including this pipeline stage
+ for (AbstractPipeline u = sourceStage, p = sourceStage.nextStage, e = this;
+ u != e;
+ u = p, p = p.nextStage) {
+
+ if (p.opIsStateful()) {
+ spliterator = p.opEvaluateParallelLazy(u, spliterator);
+ }
+ }
+ }
+ else if (terminalFlags != 0) {
+ combinedFlags = StreamOpFlag.combineOpFlags(terminalFlags, combinedFlags);
+ }
+
+ return spliterator;
+ }
+
+
+ // PipelineHelper
+
+ @Override
+ final <P_IN> long exactOutputSizeIfKnown(Spliterator<P_IN> spliterator) {
+ return StreamOpFlag.SIZED.isKnown(getStreamAndOpFlags()) ? spliterator.getExactSizeIfKnown() : -1;
+ }
+
+ @Override
+ final <P_IN, S extends Sink<E_OUT>> S wrapAndCopyInto(S sink, Spliterator<P_IN> spliterator) {
+ copyInto(wrapSink(Objects.requireNonNull(sink)), spliterator);
+ return sink;
+ }
+
+ @Override
+ final <P_IN> void copyInto(Sink<P_IN> wrappedSink, Spliterator<P_IN> spliterator) {
+ Objects.requireNonNull(wrappedSink);
+
+ if (!StreamOpFlag.SHORT_CIRCUIT.isKnown(getStreamAndOpFlags())) {
+ wrappedSink.begin(spliterator.getExactSizeIfKnown());
+ spliterator.forEachRemaining(wrappedSink);
+ wrappedSink.end();
+ }
+ else {
+ copyIntoWithCancel(wrappedSink, spliterator);
+ }
+ }
+
+ @Override
+ final <P_IN> void copyIntoWithCancel(Sink<P_IN> wrappedSink, Spliterator<P_IN> spliterator) {
+ AbstractPipeline p = AbstractPipeline.this;
+ while (p.depth > 0) {
+ p = p.previousStage;
+ }
+ wrappedSink.begin(spliterator.getExactSizeIfKnown());
+ p.forEachWithCancel(spliterator, wrappedSink);
+ wrappedSink.end();
+ }
+
+ @Override
+ final int getStreamAndOpFlags() {
+ return combinedFlags;
+ }
+
+ final boolean isOrdered() {
+ return StreamOpFlag.ORDERED.isKnown(combinedFlags);
+ }
+
+ @Override
+ final <P_IN> Sink<P_IN> wrapSink(Sink<E_OUT> sink) {
+ Objects.requireNonNull(sink);
+
+ for (AbstractPipeline p=AbstractPipeline.this; p.depth > 0; p=p.previousStage) {
+ sink = p.opWrapSink(p.previousStage.combinedFlags, sink);
+ }
+ return (Sink<P_IN>) sink;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ final <P_IN> Node<E_OUT> evaluate(Spliterator<P_IN> spliterator,
+ boolean flatten,
+ IntFunction<E_OUT[]> generator) {
+ if (isParallel()) {
+ // @@@ Optimize if op of this pipeline stage is a stateful op
+ return evaluateToNode(this, spliterator, flatten, generator);
+ }
+ else {
+ Node.Builder<E_OUT> nb = makeNodeBuilder(
+ exactOutputSizeIfKnown(spliterator), generator);
+ return wrapAndCopyInto(nb, spliterator).build();
+ }
+ }
+
+
+ // Shape-specific abstract methods, implemented by XxxPipeline classes
+
+ /**
+ * Get the output shape of the pipeline. If the pipeline is the head,
+ * then it's output shape corresponds to the shape of the source.
+ * Otherwise, it's output shape corresponds to the output shape of the
+ * associated operation.
+ *
+ * @return the output shape
+ */
+ abstract StreamShape getOutputShape();
+
+ /**
+ * Collect elements output from a pipeline into a Node that holds elements
+ * of this shape.
+ *
+ * @param helper the pipeline helper describing the pipeline stages
+ * @param spliterator the source spliterator
+ * @param flattenTree true if the returned node should be flattened
+ * @param generator the array generator
+ * @return a Node holding the output of the pipeline
+ */
+ abstract <P_IN> Node<E_OUT> evaluateToNode(PipelineHelper<E_OUT> helper,
+ Spliterator<P_IN> spliterator,
+ boolean flattenTree,
+ IntFunction<E_OUT[]> generator);
+
+ /**
+ * Create a spliterator that wraps a source spliterator, compatible with
+ * this stream shape, and operations associated with a {@link
+ * PipelineHelper}.
+ *
+ * @param ph the pipeline helper describing the pipeline stages
+ * @param supplier the supplier of a spliterator
+ * @return a wrapping spliterator compatible with this shape
+ */
+ abstract <P_IN> Spliterator<E_OUT> wrap(PipelineHelper<E_OUT> ph,
+ Supplier<Spliterator<P_IN>> supplier,
+ boolean isParallel);
+
+ /**
+ * Create a lazy spliterator that wraps and obtains the supplied the
+ * spliterator when a method is invoked on the lazy spliterator.
+ * @param supplier the supplier of a spliterator
+ */
+ abstract Spliterator<E_OUT> lazySpliterator(Supplier<? extends Spliterator<E_OUT>> supplier);
+
+ /**
+ * Traverse the elements of a spliterator compatible with this stream shape,
+ * pushing those elements into a sink. If the sink requests cancellation,
+ * no further elements will be pulled or pushed.
+ *
+ * @param spliterator the spliterator to pull elements from
+ * @param sink the sink to push elements to
+ */
+ abstract void forEachWithCancel(Spliterator<E_OUT> spliterator, Sink<E_OUT> sink);
+
+ /**
+ * Make a node builder compatible with this stream shape.
+ *
+ * @param exactSizeIfKnown if {@literal >=0}, then a node builder will be created that
+ * has a fixed capacity of at most sizeIfKnown elements. If {@literal < 0},
+ * then the node builder has an unfixed capacity. A fixed capacity node
+ * builder will throw exceptions if an element is added after builder has
+ * reached capacity, or is built before the builder has reached capacity.
+ * @param generator the array generator to be used to create instances of a
+ * T[] array. For implementations supporting primitive nodes, this parameter
+ * may be ignored.
+ * @return a node builder
+ */
+ abstract Node.Builder<E_OUT> makeNodeBuilder(long exactSizeIfKnown,
+ IntFunction<E_OUT[]> generator);
+
+
+ // Op-specific abstract methods, implemented by the operation class
+
+ /**
+ * Returns whether this operation is stateful or not. If it is stateful,
+ * then the method
+ * {@link #opEvaluateParallel(PipelineHelper, java.util.Spliterator, java.util.function.IntFunction)}
+ * must be overridden.
+ *
+ * @return {@code true} if this operation is stateful
+ */
+ abstract boolean opIsStateful();
+
+ /**
+ * Accepts a {@code Sink} which will receive the results of this operation,
+ * and return a {@code Sink} which accepts elements of the input type of
+ * this operation and which performs the operation, passing the results to
+ * the provided {@code Sink}.
+ *
+ * @apiNote
+ * The implementation may use the {@code flags} parameter to optimize the
+ * sink wrapping. For example, if the input is already {@code DISTINCT},
+ * the implementation for the {@code Stream#distinct()} method could just
+ * return the sink it was passed.
+ *
+ * @param flags The combined stream and operation flags up to, but not
+ * including, this operation
+ * @param sink sink to which elements should be sent after processing
+ * @return a sink which accepts elements, perform the operation upon
+ * each element, and passes the results (if any) to the provided
+ * {@code Sink}.
+ */
+ abstract Sink<E_IN> opWrapSink(int flags, Sink<E_OUT> sink);
+
+ /**
+ * Performs a parallel evaluation of the operation using the specified
+ * {@code PipelineHelper} which describes the upstream intermediate
+ * operations. Only called on stateful operations. If {@link
+ * #opIsStateful()} returns true then implementations must override the
+ * default implementation.
+ *
+ * @implSpec The default implementation always throw
+ * {@code UnsupportedOperationException}.
+ *
+ * @param helper the pipeline helper describing the pipeline stages
+ * @param spliterator the source {@code Spliterator}
+ * @param generator the array generator
+ * @return a {@code Node} describing the result of the evaluation
+ */
+ <P_IN> Node<E_OUT> opEvaluateParallel(PipelineHelper<E_OUT> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<E_OUT[]> generator) {
+ throw new UnsupportedOperationException("Parallel evaluation is not supported");
+ }
+
+ /**
+ * Returns a {@code Spliterator} describing a parallel evaluation of the
+ * operation, using the specified {@code PipelineHelper} which describes the
+ * upstream intermediate operations. Only called on stateful operations.
+ * It is not necessary (though acceptable) to do a full computation of the
+ * result here; it is preferable, if possible, to describe the result via a
+ * lazily evaluated spliterator.
+ *
+ * @implSpec The default implementation behaves as if:
+ * <pre>{@code
+ * return evaluateParallel(helper, i -> (E_OUT[]) new
+ * Object[i]).spliterator();
+ * }</pre>
+ * and is suitable for implementations that cannot do better than a full
+ * synchronous evaluation.
+ *
+ * @param helper the pipeline helper
+ * @param spliterator the source {@code Spliterator}
+ * @return a {@code Spliterator} describing the result of the evaluation
+ */
+ <P_IN> Spliterator<E_OUT> opEvaluateParallelLazy(PipelineHelper<E_OUT> helper,
+ Spliterator<P_IN> spliterator) {
+ return opEvaluateParallel(helper, spliterator, i -> (E_OUT[]) new Object[i]).spliterator();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/AbstractShortCircuitTask.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Spliterator;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Abstract class for fork-join tasks used to implement short-circuiting
+ * stream ops, which can produce a result without processing all elements of the
+ * stream.
+ *
+ * @param <P_IN> type of input elements to the pipeline
+ * @param <P_OUT> type of output elements from the pipeline
+ * @param <R> type of intermediate result, may be different from operation
+ * result type
+ * @param <K> type of child and sibling tasks
+ * @since 1.8
+ */
+abstract class AbstractShortCircuitTask<P_IN, P_OUT, R,
+ K extends AbstractShortCircuitTask<P_IN, P_OUT, R, K>>
+ extends AbstractTask<P_IN, P_OUT, R, K> {
+ /**
+ * The result for this computation; this is shared among all tasks and set
+ * exactly once
+ */
+ protected final AtomicReference<R> sharedResult;
+
+ /**
+ * Indicates whether this task has been canceled. Tasks may cancel other
+ * tasks in the computation under various conditions, such as in a
+ * find-first operation, a task that finds a value will cancel all tasks
+ * that are later in the encounter order.
+ */
+ protected volatile boolean canceled;
+
+ /**
+ * Constructor for root tasks.
+ *
+ * @param helper the {@code PipelineHelper} describing the stream pipeline
+ * up to this operation
+ * @param spliterator the {@code Spliterator} describing the source for this
+ * pipeline
+ */
+ protected AbstractShortCircuitTask(PipelineHelper<P_OUT> helper,
+ Spliterator<P_IN> spliterator) {
+ super(helper, spliterator);
+ sharedResult = new AtomicReference<>(null);
+ }
+
+ /**
+ * Constructor for non-root nodes.
+ *
+ * @param parent parent task in the computation tree
+ * @param spliterator the {@code Spliterator} for the portion of the
+ * computation tree described by this task
+ */
+ protected AbstractShortCircuitTask(K parent,
+ Spliterator<P_IN> spliterator) {
+ super(parent, spliterator);
+ sharedResult = parent.sharedResult;
+ }
+
+ /**
+ * Returns the value indicating the computation completed with no task
+ * finding a short-circuitable result. For example, for a "find" operation,
+ * this might be null or an empty {@code Optional}.
+ *
+ * @return the result to return when no task finds a result
+ */
+ protected abstract R getEmptyResult();
+
+ @Override
+ protected boolean canCompute() {
+ // Have we already found an answer?
+ if (sharedResult.get() != null) {
+ tryComplete();
+ return false;
+ } else if (taskCanceled()) {
+ setLocalResult(getEmptyResult());
+ tryComplete();
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+ /**
+ * Declares that a globally valid result has been found. If another task has
+ * not already found the answer, the result is installed in
+ * {@code sharedResult}. The {@code compute()} method will check
+ * {@code sharedResult} before proceeding with computation, so this causes
+ * the computation to terminate early.
+ *
+ * @param result the result found
+ */
+ protected void shortCircuit(R result) {
+ if (result != null)
+ sharedResult.compareAndSet(null, result);
+ }
+
+ /**
+ * Sets a local result for this task. If this task is the root, set the
+ * shared result instead (if not already set).
+ *
+ * @param localResult The result to set for this task
+ */
+ @Override
+ protected void setLocalResult(R localResult) {
+ if (isRoot()) {
+ if (localResult != null)
+ sharedResult.compareAndSet(null, localResult);
+ }
+ else
+ super.setLocalResult(localResult);
+ }
+
+ /**
+ * Retrieves the local result for this task
+ */
+ @Override
+ public R getRawResult() {
+ return getLocalResult();
+ }
+
+ /**
+ * Retrieves the local result for this task. If this task is the root,
+ * retrieves the shared result instead.
+ */
+ @Override
+ public R getLocalResult() {
+ if (isRoot()) {
+ R answer = sharedResult.get();
+ return (answer == null) ? getEmptyResult() : answer;
+ }
+ else
+ return super.getLocalResult();
+ }
+
+ /**
+ * Mark this task as canceled
+ */
+ protected void cancel() {
+ canceled = true;
+ }
+
+ /**
+ * Queries whether this task is canceled. A task is considered canceled if
+ * it or any of its parents have been canceled.
+ *
+ * @return {@code true} if this task or any parent is canceled.
+ */
+ protected boolean taskCanceled() {
+ boolean cancel = canceled;
+ if (!cancel) {
+ for (K parent = getParent(); !cancel && parent != null; parent = parent.getParent())
+ cancel = parent.canceled;
+ }
+
+ return cancel;
+ }
+
+ /**
+ * Cancels all tasks which succeed this one in the encounter order. This
+ * includes canceling all the current task's right sibling, as well as the
+ * later right siblings of all its parents.
+ */
+ protected void cancelLaterNodes() {
+ // Go up the tree, cancel right siblings of this node and all parents
+ for (K parent = getParent(), node = (K) this; parent != null;
+ node = parent, parent = parent.getParent()) {
+ // If node is a left child of parent, then has a right sibling
+ if (parent.leftChild == node) {
+ K rightSibling = parent.rightChild;
+ if (!rightSibling.canceled)
+ rightSibling.cancel();
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/AbstractSpinedBuffer.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+/**
+ * Base class for a data structure for gathering elements into a buffer and then
+ * iterating them. Maintains an array of increasingly sized arrays, so there is
+ * no copying cost associated with growing the data structure.
+ * @since 1.8
+ */
+abstract class AbstractSpinedBuffer {
+ /**
+ * Minimum power-of-two for the first chunk.
+ */
+ public static final int MIN_CHUNK_POWER = 4;
+
+ /**
+ * Minimum size for the first chunk.
+ */
+ public static final int MIN_CHUNK_SIZE = 1 << MIN_CHUNK_POWER;
+
+ /**
+ * Max power-of-two for chunks.
+ */
+ public static final int MAX_CHUNK_POWER = 30;
+
+ /**
+ * Minimum array size for array-of-chunks.
+ */
+ public static final int MIN_SPINE_SIZE = 8;
+
+
+ /**
+ * log2 of the size of the first chunk.
+ */
+ protected final int initialChunkPower;
+
+ /**
+ * Index of the *next* element to write; may point into, or just outside of,
+ * the current chunk.
+ */
+ protected int elementIndex;
+
+ /**
+ * Index of the *current* chunk in the spine array, if the spine array is
+ * non-null.
+ */
+ protected int spineIndex;
+
+ /**
+ * Count of elements in all prior chunks.
+ */
+ protected long[] priorElementCount;
+
+ /**
+ * Construct with an initial capacity of 16.
+ */
+ protected AbstractSpinedBuffer() {
+ this.initialChunkPower = MIN_CHUNK_POWER;
+ }
+
+ /**
+ * Construct with a specified initial capacity.
+ *
+ * @param initialCapacity The minimum expected number of elements
+ */
+ protected AbstractSpinedBuffer(int initialCapacity) {
+ if (initialCapacity < 0)
+ throw new IllegalArgumentException("Illegal Capacity: "+ initialCapacity);
+
+ this.initialChunkPower = Math.max(MIN_CHUNK_POWER,
+ Integer.SIZE - Integer.numberOfLeadingZeros(initialCapacity - 1));
+ }
+
+ /**
+ * Is the buffer currently empty?
+ */
+ public boolean isEmpty() {
+ return (spineIndex == 0) && (elementIndex == 0);
+ }
+
+ /**
+ * How many elements are currently in the buffer?
+ */
+ public long count() {
+ return (spineIndex == 0)
+ ? elementIndex
+ : priorElementCount[spineIndex] + elementIndex;
+ }
+
+ /**
+ * How big should the nth chunk be?
+ */
+ protected int chunkSize(int n) {
+ int power = (n == 0 || n == 1)
+ ? initialChunkPower
+ : Math.min(initialChunkPower + n - 1, AbstractSpinedBuffer.MAX_CHUNK_POWER);
+ return 1 << power;
+ }
+
+ /**
+ * Remove all data from the buffer
+ */
+ public abstract void clear();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/AbstractTask.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,373 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Spliterator;
+import java.util.concurrent.CountedCompleter;
+import java.util.concurrent.ForkJoinPool;
+
+/**
+ * Abstract base class for most fork-join tasks used to implement stream ops.
+ * Manages splitting logic, tracking of child tasks, and intermediate results.
+ * Each task is associated with a {@link Spliterator} that describes the portion
+ * of the input associated with the subtree rooted at this task.
+ * Tasks may be leaf nodes (which will traverse the elements of
+ * the {@code Spliterator}) or internal nodes (which split the
+ * {@code Spliterator} into multiple child tasks).
+ *
+ * @implNote
+ * <p>This class is based on {@link CountedCompleter}, a form of fork-join task
+ * where each task has a semaphore-like count of uncompleted children, and the
+ * task is implicitly completed and notified when its last child completes.
+ * Internal node tasks will likely override the {@code onCompletion} method from
+ * {@code CountedCompleter} to merge the results from child tasks into the
+ * current task's result.
+ *
+ * <p>Splitting and setting up the child task links is done by {@code compute()}
+ * for internal nodes. At {@code compute()} time for leaf nodes, it is
+ * guaranteed that the parent's child-related fields (including sibling links
+ * for the parent's children) will be set up for all children.
+ *
+ * <p>For example, a task that performs a reduce would override {@code doLeaf()}
+ * to perform a reduction on that leaf node's chunk using the
+ * {@code Spliterator}, and override {@code onCompletion()} to merge the results
+ * of the child tasks for internal nodes:
+ *
+ * <pre>{@code
+ * protected S doLeaf() {
+ * spliterator.forEach(...);
+ * return localReductionResult;
+ * }
+ *
+ * public void onCompletion(CountedCompleter caller) {
+ * if (!isLeaf()) {
+ * ReduceTask<P_IN, P_OUT, T, R> child = children;
+ * R result = child.getLocalResult();
+ * child = child.nextSibling;
+ * for (; child != null; child = child.nextSibling)
+ * result = combine(result, child.getLocalResult());
+ * setLocalResult(result);
+ * }
+ * }
+ * }</pre>
+ *
+ * @param <P_IN> Type of elements input to the pipeline
+ * @param <P_OUT> Type of elements output from the pipeline
+ * @param <R> Type of intermediate result, which may be different from operation
+ * result type
+ * @param <K> Type of parent, child and sibling tasks
+ * @since 1.8
+ */
+abstract class AbstractTask<P_IN, P_OUT, R,
+ K extends AbstractTask<P_IN, P_OUT, R, K>>
+ extends CountedCompleter<R> {
+
+ /**
+ * Default target factor of leaf tasks for parallel decomposition.
+ * To allow load balancing, we over-partition, currently to approximately
+ * four tasks per processor, which enables others to help out
+ * if leaf tasks are uneven or some processors are otherwise busy.
+ */
+ static final int LEAF_TARGET = ForkJoinPool.getCommonPoolParallelism() << 2;
+
+ /** The pipeline helper, common to all tasks in a computation */
+ protected final PipelineHelper<P_OUT> helper;
+
+ /**
+ * The spliterator for the portion of the input associated with the subtree
+ * rooted at this task
+ */
+ protected Spliterator<P_IN> spliterator;
+
+ /** Target leaf size, common to all tasks in a computation */
+ protected final long targetSize;
+
+ /**
+ * The left child.
+ * null if no children
+ * if non-null rightChild is non-null
+ */
+ protected K leftChild;
+
+ /**
+ * The right child.
+ * null if no children
+ * if non-null leftChild is non-null
+ */
+ protected K rightChild;
+
+ /** The result of this node, if completed */
+ private R localResult;
+
+ /**
+ * Constructor for root nodes.
+ *
+ * @param helper The {@code PipelineHelper} describing the stream pipeline
+ * up to this operation
+ * @param spliterator The {@code Spliterator} describing the source for this
+ * pipeline
+ */
+ protected AbstractTask(PipelineHelper<P_OUT> helper,
+ Spliterator<P_IN> spliterator) {
+ super(null);
+ this.helper = helper;
+ this.spliterator = spliterator;
+ this.targetSize = suggestTargetSize(spliterator.estimateSize());
+ }
+
+ /**
+ * Constructor for non-root nodes.
+ *
+ * @param parent this node's parent task
+ * @param spliterator {@code Spliterator} describing the subtree rooted at
+ * this node, obtained by splitting the parent {@code Spliterator}
+ */
+ protected AbstractTask(K parent,
+ Spliterator<P_IN> spliterator) {
+ super(parent);
+ this.spliterator = spliterator;
+ this.helper = parent.helper;
+ this.targetSize = parent.targetSize;
+ }
+
+ /**
+ * Constructs a new node of type T whose parent is the receiver; must call
+ * the AbstractTask(T, Spliterator) constructor with the receiver and the
+ * provided Spliterator.
+ *
+ * @param spliterator {@code Spliterator} describing the subtree rooted at
+ * this node, obtained by splitting the parent {@code Spliterator}
+ * @return newly constructed child node
+ */
+ protected abstract K makeChild(Spliterator<P_IN> spliterator);
+
+ /**
+ * Computes the result associated with a leaf node. Will be called by
+ * {@code compute()} and the result passed to @{code setLocalResult()}
+ *
+ * @return the computed result of a leaf node
+ */
+ protected abstract R doLeaf();
+
+ /**
+ * Returns a suggested target leaf size based on the initial size estimate.
+ *
+ * @return suggested target leaf size
+ */
+ public static long suggestTargetSize(long sizeEstimate) {
+ long est = sizeEstimate / LEAF_TARGET;
+ return est > 0L ? est : 1L;
+ }
+
+ /**
+ * Returns a suggestion whether it is advisable to split the provided
+ * spliterator based on target size and other considerations, such as pool
+ * state.
+ *
+ * @return {@code true} if a split is advised otherwise {@code false}
+ */
+ public static boolean suggestSplit(Spliterator spliterator,
+ long targetSize) {
+ long remaining = spliterator.estimateSize();
+ return (remaining > targetSize);
+ // @@@ May additionally want to fold in pool characteristics such as surplus task count
+ }
+
+ /**
+ * Returns a suggestion whether it is adviseable to split this task based on
+ * target size and other considerations.
+ *
+ * @return {@code true} if a split is advised otherwise {@code false}
+ */
+ public boolean suggestSplit() {
+ return suggestSplit(spliterator, targetSize);
+ }
+
+ /**
+ * Returns the local result, if any. Subclasses should use
+ * {@link #setLocalResult(Object)} and {@link #getLocalResult()} to manage
+ * results. This returns the local result so that calls from within the
+ * fork-join framework will return the correct result.
+ *
+ * @return local result for this node previously stored with
+ * {@link #setLocalResult}
+ */
+ @Override
+ public R getRawResult() {
+ return localResult;
+ }
+
+ /**
+ * Does nothing; instead, subclasses should use
+ * {@link #setLocalResult(Object)}} to manage results.
+ *
+ * @param result must be null, or an exception is thrown (this is a safety
+ * tripwire to detect when {@code setRawResult()} is being used
+ * instead of {@code setLocalResult()}
+ */
+ @Override
+ protected void setRawResult(R result) {
+ if (result != null)
+ throw new IllegalStateException();
+ }
+
+ /**
+ * Retrieves a result previously stored with {@link #setLocalResult}
+ *
+ * @return local result for this node previously stored with
+ * {@link #setLocalResult}
+ */
+ protected R getLocalResult() {
+ return localResult;
+ }
+
+ /**
+ * Associates the result with the task, can be retrieved with
+ * {@link #getLocalResult}
+ *
+ * @param localResult local result for this node
+ */
+ protected void setLocalResult(R localResult) {
+ this.localResult = localResult;
+ }
+
+ /**
+ * Indicates whether this task is a leaf node. (Only valid after
+ * {@link #compute} has been called on this node). If the node is not a
+ * leaf node, then children will be non-null and numChildren will be
+ * positive.
+ *
+ * @return {@code true} if this task is a leaf node
+ */
+ protected boolean isLeaf() {
+ return leftChild == null;
+ }
+
+ /**
+ * Indicates whether this task is the root node
+ *
+ * @return {@code true} if this task is the root node.
+ */
+ protected boolean isRoot() {
+ return getParent() == null;
+ }
+
+ /**
+ * Returns the parent of this task, or null if this task is the root
+ *
+ * @return the parent of this task, or null if this task is the root
+ */
+ @SuppressWarnings("unchecked")
+ protected K getParent() {
+ return (K) getCompleter();
+ }
+
+ /**
+ * Decides whether or not to split a task further or compute it directly. If
+ * computing directly, call {@code doLeaf} and pass the result to
+ * {@code setRawResult}. If splitting, set up the child-related fields,
+ * create the child tasks, fork the leftmost (prefix) child tasks, and
+ * compute the rightmost (remaining) child tasks.
+ *
+ * <p>
+ * Computing will continue for rightmost tasks while a task can be computed
+ * as determined by {@link #canCompute()} and that task should and can be
+ * split into left and right tasks.
+ *
+ * <p>
+ * The rightmost tasks are computed in a loop rather than recursively to
+ * avoid potential stack overflows when computing with a right-balanced
+ * tree, such as that produced when splitting with a {@link Spliterator}
+ * created from an {@link java.util.Iterator}.
+ */
+ @Override
+ public final void compute() {
+ @SuppressWarnings("unchecked")
+ K task = (K) this;
+ while (task.canCompute()) {
+ Spliterator<P_IN> split;
+ if (!task.suggestSplit() || (split = task.spliterator.trySplit()) == null) {
+ task.setLocalResult(task.doLeaf());
+ task.tryComplete();
+ return;
+ }
+ else {
+ K l = task.leftChild = task.makeChild(split);
+ K r = task.rightChild = task.makeChild(task.spliterator);
+ task.setPendingCount(1);
+ l.fork();
+ task = r;
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @implNote
+ * Clears spliterator and children fields. Overriders MUST call
+ * {@code super.onCompletion} as the last thing they do if they want these
+ * cleared.
+ */
+ @Override
+ public void onCompletion(CountedCompleter<?> caller) {
+ spliterator = null;
+ leftChild = rightChild = null;
+ }
+
+ /**
+ * Determines if the task can be computed.
+ *
+ * @implSpec The default always returns true
+ *
+ * @return {@code true} if this task can be computed to either calculate the
+ * leaf via {@link #doLeaf()} or split, otherwise false if this task
+ * cannot be computed, for example if this task has been canceled
+ * and/or a result for the computation has been found by another
+ * task.
+ */
+ protected boolean canCompute() {
+ return true;
+ }
+
+ /**
+ * Returns whether this node is a "leftmost" node -- whether the path from
+ * the root to this node involves only traversing leftmost child links. For
+ * a leaf node, this means it is the first leaf node in the encounter order.
+ *
+ * @return {@code true} if this node is a "leftmost" node
+ */
+ protected boolean isLeftmostNode() {
+ @SuppressWarnings("unchecked")
+ K node = (K) this;
+ while (node != null) {
+ K parent = node.getParent();
+ if (parent != null && parent.leftChild != node)
+ return false;
+ node = parent;
+ }
+ return true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/BaseStream.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Iterator;
+import java.util.Spliterator;
+
+/**
+ * Base interface for stream types such as {@link Stream}, {@link IntStream},
+ * etc. Contains methods common to all stream types. Many of these methods
+ * are implemented by {@link AbstractPipeline}, even though
+ * {@code AbstractPipeline} does not directly implement {@code BaseStream}.
+ *
+ * @param <T> type of stream elements
+ * @param <S> type of stream implementing {@code BaseStream}
+ * @since 1.8
+ */
+interface BaseStream<T, S extends BaseStream<T, S>> {
+ /**
+ * Returns an iterator for the elements of this stream.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @return the element iterator for this stream
+ */
+ Iterator<T> iterator();
+
+ /**
+ * Returns a spliterator for the elements of this stream.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @return the element spliterator for this stream
+ */
+ Spliterator<T> spliterator();
+
+ /**
+ * Returns whether this stream, when executed, would execute in parallel
+ * (assuming no further modification of the stream, such as appending
+ * further intermediate operations or changing its parallelism). Calling
+ * this method after invoking an intermediate or terminal stream operation
+ * method may yield unpredictable results.
+ *
+ * @return {@code true} if this stream would execute in parallel if executed
+ * without further modification otherwise {@code false}
+ */
+ boolean isParallel();
+
+ /**
+ * Returns an equivalent stream that is sequential. May return
+ * itself, either because the stream was already sequential, or because
+ * the underlying stream state was modified to be sequential.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @return a sequential stream
+ */
+ S sequential();
+
+ /**
+ * Returns an equivalent stream that is parallel. May return
+ * itself, either because the stream was already parallel, or because
+ * the underlying stream state was modified to be parallel.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @return a parallel stream
+ */
+ S parallel();
+
+ /**
+ * Returns an equivalent stream that is
+ * <a href="package-summary.html#Ordering">unordered</a>. May return
+ * itself if the stream was already unordered.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @return an unordered stream
+ */
+ S unordered();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/CloseableStream.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.util.stream;
+
+/**
+ * A {@code CloseableStream} is a {@code Stream} that can be closed.
+ * The close method is invoked to release resources that the object is
+ * holding (such as open files).
+ *
+ * @param <T> The type of stream elements
+ * @since 1.8
+ */
+public interface CloseableStream<T> extends Stream<T>, AutoCloseable {
+
+ /**
+ * Closes this resource, relinquishing any underlying resources.
+ * This method is invoked automatically on objects managed by the
+ * {@code try}-with-resources statement. Does nothing if called when
+ * the resource has already been closed.
+ *
+ * This method does not allow throwing checked {@code Exception}s like
+ * {@link AutoCloseable#close() AutoCloseable.close()}. Cases where the
+ * close operation may fail require careful attention by implementers. It
+ * is strongly advised to relinquish the underlying resources and to
+ * internally <em>mark</em> the resource as closed. The {@code close}
+ * method is unlikely to be invoked more than once and so this ensures
+ * that the resources are released in a timely manner. Furthermore it
+ * reduces problems that could arise when the resource wraps, or is
+ * wrapped, by another resource.
+ *
+ * @see AutoCloseable#close()
+ */
+ void close();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Collector.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Collections;
+import java.util.Set;
+import java.util.function.BiFunction;
+import java.util.function.BinaryOperator;
+import java.util.function.Supplier;
+
+/**
+ * A <a href="package-summary.html#Reduction">reduction operation</a> that
+ * supports folding input elements into a cumulative result. The result may be
+ * a value or may be a mutable result container. Examples of operations
+ * accumulating results into a mutable result container include: accumulating
+ * input elements into a {@code Collection}; concatenating strings into a
+ * {@code StringBuilder}; computing summary information about elements such as
+ * sum, min, max, or average; computing "pivot table" summaries such as "maximum
+ * valued transaction by seller", etc. Reduction operations can be performed
+ * either sequentially or in parallel.
+ *
+ * <p>The following are examples of using the predefined {@code Collector}
+ * implementations in {@link Collectors} with the {@code Stream} API to perform
+ * mutable reduction tasks:
+ * <pre>{@code
+ * // Accumulate elements into a List
+ * List<String> list = stream.collect(Collectors.toList());
+ *
+ * // Accumulate elements into a TreeSet
+ * Set<String> list = stream.collect(Collectors.toCollection(TreeSet::new));
+ *
+ * // Convert elements to strings and concatenate them, separated by commas
+ * String joined = stream.map(Object::toString)
+ * .collect(Collectors.toStringJoiner(", "))
+ * .toString();
+ *
+ * // Find highest-paid employee
+ * Employee highestPaid = employees.stream()
+ * .collect(Collectors.maxBy(Comparators.comparing(Employee::getSalary)));
+ *
+ * // Group employees by department
+ * Map<Department, List<Employee>> byDept
+ * = employees.stream()
+ * .collect(Collectors.groupingBy(Employee::getDepartment));
+ *
+ * // Find highest-paid employee by department
+ * Map<Department, Employee> highestPaidByDept
+ * = employees.stream()
+ * .collect(Collectors.groupingBy(Employee::getDepartment,
+ * Collectors.maxBy(Comparators.comparing(Employee::getSalary))));
+ *
+ * // Partition students into passing and failing
+ * Map<Boolean, List<Student>> passingFailing =
+ * students.stream()
+ * .collect(Collectors.partitioningBy(s -> s.getGrade() >= PASS_THRESHOLD);
+ *
+ * }</pre>
+ *
+ * <p>A {@code Collector} is specified by three functions that work together to
+ * manage a result or result container. They are: creation of an initial
+ * result, incorporating a new data element into a result, and combining two
+ * results into one. The last function -- combining two results into one -- is
+ * used during parallel operations, where subsets of the input are accumulated
+ * in parallel, and then the subresults merged into a combined result. The
+ * result may be a mutable container or a value. If the result is mutable, the
+ * accumulation and combination functions may either mutate their left argument
+ * and return that (such as adding elements to a collection), or return a new
+ * result, in which case it should not perform any mutation.
+ *
+ * <p>Collectors also have a set of characteristics, including
+ * {@link Characteristics#CONCURRENT} and
+ * {@link Characteristics#STRICTLY_MUTATIVE}. These characteristics provide
+ * hints that can be used by a reduction implementation to provide better
+ * performance.
+ *
+ * <p>Libraries that implement reduction based on {@code Collector}, such as
+ * {@link Stream#collect(Collector)}, must adhere to the following constraints:
+ * <ul>
+ * <li>The first argument passed to the accumulator function, and both
+ * arguments passed to the combiner function, must be the result of a
+ * previous invocation of {@link #resultSupplier()}, {@link #accumulator()},
+ * or {@link #combiner()}.</li>
+ * <li>The implementation should not do anything with the result of any of
+ * the result supplier, accumulator, or combiner functions other than to
+ * pass them again to the accumulator or combiner functions, or return them
+ * to the caller of the reduction operation.</li>
+ * <li>If a result is passed to the accumulator or combiner function, and
+ * the same object is not returned from that function, it is never used
+ * again.</li>
+ * <li>Once a result is passed to the combiner function, it is never passed
+ * to the accumulator function again.</li>
+ * <li>For non-concurrent collectors, any result returned from the result
+ * supplier, accumulator, or combiner functions must be serially
+ * thread-confined. This enables collection to occur in parallel without
+ * the {@code Collector} needing to implement any additional synchronization.
+ * The reduction implementation must manage that the input is properly
+ * partitioned, that partitions are processed in isolation, and combining
+ * happens only after accumulation is complete.</li>
+ * <li>For concurrent collectors, an implementation is free to (but not
+ * required to) implement reduction concurrently. A concurrent reduction
+ * is one where the accumulator function is called concurrently from
+ * multiple threads, using the same concurrently-modifiable result container,
+ * rather than keeping the result isolated during accumulation.
+ * A concurrent reduction should only be applied if the collector has the
+ * {@link Characteristics#UNORDERED} characteristics or if the
+ * originating data is unordered.</li>
+ * </ul>
+ *
+ * @apiNote
+ * Performing a reduction operation with a {@code Collector} should produce a
+ * result equivalent to:
+ * <pre>{@code
+ * BiFunction<R,T,R> accumulator = collector.accumulator();
+ * R result = collector.resultSupplier().get();
+ * for (T t : data)
+ * result = accumulator.apply(result, t);
+ * return result;
+ * }</pre>
+ *
+ * <p>However, the library is free to partition the input, perform the reduction
+ * on the partitions, and then use the combiner function to combine the partial
+ * results to achieve a parallel reduction. Depending on the specific reduction
+ * operation, this may perform better or worse, depending on the relative cost
+ * of the accumulator and combiner functions.
+ *
+ * <p>An example of an operation that can be easily modeled by {@code Collector}
+ * is accumulating elements into a {@code TreeSet}. In this case, the {@code
+ * resultSupplier()} function is {@code () -> new Treeset<T>()}, the
+ * {@code accumulator} function is
+ * {@code (set, element) -> { set.add(element); return set; }}, and the combiner
+ * function is {@code (left, right) -> { left.addAll(right); return left; }}.
+ * (This behavior is implemented by
+ * {@code Collectors.toCollection(TreeSet::new)}).
+ *
+ * TODO Associativity and commutativity
+ *
+ * @see Stream#collect(Collector)
+ * @see Collectors
+ *
+ * @param <T> the type of input element to the collect operation
+ * @param <R> the result type of the collect operation
+ * @since 1.8
+ */
+public interface Collector<T, R> {
+ /**
+ * A function that creates and returns a new result that represents
+ * "no values". If the accumulator or combiner functions may mutate their
+ * arguments, this must be a new, empty result container.
+ *
+ * @return a function which, when invoked, returns a result representing
+ * "no values"
+ */
+ Supplier<R> resultSupplier();
+
+ /**
+ * A function that folds a new value into a cumulative result. The result
+ * may be a mutable result container or a value. The accumulator function
+ * may modify a mutable container and return it, or create a new result and
+ * return that, but if it returns a new result object, it must not modify
+ * any of its arguments.
+ *
+ * <p>If the collector has the {@link Characteristics#STRICTLY_MUTATIVE}
+ * characteristic, then the accumulator function <em>must</em> always return
+ * its first argument, after possibly mutating its state.
+ *
+ * @return a function which folds a new value into a cumulative result
+ */
+ BiFunction<R, T, R> accumulator();
+
+ /**
+ * A function that accepts two partial results and merges them. The
+ * combiner function may fold state from one argument into the other and
+ * return that, or may return a new result object, but if it returns
+ * a new result object, it must not modify the state of either of its
+ * arguments.
+ *
+ * <p>If the collector has the {@link Characteristics#STRICTLY_MUTATIVE}
+ * characteristic, then the combiner function <em>must</em> always return
+ * its first argument, after possibly mutating its state.
+ *
+ * @return a function which combines two partial results into a cumulative
+ * result
+ */
+ BinaryOperator<R> combiner();
+
+ /**
+ * Returns a {@code Set} of {@code Collector.Characteristics} indicating
+ * the characteristics of this Collector. This set should be immutable.
+ *
+ * @return an immutable set of collector characteristics
+ */
+ Set<Characteristics> characteristics();
+
+ /**
+ * Characteristics indicating properties of a {@code Collector}, which can
+ * be used to optimize reduction implementations.
+ */
+ enum Characteristics {
+ /**
+ * Indicates that this collector is <em>concurrent</em>, meaning that
+ * the result container can support the accumulator function being
+ * called concurrently with the same result container from multiple
+ * threads. Concurrent collectors must also always have the
+ * {@code STRICTLY_MUTATIVE} characteristic.
+ *
+ * <p>If a {@code CONCURRENT} collector is not also {@code UNORDERED},
+ * then it should only be evaluated concurrently if applied to an
+ * unordered data source.
+ */
+ CONCURRENT,
+
+ /**
+ * Indicates that the result container has no intrinsic order, such as
+ * a {@link Set}.
+ */
+ UNORDERED,
+
+ /**
+ * Indicates that this collector operates by strict mutation of its
+ * result container. This means that the {@link #accumulator()} and
+ * {@link #combiner()} functions will always modify the state of and
+ * return their first argument, rather than returning a different result
+ * container.
+ */
+ STRICTLY_MUTATIVE
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Collectors.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,1320 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.AbstractMap;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Comparators;
+import java.util.DoubleSummaryStatistics;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.IntSummaryStatistics;
+import java.util.Iterator;
+import java.util.List;
+import java.util.LongSummaryStatistics;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.Set;
+import java.util.StringJoiner;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.BiFunction;
+import java.util.function.BinaryOperator;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+import java.util.function.ToDoubleFunction;
+import java.util.function.ToIntFunction;
+import java.util.function.ToLongFunction;
+
+/**
+ * Implementations of {@link Collector} that implement various useful reduction
+ * operations, such as accumulating elements into collections, summarizing
+ * elements according to various criteria, etc.
+ *
+ * <p>The following are examples of using the predefined {@code Collector}
+ * implementations in {@link Collectors} with the {@code Stream} API to perform
+ * mutable reduction tasks:
+ *
+ * <pre>{@code
+ * // Accumulate elements into a List
+ * List<Person> list = people.collect(Collectors.toList());
+ *
+ * // Accumulate elements into a TreeSet
+ * List<Person> list = people.collect(Collectors.toCollection(TreeSet::new));
+ *
+ * // Convert elements to strings and concatenate them, separated by commas
+ * String joined = stream.map(Object::toString)
+ * .collect(Collectors.toStringJoiner(", "))
+ * .toString();
+ *
+ * // Find highest-paid employee
+ * Employee highestPaid = employees.stream()
+ * .collect(Collectors.maxBy(Comparators.comparing(Employee::getSalary)));
+ *
+ * // Group employees by department
+ * Map<Department, List<Employee>> byDept
+ * = employees.stream()
+ * .collect(Collectors.groupingBy(Employee::getDepartment));
+ *
+ * // Find highest-paid employee by department
+ * Map<Department, Employee> highestPaidByDept
+ * = employees.stream()
+ * .collect(Collectors.groupingBy(Employee::getDepartment,
+ * Collectors.maxBy(Comparators.comparing(Employee::getSalary))));
+ *
+ * // Partition students into passing and failing
+ * Map<Boolean, List<Student>> passingFailing =
+ * students.stream()
+ * .collect(Collectors.partitioningBy(s -> s.getGrade() >= PASS_THRESHOLD);
+ *
+ * }</pre>
+ *
+ * TODO explanation of parallel collection
+ *
+ * @since 1.8
+ */
+public final class Collectors {
+
+ private static final Set<Collector.Characteristics> CH_CONCURRENT
+ = Collections.unmodifiableSet(EnumSet.of(Collector.Characteristics.CONCURRENT,
+ Collector.Characteristics.STRICTLY_MUTATIVE,
+ Collector.Characteristics.UNORDERED));
+ private static final Set<Collector.Characteristics> CH_STRICT
+ = Collections.unmodifiableSet(EnumSet.of(Collector.Characteristics.STRICTLY_MUTATIVE));
+ private static final Set<Collector.Characteristics> CH_STRICT_UNORDERED
+ = Collections.unmodifiableSet(EnumSet.of(Collector.Characteristics.STRICTLY_MUTATIVE,
+ Collector.Characteristics.UNORDERED));
+
+ private Collectors() { }
+
+ /**
+ * Returns a merge function, suitable for use in
+ * {@link Map#merge(Object, Object, BiFunction) Map.merge()} or
+ * {@link #toMap(Function, Function, BinaryOperator) toMap()}, which always
+ * throws {@code IllegalStateException}. This can be used to enforce the
+ * assumption that the elements being collected are distinct.
+ *
+ * @param <T> the type of input arguments to the merge function
+ * @return a merge function which always throw {@code IllegalStateException}
+ *
+ * @see #firstWinsMerger()
+ * @see #lastWinsMerger()
+ */
+ public static <T> BinaryOperator<T> throwingMerger() {
+ return (u,v) -> { throw new IllegalStateException(String.format("Duplicate key %s", u)); };
+ }
+
+ /**
+ * Returns a merge function, suitable for use in
+ * {@link Map#merge(Object, Object, BiFunction) Map.merge()} or
+ * {@link #toMap(Function, Function, BinaryOperator) toMap()},
+ * which implements a "first wins" policy.
+ *
+ * @param <T> the type of input arguments to the merge function
+ * @return a merge function which always returns its first argument
+ * @see #lastWinsMerger()
+ * @see #throwingMerger()
+ */
+ public static <T> BinaryOperator<T> firstWinsMerger() {
+ return (u,v) -> u;
+ }
+
+ /**
+ * Returns a merge function, suitable for use in
+ * {@link Map#merge(Object, Object, BiFunction) Map.merge()} or
+ * {@link #toMap(Function, Function, BinaryOperator) toMap()},
+ * which implements a "last wins" policy.
+ *
+ * @param <T> the type of input arguments to the merge function
+ * @return a merge function which always returns its second argument
+ * @see #firstWinsMerger()
+ * @see #throwingMerger()
+ */
+ public static <T> BinaryOperator<T> lastWinsMerger() {
+ return (u,v) -> v;
+ }
+
+ /**
+ * Simple implementation class for {@code Collector}.
+ *
+ * @param <T> the type of elements to be collected
+ * @param <R> the type of the result
+ */
+ private static final class CollectorImpl<T, R> implements Collector<T,R> {
+ private final Supplier<R> resultSupplier;
+ private final BiFunction<R, T, R> accumulator;
+ private final BinaryOperator<R> combiner;
+ private final Set<Characteristics> characteristics;
+
+ CollectorImpl(Supplier<R> resultSupplier,
+ BiFunction<R, T, R> accumulator,
+ BinaryOperator<R> combiner,
+ Set<Characteristics> characteristics) {
+ this.resultSupplier = resultSupplier;
+ this.accumulator = accumulator;
+ this.combiner = combiner;
+ this.characteristics = characteristics;
+ }
+
+ CollectorImpl(Supplier<R> resultSupplier,
+ BiFunction<R, T, R> accumulator,
+ BinaryOperator<R> combiner) {
+ this(resultSupplier, accumulator, combiner, Collections.emptySet());
+ }
+
+ @Override
+ public BiFunction<R, T, R> accumulator() {
+ return accumulator;
+ }
+
+ @Override
+ public Supplier<R> resultSupplier() {
+ return resultSupplier;
+ }
+
+ @Override
+ public BinaryOperator<R> combiner() {
+ return combiner;
+ }
+
+ @Override
+ public Set<Characteristics> characteristics() {
+ return characteristics;
+ }
+ }
+
+ /**
+ * Returns a {@code Collector} that accumulates the input elements into a
+ * new {@code Collection}, in encounter order. The {@code Collection} is
+ * created by the provided factory.
+ *
+ * @param <T> the type of the input elements
+ * @param <C> the type of the resulting {@code Collection}
+ * @param collectionFactory a {@code Supplier} which returns a new, empty
+ * {@code Collection} of the appropriate type
+ * @return a {@code Collector} which collects all the input elements into a
+ * {@code Collection}, in encounter order
+ */
+ public static <T, C extends Collection<T>>
+ Collector<T, C> toCollection(Supplier<C> collectionFactory) {
+ return new CollectorImpl<>(collectionFactory,
+ (r, t) -> { r.add(t); return r; },
+ (r1, r2) -> { r1.addAll(r2); return r1; },
+ CH_STRICT);
+ }
+
+ /**
+ * Returns a {@code Collector} that accumulates the input elements into a
+ * new {@code List}. There are no guarantees on the type, mutability,
+ * serializability, or thread-safety of the {@code List} returned.
+ *
+ * @param <T> the type of the input elements
+ * @return a {@code Collector} which collects all the input elements into a
+ * {@code List}, in encounter order
+ */
+ public static <T>
+ Collector<T, List<T>> toList() {
+ BiFunction<List<T>, T, List<T>> accumulator = (list, t) -> {
+ switch (list.size()) {
+ case 0:
+ return Collections.singletonList(t);
+ case 1:
+ List<T> newList = new ArrayList<>();
+ newList.add(list.get(0));
+ newList.add(t);
+ return newList;
+ default:
+ list.add(t);
+ return list;
+ }
+ };
+ BinaryOperator<List<T>> combiner = (left, right) -> {
+ switch (left.size()) {
+ case 0:
+ return right;
+ case 1:
+ List<T> newList = new ArrayList<>(left.size() + right.size());
+ newList.addAll(left);
+ newList.addAll(right);
+ return newList;
+ default:
+ left.addAll(right);
+ return left;
+ }
+ };
+ return new CollectorImpl<>(Collections::emptyList, accumulator, combiner);
+ }
+
+ /**
+ * Returns a {@code Collector} that accumulates the input elements into a
+ * new {@code Set}. There are no guarantees on the type, mutability,
+ * serializability, or thread-safety of the {@code Set} returned.
+ *
+ * <p>This is an {@link Collector.Characteristics#UNORDERED unordered}
+ * Collector.
+ *
+ * @param <T> the type of the input elements
+ * @return a {@code Collector} which collects all the input elements into a
+ * {@code Set}
+ */
+ public static <T>
+ Collector<T, Set<T>> toSet() {
+ return new CollectorImpl<>((Supplier<Set<T>>) HashSet::new,
+ (r, t) -> { r.add(t); return r; },
+ (r1, r2) -> { r1.addAll(r2); return r1; },
+ CH_STRICT_UNORDERED);
+ }
+
+ /**
+ * Returns a {@code Collector} that concatenates the input elements into a
+ * new {@link StringBuilder}.
+ *
+ * @return a {@code Collector} which collects String elements into a
+ * {@code StringBuilder}, in encounter order
+ */
+ public static Collector<String, StringBuilder> toStringBuilder() {
+ return new CollectorImpl<>(StringBuilder::new,
+ (r, t) -> { r.append(t); return r; },
+ (r1, r2) -> { r1.append(r2); return r1; },
+ CH_STRICT);
+ }
+
+ /**
+ * Returns a {@code Collector} that concatenates the input elements into a
+ * new {@link StringJoiner}, using the specified delimiter.
+ *
+ * @param delimiter the delimiter to be used between each element
+ * @return A {@code Collector} which collects String elements into a
+ * {@code StringJoiner}, in encounter order
+ */
+ public static Collector<CharSequence, StringJoiner> toStringJoiner(CharSequence delimiter) {
+ BinaryOperator<StringJoiner> merger = (sj, other) -> {
+ if (other.length() > 0)
+ sj.add(other.toString());
+ return sj;
+ };
+ return new CollectorImpl<>(() -> new StringJoiner(delimiter),
+ (r, t) -> { r.add(t); return r; },
+ merger, CH_STRICT);
+ }
+
+ /**
+ * {@code BinaryOperator<Map>} that merges the contents of its right
+ * argument into its left argument, using the provided merge function to
+ * handle duplicate keys.
+ *
+ * @param <K> type of the map keys
+ * @param <V> type of the map values
+ * @param <M> type of the map
+ * @param mergeFunction A merge function suitable for
+ * {@link Map#merge(Object, Object, BiFunction) Map.merge()}
+ * @return a merge function for two maps
+ */
+ private static <K, V, M extends Map<K,V>>
+ BinaryOperator<M> mapMerger(BinaryOperator<V> mergeFunction) {
+ return (m1, m2) -> {
+ for (Map.Entry<K,V> e : m2.entrySet())
+ m1.merge(e.getKey(), e.getValue(), mergeFunction);
+ return m1;
+ };
+ }
+
+ /**
+ * Adapts a {@code Collector<U,R>} to a {@code Collector<T,R>} by applying
+ * a mapping function to each input element before accumulation.
+ *
+ * @apiNote
+ * The {@code mapping()} collectors are most useful when used in a
+ * multi-level reduction, downstream of {@code groupingBy} or
+ * {@code partitioningBy}. For example, given a stream of
+ * {@code Person}, to accumulate the set of last names in each city:
+ * <pre>{@code
+ * Map<City, Set<String>> lastNamesByCity
+ * = people.stream().collect(groupingBy(Person::getCity,
+ * mapping(Person::getLastName, toSet())));
+ * }</pre>
+ *
+ * @param <T> the type of the input elements
+ * @param <U> type of elements accepted by downstream collector
+ * @param <R> result type of collector
+ * @param mapper a function to be applied to the input elements
+ * @param downstream a collector which will accept mapped values
+ * @return a collector which applies the mapping function to the input
+ * elements and provides the mapped results to the downstream collector
+ */
+ public static <T, U, R> Collector<T, R>
+ mapping(Function<? super T, ? extends U> mapper, Collector<? super U, R> downstream) {
+ BiFunction<R, ? super U, R> downstreamAccumulator = downstream.accumulator();
+ return new CollectorImpl<>(downstream.resultSupplier(),
+ (r, t) -> downstreamAccumulator.apply(r, mapper.apply(t)),
+ downstream.combiner(), downstream.characteristics());
+ }
+
+ /**
+ * Returns a {@code Collector<T, Long>} that counts the number of input
+ * elements.
+ *
+ * @implSpec
+ * This produces a result equivalent to:
+ * <pre>{@code
+ * reducing(0L, e -> 1L, Long::sum)
+ * }</pre>
+ *
+ * @param <T> the type of the input elements
+ * @return a {@code Collector} that counts the input elements
+ */
+ public static <T> Collector<T, Long>
+ counting() {
+ return reducing(0L, e -> 1L, Long::sum);
+ }
+
+ /**
+ * Returns a {@code Collector<T, T>} that produces the minimal element
+ * according to a given {@code Comparator}.
+ *
+ * @implSpec
+ * This produces a result equivalent to:
+ * <pre>{@code
+ * reducing(Comparators.lesserOf(comparator))
+ * }</pre>
+ *
+ * @param <T> the type of the input elements
+ * @param comparator a {@code Comparator} for comparing elements
+ * @return a {@code Collector} that produces the minimal value
+ */
+ public static <T> Collector<T, T>
+ minBy(Comparator<? super T> comparator) {
+ return reducing(Comparators.lesserOf(comparator));
+ }
+
+ /**
+ * Returns a {@code Collector<T, T>} that produces the maximal element
+ * according to a given {@code Comparator}.
+ *
+ * @implSpec
+ * This produces a result equivalent to:
+ * <pre>{@code
+ * reducing(Comparators.greaterOf(comparator))
+ * }</pre>
+ *
+ * @param <T> the type of the input elements
+ * @param comparator a {@code Comparator} for comparing elements
+ * @return a {@code Collector} that produces the maximal value
+ */
+ public static <T> Collector<T, T>
+ maxBy(Comparator<? super T> comparator) {
+ return reducing(Comparators.greaterOf(comparator));
+ }
+
+ /**
+ * Returns a {@code Collector<T, Long>} that produces the sum of a
+ * long-valued function applied to the input element.
+ *
+ * @implSpec
+ * This produces a result equivalent to:
+ * <pre>{@code
+ * reducing(0L, mapper, Long::sum)
+ * }</pre>
+ *
+ * @param <T> the type of the input elements
+ * @param mapper a function extracting the property to be summed
+ * @return a {@code Collector} that produces the sum of a derived property
+ */
+ public static <T> Collector<T, Long>
+ sumBy(Function<? super T, Long> mapper) {
+ return reducing(0L, mapper, Long::sum);
+ }
+
+ /**
+ * Returns a {@code Collector<T,T>} which performs a reduction of its
+ * input elements under a specified {@code BinaryOperator}.
+ *
+ * @apiNote
+ * The {@code reducing()} collectors are most useful when used in a
+ * multi-level reduction, downstream of {@code groupingBy} or
+ * {@code partitioningBy}. To perform a simple reduction on a stream,
+ * use {@link Stream#reduce(BinaryOperator)} instead.
+ *
+ * @param <T> element type for the input and output of the reduction
+ * @param identity the identity value for the reduction (also, the value
+ * that is returned when there are no input elements)
+ * @param op a {@code BinaryOperator<T>} used to reduce the input elements
+ * @return a {@code Collector} which implements the reduction operation
+ *
+ * @see #reducing(BinaryOperator)
+ * @see #reducing(Object, Function, BinaryOperator)
+ */
+ public static <T> Collector<T, T>
+ reducing(T identity, BinaryOperator<T> op) {
+ return new CollectorImpl<>(() -> identity, (r, t) -> (r == null ? t : op.apply(r, t)), op);
+ }
+
+ /**
+ * Returns a {@code Collector<T,T>} which performs a reduction of its
+ * input elements under a specified {@code BinaryOperator}.
+ *
+ * @apiNote
+ * The {@code reducing()} collectors are most useful when used in a
+ * multi-level reduction, downstream of {@code groupingBy} or
+ * {@code partitioningBy}. To perform a simple reduction on a stream,
+ * use {@link Stream#reduce(BinaryOperator)} instead.
+ *
+ * <p>For example, given a stream of {@code Person}, to calculate tallest
+ * person in each city:
+ * <pre>{@code
+ * Comparator<Person> byHeight = Comparators.comparing(Person::getHeight);
+ * BinaryOperator<Person> tallerOf = Comparators.greaterOf(byHeight);
+ * Map<City, Person> tallestByCity
+ * = people.stream().collect(groupingBy(Person::getCity, reducing(tallerOf)));
+ * }</pre>
+ *
+ * @implSpec
+ * The default implementation is equivalent to:
+ * <pre>{@code
+ * reducing(null, op);
+ * }</pre>
+ *
+ * @param <T> element type for the input and output of the reduction
+ * @param op a {@code BinaryOperator<T>} used to reduce the input elements
+ * @return a {@code Collector} which implements the reduction operation
+ *
+ * @see #reducing(Object, BinaryOperator)
+ * @see #reducing(Object, Function, BinaryOperator)
+ */
+ public static <T> Collector<T, T>
+ reducing(BinaryOperator<T> op) {
+ return reducing(null, op);
+ }
+
+ /**
+ * Returns a {@code Collector<T,U>} which performs a reduction of its
+ * input elements under a specified mapping function and
+ * {@code BinaryOperator}. This is a generalization of
+ * {@link #reducing(Object, BinaryOperator)} which allows a transformation
+ * of the elements before reduction.
+ *
+ * @apiNote
+ * The {@code reducing()} collectors are most useful when used in a
+ * multi-level reduction, downstream of {@code groupingBy} or
+ * {@code partitioningBy}. To perform a simple reduction on a stream,
+ * use {@link Stream#reduce(BinaryOperator)} instead.
+ *
+ * <p>For example, given a stream of {@code Person}, to calculate the longest
+ * last name of residents in each city:
+ * <pre>{@code
+ * Comparator<String> byLength = Comparators.comparing(String::length);
+ * BinaryOperator<String> longerOf = Comparators.greaterOf(byLength);
+ * Map<City, String> longestLastNameByCity
+ * = people.stream().collect(groupingBy(Person::getCity,
+ * reducing(Person::getLastName, longerOf)));
+ * }</pre>
+ *
+ * @param <T> the type of the input elements
+ * @param <U> the type of the mapped values
+ * @param identity the identity value for the reduction (also, the value
+ * that is returned when there are no input elements)
+ * @param mapper a mapping function to apply to each input value
+ * @param op a {@code BinaryOperator<U>} used to reduce the mapped values
+ * @return a {@code Collector} implementing the map-reduce operation
+ *
+ * @see #reducing(Object, BinaryOperator)
+ * @see #reducing(BinaryOperator)
+ */
+ public static <T, U>
+ Collector<T, U> reducing(U identity,
+ Function<? super T, ? extends U> mapper,
+ BinaryOperator<U> op) {
+ return new CollectorImpl<>(() -> identity,
+ (r, t) -> (r == null ? mapper.apply(t) : op.apply(r, mapper.apply(t))),
+ op);
+ }
+
+ /**
+ * Returns a {@code Collector} implementing a "group by" operation on
+ * input elements of type {@code T}, grouping elements according to a
+ * classification function.
+ *
+ * <p>The classification function maps elements to some key type {@code K}.
+ * The collector produces a {@code Map<K, List<T>>} whose keys are the
+ * values resulting from applying the classification function to the input
+ * elements, and whose corresponding values are {@code List}s containing the
+ * input elements which map to the associated key under the classification
+ * function.
+ *
+ * <p>There are no guarantees on the type, mutability, serializability, or
+ * thread-safety of the {@code Map} or {@code List} objects returned.
+ * @implSpec
+ * This produces a result similar to:
+ * <pre>{@code
+ * groupingBy(classifier, toList());
+ * }</pre>
+ *
+ * @param <T> the type of the input elements
+ * @param <K> the type of the keys
+ * @param classifier the classifier function mapping input elements to keys
+ * @return a {@code Collector} implementing the group-by operation
+ *
+ * @see #groupingBy(Function, Collector)
+ * @see #groupingBy(Function, Supplier, Collector)
+ * @see #groupingByConcurrent(Function)
+ */
+ public static <T, K>
+ Collector<T, Map<K, List<T>>> groupingBy(Function<? super T, ? extends K> classifier) {
+ return groupingBy(classifier, HashMap::new, toList());
+ }
+
+ /**
+ * Returns a {@code Collector} implementing a cascaded "group by" operation
+ * on input elements of type {@code T}, grouping elements according to a
+ * classification function, and then performing a reduction operation on
+ * the values associated with a given key using the specified downstream
+ * {@code Collector}.
+ *
+ * <p>The classification function maps elements to some key type {@code K}.
+ * The downstream collector operates on elements of type {@code T} and
+ * produces a result of type {@code D}. The resulting collector produces a
+ * {@code Map<K, D>}.
+ *
+ * <p>There are no guarantees on the type, mutability,
+ * serializability, or thread-safety of the {@code Map} returned.
+ *
+ * <p>For example, to compute the set of last names of people in each city:
+ * <pre>{@code
+ * Map<City, Set<String>> namesByCity
+ * = people.stream().collect(groupingBy(Person::getCity,
+ * mapping(Person::getLastName, toSet())));
+ * }</pre>
+ *
+ * @param <T> the type of the input elements
+ * @param <K> the type of the keys
+ * @param <D> the result type of the downstream reduction
+ * @param classifier a classifier function mapping input elements to keys
+ * @param downstream a {@code Collector} implementing the downstream reduction
+ * @return a {@code Collector} implementing the cascaded group-by operation
+ * @see #groupingBy(Function)
+ *
+ * @see #groupingBy(Function, Supplier, Collector)
+ * @see #groupingByConcurrent(Function, Collector)
+ */
+ public static <T, K, D>
+ Collector<T, Map<K, D>> groupingBy(Function<? super T, ? extends K> classifier,
+ Collector<? super T, D> downstream) {
+ return groupingBy(classifier, HashMap::new, downstream);
+ }
+
+ /**
+ * Returns a {@code Collector} implementing a cascaded "group by" operation
+ * on input elements of type {@code T}, grouping elements according to a
+ * classification function, and then performing a reduction operation on
+ * the values associated with a given key using the specified downstream
+ * {@code Collector}. The {@code Map} produced by the Collector is created
+ * with the supplied factory function.
+ *
+ * <p>The classification function maps elements to some key type {@code K}.
+ * The downstream collector operates on elements of type {@code T} and
+ * produces a result of type {@code D}. The resulting collector produces a
+ * {@code Map<K, D>}.
+ *
+ * <p>For example, to compute the set of last names of people in each city,
+ * where the city names are sorted:
+ * <pre>{@code
+ * Map<City, Set<String>> namesByCity
+ * = people.stream().collect(groupingBy(Person::getCity, TreeMap::new,
+ * mapping(Person::getLastName, toSet())));
+ * }</pre>
+ *
+ * @param <T> the type of the input elements
+ * @param <K> the type of the keys
+ * @param <D> the result type of the downstream reduction
+ * @param <M> the type of the resulting {@code Map}
+ * @param classifier a classifier function mapping input elements to keys
+ * @param downstream a {@code Collector} implementing the downstream reduction
+ * @param mapFactory a function which, when called, produces a new empty
+ * {@code Map} of the desired type
+ * @return a {@code Collector} implementing the cascaded group-by operation
+ *
+ * @see #groupingBy(Function, Collector)
+ * @see #groupingBy(Function)
+ * @see #groupingByConcurrent(Function, Supplier, Collector)
+ */
+ public static <T, K, D, M extends Map<K, D>>
+ Collector<T, M> groupingBy(Function<? super T, ? extends K> classifier,
+ Supplier<M> mapFactory,
+ Collector<? super T, D> downstream) {
+ Supplier<D> downstreamSupplier = downstream.resultSupplier();
+ BiFunction<D, ? super T, D> downstreamAccumulator = downstream.accumulator();
+ BiFunction<M, T, M> accumulator = (m, t) -> {
+ K key = Objects.requireNonNull(classifier.apply(t), "element cannot be mapped to a null key");
+ D oldContainer = m.computeIfAbsent(key, k -> downstreamSupplier.get());
+ D newContainer = downstreamAccumulator.apply(oldContainer, t);
+ if (newContainer != oldContainer)
+ m.put(key, newContainer);
+ return m;
+ };
+ return new CollectorImpl<>(mapFactory, accumulator, mapMerger(downstream.combiner()), CH_STRICT);
+ }
+
+ /**
+ * Returns a {@code Collector} implementing a concurrent "group by"
+ * operation on input elements of type {@code T}, grouping elements
+ * according to a classification function.
+ *
+ * <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
+ * {@link Collector.Characteristics#UNORDERED unordered} Collector.
+ *
+ * <p>The classification function maps elements to some key type {@code K}.
+ * The collector produces a {@code ConcurrentMap<K, List<T>>} whose keys are the
+ * values resulting from applying the classification function to the input
+ * elements, and whose corresponding values are {@code List}s containing the
+ * input elements which map to the associated key under the classification
+ * function.
+ *
+ * <p>There are no guarantees on the type, mutability, or serializability
+ * of the {@code Map} or {@code List} objects returned, or of the
+ * thread-safety of the {@code List} objects returned.
+ * @implSpec
+ * This produces a result similar to:
+ * <pre>{@code
+ * groupingByConcurrent(classifier, toList());
+ * }</pre>
+ *
+ * @param <T> the type of the input elements
+ * @param <K> the type of the keys
+ * @param classifier a classifier function mapping input elements to keys
+ * @return a {@code Collector} implementing the group-by operation
+ *
+ * @see #groupingBy(Function)
+ * @see #groupingByConcurrent(Function, Collector)
+ * @see #groupingByConcurrent(Function, Supplier, Collector)
+ */
+ public static <T, K>
+ Collector<T, ConcurrentMap<K, List<T>>> groupingByConcurrent(Function<? super T, ? extends K> classifier) {
+ return groupingByConcurrent(classifier, ConcurrentHashMap::new, toList());
+ }
+
+ /**
+ * Returns a {@code Collector} implementing a concurrent cascaded "group by"
+ * operation on input elements of type {@code T}, grouping elements
+ * according to a classification function, and then performing a reduction
+ * operation on the values associated with a given key using the specified
+ * downstream {@code Collector}.
+ *
+ * <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
+ * {@link Collector.Characteristics#UNORDERED unordered} Collector.
+ *
+ * <p>The classification function maps elements to some key type {@code K}.
+ * The downstream collector operates on elements of type {@code T} and
+ * produces a result of type {@code D}. The resulting collector produces a
+ * {@code Map<K, D>}.
+ *
+ * <p>For example, to compute the set of last names of people in each city,
+ * where the city names are sorted:
+ * <pre>{@code
+ * ConcurrentMap<City, Set<String>> namesByCity
+ * = people.stream().collect(groupingByConcurrent(Person::getCity, TreeMap::new,
+ * mapping(Person::getLastName, toSet())));
+ * }</pre>
+ *
+ * @param <T> the type of the input elements
+ * @param <K> the type of the keys
+ * @param <D> the result type of the downstream reduction
+ * @param classifier a classifier function mapping input elements to keys
+ * @param downstream a {@code Collector} implementing the downstream reduction
+ * @return a {@code Collector} implementing the cascaded group-by operation
+ *
+ * @see #groupingBy(Function, Collector)
+ * @see #groupingByConcurrent(Function)
+ * @see #groupingByConcurrent(Function, Supplier, Collector)
+ */
+ public static <T, K, D>
+ Collector<T, ConcurrentMap<K, D>> groupingByConcurrent(Function<? super T, ? extends K> classifier,
+ Collector<? super T, D> downstream) {
+ return groupingByConcurrent(classifier, ConcurrentHashMap::new, downstream);
+ }
+
+ /**
+ * Returns a concurrent {@code Collector} implementing a cascaded "group by"
+ * operation on input elements of type {@code T}, grouping elements
+ * according to a classification function, and then performing a reduction
+ * operation on the values associated with a given key using the specified
+ * downstream {@code Collector}. The {@code ConcurrentMap} produced by the
+ * Collector is created with the supplied factory function.
+ *
+ * <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
+ * {@link Collector.Characteristics#UNORDERED unordered} Collector.
+ *
+ * <p>The classification function maps elements to some key type {@code K}.
+ * The downstream collector operates on elements of type {@code T} and
+ * produces a result of type {@code D}. The resulting collector produces a
+ * {@code Map<K, D>}.
+ *
+ * <p>For example, to compute the set of last names of people in each city,
+ * where the city names are sorted:
+ * <pre>{@code
+ * ConcurrentMap<City, Set<String>> namesByCity
+ * = people.stream().collect(groupingBy(Person::getCity, ConcurrentSkipListMap::new,
+ * mapping(Person::getLastName, toSet())));
+ * }</pre>
+ *
+ *
+ * @param <T> the type of the input elements
+ * @param <K> the type of the keys
+ * @param <D> the result type of the downstream reduction
+ * @param <M> the type of the resulting {@code ConcurrentMap}
+ * @param classifier a classifier function mapping input elements to keys
+ * @param downstream a {@code Collector} implementing the downstream reduction
+ * @param mapFactory a function which, when called, produces a new empty
+ * {@code ConcurrentMap} of the desired type
+ * @return a {@code Collector} implementing the cascaded group-by operation
+ *
+ * @see #groupingByConcurrent(Function)
+ * @see #groupingByConcurrent(Function, Collector)
+ * @see #groupingBy(Function, Supplier, Collector)
+ */
+ public static <T, K, D, M extends ConcurrentMap<K, D>>
+ Collector<T, M> groupingByConcurrent(Function<? super T, ? extends K> classifier,
+ Supplier<M> mapFactory,
+ Collector<? super T, D> downstream) {
+ Supplier<D> downstreamSupplier = downstream.resultSupplier();
+ BiFunction<D, ? super T, D> downstreamAccumulator = downstream.accumulator();
+ BinaryOperator<M> combiner = mapMerger(downstream.combiner());
+ if (downstream.characteristics().contains(Collector.Characteristics.CONCURRENT)) {
+ BiFunction<M, T, M> accumulator = (m, t) -> {
+ K key = Objects.requireNonNull(classifier.apply(t), "element cannot be mapped to a null key");
+ downstreamAccumulator.apply(m.computeIfAbsent(key, k -> downstreamSupplier.get()), t);
+ return m;
+ };
+ return new CollectorImpl<>(mapFactory, accumulator, combiner, CH_CONCURRENT);
+ } else if (downstream.characteristics().contains(Collector.Characteristics.STRICTLY_MUTATIVE)) {
+ BiFunction<M, T, M> accumulator = (m, t) -> {
+ K key = Objects.requireNonNull(classifier.apply(t), "element cannot be mapped to a null key");
+ D resultContainer = m.computeIfAbsent(key, k -> downstreamSupplier.get());
+ synchronized (resultContainer) {
+ downstreamAccumulator.apply(resultContainer, t);
+ }
+ return m;
+ };
+ return new CollectorImpl<>(mapFactory, accumulator, combiner, CH_CONCURRENT);
+ } else {
+ BiFunction<M, T, M> accumulator = (m, t) -> {
+ K key = Objects.requireNonNull(classifier.apply(t), "element cannot be mapped to a null key");
+ do {
+ D oldResult = m.computeIfAbsent(key, k -> downstreamSupplier.get());
+ if (oldResult == null) {
+ if (m.putIfAbsent(key, downstreamAccumulator.apply(null, t)) == null)
+ return m;
+ } else {
+ synchronized (oldResult) {
+ if (m.get(key) != oldResult)
+ continue;
+ D newResult = downstreamAccumulator.apply(oldResult, t);
+ if (oldResult != newResult)
+ m.put(key, newResult);
+ return m;
+ }
+ }
+ } while (true);
+ };
+ return new CollectorImpl<>(mapFactory, accumulator, combiner, CH_CONCURRENT);
+ }
+ }
+
+ /**
+ * Returns a {@code Collector} which partitions the input elements according
+ * to a {@code Predicate}, and organizes them into a
+ * {@code Map<Boolean, List<T>>}.
+ *
+ * There are no guarantees on the type, mutability,
+ * serializability, or thread-safety of the {@code Map} returned.
+ *
+ * @param <T> the type of the input elements
+ * @param predicate a predicate used for classifying input elements
+ * @return a {@code Collector} implementing the partitioning operation
+ *
+ * @see #partitioningBy(Predicate, Collector)
+ */
+ public static <T>
+ Collector<T, Map<Boolean, List<T>>> partitioningBy(Predicate<? super T> predicate) {
+ return partitioningBy(predicate, toList());
+ }
+
+ /**
+ * Returns a {@code Collector} which partitions the input elements according
+ * to a {@code Predicate}, reduces the values in each partition according to
+ * another {@code Collector}, and organizes them into a
+ * {@code Map<Boolean, D>} whose values are the result of the downstream
+ * reduction.
+ *
+ * <p>There are no guarantees on the type, mutability,
+ * serializability, or thread-safety of the {@code Map} returned.
+ *
+ * @param <T> the type of the input elements
+ * @param <D> the result type of the downstream reduction
+ * @param predicate a predicate used for classifying input elements
+ * @param downstream a {@code Collector} implementing the downstream
+ * reduction
+ * @return a {@code Collector} implementing the cascaded partitioning
+ * operation
+ *
+ * @see #partitioningBy(Predicate)
+ */
+ public static <T, D>
+ Collector<T, Map<Boolean, D>> partitioningBy(Predicate<? super T> predicate,
+ Collector<? super T, D> downstream) {
+ BiFunction<D, ? super T, D> downstreamAccumulator = downstream.accumulator();
+ BiFunction<Map<Boolean, D>, T, Map<Boolean, D>> accumulator = (result, t) -> {
+ Partition<D> asPartition = ((Partition<D>) result);
+ if (predicate.test(t)) {
+ D newResult = downstreamAccumulator.apply(asPartition.forTrue, t);
+ if (newResult != asPartition.forTrue)
+ asPartition.forTrue = newResult;
+ } else {
+ D newResult = downstreamAccumulator.apply(asPartition.forFalse, t);
+ if (newResult != asPartition.forFalse)
+ asPartition.forFalse = newResult;
+ }
+ return result;
+ };
+ return new CollectorImpl<>(() -> new Partition<>(downstream.resultSupplier().get(),
+ downstream.resultSupplier().get()),
+ accumulator, partitionMerger(downstream.combiner()), CH_STRICT);
+ }
+
+ /**
+ * Merge function for two partitions, given a merge function for the
+ * elements.
+ */
+ private static <D> BinaryOperator<Map<Boolean, D>> partitionMerger(BinaryOperator<D> op) {
+ return (m1, m2) -> {
+ Partition<D> left = (Partition<D>) m1;
+ Partition<D> right = (Partition<D>) m2;
+ if (left.forFalse == null)
+ left.forFalse = right.forFalse;
+ else if (right.forFalse != null)
+ left.forFalse = op.apply(left.forFalse, right.forFalse);
+ if (left.forTrue == null)
+ left.forTrue = right.forTrue;
+ else if (right.forTrue != null)
+ left.forTrue = op.apply(left.forTrue, right.forTrue);
+ return left;
+ };
+ }
+
+ /**
+ * Accumulate elements into a {@code Map} whose keys and values are the
+ * result of applying mapping functions to the input elements.
+ * If the mapped keys contains duplicates (according to
+ * {@link Object#equals(Object)}), an {@code IllegalStateException} is
+ * thrown when the collection operation is performed. If the mapped keys
+ * may have duplicates, use {@link #toMap(Function, Function, BinaryOperator)}
+ * instead.
+ *
+ * @apiNote
+ * It is common for either the key or the value to be the input elements.
+ * In this case, the utility method
+ * {@link java.util.function.Function#identity()} may be helpful.
+ * For example, the following produces a {@code Map} mapping
+ * students to their grade point average:
+ * <pre>{@code
+ * Map<Student, Double> studentToGPA
+ * students.stream().collect(toMap(Functions.identity(),
+ * student -> computeGPA(student)));
+ * }</pre>
+ * And the following produces a {@code Map} mapping a unique identifier to
+ * students:
+ * <pre>{@code
+ * Map<String, Student> studentIdToStudent
+ * students.stream().collect(toMap(Student::getId,
+ * Functions.identity());
+ * }</pre>
+ *
+ * @param <T> the type of the input elements
+ * @param <K> the output type of the key mapping function
+ * @param <U> the output type of the value mapping function
+ * @param keyMapper a mapping function to produce keys
+ * @param valueMapper a mapping function to produce values
+ * @return a {@code Collector} which collects elements into a {@code Map}
+ * whose keys and values are the result of applying mapping functions to
+ * the input elements
+ *
+ * @see #toMap(Function, Function, BinaryOperator)
+ * @see #toMap(Function, Function, BinaryOperator, Supplier)
+ * @see #toConcurrentMap(Function, Function)
+ */
+ public static <T, K, U>
+ Collector<T, Map<K,U>> toMap(Function<? super T, ? extends K> keyMapper,
+ Function<? super T, ? extends U> valueMapper) {
+ return toMap(keyMapper, valueMapper, throwingMerger(), HashMap::new);
+ }
+
+ /**
+ * Accumulate elements into a {@code Map} whose keys and values are the
+ * result of applying mapping functions to the input elements. If the mapped
+ * keys contains duplicates (according to {@link Object#equals(Object)}),
+ * the value mapping function is applied to each equal element, and the
+ * results are merged using the provided merging function.
+ *
+ * @apiNote
+ * There are multiple ways to deal with collisions between multiple elements
+ * mapping to the same key. There are some predefined merging functions,
+ * such as {@link #throwingMerger()}, {@link #firstWinsMerger()}, and
+ * {@link #lastWinsMerger()}, that implement common policies, or you can
+ * implement custom policies easily. For example, if you have a stream
+ * of {@code Person}, and you want to produce a "phone book" mapping name to
+ * address, but it is possible that two persons have the same name, you can
+ * do as follows to gracefully deals with these collisions, and produce a
+ * {@code Map} mapping names to a concatenated list of addresses:
+ * <pre>{@code
+ * Map<String, String> phoneBook
+ * people.stream().collect(toMap(Person::getName,
+ * Person::getAddress,
+ * (s, a) -> s + ", " + a));
+ * }</pre>
+ *
+ * @param <T> the type of the input elements
+ * @param <K> the output type of the key mapping function
+ * @param <U> the output type of the value mapping function
+ * @param keyMapper a mapping function to produce keys
+ * @param valueMapper a mapping function to produce values
+ * @param mergeFunction a merge function, used to resolve collisions between
+ * values associated with the same key, as supplied
+ * to {@link Map#merge(Object, Object, BiFunction)}
+ * @return a {@code Collector} which collects elements into a {@code Map}
+ * whose keys are the result of applying a key mapping function to the input
+ * elements, and whose values are the result of applying a value mapping
+ * function to all input elements equal to the key and combining them
+ * using the merge function
+ *
+ * @see #toMap(Function, Function)
+ * @see #toMap(Function, Function, BinaryOperator, Supplier)
+ * @see #toConcurrentMap(Function, Function, BinaryOperator)
+ */
+ public static <T, K, U>
+ Collector<T, Map<K,U>> toMap(Function<? super T, ? extends K> keyMapper,
+ Function<? super T, ? extends U> valueMapper,
+ BinaryOperator<U> mergeFunction) {
+ return toMap(keyMapper, valueMapper, mergeFunction, HashMap::new);
+ }
+
+ /**
+ * Accumulate elements into a {@code Map} whose keys and values are the
+ * result of applying mapping functions to the input elements. If the mapped
+ * keys contains duplicates (according to {@link Object#equals(Object)}),
+ * the value mapping function is applied to each equal element, and the
+ * results are merged using the provided merging function. The {@code Map}
+ * is created by a provided supplier function.
+ *
+ * @param <T> the type of the input elements
+ * @param <K> the output type of the key mapping function
+ * @param <U> the output type of the value mapping function
+ * @param <M> the type of the resulting {@code Map}
+ * @param keyMapper a mapping function to produce keys
+ * @param valueMapper a mapping function to produce values
+ * @param mergeFunction a merge function, used to resolve collisions between
+ * values associated with the same key, as supplied
+ * to {@link Map#merge(Object, Object, BiFunction)}
+ * @param mapSupplier a function which returns a new, empty {@code Map} into
+ * which the results will be inserted
+ * @return a {@code Collector} which collects elements into a {@code Map}
+ * whose keys are the result of applying a key mapping function to the input
+ * elements, and whose values are the result of applying a value mapping
+ * function to all input elements equal to the key and combining them
+ * using the merge function
+ *
+ * @see #toMap(Function, Function)
+ * @see #toMap(Function, Function, BinaryOperator)
+ * @see #toConcurrentMap(Function, Function, BinaryOperator, Supplier)
+ */
+ public static <T, K, U, M extends Map<K, U>>
+ Collector<T, M> toMap(Function<? super T, ? extends K> keyMapper,
+ Function<? super T, ? extends U> valueMapper,
+ BinaryOperator<U> mergeFunction,
+ Supplier<M> mapSupplier) {
+ BiFunction<M, T, M> accumulator
+ = (map, element) -> {
+ map.merge(keyMapper.apply(element), valueMapper.apply(element), mergeFunction);
+ return map;
+ };
+ return new CollectorImpl<>(mapSupplier, accumulator, mapMerger(mergeFunction), CH_STRICT);
+ }
+
+ /**
+ * Accumulate elements into a {@code ConcurrentMap} whose keys and values
+ * are the result of applying mapping functions to the input elements.
+ * If the mapped keys contains duplicates (according to
+ * {@link Object#equals(Object)}), an {@code IllegalStateException} is
+ * thrown when the collection operation is performed. If the mapped keys
+ * may have duplicates, use
+ * {@link #toConcurrentMap(Function, Function, BinaryOperator)} instead.
+ *
+ * @apiNote
+ * It is common for either the key or the value to be the input elements.
+ * In this case, the utility method
+ * {@link java.util.function.Function#identity()} may be helpful.
+ * For example, the following produces a {@code Map} mapping
+ * students to their grade point average:
+ * <pre>{@code
+ * Map<Student, Double> studentToGPA
+ * students.stream().collect(toMap(Functions.identity(),
+ * student -> computeGPA(student)));
+ * }</pre>
+ * And the following produces a {@code Map} mapping a unique identifier to
+ * students:
+ * <pre>{@code
+ * Map<String, Student> studentIdToStudent
+ * students.stream().collect(toConcurrentMap(Student::getId,
+ * Functions.identity());
+ * }</pre>
+ *
+ * <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
+ * {@link Collector.Characteristics#UNORDERED unordered} Collector.
+ *
+ * @param <T> the type of the input elements
+ * @param <K> the output type of the key mapping function
+ * @param <U> the output type of the value mapping function
+ * @param keyMapper the mapping function to produce keys
+ * @param valueMapper the mapping function to produce values
+ * @return a concurrent {@code Collector} which collects elements into a
+ * {@code ConcurrentMap} whose keys are the result of applying a key mapping
+ * function to the input elements, and whose values are the result of
+ * applying a value mapping function to the input elements
+ *
+ * @see #toMap(Function, Function)
+ * @see #toConcurrentMap(Function, Function, BinaryOperator)
+ * @see #toConcurrentMap(Function, Function, BinaryOperator, Supplier)
+ */
+ public static <T, K, U>
+ Collector<T, ConcurrentMap<K,U>> toConcurrentMap(Function<? super T, ? extends K> keyMapper,
+ Function<? super T, ? extends U> valueMapper) {
+ return toConcurrentMap(keyMapper, valueMapper, throwingMerger(), ConcurrentHashMap::new);
+ }
+
+ /**
+ * Accumulate elements into a {@code ConcurrentMap} whose keys and values
+ * are the result of applying mapping functions to the input elements. If
+ * the mapped keys contains duplicates (according to {@link Object#equals(Object)}),
+ * the value mapping function is applied to each equal element, and the
+ * results are merged using the provided merging function.
+ *
+ * @apiNote
+ * There are multiple ways to deal with collisions between multiple elements
+ * mapping to the same key. There are some predefined merging functions,
+ * such as {@link #throwingMerger()}, {@link #firstWinsMerger()}, and
+ * {@link #lastWinsMerger()}, that implement common policies, or you can
+ * implement custom policies easily. For example, if you have a stream
+ * of {@code Person}, and you want to produce a "phone book" mapping name to
+ * address, but it is possible that two persons have the same name, you can
+ * do as follows to gracefully deals with these collisions, and produce a
+ * {@code Map} mapping names to a concatenated list of addresses:
+ * <pre>{@code
+ * Map<String, String> phoneBook
+ * people.stream().collect(toConcurrentMap(Person::getName,
+ * Person::getAddress,
+ * (s, a) -> s + ", " + a));
+ * }</pre>
+ *
+ * <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
+ * {@link Collector.Characteristics#UNORDERED unordered} Collector.
+ *
+ * @param <T> the type of the input elements
+ * @param <K> the output type of the key mapping function
+ * @param <U> the output type of the value mapping function
+ * @param keyMapper a mapping function to produce keys
+ * @param valueMapper a mapping function to produce values
+ * @param mergeFunction a merge function, used to resolve collisions between
+ * values associated with the same key, as supplied
+ * to {@link Map#merge(Object, Object, BiFunction)}
+ * @return a concurrent {@code Collector} which collects elements into a
+ * {@code ConcurrentMap} whose keys are the result of applying a key mapping
+ * function to the input elements, and whose values are the result of
+ * applying a value mapping function to all input elements equal to the key
+ * and combining them using the merge function
+ *
+ * @see #toConcurrentMap(Function, Function)
+ * @see #toConcurrentMap(Function, Function, BinaryOperator, Supplier)
+ * @see #toMap(Function, Function, BinaryOperator)
+ */
+ public static <T, K, U>
+ Collector<T, ConcurrentMap<K,U>> toConcurrentMap(Function<? super T, ? extends K> keyMapper,
+ Function<? super T, ? extends U> valueMapper,
+ BinaryOperator<U> mergeFunction) {
+ return toConcurrentMap(keyMapper, valueMapper, mergeFunction, ConcurrentHashMap::new);
+ }
+
+ /**
+ * Accumulate elements into a {@code ConcurrentMap} whose keys and values
+ * are the result of applying mapping functions to the input elements. If
+ * the mapped keys contains duplicates (according to {@link Object#equals(Object)}),
+ * the value mapping function is applied to each equal element, and the
+ * results are merged using the provided merging function. The
+ * {@code ConcurrentMap} is created by a provided supplier function.
+ *
+ * <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
+ * {@link Collector.Characteristics#UNORDERED unordered} Collector.
+ *
+ * @param <T> the type of the input elements
+ * @param <K> the output type of the key mapping function
+ * @param <U> the output type of the value mapping function
+ * @param <M> the type of the resulting {@code ConcurrentMap}
+ * @param keyMapper a mapping function to produce keys
+ * @param valueMapper a mapping function to produce values
+ * @param mergeFunction a merge function, used to resolve collisions between
+ * values associated with the same key, as supplied
+ * to {@link Map#merge(Object, Object, BiFunction)}
+ * @param mapSupplier a function which returns a new, empty {@code Map} into
+ * which the results will be inserted
+ * @return a concurrent {@code Collector} which collects elements into a
+ * {@code ConcurrentMap} whose keys are the result of applying a key mapping
+ * function to the input elements, and whose values are the result of
+ * applying a value mapping function to all input elements equal to the key
+ * and combining them using the merge function
+ *
+ * @see #toConcurrentMap(Function, Function)
+ * @see #toConcurrentMap(Function, Function, BinaryOperator)
+ * @see #toMap(Function, Function, BinaryOperator, Supplier)
+ */
+ public static <T, K, U, M extends ConcurrentMap<K, U>>
+ Collector<T, M> toConcurrentMap(Function<? super T, ? extends K> keyMapper,
+ Function<? super T, ? extends U> valueMapper,
+ BinaryOperator<U> mergeFunction,
+ Supplier<M> mapSupplier) {
+ BiFunction<M, T, M> accumulator = (map, element) -> {
+ map.merge(keyMapper.apply(element), valueMapper.apply(element), mergeFunction);
+ return map;
+ };
+ return new CollectorImpl<>(mapSupplier, accumulator, mapMerger(mergeFunction), CH_CONCURRENT);
+ }
+
+ /**
+ * Returns a {@code Collector} which applies an {@code int}-producing
+ * mapping function to each input element, and returns summary statistics
+ * for the resulting values.
+ *
+ * @param <T> the type of the input elements
+ * @param mapper a mapping function to apply to each element
+ * @return a {@code Collector} implementing the summary-statistics reduction
+ *
+ * @see #toDoubleSummaryStatistics(ToDoubleFunction)
+ * @see #toLongSummaryStatistics(ToLongFunction)
+ */
+ public static <T>
+ Collector<T, IntSummaryStatistics> toIntSummaryStatistics(ToIntFunction<? super T> mapper) {
+ return new CollectorImpl<>(IntSummaryStatistics::new,
+ (r, t) -> { r.accept(mapper.applyAsInt(t)); return r; },
+ (l, r) -> { l.combine(r); return l; }, CH_STRICT);
+ }
+
+ /**
+ * Returns a {@code Collector} which applies an {@code long}-producing
+ * mapping function to each input element, and returns summary statistics
+ * for the resulting values.
+ *
+ * @param <T> the type of the input elements
+ * @param mapper the mapping function to apply to each element
+ * @return a {@code Collector} implementing the summary-statistics reduction
+ *
+ * @see #toDoubleSummaryStatistics(ToDoubleFunction)
+ * @see #toIntSummaryStatistics(ToIntFunction)
+ */
+ public static <T>
+ Collector<T, LongSummaryStatistics> toLongSummaryStatistics(ToLongFunction<? super T> mapper) {
+ return new CollectorImpl<>(LongSummaryStatistics::new,
+ (r, t) -> { r.accept(mapper.applyAsLong(t)); return r; },
+ (l, r) -> { l.combine(r); return l; }, CH_STRICT);
+ }
+
+ /**
+ * Returns a {@code Collector} which applies an {@code double}-producing
+ * mapping function to each input element, and returns summary statistics
+ * for the resulting values.
+ *
+ * @param <T> the type of the input elements
+ * @param mapper a mapping function to apply to each element
+ * @return a {@code Collector} implementing the summary-statistics reduction
+ *
+ * @see #toLongSummaryStatistics(ToLongFunction)
+ * @see #toIntSummaryStatistics(ToIntFunction)
+ */
+ public static <T>
+ Collector<T, DoubleSummaryStatistics> toDoubleSummaryStatistics(ToDoubleFunction<? super T> mapper) {
+ return new CollectorImpl<>(DoubleSummaryStatistics::new,
+ (r, t) -> { r.accept(mapper.applyAsDouble(t)); return r; },
+ (l, r) -> { l.combine(r); return l; }, CH_STRICT);
+ }
+
+ /**
+ * Implementation class used by partitioningBy.
+ */
+ private static final class Partition<T>
+ extends AbstractMap<Boolean, T>
+ implements Map<Boolean, T> {
+ T forTrue;
+ T forFalse;
+
+ Partition(T forTrue, T forFalse) {
+ this.forTrue = forTrue;
+ this.forFalse = forFalse;
+ }
+
+ @Override
+ public Set<Map.Entry<Boolean, T>> entrySet() {
+ return new AbstractSet<Map.Entry<Boolean, T>>() {
+ @Override
+ public Iterator<Map.Entry<Boolean, T>> iterator() {
+
+ return new Iterator<Map.Entry<Boolean, T>>() {
+ int state = 0;
+
+ @Override
+ public boolean hasNext() {
+ return state < 2;
+ }
+
+ @Override
+ public Map.Entry<Boolean, T> next() {
+ if (state >= 2)
+ throw new NoSuchElementException();
+ return (state++ == 0)
+ ? new SimpleImmutableEntry<>(false, forFalse)
+ : new SimpleImmutableEntry<>(true, forTrue);
+ }
+ };
+ }
+
+ @Override
+ public int size() {
+ return 2;
+ }
+ };
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/DelegatingStream.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.util.stream;
+
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Spliterator;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.BinaryOperator;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.IntFunction;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+import java.util.function.ToDoubleFunction;
+import java.util.function.ToIntFunction;
+import java.util.function.ToLongFunction;
+
+/**
+ * A {@code Stream} implementation that delegates operations to another {@code
+ * Stream}.
+ *
+ * @param <T> type of stream elements for this stream and underlying delegate
+ * stream
+ *
+ * @since 1.8
+ */
+public class DelegatingStream<T> implements Stream<T> {
+ final private Stream<T> delegate;
+
+ /**
+ * Construct a {@code Stream} that delegates operations to another {@code
+ * Stream}.
+ *
+ * @param delegate the underlying {@link Stream} to which we delegate all
+ * {@code Stream} methods
+ * @throws NullPointerException if the delegate is null
+ */
+ public DelegatingStream(Stream<T> delegate) {
+ this.delegate = Objects.requireNonNull(delegate);
+ }
+
+ // -- BaseStream methods --
+
+ @Override
+ public Spliterator<T> spliterator() {
+ return delegate.spliterator();
+ }
+
+ @Override
+ public boolean isParallel() {
+ return delegate.isParallel();
+ }
+
+ @Override
+ public Iterator<T> iterator() {
+ return delegate.iterator();
+ }
+
+ // -- Stream methods --
+
+ @Override
+ public Stream<T> filter(Predicate<? super T> predicate) {
+ return delegate.filter(predicate);
+ }
+
+ @Override
+ public <R> Stream<R> map(Function<? super T, ? extends R> mapper) {
+ return delegate.map(mapper);
+ }
+
+ @Override
+ public IntStream mapToInt(ToIntFunction<? super T> mapper) {
+ return delegate.mapToInt(mapper);
+ }
+
+ @Override
+ public LongStream mapToLong(ToLongFunction<? super T> mapper) {
+ return delegate.mapToLong(mapper);
+ }
+
+ @Override
+ public DoubleStream mapToDouble(ToDoubleFunction<? super T> mapper) {
+ return delegate.mapToDouble(mapper);
+ }
+
+ @Override
+ public <R> Stream<R> flatMap(Function<? super T, ? extends Stream<? extends R>> mapper) {
+ return delegate.flatMap(mapper);
+ }
+
+ @Override
+ public IntStream flatMapToInt(Function<? super T, ? extends IntStream> mapper) {
+ return delegate.flatMapToInt(mapper);
+ }
+
+ @Override
+ public LongStream flatMapToLong(Function<? super T, ? extends LongStream> mapper) {
+ return delegate.flatMapToLong(mapper);
+ }
+
+ @Override
+ public DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) {
+ return delegate.flatMapToDouble(mapper);
+ }
+
+ @Override
+ public Stream<T> distinct() {
+ return delegate.distinct();
+ }
+
+ @Override
+ public Stream<T> sorted() {
+ return delegate.sorted();
+ }
+
+ @Override
+ public Stream<T> sorted(Comparator<? super T> comparator) {
+ return delegate.sorted(comparator);
+ }
+
+ @Override
+ public void forEach(Consumer<? super T> action) {
+ delegate.forEach(action);
+ }
+
+ @Override
+ public void forEachOrdered(Consumer<? super T> action) {
+ delegate.forEachOrdered(action);
+ }
+
+ @Override
+ public Stream<T> peek(Consumer<? super T> consumer) {
+ return delegate.peek(consumer);
+ }
+
+ @Override
+ public Stream<T> limit(long maxSize) {
+ return delegate.limit(maxSize);
+ }
+
+ @Override
+ public Stream<T> substream(long startingOffset) {
+ return delegate.substream(startingOffset);
+ }
+
+ @Override
+ public Stream<T> substream(long startingOffset, long endingOffset) {
+ return delegate.substream(startingOffset, endingOffset);
+ }
+
+ @Override
+ public <A> A[] toArray(IntFunction<A[]> generator) {
+ return delegate.toArray(generator);
+ }
+
+ @Override
+ public Object[] toArray() {
+ return delegate.toArray();
+ }
+
+ @Override
+ public T reduce(T identity, BinaryOperator<T> accumulator) {
+ return delegate.reduce(identity, accumulator);
+ }
+
+ @Override
+ public Optional<T> reduce(BinaryOperator<T> accumulator) {
+ return delegate.reduce(accumulator);
+ }
+
+ @Override
+ public <U> U reduce(U identity, BiFunction<U, ? super T, U> accumulator,
+ BinaryOperator<U> combiner) {
+ return delegate.reduce(identity, accumulator, combiner);
+ }
+
+ @Override
+ public <R> R collect(Supplier<R> resultFactory,
+ BiConsumer<R, ? super T> accumulator,
+ BiConsumer<R, R> combiner) {
+ return delegate.collect(resultFactory, accumulator, combiner);
+ }
+
+ @Override
+ public <R> R collect(Collector<? super T, R> collector) {
+ return delegate.collect(collector);
+ }
+
+ @Override
+ public Optional<T> max(Comparator<? super T> comparator) {
+ return delegate.max(comparator);
+ }
+
+ @Override
+ public Optional<T> min(Comparator<? super T> comparator) {
+ return delegate.min(comparator);
+ }
+
+ @Override
+ public long count() {
+ return delegate.count();
+ }
+
+ @Override
+ public boolean anyMatch(Predicate<? super T> predicate) {
+ return delegate.anyMatch(predicate);
+ }
+
+ @Override
+ public boolean allMatch(Predicate<? super T> predicate) {
+ return delegate.allMatch(predicate);
+ }
+
+ @Override
+ public boolean noneMatch(Predicate<? super T> predicate) {
+ return delegate.noneMatch(predicate);
+ }
+
+ @Override
+ public Optional<T> findFirst() {
+ return delegate.findFirst();
+ }
+
+ @Override
+ public Optional<T> findAny() {
+ return delegate.findAny();
+ }
+
+ @Override
+ public Stream<T> unordered() {
+ return delegate.unordered();
+ }
+
+ @Override
+ public Stream<T> sequential() {
+ return delegate.sequential();
+ }
+
+ @Override
+ public Stream<T> parallel() {
+ return delegate.parallel();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/DistinctOps.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Objects;
+import java.util.Set;
+import java.util.Spliterator;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.IntFunction;
+
+/**
+ * Factory methods for transforming streams into duplicate-free streams, using
+ * {@link Object#equals(Object)} to determine equality.
+ *
+ * @since 1.8
+ */
+final class DistinctOps {
+
+ private DistinctOps() { }
+
+ /**
+ * Appends a "distinct" operation to the provided stream, and returns the
+ * new stream.
+ *
+ * @param <T> the type of both input and output elements
+ * @param upstream a reference stream with element type T
+ * @return the new stream
+ */
+ static <T> ReferencePipeline<T, T> makeRef(AbstractPipeline<?, T, ?> upstream) {
+ return new ReferencePipeline.StatefulOp<T, T>(upstream, StreamShape.REFERENCE,
+ StreamOpFlag.IS_DISTINCT | StreamOpFlag.NOT_SIZED) {
+ @Override
+ <P_IN> Node<T> opEvaluateParallel(PipelineHelper<T> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<T[]> generator) {
+ if (StreamOpFlag.DISTINCT.isKnown(helper.getStreamAndOpFlags())) {
+ // No-op
+ return helper.evaluate(spliterator, false, generator);
+ }
+ else if (StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+ // If the stream is SORTED then it should also be ORDERED so the following will also
+ // preserve the sort order
+ TerminalOp<T, LinkedHashSet<T>> reduceOp
+ = ReduceOps.<T, LinkedHashSet<T>>makeRef(LinkedHashSet::new, LinkedHashSet::add,
+ LinkedHashSet::addAll);
+ return Nodes.node(reduceOp.evaluateParallel(helper, spliterator));
+ }
+ else {
+ // Holder of null state since ConcurrentHashMap does not support null values
+ AtomicBoolean seenNull = new AtomicBoolean(false);
+ ConcurrentHashMap<T, Boolean> map = new ConcurrentHashMap<>();
+ TerminalOp<T, Void> forEachOp = ForEachOps.makeRef(t -> {
+ if (t == null)
+ seenNull.set(true);
+ else
+ map.putIfAbsent(t, Boolean.TRUE);
+ }, false);
+ forEachOp.evaluateParallel(helper, spliterator);
+
+ // If null has been seen then copy the key set into a HashSet that supports null values
+ // and add null
+ Set<T> keys = map.keySet();
+ if (seenNull.get()) {
+ // TODO Implement a more efficient set-union view, rather than copying
+ keys = new HashSet<>(keys);
+ keys.add(null);
+ }
+ return Nodes.node(keys);
+ }
+ }
+
+ @Override
+ Sink<T> opWrapSink(int flags, Sink<T> sink) {
+ Objects.requireNonNull(sink);
+
+ if (StreamOpFlag.DISTINCT.isKnown(flags)) {
+ return sink;
+ } else if (StreamOpFlag.SORTED.isKnown(flags)) {
+ return new Sink.ChainedReference<T>(sink) {
+ boolean seenNull;
+ T lastSeen;
+
+ @Override
+ public void begin(long size) {
+ seenNull = false;
+ lastSeen = null;
+ downstream.begin(-1);
+ }
+
+ @Override
+ public void end() {
+ seenNull = false;
+ lastSeen = null;
+ downstream.end();
+ }
+
+ @Override
+ public void accept(T t) {
+ if (t == null) {
+ if (!seenNull) {
+ seenNull = true;
+ downstream.accept(lastSeen = null);
+ }
+ } else if (lastSeen == null || !t.equals(lastSeen)) {
+ downstream.accept(lastSeen = t);
+ }
+ }
+ };
+ } else {
+ return new Sink.ChainedReference<T>(sink) {
+ Set<T> seen;
+
+ @Override
+ public void begin(long size) {
+ seen = new HashSet<>();
+ downstream.begin(-1);
+ }
+
+ @Override
+ public void end() {
+ seen = null;
+ downstream.end();
+ }
+
+ @Override
+ public void accept(T t) {
+ if (!seen.contains(t)) {
+ seen.add(t);
+ downstream.accept(t);
+ }
+ }
+ };
+ }
+ }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/DoublePipeline.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,596 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.DoubleSummaryStatistics;
+import java.util.Objects;
+import java.util.OptionalDouble;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.BinaryOperator;
+import java.util.function.DoubleBinaryOperator;
+import java.util.function.DoubleConsumer;
+import java.util.function.DoubleFunction;
+import java.util.function.DoublePredicate;
+import java.util.function.DoubleToIntFunction;
+import java.util.function.DoubleToLongFunction;
+import java.util.function.DoubleUnaryOperator;
+import java.util.function.IntFunction;
+import java.util.function.ObjDoubleConsumer;
+import java.util.function.Supplier;
+
+/**
+ * Abstract base class for an intermediate pipeline stage or pipeline source
+ * stage implementing whose elements are of type {@code double}.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ *
+ * @since 1.8
+ */
+abstract class DoublePipeline<E_IN>
+ extends AbstractPipeline<E_IN, Double, DoubleStream>
+ implements DoubleStream {
+
+ /**
+ * Constructor for the head of a stream pipeline.
+ *
+ * @param source {@code Supplier<Spliterator>} describing the stream source
+ * @param sourceFlags the source flags for the stream source, described in
+ * {@link StreamOpFlag}
+ */
+ DoublePipeline(Supplier<? extends Spliterator<Double>> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ /**
+ * Constructor for the head of a stream pipeline.
+ *
+ * @param source {@code Spliterator} describing the stream source
+ * @param sourceFlags the source flags for the stream source, described in
+ * {@link StreamOpFlag}
+ */
+ DoublePipeline(Spliterator<Double> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ /**
+ * Constructor for appending an intermediate operation onto an existing
+ * pipeline.
+ *
+ * @param upstream the upstream element source.
+ * @param opFlags the operation flags
+ */
+ DoublePipeline(AbstractPipeline<?, E_IN, ?> upstream, int opFlags) {
+ super(upstream, opFlags);
+ }
+
+ /**
+ * Adapt a {@code Sink<Double> to a {@code DoubleConsumer}, ideally simply
+ * by casting.
+ */
+ private static DoubleConsumer adapt(Sink<Double> sink) {
+ if (sink instanceof DoubleConsumer) {
+ return (DoubleConsumer) sink;
+ } else {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(AbstractPipeline.class,
+ "using DoubleStream.adapt(Sink<Double> s)");
+ return sink::accept;
+ }
+ }
+
+ /**
+ * Adapt a {@code Spliterator<Double>} to a {@code Spliterator.OfDouble}.
+ *
+ * @implNote
+ * The implementation attempts to cast to a Spliterator.OfDouble, and throws
+ * an exception if this cast is not possible.
+ */
+ private static Spliterator.OfDouble adapt(Spliterator<Double> s) {
+ if (s instanceof Spliterator.OfDouble) {
+ return (Spliterator.OfDouble) s;
+ } else {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(AbstractPipeline.class,
+ "using DoubleStream.adapt(Spliterator<Double> s)");
+ throw new UnsupportedOperationException("DoubleStream.adapt(Spliterator<Double> s)");
+ }
+ }
+
+
+ // Shape-specific methods
+
+ @Override
+ final StreamShape getOutputShape() {
+ return StreamShape.DOUBLE_VALUE;
+ }
+
+ @Override
+ final <P_IN> Node<Double> evaluateToNode(PipelineHelper<Double> helper,
+ Spliterator<P_IN> spliterator,
+ boolean flattenTree,
+ IntFunction<Double[]> generator) {
+ return Nodes.collectDouble(helper, spliterator, flattenTree);
+ }
+
+ @Override
+ final <P_IN> Spliterator<Double> wrap(PipelineHelper<Double> ph,
+ Supplier<Spliterator<P_IN>> supplier,
+ boolean isParallel) {
+ return new StreamSpliterators.DoubleWrappingSpliterator<>(ph, supplier, isParallel);
+ }
+
+ @Override
+ final Spliterator.OfDouble lazySpliterator(Supplier<? extends Spliterator<Double>> supplier) {
+ return new StreamSpliterators.DelegatingSpliterator.OfDouble((Supplier<Spliterator.OfDouble>) supplier);
+ }
+
+ @Override
+ final void forEachWithCancel(Spliterator<Double> spliterator, Sink<Double> sink) {
+ Spliterator.OfDouble spl = adapt(spliterator);
+ DoubleConsumer adaptedSink = adapt(sink);
+ do { } while (!sink.cancellationRequested() && spl.tryAdvance(adaptedSink));
+ }
+
+ @Override
+ final Node.Builder<Double> makeNodeBuilder(long exactSizeIfKnown, IntFunction<Double[]> generator) {
+ return Nodes.doubleBuilder(exactSizeIfKnown);
+ }
+
+
+ // DoubleStream
+
+ @Override
+ public final PrimitiveIterator.OfDouble iterator() {
+ return Spliterators.iteratorFromSpliterator(spliterator());
+ }
+
+ @Override
+ public final Spliterator.OfDouble spliterator() {
+ return adapt(super.spliterator());
+ }
+
+ // Stateless intermediate ops from DoubleStream
+
+ @Override
+ public final Stream<Double> boxed() {
+ return mapToObj(Double::valueOf);
+ }
+
+ @Override
+ public final DoubleStream map(DoubleUnaryOperator mapper) {
+ Objects.requireNonNull(mapper);
+ return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+ return new Sink.ChainedDouble(sink) {
+ @Override
+ public void accept(double t) {
+ downstream.accept(mapper.applyAsDouble(t));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final <U> Stream<U> mapToObj(DoubleFunction<? extends U> mapper) {
+ Objects.requireNonNull(mapper);
+ return new ReferencePipeline.StatelessOp<Double, U>(this, StreamShape.DOUBLE_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Double> opWrapSink(int flags, Sink<U> sink) {
+ return new Sink.ChainedDouble(sink) {
+ @Override
+ public void accept(double t) {
+ downstream.accept(mapper.apply(t));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final IntStream mapToInt(DoubleToIntFunction mapper) {
+ Objects.requireNonNull(mapper);
+ return new IntPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Double> opWrapSink(int flags, Sink<Integer> sink) {
+ return new Sink.ChainedDouble(sink) {
+ @Override
+ public void accept(double t) {
+ downstream.accept(mapper.applyAsInt(t));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final LongStream mapToLong(DoubleToLongFunction mapper) {
+ Objects.requireNonNull(mapper);
+ return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
+ return new Sink.ChainedDouble(sink) {
+ @Override
+ public void accept(double t) {
+ downstream.accept(mapper.applyAsLong(t));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final DoubleStream flatMap(DoubleFunction<? extends DoubleStream> mapper) {
+ return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+ @Override
+ Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+ return new Sink.ChainedDouble(sink) {
+ public void accept(double t) {
+ // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+ DoubleStream result = mapper.apply(t);
+ if (result != null)
+ result.sequential().forEach(i -> downstream.accept(i));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public DoubleStream unordered() {
+ if (!isOrdered())
+ return this;
+ return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE, StreamOpFlag.NOT_ORDERED) {
+ @Override
+ Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+ return sink;
+ }
+ };
+ }
+
+ @Override
+ public final DoubleStream filter(DoublePredicate predicate) {
+ Objects.requireNonNull(predicate);
+ return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
+ StreamOpFlag.NOT_SIZED) {
+ @Override
+ Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+ return new Sink.ChainedDouble(sink) {
+ @Override
+ public void accept(double t) {
+ if (predicate.test(t))
+ downstream.accept(t);
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final DoubleStream peek(DoubleConsumer consumer) {
+ Objects.requireNonNull(consumer);
+ return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
+ 0) {
+ @Override
+ Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+ return new Sink.ChainedDouble(sink) {
+ @Override
+ public void accept(double t) {
+ consumer.accept(t);
+ downstream.accept(t);
+ }
+ };
+ }
+ };
+ }
+
+ // Stateful intermediate ops from DoubleStream
+
+ @Override
+ public final DoubleStream limit(long maxSize) {
+ if (maxSize < 0)
+ throw new IllegalArgumentException(Long.toString(maxSize));
+ return SliceOps.makeDouble(this, (long) 0, maxSize);
+ }
+
+ @Override
+ public final DoubleStream substream(long startingOffset) {
+ if (startingOffset < 0)
+ throw new IllegalArgumentException(Long.toString(startingOffset));
+ if (startingOffset == 0)
+ return this;
+ else {
+ long limit = -1;
+ return SliceOps.makeDouble(this, startingOffset, limit);
+ }
+ }
+
+ @Override
+ public final DoubleStream substream(long startingOffset, long endingOffset) {
+ if (startingOffset < 0 || endingOffset < startingOffset)
+ throw new IllegalArgumentException(String.format("substream(%d, %d)", startingOffset, endingOffset));
+ return SliceOps.makeDouble(this, startingOffset, endingOffset - startingOffset);
+ }
+
+ @Override
+ public final DoubleStream sorted() {
+ return SortedOps.makeDouble(this);
+ }
+
+ @Override
+ public final DoubleStream distinct() {
+ // While functional and quick to implement, this approach is not very efficient.
+ // An efficient version requires a double-specific map/set implementation.
+ return boxed().distinct().mapToDouble(i -> (double) i);
+ }
+
+ // Terminal ops from DoubleStream
+
+ @Override
+ public void forEach(DoubleConsumer consumer) {
+ evaluate(ForEachOps.makeDouble(consumer, false));
+ }
+
+ @Override
+ public void forEachOrdered(DoubleConsumer consumer) {
+ evaluate(ForEachOps.makeDouble(consumer, true));
+ }
+
+ @Override
+ public final double sum() {
+ // TODO: better algorithm to compensate for errors
+ return reduce(0.0, Double::sum);
+ }
+
+ @Override
+ public final OptionalDouble min() {
+ return reduce(Math::min);
+ }
+
+ @Override
+ public final OptionalDouble max() {
+ return reduce(Math::max);
+ }
+
+ @Override
+ public final OptionalDouble average() {
+ double[] avg = collect(() -> new double[2],
+ (ll, i) -> {
+ ll[0]++;
+ ll[1] += i;
+ },
+ (ll, rr) -> {
+ ll[0] += rr[0];
+ ll[1] += rr[1];
+ });
+ return avg[0] > 0
+ ? OptionalDouble.of(avg[1] / avg[0])
+ : OptionalDouble.empty();
+ }
+
+ @Override
+ public final long count() {
+ return mapToObj(e -> null).mapToInt(e -> 1).sum();
+ }
+
+ @Override
+ public final DoubleSummaryStatistics summaryStatistics() {
+ return collect(DoubleSummaryStatistics::new, DoubleSummaryStatistics::accept,
+ DoubleSummaryStatistics::combine);
+ }
+
+ @Override
+ public final double reduce(double identity, DoubleBinaryOperator op) {
+ return evaluate(ReduceOps.makeDouble(identity, op));
+ }
+
+ @Override
+ public final OptionalDouble reduce(DoubleBinaryOperator op) {
+ return evaluate(ReduceOps.makeDouble(op));
+ }
+
+ @Override
+ public final <R> R collect(Supplier<R> resultFactory,
+ ObjDoubleConsumer<R> accumulator,
+ BiConsumer<R, R> combiner) {
+ BinaryOperator<R> operator = (left, right) -> {
+ combiner.accept(left, right);
+ return left;
+ };
+ return evaluate(ReduceOps.makeDouble(resultFactory, accumulator, operator));
+ }
+
+ @Override
+ public final boolean anyMatch(DoublePredicate predicate) {
+ return evaluate(MatchOps.makeDouble(predicate, MatchOps.MatchKind.ANY));
+ }
+
+ @Override
+ public final boolean allMatch(DoublePredicate predicate) {
+ return evaluate(MatchOps.makeDouble(predicate, MatchOps.MatchKind.ALL));
+ }
+
+ @Override
+ public final boolean noneMatch(DoublePredicate predicate) {
+ return evaluate(MatchOps.makeDouble(predicate, MatchOps.MatchKind.NONE));
+ }
+
+ @Override
+ public final OptionalDouble findFirst() {
+ return evaluate(FindOps.makeDouble(true));
+ }
+
+ @Override
+ public final OptionalDouble findAny() {
+ return evaluate(FindOps.makeDouble(false));
+ }
+
+ @Override
+ public final double[] toArray() {
+ return Nodes.flattenDouble((Node.OfDouble) evaluateToArrayNode(Double[]::new))
+ .asDoubleArray();
+ }
+
+ //
+
+ /**
+ * Source stage of a DoubleStream
+ *
+ * @param <E_IN> type of elements in the upstream source
+ */
+ static class Head<E_IN> extends DoublePipeline<E_IN> {
+ /**
+ * Constructor for the source stage of a DoubleStream.
+ *
+ * @param source {@code Supplier<Spliterator>} describing the stream
+ * source
+ * @param sourceFlags the source flags for the stream source, described
+ * in {@link StreamOpFlag}
+ * @param parallel {@code true} if the pipeline is parallel
+ */
+ Head(Supplier<? extends Spliterator<Double>> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ /**
+ * Constructor for the source stage of a DoubleStream.
+ *
+ * @param source {@code Spliterator} describing the stream source
+ * @param sourceFlags the source flags for the stream source, described
+ * in {@link StreamOpFlag}
+ * @param parallel {@code true} if the pipeline is parallel
+ */
+ Head(Spliterator<Double> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ @Override
+ final boolean opIsStateful() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ final Sink<E_IN> opWrapSink(int flags, Sink<Double> sink) {
+ throw new UnsupportedOperationException();
+ }
+
+ // Optimized sequential terminal operations for the head of the pipeline
+
+ @Override
+ public void forEach(DoubleConsumer consumer) {
+ if (!isParallel()) {
+ adapt(sourceStageSpliterator()).forEachRemaining(consumer);
+ }
+ else {
+ super.forEach(consumer);
+ }
+ }
+
+ @Override
+ public void forEachOrdered(DoubleConsumer consumer) {
+ if (!isParallel()) {
+ adapt(sourceStageSpliterator()).forEachRemaining(consumer);
+ }
+ else {
+ super.forEachOrdered(consumer);
+ }
+ }
+
+ }
+
+ /**
+ * Base class for a stateless intermediate stage of a DoubleStream.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @since 1.8
+ */
+ abstract static class StatelessOp<E_IN> extends DoublePipeline<E_IN> {
+ /**
+ * Construct a new DoubleStream by appending a stateless intermediate
+ * operation to an existing stream.
+ *
+ * @param upstream the upstream pipeline stage
+ * @param inputShape the stream shape for the upstream pipeline stage
+ * @param opFlags operation flags for the new stage
+ */
+ StatelessOp(AbstractPipeline<?, E_IN, ?> upstream,
+ StreamShape inputShape,
+ int opFlags) {
+ super(upstream, opFlags);
+ assert upstream.getOutputShape() == inputShape;
+ }
+
+ @Override
+ final boolean opIsStateful() {
+ return false;
+ }
+ }
+
+ /**
+ * Base class for a stateful intermediate stage of a DoubleStream.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @since 1.8
+ */
+ abstract static class StatefulOp<E_IN> extends DoublePipeline<E_IN> {
+ /**
+ * Construct a new DoubleStream by appending a stateful intermediate
+ * operation to an existing stream.
+ *
+ * @param upstream the upstream pipeline stage
+ * @param inputShape the stream shape for the upstream pipeline stage
+ * @param opFlags operation flags for the new stage
+ */
+ StatefulOp(AbstractPipeline<?, E_IN, ?> upstream,
+ StreamShape inputShape,
+ int opFlags) {
+ super(upstream, opFlags);
+ assert upstream.getOutputShape() == inputShape;
+ }
+
+ @Override
+ final boolean opIsStateful() {
+ return true;
+ }
+
+ @Override
+ abstract <P_IN> Node<Double> opEvaluateParallel(PipelineHelper<Double> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<Double[]> generator);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/DoubleStream.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,827 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Arrays;
+import java.util.DoubleSummaryStatistics;
+import java.util.Objects;
+import java.util.OptionalDouble;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.DoubleBinaryOperator;
+import java.util.function.DoubleConsumer;
+import java.util.function.DoubleFunction;
+import java.util.function.DoublePredicate;
+import java.util.function.DoubleSupplier;
+import java.util.function.DoubleToIntFunction;
+import java.util.function.DoubleToLongFunction;
+import java.util.function.DoubleUnaryOperator;
+import java.util.function.Function;
+import java.util.function.ObjDoubleConsumer;
+import java.util.function.Supplier;
+
+/**
+ * A sequence of primitive double elements supporting sequential and parallel
+ * bulk operations. Streams support lazy intermediate operations (transforming
+ * a stream to another stream) such as {@code filter} and {@code map}, and terminal
+ * operations (consuming the contents of a stream to produce a result or
+ * side-effect), such as {@code forEach}, {@code findFirst}, and {@code
+ * iterator}. Once an operation has been performed on a stream, it
+ * is considered <em>consumed</em> and no longer usable for other operations.
+ *
+ * <p>For sequential stream pipelines, all operations are performed in the
+ * <a href="package-summary.html#Ordering">encounter order</a> of the pipeline
+ * source, if the pipeline source has a defined encounter order.
+ *
+ * <p>For parallel stream pipelines, unless otherwise specified, intermediate
+ * stream operations preserve the <a href="package-summary.html#Ordering">
+ * encounter order</a> of their source, and terminal operations
+ * respect the encounter order of their source, if the source
+ * has an encounter order. Provided that and parameters to stream operations
+ * satisfy the <a href="package-summary.html#NonInterference">non-interference
+ * requirements</a>, and excepting differences arising from the absence of
+ * a defined encounter order, the result of a stream pipeline should be the
+ * stable across multiple executions of the same operations on the same source.
+ * However, the timing and thread in which side-effects occur (for those
+ * operations which are allowed to produce side-effects, such as
+ * {@link #forEach(DoubleConsumer)}), are explicitly nondeterministic for parallel
+ * execution of stream pipelines.
+ *
+ * <p>Unless otherwise noted, passing a {@code null} argument to any stream
+ * method may result in a {@link NullPointerException}.
+ *
+ * @apiNote
+ * Streams are not data structures; they do not manage the storage for their
+ * elements, nor do they support access to individual elements. However,
+ * you can use the {@link #iterator()} or {@link #spliterator()} operations to
+ * perform a controlled traversal.
+ *
+ * @since 1.8
+ * @see <a href="package-summary.html">java.util.stream</a>
+ */
+public interface DoubleStream extends BaseStream<Double, DoubleStream> {
+
+ /**
+ * Returns a stream consisting of the elements of this stream that match
+ * the given predicate.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> predicate to apply to
+ * each element to determine if it should be included
+ * @return the new stream
+ */
+ DoubleStream filter(DoublePredicate predicate);
+
+ /**
+ * Returns a stream consisting of the results of applying the given
+ * function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to
+ * each element
+ * @return the new stream
+ */
+ DoubleStream map(DoubleUnaryOperator mapper);
+
+ /**
+ * Returns an object-valued {@code Stream} consisting of the results of
+ * applying the given function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">
+ * intermediate operation</a>.
+ *
+ * @param <U> the element type of the new stream
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ <U> Stream<U> mapToObj(DoubleFunction<? extends U> mapper);
+
+ /**
+ * Returns an {@code IntStream} consisting of the results of applying the
+ * given function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ IntStream mapToInt(DoubleToIntFunction mapper);
+
+ /**
+ * Returns a {@code LongStream} consisting of the results of applying the
+ * given function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ LongStream mapToLong(DoubleToLongFunction mapper);
+
+ /**
+ * Returns a stream consisting of the results of replacing each element of
+ * this stream with the contents of the stream produced by applying the
+ * provided mapping function to each element.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @apiNote
+ * The {@code flatMap()} operation has the effect of applying a one-to-many
+ * tranformation to the elements of the stream, and then flattening the
+ * resulting elements into a new stream. For example, if {@code orders}
+ * is a stream of purchase orders, and each purchase order contains a
+ * collection of line items, then the following produces a stream of line
+ * items:
+ * <pre>{@code
+ * orderStream.flatMap(order -> order.getLineItems().stream())...
+ * }</pre>
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to
+ * each element which produces an {@code DoubleStream} of new
+ * values
+ * @return the new stream
+ * @see Stream#flatMap(Function)
+ */
+ DoubleStream flatMap(DoubleFunction<? extends DoubleStream> mapper);
+
+ /**
+ * Returns a stream consisting of the distinct elements of this stream. The
+ * elements are compared for equality according to
+ * {@link java.lang.Double#compare(double, double)}.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">stateful
+ * intermediate operation</a>.
+ *
+ * @return the result stream
+ */
+ DoubleStream distinct();
+
+ /**
+ * Returns a stream consisting of the elements of this stream in sorted
+ * order. The elements are compared for equality according to
+ * {@link java.lang.Double#compare(double, double)}.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">stateful
+ * intermediate operation</a>.
+ *
+ * @return the result stream
+ */
+ DoubleStream sorted();
+
+ /**
+ * Returns a stream consisting of the elements of this stream, additionally
+ * performing the provided action on each element as elements are consumed
+ * from the resulting stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * <p>For parallel stream pipelines, the action may be called at
+ * whatever time and in whatever thread the element is made available by the
+ * upstream operation. If the action modifies shared state,
+ * it is responsible for providing the required synchronization.
+ *
+ * @apiNote This method exists mainly to support debugging, where you want
+ * to see the elements as they flow past a certain point in a pipeline:
+ * <pre>{@code
+ * list.stream()
+ * .filter(filteringFunction)
+ * .peek(e -> {System.out.println("Filtered value: " + e); });
+ * .map(mappingFunction)
+ * .peek(e -> {System.out.println("Mapped value: " + e); });
+ * .collect(Collectors.toDoubleSummaryStastistics());
+ * }</pre>
+ *
+ * @param consumer a <a href="package-summary.html#NonInterference">
+ * non-interfering</a> action to perform on the elements as
+ * they are consumed from the stream
+ * @return the new stream
+ */
+ DoubleStream peek(DoubleConsumer consumer);
+
+ /**
+ * Returns a stream consisting of the elements of this stream, truncated
+ * to be no longer than {@code maxSize} in length.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * stateful intermediate operation</a>.
+ *
+ * @param maxSize the number of elements the stream should be limited to
+ * @return the new stream
+ * @throws IllegalArgumentException if {@code maxSize} is negative
+ */
+ DoubleStream limit(long maxSize);
+
+ /**
+ * Returns a stream consisting of the remaining elements of this stream
+ * after indexing {@code startInclusive} elements into the stream. If the
+ * {@code startInclusive} index lies past the end of this stream then an
+ * empty stream will be returned.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">stateful
+ * intermediate operation</a>.
+ *
+ * @param startInclusive the number of leading elements to skip
+ * @return the new stream
+ * @throws IllegalArgumentException if {@code startInclusive} is negative
+ */
+ DoubleStream substream(long startInclusive);
+
+ /**
+ * Returns a stream consisting of the remaining elements of this stream
+ * after indexing {@code startInclusive} elements into the stream and
+ * truncated to contain no more than {@code endExclusive - startInclusive}
+ * elements. If the {@code startInclusive} index lies past the end
+ * of this stream then an empty stream will be returned.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * stateful intermediate operation</a>.
+ *
+ * @param startInclusive the starting position of the substream, inclusive
+ * @param endExclusive the ending position of the substream, exclusive
+ * @return the new stream
+ * @throws IllegalArgumentException if {@code startInclusive} or
+ * {@code endExclusive} is negative or {@code startInclusive} is greater
+ * than {@code endExclusive}
+ */
+ DoubleStream substream(long startInclusive, long endExclusive);
+
+ /**
+ * Performs an action for each element of this stream.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * <p>For parallel stream pipelines, this operation does <em>not</em>
+ * guarantee to respect the encounter order of the stream, as doing so
+ * would sacrifice the benefit of parallelism. For any given element, the
+ * action may be performed at whatever time and in whatever thread the
+ * library chooses. If the action accesses shared state, it is
+ * responsible for providing the required synchronization.
+ *
+ * @param action a <a href="package-summary.html#NonInterference">
+ * non-interfering</a> action to perform on the elements
+ */
+ void forEach(DoubleConsumer action);
+
+ /**
+ * Performs an action for each element of this stream, guaranteeing that
+ * each element is processed in encounter order for streams that have a
+ * defined encounter order.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @param action a <a href="package-summary.html#NonInterference">
+ * non-interfering</a> action to perform on the elements
+ * @see #forEach(DoubleConsumer)
+ */
+ void forEachOrdered(DoubleConsumer action);
+
+ /**
+ * Returns an array containing the elements of this stream.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @return an array containing the elements of this stream
+ */
+ double[] toArray();
+
+ /**
+ * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+ * elements of this stream, using the provided identity value and an
+ * <a href="package-summary.html#Associativity">associative</a>
+ * accumulation function, and returns the reduced value. This is equivalent
+ * to:
+ * <pre>{@code
+ * double result = identity;
+ * for (double element : this stream)
+ * result = accumulator.apply(result, element)
+ * return result;
+ * }</pre>
+ *
+ * but is not constrained to execute sequentially.
+ *
+ * <p>The {@code identity} value must be an identity for the accumulator
+ * function. This means that for all {@code x},
+ * {@code accumulator.apply(identity, x)} is equal to {@code x}.
+ * The {@code accumulator} function must be an
+ * <a href="package-summary.html#Associativity">associative</a> function.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @apiNote Sum, min, max, and average are all special cases of reduction.
+ * Summing a stream of numbers can be expressed as:
+
+ * <pre>{@code
+ * double sum = numbers.reduce(0, (a, b) -> a+b);
+ * }</pre>
+ *
+ * or more compactly:
+ *
+ * <pre>{@code
+ * double sum = numbers.reduce(0, Double::sum);
+ * }</pre>
+ *
+ * <p>While this may seem a more roundabout way to perform an aggregation
+ * compared to simply mutating a running total in a loop, reduction
+ * operations parallelize more gracefully, without needing additional
+ * synchronization and with greatly reduced risk of data races.
+ *
+ * @param identity the identity value for the accumulating function
+ * @param op an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for combining two values
+ * @return the result of the reduction
+ * @see #sum()
+ * @see #min()
+ * @see #max()
+ * @see #average()
+ */
+ double reduce(double identity, DoubleBinaryOperator op);
+
+ /**
+ * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+ * elements of this stream, using an
+ * <a href="package-summary.html#Associativity">associative</a> accumulation
+ * function, and returns an {@code OptionalDouble} describing the reduced
+ * value, if any. This is equivalent to:
+ * <pre>{@code
+ * boolean foundAny = false;
+ * double result = null;
+ * for (double element : this stream) {
+ * if (!foundAny) {
+ * foundAny = true;
+ * result = element;
+ * }
+ * else
+ * result = accumulator.apply(result, element);
+ * }
+ * return foundAny ? OptionalDouble.of(result) : OptionalDouble.empty();
+ * }</pre>
+ *
+ * but is not constrained to execute sequentially.
+ *
+ * <p>The {@code accumulator} function must be an
+ * <a href="package-summary.html#Associativity">associative</a> function.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @param op an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for combining two values
+ * @return the result of the reduction
+ * @see #reduce(double, DoubleBinaryOperator)
+ */
+ OptionalDouble reduce(DoubleBinaryOperator op);
+
+ /**
+ * Performs a <a href="package-summary.html#MutableReduction">mutable
+ * reduction</a> operation on the elements of this stream. A mutable
+ * reduction is one in which the reduced value is a mutable value holder,
+ * such as an {@code ArrayList}, and elements are incorporated by updating
+ * the state of the result, rather than by replacing the result. This
+ * produces a result equivalent to:
+ * <pre>{@code
+ * R result = resultFactory.get();
+ * for (double element : this stream)
+ * accumulator.accept(result, element);
+ * return result;
+ * }</pre>
+ *
+ * <p>Like {@link #reduce(double, DoubleBinaryOperator)}, {@code collect}
+ * operations can be parallelized without requiring additional
+ * synchronization.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @param <R> type of the result
+ * @param resultFactory a function that creates a new result container.
+ * For a parallel execution, this function may be
+ * called multiple times and must return a fresh value
+ * each time.
+ * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for incorporating an additional
+ * element into a result
+ * @param combiner an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for combining two values, which
+ * must be compatible with the accumulator function
+ * @return the result of the reduction
+ * @see Stream#collect(Supplier, BiConsumer, BiConsumer)
+ */
+ <R> R collect(Supplier<R> resultFactory,
+ ObjDoubleConsumer<R> accumulator,
+ BiConsumer<R, R> combiner);
+
+ /**
+ * Returns the sum of elements in this stream. The sum returned can vary
+ * depending upon the order in which elements are encountered. This is due
+ * to accumulated rounding error in addition of values of differing
+ * magnitudes. Elements sorted by increasing absolute magnitude tend to
+ * yield more accurate results. If any stream element is a {@code NaN} or
+ * the sum is at any point a {@code NaN} then the sum will be {@code NaN}.
+ * This is a special case of a
+ * <a href="package-summary.html#MutableReduction">reduction</a> and is
+ * equivalent to:
+ * <pre>{@code
+ * return reduce(0, Double::sum);
+ * }</pre>
+ *
+ * @return the sum of elements in this stream
+ */
+ double sum();
+
+ /**
+ * Returns an {@code OptionalDouble} describing the minimum element of this
+ * stream, or an empty OptionalDouble if this stream is empty. The minimum
+ * element will be {@code Double.NaN} if any stream element was NaN. Unlike
+ * the numerical comparison operators, this method considers negative zero
+ * to be strictly smaller than positive zero. This is a special case of a
+ * <a href="package-summary.html#MutableReduction">reduction</a> and is
+ * equivalent to:
+ * <pre>{@code
+ * return reduce(Double::min);
+ * }</pre>
+ *
+ * @return an {@code OptionalDouble} containing the minimum element of this
+ * stream, or an empty optional if the stream is empty
+ */
+ OptionalDouble min();
+
+ /**
+ * Returns an {@code OptionalDouble} describing the maximum element of this
+ * stream, or an empty OptionalDouble if this stream is empty. The maximum
+ * element will be {@code Double.NaN} if any stream element was NaN. Unlike
+ * the numerical comparison operators, this method considers negative zero
+ * to be strictly smaller than positive zero. This is a
+ * special case of a
+ * <a href="package-summary.html#MutableReduction">reduction</a> and is
+ * equivalent to:
+ * <pre>{@code
+ * return reduce(Double::max);
+ * }</pre>
+ *
+ * @return an {@code OptionalDouble} containing the maximum element of this
+ * stream, or an empty optional if the stream is empty
+ */
+ OptionalDouble max();
+
+ /**
+ * Returns the count of elements in this stream. This is a special case of
+ * a <a href="package-summary.html#MutableReduction">reduction</a> and is
+ * equivalent to:
+ * <pre>{@code
+ * return mapToLong(e -> 1L).sum();
+ * }</pre>
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+ *
+ * @return the count of elements in this stream
+ */
+ long count();
+
+ /**
+ * Returns an {@code OptionalDouble} describing the average of elements of
+ * this stream, or an empty optional if this stream is empty. The average
+ * returned can vary depending upon the order in which elements are
+ * encountered. This is due to accumulated rounding error in addition of
+ * elements of differing magnitudes. Elements sorted by increasing absolute
+ * magnitude tend to yield more accurate results. If any recorded value is
+ * a {@code NaN} or the sum is at any point a {@code NaN} then the average
+ * will be {@code NaN}. This is a special case of a
+ * <a href="package-summary.html#MutableReduction">reduction</a>.
+ *
+ * @return an {@code OptionalDouble} containing the average element of this
+ * stream, or an empty optional if the stream is empty
+ */
+ OptionalDouble average();
+
+ /**
+ * Returns a {@code DoubleSummaryStatistics} describing various summary data
+ * about the elements of this stream. This is a special
+ * case of a <a href="package-summary.html#MutableReduction">reduction</a>.
+ *
+ * @return a {@code DoubleSummaryStatistics} describing various summary data
+ * about the elements of this stream
+ */
+ DoubleSummaryStatistics summaryStatistics();
+
+ /**
+ * Returns whether any elements of this stream match the provided
+ * predicate. May not evaluate the predicate on all elements if not
+ * necessary for determining the result.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> predicate to apply to elements of this
+ * stream
+ * @return {@code true} if any elements of the stream match the provided
+ * predicate otherwise {@code false}
+ */
+ boolean anyMatch(DoublePredicate predicate);
+
+ /**
+ * Returns whether all elements of this stream match the provided predicate.
+ * May not evaluate the predicate on all elements if not necessary for
+ * determining the result.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> predicate to apply to elements of this
+ * stream
+ * @return {@code true} if all elements of the stream match the provided
+ * predicate otherwise {@code false}
+ */
+ boolean allMatch(DoublePredicate predicate);
+
+ /**
+ * Returns whether no elements of this stream match the provided predicate.
+ * May not evaluate the predicate on all elements if not necessary for
+ * determining the result.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> predicate to apply to elements of this
+ * stream
+ * @return {@code true} if no elements of the stream match the provided
+ * predicate otherwise {@code false}
+ */
+ boolean noneMatch(DoublePredicate predicate);
+
+ /**
+ * Returns an {@link OptionalDouble} describing the first element of this
+ * stream (in the encounter order), or an empty {@code OptionalDouble} if
+ * the stream is empty. If the stream has no encounter order, than any
+ * element may be returned.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @return an {@code OptionalDouble} describing the first element of this
+ * stream, or an empty {@code OptionalDouble} if the stream is empty
+ */
+ OptionalDouble findFirst();
+
+ /**
+ * Returns an {@link OptionalDouble} describing some element of the stream,
+ * or an empty {@code OptionalDouble} if the stream is empty.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * <p>The behavior of this operation is explicitly nondeterministic; it is
+ * free to select any element in the stream. This is to allow for maximal
+ * performance in parallel operations; the cost is that multiple invocations
+ * on the same source may not return the same result. (If the first element
+ * in the encounter order is desired, use {@link #findFirst()} instead.)
+ *
+ * @return an {@code OptionalDouble} describing some element of this stream,
+ * or an empty {@code OptionalDouble} if the stream is empty
+ * @see #findFirst()
+ */
+ OptionalDouble findAny();
+
+ /**
+ * Returns a {@code Stream} consisting of the elements of this stream,
+ * boxed to {@code Double}.
+ *
+ * @return a {@code Stream} consistent of the elements of this stream,
+ * each boxed to a {@code Double}
+ */
+ Stream<Double> boxed();
+
+ @Override
+ DoubleStream sequential();
+
+ @Override
+ DoubleStream parallel();
+
+ @Override
+ PrimitiveIterator.OfDouble iterator();
+
+ @Override
+ Spliterator.OfDouble spliterator();
+
+
+ // Static factories
+
+ /**
+ * Returns a builder for a {@code DoubleStream}.
+ *
+ * @return a stream builder
+ */
+ public static StreamBuilder.OfDouble builder() {
+ return new Streams.DoubleStreamBuilderImpl();
+ }
+
+ /**
+ * Returns an empty sequential {@code DoubleStream}.
+ *
+ * @return an empty sequential stream
+ */
+ public static DoubleStream empty() {
+ return StreamSupport.doubleStream(Spliterators.emptyDoubleSpliterator());
+ }
+
+ /**
+ * Returns a sequential {@code DoubleStream} containing a single element.
+ *
+ * @param t the single element
+ * @return a singleton sequential stream
+ */
+ public static DoubleStream of(double t) {
+ return StreamSupport.doubleStream(new Streams.DoubleStreamBuilderImpl(t));
+ }
+
+ /**
+ * Returns a sequential stream whose elements are the specified values.
+ *
+ * @param values the elements of the new stream
+ * @return the new stream
+ */
+ public static DoubleStream of(double... values) {
+ return Arrays.stream(values);
+ }
+
+ /**
+ * Returns an infinite sequential {@code DoubleStream} produced by iterative
+ * application of a function {@code f} to an initial element {@code seed},
+ * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)},
+ * {@code f(f(seed))}, etc.
+ *
+ * <p>The first element (position {@code 0}) in the {@code DoubleStream}
+ * will be the provided {@code seed}. For {@code n > 0}, the element at
+ * position {@code n}, will be the result of applying the function {@code f}
+ * to the element at position {@code n - 1}.
+ *
+ * @param seed the initial element
+ * @param f a function to be applied to to the previous element to produce
+ * a new element
+ * @return a new sequential {@code DoubleStream}
+ */
+ public static DoubleStream iterate(final double seed, final DoubleUnaryOperator f) {
+ Objects.requireNonNull(f);
+ final PrimitiveIterator.OfDouble iterator = new PrimitiveIterator.OfDouble() {
+ double t = seed;
+
+ @Override
+ public boolean hasNext() {
+ return true;
+ }
+
+ @Override
+ public double nextDouble() {
+ double v = t;
+ t = f.applyAsDouble(t);
+ return v;
+ }
+ };
+ return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize(
+ iterator,
+ Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+ }
+
+ /**
+ * Returns a sequential {@code DoubleStream} where each element is
+ * generated by an {@code DoubleSupplier}. This is suitable for generating
+ * constant streams, streams of random elements, etc.
+ *
+ * @param s the {@code DoubleSupplier} for generated elements
+ * @return a new sequential {@code DoubleStream}
+ */
+ public static DoubleStream generate(DoubleSupplier s) {
+ Objects.requireNonNull(s);
+ return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize(
+ new PrimitiveIterator.OfDouble() {
+ @Override
+ public boolean hasNext() { return true; }
+
+ @Override
+ public double nextDouble() { return s.getAsDouble(); }
+ },
+ Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+ }
+
+ /**
+ * Returns a sequential {@code DoubleStream} from {@code startInclusive} (inclusive)
+ * to {@code endExclusive} (exclusive) by an incremental step of 1.0.
+ *
+ * @implSpec
+ * The implementation behaves as if:
+ * <pre>{@code
+ * doubleRange(startInclusive, endExclusive, 1.0);
+ * }</pre>
+ *
+ * @param startInclusive the (inclusive) initial value
+ * @param endExclusive the exclusive upper bound
+ * @return a sequential {@code DoubleStream} for the range of {@code double}
+ * elements
+ */
+ public static DoubleStream range(double startInclusive, double endExclusive) {
+ return range(startInclusive, endExclusive, 1.0);
+ }
+
+ /**
+ * Returns a sequential {@code DoubleStream} from {@code startInclusive}
+ * (inclusive) to {@code endExclusive} (exclusive) by {@code step}. If
+ * {@code startInclusive} is greater than or equal to {@code
+ * endExclusive}, an empty stream is returned.
+ *
+ * An equivalent sequence of increasing values can be produced
+ * sequentially using a {@code for} loop as follows:
+ * <pre>{@code
+ * long size = (long) Math.ceil((startInclusive - endExclusive) / step);
+ * long i = 0
+ * for (double v = startInclusive; i < size; i++, v = startInclusive + step * i) {
+ * ...
+ * }
+ * }</pre>
+ *
+ * @param startInclusive the (inclusive) initial value
+ * @param endExclusive the exclusive upper bound
+ * @param step the difference between consecutive values
+ * @return a sequential {@code DoubleStream} for tne range of {@code double}
+ * elements
+ * @throws IllegalArgumentException if {@code step} is less than or equal to
+ * 0. is {@code NaN}, or the count of elements in the range would be
+ * greater than {@code Long.MAX_VALUE}
+ */
+ public static DoubleStream range(double startInclusive, double endExclusive, double step) {
+ // @@@ Need to check for ranges that may not produce distinct values
+ // such as when the step is very small
+ // Also clarify the size of the range which may produce more or less
+ // than expected
+ if (step <= 0 || Double.isNaN(step)) {
+ throw new IllegalArgumentException(String.format("Illegal step: %f", step));
+ } else {
+ double range = endExclusive - startInclusive;
+ if (range <= 0) {
+ return empty();
+ }
+ double size = Math.ceil((endExclusive - startInclusive) / step);
+ if (Double.isNaN(size)) {
+ throw new IllegalArgumentException(
+ String.format("Illegal range: %f size is NaN", size));
+ } else if (size > Long.MAX_VALUE) {
+ throw new IllegalArgumentException(
+ String.format("Illegal range: size %f > Long.MAX_VALUE", size));
+ } else {
+ return StreamSupport.doubleStream(
+ new Streams.RangeDoubleSpliterator(
+ startInclusive, endExclusive, step, 0, (long) size));
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/FindOps.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Optional;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.OptionalLong;
+import java.util.Spliterator;
+import java.util.concurrent.CountedCompleter;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+
+/**
+ * Factory for instances of a short-circuiting {@code TerminalOp} that searches
+ * for an element in a stream pipeline, and terminates when it finds one.
+ * Supported variants include find-first (find the first element in the
+ * encounter order) and find-any (find any element, may not be the first in
+ * encounter order.)
+ *
+ * @since 1.8
+ */
+final class FindOps {
+
+ private FindOps() { }
+
+ /**
+ * Constructs a {@code TerminalOp} for streams of objects.
+ *
+ * @param <T> the type of elements of the stream
+ * @param mustFindFirst whether the {@code TerminalOp} must produce the
+ * first element in the encounter order
+ * @return a {@code TerminalOp} implementing the find operation
+ */
+ public static <T> TerminalOp<T, Optional<T>> makeRef(boolean mustFindFirst) {
+ return new FindOp<>(mustFindFirst, StreamShape.REFERENCE, Optional.empty(),
+ Optional::isPresent, FindSink.OfRef::new);
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} for streams of ints.
+ *
+ * @param mustFindFirst whether the {@code TerminalOp} must produce the
+ * first element in the encounter order
+ * @return a {@code TerminalOp} implementing the find operation
+ */
+ public static TerminalOp<Integer, OptionalInt> makeInt(boolean mustFindFirst) {
+ return new FindOp<>(mustFindFirst, StreamShape.INT_VALUE, OptionalInt.empty(),
+ OptionalInt::isPresent, FindSink.OfInt::new);
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} for streams of longs.
+ *
+ * @param mustFindFirst whether the {@code TerminalOp} must produce the
+ * first element in the encounter order
+ * @return a {@code TerminalOp} implementing the find operation
+ */
+ public static TerminalOp<Long, OptionalLong> makeLong(boolean mustFindFirst) {
+ return new FindOp<>(mustFindFirst, StreamShape.LONG_VALUE, OptionalLong.empty(),
+ OptionalLong::isPresent, FindSink.OfLong::new);
+ }
+
+ /**
+ * Constructs a {@code FindOp} for streams of doubles.
+ *
+ * @param mustFindFirst whether the {@code TerminalOp} must produce the
+ * first element in the encounter order
+ * @return a {@code TerminalOp} implementing the find operation
+ */
+ public static TerminalOp<Double, OptionalDouble> makeDouble(boolean mustFindFirst) {
+ return new FindOp<>(mustFindFirst, StreamShape.DOUBLE_VALUE, OptionalDouble.empty(),
+ OptionalDouble::isPresent, FindSink.OfDouble::new);
+ }
+
+ /**
+ * A short-circuiting {@code TerminalOp} that searches for an element in a
+ * stream pipeline, and terminates when it finds one. Implements both
+ * find-first (find the first element in the encounter order) and find-any
+ * (find any element, may not be the first in encounter order.)
+ *
+ * @param <T> the output type of the stream pipeline
+ * @param <O> the result type of the find operation, typically an optional
+ * type
+ */
+ private static final class FindOp<T, O> implements TerminalOp<T, O> {
+ private final StreamShape shape;
+ final boolean mustFindFirst;
+ final O emptyValue;
+ final Predicate<O> presentPredicate;
+ final Supplier<TerminalSink<T, O>> sinkSupplier;
+
+ /**
+ * Constructs a {@code FindOp}.
+ *
+ * @param mustFindFirst if true, must find the first element in
+ * encounter order, otherwise can find any element
+ * @param shape stream shape of elements to search
+ * @param emptyValue result value corresponding to "found nothing"
+ * @param presentPredicate {@code Predicate} on result value
+ * corresponding to "found something"
+ * @param sinkSupplier supplier for a {@code TerminalSink} implementing
+ * the matching functionality
+ */
+ FindOp(boolean mustFindFirst,
+ StreamShape shape,
+ O emptyValue,
+ Predicate<O> presentPredicate,
+ Supplier<TerminalSink<T, O>> sinkSupplier) {
+ this.mustFindFirst = mustFindFirst;
+ this.shape = shape;
+ this.emptyValue = emptyValue;
+ this.presentPredicate = presentPredicate;
+ this.sinkSupplier = sinkSupplier;
+ }
+
+ @Override
+ public int getOpFlags() {
+ return StreamOpFlag.IS_SHORT_CIRCUIT | (mustFindFirst ? 0 : StreamOpFlag.NOT_ORDERED);
+ }
+
+ @Override
+ public StreamShape inputShape() {
+ return shape;
+ }
+
+ @Override
+ public <S> O evaluateSequential(PipelineHelper<T> helper,
+ Spliterator<S> spliterator) {
+ O result = helper.wrapAndCopyInto(sinkSupplier.get(), spliterator).get();
+ return result != null ? result : emptyValue;
+ }
+
+ @Override
+ public <P_IN> O evaluateParallel(PipelineHelper<T> helper,
+ Spliterator<P_IN> spliterator) {
+ return new FindTask<>(this, helper, spliterator).invoke();
+ }
+ }
+
+ /**
+ * Implementation of @{code TerminalSink} that implements the find
+ * functionality, requesting cancellation when something has been found
+ *
+ * @param <T> The type of input element
+ * @param <O> The result type, typically an optional type
+ */
+ private static abstract class FindSink<T, O> implements TerminalSink<T, O> {
+ boolean hasValue;
+ T value;
+
+ FindSink() {} // Avoid creation of special accessor
+
+ @Override
+ public void accept(T value) {
+ if (!hasValue) {
+ hasValue = true;
+ this.value = value;
+ }
+ }
+
+ @Override
+ public boolean cancellationRequested() {
+ return hasValue;
+ }
+
+ /** Specialization of {@code FindSink} for reference streams */
+ static final class OfRef<T> extends FindSink<T, Optional<T>> {
+ @Override
+ public Optional<T> get() {
+ return hasValue ? Optional.of(value) : null;
+ }
+ }
+
+ /** Specialization of {@code FindSink} for int streams */
+ static final class OfInt extends FindSink<Integer, OptionalInt>
+ implements Sink.OfInt {
+ @Override
+ public void accept(int value) {
+ // Boxing is OK here, since few values will actually flow into the sink
+ accept((Integer) value);
+ }
+
+ @Override
+ public OptionalInt get() {
+ return hasValue ? OptionalInt.of(value) : null;
+ }
+ }
+
+ /** Specialization of {@code FindSink} for long streams */
+ static final class OfLong extends FindSink<Long, OptionalLong>
+ implements Sink.OfLong {
+ @Override
+ public void accept(long value) {
+ // Boxing is OK here, since few values will actually flow into the sink
+ accept((Long) value);
+ }
+
+ @Override
+ public OptionalLong get() {
+ return hasValue ? OptionalLong.of(value) : null;
+ }
+ }
+
+ /** Specialization of {@code FindSink} for double streams */
+ static final class OfDouble extends FindSink<Double, OptionalDouble>
+ implements Sink.OfDouble {
+ @Override
+ public void accept(double value) {
+ // Boxing is OK here, since few values will actually flow into the sink
+ accept((Double) value);
+ }
+
+ @Override
+ public OptionalDouble get() {
+ return hasValue ? OptionalDouble.of(value) : null;
+ }
+ }
+ }
+
+ /**
+ * {@code ForkJoinTask} implementing parallel short-circuiting search
+ * @param <P_IN> Input element type to the stream pipeline
+ * @param <P_OUT> Output element type from the stream pipeline
+ * @param <O> Result type from the find operation
+ */
+ private static final class FindTask<P_IN, P_OUT, O>
+ extends AbstractShortCircuitTask<P_IN, P_OUT, O, FindTask<P_IN, P_OUT, O>> {
+ private final FindOp<P_OUT, O> op;
+
+ FindTask(FindOp<P_OUT, O> op,
+ PipelineHelper<P_OUT> helper,
+ Spliterator<P_IN> spliterator) {
+ super(helper, spliterator);
+ this.op = op;
+ }
+
+ FindTask(FindTask<P_IN, P_OUT, O> parent, Spliterator<P_IN> spliterator) {
+ super(parent, spliterator);
+ this.op = parent.op;
+ }
+
+ @Override
+ protected FindTask<P_IN, P_OUT, O> makeChild(Spliterator<P_IN> spliterator) {
+ return new FindTask<>(this, spliterator);
+ }
+
+ @Override
+ protected O getEmptyResult() {
+ return op.emptyValue;
+ }
+
+ private void foundResult(O answer) {
+ if (isLeftmostNode())
+ shortCircuit(answer);
+ else
+ cancelLaterNodes();
+ }
+
+ @Override
+ protected O doLeaf() {
+ O result = helper.wrapAndCopyInto(op.sinkSupplier.get(), spliterator).get();
+ if (!op.mustFindFirst) {
+ if (result != null)
+ shortCircuit(result);
+ return null;
+ }
+ else {
+ if (result != null) {
+ foundResult(result);
+ return result;
+ }
+ else
+ return null;
+ }
+ }
+
+ @Override
+ public void onCompletion(CountedCompleter<?> caller) {
+ if (op.mustFindFirst) {
+ for (FindTask<P_IN, P_OUT, O> child = leftChild, p = null; child != p;
+ p = child, child = rightChild) {
+ O result = child.getLocalResult();
+ if (result != null && op.presentPredicate.test(result)) {
+ setLocalResult(result);
+ foundResult(result);
+ break;
+ }
+ }
+ }
+ super.onCompletion(caller);
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/ForEachOps.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,396 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountedCompleter;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.LongConsumer;
+
+/**
+ * Factory for creating instances of {@code TerminalOp} that perform an
+ * action for every element of a stream. Supported variants include unordered
+ * traversal (elements are provided to the {@code Consumer} as soon as they are
+ * available), and ordered traversal (elements are provided to the
+ * {@code Consumer} in encounter order.)
+ *
+ * <p>Elements are provided to the {@code Consumer} on whatever thread and
+ * whatever order they become available. For ordered traversals, it is
+ * guaranteed that processing an element <em>happens-before</em> processing
+ * subsequent elements in the encounter order.
+ *
+ * <p>Exceptions occurring as a result of sending an element to the
+ * {@code Consumer} will be relayed to the caller and traversal will be
+ * prematurely terminated.
+ *
+ * @since 1.8
+ */
+final class ForEachOps {
+
+ private ForEachOps() { }
+
+ /**
+ * Constructs a {@code TerminalOp} that perform an action for every element
+ * of a stream.
+ *
+ * @param action the {@code Consumer} that receives all elements of a
+ * stream
+ * @param ordered whether an ordered traversal is requested
+ * @param <T> the type of the stream elements
+ * @return the {@code TerminalOp} instance
+ */
+ public static <T> TerminalOp<T, Void> makeRef(Consumer<? super T> action,
+ boolean ordered) {
+ Objects.requireNonNull(action);
+ return new ForEachOp.OfRef<>(action, ordered);
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that perform an action for every element
+ * of an {@code IntStream}.
+ *
+ * @param action the {@code IntConsumer} that receives all elements of a
+ * stream
+ * @param ordered whether an ordered traversal is requested
+ * @return the {@code TerminalOp} instance
+ */
+ public static TerminalOp<Integer, Void> makeInt(IntConsumer action,
+ boolean ordered) {
+ Objects.requireNonNull(action);
+ return new ForEachOp.OfInt(action, ordered);
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that perform an action for every element
+ * of a {@code LongStream}.
+ *
+ * @param action the {@code LongConsumer} that receives all elements of a
+ * stream
+ * @param ordered whether an ordered traversal is requested
+ * @return the {@code TerminalOp} instance
+ */
+ public static TerminalOp<Long, Void> makeLong(LongConsumer action,
+ boolean ordered) {
+ Objects.requireNonNull(action);
+ return new ForEachOp.OfLong(action, ordered);
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that perform an action for every element
+ * of a {@code DoubleStream}.
+ *
+ * @param action the {@code DoubleConsumer} that receives all elements of
+ * a stream
+ * @param ordered whether an ordered traversal is requested
+ * @return the {@code TerminalOp} instance
+ */
+ public static TerminalOp<Double, Void> makeDouble(DoubleConsumer action,
+ boolean ordered) {
+ Objects.requireNonNull(action);
+ return new ForEachOp.OfDouble(action, ordered);
+ }
+
+ /**
+ * A {@code TerminalOp} that evaluates a stream pipeline and sends the
+ * output to itself as a {@code TerminalSink}. Elements will be sent in
+ * whatever thread they become available. If the traversal is unordered,
+ * they will be sent independent of the stream's encounter order.
+ *
+ * <p>This terminal operation is stateless. For parallel evaluation, each
+ * leaf instance of a {@code ForEachTask} will send elements to the same
+ * {@code TerminalSink} reference that is an instance of this class.
+ *
+ * @param <T> the output type of the stream pipeline
+ */
+ private static abstract class ForEachOp<T>
+ implements TerminalOp<T, Void>, TerminalSink<T, Void> {
+ private final boolean ordered;
+
+ protected ForEachOp(boolean ordered) {
+ this.ordered = ordered;
+ }
+
+ // TerminalOp
+
+ @Override
+ public int getOpFlags() {
+ return ordered ? 0 : StreamOpFlag.NOT_ORDERED;
+ }
+
+ @Override
+ public <S> Void evaluateSequential(PipelineHelper<T> helper,
+ Spliterator<S> spliterator) {
+ return helper.wrapAndCopyInto(this, spliterator).get();
+ }
+
+ @Override
+ public <S> Void evaluateParallel(PipelineHelper<T> helper,
+ Spliterator<S> spliterator) {
+ if (ordered)
+ new ForEachOrderedTask<>(helper, spliterator, this).invoke();
+ else
+ new ForEachTask<>(helper, spliterator, helper.wrapSink(this)).invoke();
+ return null;
+ }
+
+ // TerminalSink
+
+ @Override
+ public Void get() {
+ return null;
+ }
+
+ // Implementations
+
+ /** Implementation class for reference streams */
+ private static class OfRef<T> extends ForEachOp<T> {
+ final Consumer<? super T> consumer;
+
+ OfRef(Consumer<? super T> consumer, boolean ordered) {
+ super(ordered);
+ this.consumer = consumer;
+ }
+
+ @Override
+ public void accept(T t) {
+ consumer.accept(t);
+ }
+ }
+
+ /** Implementation class for {@code IntStream} */
+ private static class OfInt extends ForEachOp<Integer>
+ implements Sink.OfInt {
+ final IntConsumer consumer;
+
+ OfInt(IntConsumer consumer, boolean ordered) {
+ super(ordered);
+ this.consumer = consumer;
+ }
+
+ @Override
+ public StreamShape inputShape() {
+ return StreamShape.INT_VALUE;
+ }
+
+ @Override
+ public void accept(int t) {
+ consumer.accept(t);
+ }
+ }
+
+ /** Implementation class for {@code LongStream} */
+ private static class OfLong extends ForEachOp<Long>
+ implements Sink.OfLong {
+ final LongConsumer consumer;
+
+ OfLong(LongConsumer consumer, boolean ordered) {
+ super(ordered);
+ this.consumer = consumer;
+ }
+
+ @Override
+ public StreamShape inputShape() {
+ return StreamShape.LONG_VALUE;
+ }
+
+ @Override
+ public void accept(long t) {
+ consumer.accept(t);
+ }
+ }
+
+ /** Implementation class for {@code DoubleStream} */
+ private static class OfDouble extends ForEachOp<Double>
+ implements Sink.OfDouble {
+ final DoubleConsumer consumer;
+
+ OfDouble(DoubleConsumer consumer, boolean ordered) {
+ super(ordered);
+ this.consumer = consumer;
+ }
+
+ @Override
+ public StreamShape inputShape() {
+ return StreamShape.DOUBLE_VALUE;
+ }
+
+ @Override
+ public void accept(double t) {
+ consumer.accept(t);
+ }
+ }
+ }
+
+ /** A {@code ForkJoinTask} for performing a parallel for-each operation */
+ private static class ForEachTask<S, T> extends CountedCompleter<Void> {
+ private Spliterator<S> spliterator;
+ private final Sink<S> sink;
+ private final PipelineHelper<T> helper;
+ private final long targetSize;
+
+ ForEachTask(PipelineHelper<T> helper,
+ Spliterator<S> spliterator,
+ Sink<S> sink) {
+ super(null);
+ this.spliterator = spliterator;
+ this.sink = sink;
+ this.targetSize = AbstractTask.suggestTargetSize(spliterator.estimateSize());
+ this.helper = helper;
+ }
+
+ ForEachTask(ForEachTask<S, T> parent, Spliterator<S> spliterator) {
+ super(parent);
+ this.spliterator = spliterator;
+ this.sink = parent.sink;
+ this.targetSize = parent.targetSize;
+ this.helper = parent.helper;
+ }
+
+ public void compute() {
+ boolean isShortCircuit = StreamOpFlag.SHORT_CIRCUIT.isKnown(helper.getStreamAndOpFlags());
+ while (true) {
+ if (isShortCircuit && sink.cancellationRequested()) {
+ propagateCompletion();
+ spliterator = null;
+ return;
+ }
+
+ Spliterator<S> split;
+ if (!AbstractTask.suggestSplit(spliterator, targetSize)
+ || (split = spliterator.trySplit()) == null) {
+ helper.copyInto(sink, spliterator);
+ propagateCompletion();
+ spliterator = null;
+ return;
+ }
+ else {
+ addToPendingCount(1);
+ new ForEachTask<>(this, split).fork();
+ }
+ }
+ }
+ }
+
+ /**
+ * A {@code ForkJoinTask} for performing a parallel for-each operation
+ * which visits the elements in encounter order
+ */
+ private static class ForEachOrderedTask<S, T> extends CountedCompleter<Void> {
+ private final PipelineHelper<T> helper;
+ private Spliterator<S> spliterator;
+ private final long targetSize;
+ private final ConcurrentHashMap<ForEachOrderedTask<S, T>, ForEachOrderedTask<S, T>> completionMap;
+ private final Sink<T> action;
+ private final Object lock;
+ private final ForEachOrderedTask<S, T> leftPredecessor;
+ private Node<T> node;
+
+ protected ForEachOrderedTask(PipelineHelper<T> helper,
+ Spliterator<S> spliterator,
+ Sink<T> action) {
+ super(null);
+ this.helper = helper;
+ this.spliterator = spliterator;
+ this.targetSize = AbstractTask.suggestTargetSize(spliterator.estimateSize());
+ this.completionMap = new ConcurrentHashMap<>();
+ this.action = action;
+ this.lock = new Object();
+ this.leftPredecessor = null;
+ }
+
+ ForEachOrderedTask(ForEachOrderedTask<S, T> parent,
+ Spliterator<S> spliterator,
+ ForEachOrderedTask<S, T> leftPredecessor) {
+ super(parent);
+ this.helper = parent.helper;
+ this.spliterator = spliterator;
+ this.targetSize = parent.targetSize;
+ this.completionMap = parent.completionMap;
+ this.action = parent.action;
+ this.lock = parent.lock;
+ this.leftPredecessor = leftPredecessor;
+ }
+
+ @Override
+ public final void compute() {
+ doCompute(this);
+ }
+
+ private static<S, T> void doCompute(ForEachOrderedTask<S, T> task) {
+ while (true) {
+ Spliterator<S> split;
+ if (!AbstractTask.suggestSplit(task.spliterator, task.targetSize)
+ || (split = task.spliterator.trySplit()) == null) {
+ if (task.getPendingCount() == 0) {
+ task.helper.wrapAndCopyInto(task.action, task.spliterator);
+ }
+ else {
+ Node.Builder<T> nb = task.helper.makeNodeBuilder(
+ task.helper.exactOutputSizeIfKnown(task.spliterator),
+ size -> (T[]) new Object[size]);
+ task.node = task.helper.wrapAndCopyInto(nb, task.spliterator).build();
+ }
+ task.tryComplete();
+ return;
+ }
+ else {
+ ForEachOrderedTask<S, T> leftChild = new ForEachOrderedTask<>(task, split, task.leftPredecessor);
+ ForEachOrderedTask<S, T> rightChild = new ForEachOrderedTask<>(task, task.spliterator, leftChild);
+ task.completionMap.put(leftChild, rightChild);
+ task.addToPendingCount(1); // forking
+ rightChild.addToPendingCount(1); // right pending on left child
+ if (task.leftPredecessor != null) {
+ leftChild.addToPendingCount(1); // left pending on previous subtree, except left spine
+ if (task.completionMap.replace(task.leftPredecessor, task, leftChild))
+ task.addToPendingCount(-1); // transfer my "right child" count to my left child
+ else
+ leftChild.addToPendingCount(-1); // left child is ready to go when ready
+ }
+ leftChild.fork();
+ task = rightChild;
+ }
+ }
+ }
+
+ @Override
+ public void onCompletion(CountedCompleter<?> caller) {
+ spliterator = null;
+ if (node != null) {
+ // Dump any data from this leaf into the sink
+ synchronized (lock) {
+ node.forEach(action);
+ }
+ node = null;
+ }
+ ForEachOrderedTask<S, T> victim = completionMap.remove(this);
+ if (victim != null)
+ victim.tryComplete();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/IntPipeline.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,631 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.IntSummaryStatistics;
+import java.util.Objects;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.BinaryOperator;
+import java.util.function.IntBinaryOperator;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.IntPredicate;
+import java.util.function.IntToDoubleFunction;
+import java.util.function.IntToLongFunction;
+import java.util.function.IntUnaryOperator;
+import java.util.function.ObjIntConsumer;
+import java.util.function.Supplier;
+
+/**
+ * Abstract base class for an intermediate pipeline stage or pipeline source
+ * stage implementing whose elements are of type {@code int}.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @since 1.8
+ */
+abstract class IntPipeline<E_IN>
+ extends AbstractPipeline<E_IN, Integer, IntStream>
+ implements IntStream {
+
+ /**
+ * Constructor for the head of a stream pipeline.
+ *
+ * @param source {@code Supplier<Spliterator>} describing the stream source
+ * @param sourceFlags The source flags for the stream source, described in
+ * {@link StreamOpFlag}
+ * @param parallel {@code true} if the pipeline is parallel
+ */
+ IntPipeline(Supplier<? extends Spliterator<Integer>> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ /**
+ * Constructor for the head of a stream pipeline.
+ *
+ * @param source {@code Spliterator} describing the stream source
+ * @param sourceFlags The source flags for the stream source, described in
+ * {@link StreamOpFlag}
+ * @param parallel {@code true} if the pipeline is parallel
+ */
+ IntPipeline(Spliterator<Integer> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ /**
+ * Constructor for appending an intermediate operation onto an existing
+ * pipeline.
+ *
+ * @param upstream the upstream element source
+ * @param opFlags the operation flags for the new operation
+ */
+ IntPipeline(AbstractPipeline<?, E_IN, ?> upstream, int opFlags) {
+ super(upstream, opFlags);
+ }
+
+ /**
+ * Adapt a {@code Sink<Integer> to an {@code IntConsumer}, ideally simply
+ * by casting.
+ */
+ private static IntConsumer adapt(Sink<Integer> sink) {
+ if (sink instanceof IntConsumer) {
+ return (IntConsumer) sink;
+ }
+ else {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(AbstractPipeline.class,
+ "using IntStream.adapt(Sink<Integer> s)");
+ return sink::accept;
+ }
+ }
+
+ /**
+ * Adapt a {@code Spliterator<Integer>} to a {@code Spliterator.OfInt}.
+ *
+ * @implNote
+ * The implementation attempts to cast to a Spliterator.OfInt, and throws an
+ * exception if this cast is not possible.
+ */
+ private static Spliterator.OfInt adapt(Spliterator<Integer> s) {
+ if (s instanceof Spliterator.OfInt) {
+ return (Spliterator.OfInt) s;
+ }
+ else {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(AbstractPipeline.class,
+ "using IntStream.adapt(Spliterator<Integer> s)");
+ throw new UnsupportedOperationException("IntStream.adapt(Spliterator<Integer> s)");
+ }
+ }
+
+
+ // Shape-specific methods
+
+ @Override
+ final StreamShape getOutputShape() {
+ return StreamShape.INT_VALUE;
+ }
+
+ @Override
+ final <P_IN> Node<Integer> evaluateToNode(PipelineHelper<Integer> helper,
+ Spliterator<P_IN> spliterator,
+ boolean flattenTree,
+ IntFunction<Integer[]> generator) {
+ return Nodes.collectInt(helper, spliterator, flattenTree);
+ }
+
+ @Override
+ final <P_IN> Spliterator<Integer> wrap(PipelineHelper<Integer> ph,
+ Supplier<Spliterator<P_IN>> supplier,
+ boolean isParallel) {
+ return new StreamSpliterators.IntWrappingSpliterator<>(ph, supplier, isParallel);
+ }
+
+ @Override
+ final Spliterator.OfInt lazySpliterator(Supplier<? extends Spliterator<Integer>> supplier) {
+ return new StreamSpliterators.DelegatingSpliterator.OfInt((Supplier<Spliterator.OfInt>) supplier);
+ }
+
+ @Override
+ final void forEachWithCancel(Spliterator<Integer> spliterator, Sink<Integer> sink) {
+ Spliterator.OfInt spl = adapt(spliterator);
+ IntConsumer adaptedSink = adapt(sink);
+ do { } while (!sink.cancellationRequested() && spl.tryAdvance(adaptedSink));
+ }
+
+ @Override
+ final Node.Builder<Integer> makeNodeBuilder(long exactSizeIfKnown,
+ IntFunction<Integer[]> generator) {
+ return Nodes.intBuilder(exactSizeIfKnown);
+ }
+
+
+ // IntStream
+
+ @Override
+ public final PrimitiveIterator.OfInt iterator() {
+ return Spliterators.iteratorFromSpliterator(spliterator());
+ }
+
+ @Override
+ public final Spliterator.OfInt spliterator() {
+ return adapt(super.spliterator());
+ }
+
+ // Stateless intermediate ops from IntStream
+
+ @Override
+ public final LongStream longs() {
+ return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Integer> opWrapSink(int flags, Sink<Long> sink) {
+ return new Sink.ChainedInt(sink) {
+ @Override
+ public void accept(int t) {
+ downstream.accept((long) t);
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final DoubleStream doubles() {
+ return new DoublePipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Integer> opWrapSink(int flags, Sink<Double> sink) {
+ return new Sink.ChainedInt(sink) {
+ @Override
+ public void accept(int t) {
+ downstream.accept((double) t);
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final Stream<Integer> boxed() {
+ return mapToObj(Integer::valueOf);
+ }
+
+ @Override
+ public final IntStream map(IntUnaryOperator mapper) {
+ Objects.requireNonNull(mapper);
+ return new StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+ return new Sink.ChainedInt(sink) {
+ @Override
+ public void accept(int t) {
+ downstream.accept(mapper.applyAsInt(t));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final <U> Stream<U> mapToObj(IntFunction<? extends U> mapper) {
+ Objects.requireNonNull(mapper);
+ return new ReferencePipeline.StatelessOp<Integer, U>(this, StreamShape.INT_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Integer> opWrapSink(int flags, Sink<U> sink) {
+ return new Sink.ChainedInt(sink) {
+ @Override
+ public void accept(int t) {
+ downstream.accept(mapper.apply(t));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final LongStream mapToLong(IntToLongFunction mapper) {
+ Objects.requireNonNull(mapper);
+ return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Integer> opWrapSink(int flags, Sink<Long> sink) {
+ return new Sink.ChainedInt(sink) {
+ @Override
+ public void accept(int t) {
+ downstream.accept(mapper.applyAsLong(t));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final DoubleStream mapToDouble(IntToDoubleFunction mapper) {
+ Objects.requireNonNull(mapper);
+ return new DoublePipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Integer> opWrapSink(int flags, Sink<Double> sink) {
+ return new Sink.ChainedInt(sink) {
+ @Override
+ public void accept(int t) {
+ downstream.accept(mapper.applyAsDouble(t));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final IntStream flatMap(IntFunction<? extends IntStream> mapper) {
+ return new StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+ @Override
+ Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+ return new Sink.ChainedInt(sink) {
+ public void accept(int t) {
+ // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+ IntStream result = mapper.apply(t);
+ if (result != null)
+ result.sequential().forEach(i -> downstream.accept(i));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public IntStream unordered() {
+ if (!isOrdered())
+ return this;
+ return new StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_ORDERED) {
+ @Override
+ Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+ return sink;
+ }
+ };
+ }
+
+ @Override
+ public final IntStream filter(IntPredicate predicate) {
+ Objects.requireNonNull(predicate);
+ return new StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+ StreamOpFlag.NOT_SIZED) {
+ @Override
+ Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+ return new Sink.ChainedInt(sink) {
+ @Override
+ public void accept(int t) {
+ if (predicate.test(t))
+ downstream.accept(t);
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final IntStream peek(IntConsumer consumer) {
+ Objects.requireNonNull(consumer);
+ return new StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+ 0) {
+ @Override
+ Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+ return new Sink.ChainedInt(sink) {
+ @Override
+ public void accept(int t) {
+ consumer.accept(t);
+ downstream.accept(t);
+ }
+ };
+ }
+ };
+ }
+
+ // Stateful intermediate ops from IntStream
+
+ private IntStream slice(long skip, long limit) {
+ return SliceOps.makeInt(this, skip, limit);
+ }
+
+ @Override
+ public final IntStream limit(long maxSize) {
+ if (maxSize < 0)
+ throw new IllegalArgumentException(Long.toString(maxSize));
+ return slice(0, maxSize);
+ }
+
+ @Override
+ public final IntStream substream(long startingOffset) {
+ if (startingOffset < 0)
+ throw new IllegalArgumentException(Long.toString(startingOffset));
+ if (startingOffset == 0)
+ return this;
+ else
+ return slice(startingOffset, -1);
+ }
+
+ @Override
+ public final IntStream substream(long startingOffset, long endingOffset) {
+ if (startingOffset < 0 || endingOffset < startingOffset)
+ throw new IllegalArgumentException(String.format("substream(%d, %d)", startingOffset, endingOffset));
+ return slice(startingOffset, endingOffset - startingOffset);
+ }
+
+ @Override
+ public final IntStream sorted() {
+ return SortedOps.makeInt(this);
+ }
+
+ @Override
+ public final IntStream distinct() {
+ // While functional and quick to implement, this approach is not very efficient.
+ // An efficient version requires an int-specific map/set implementation.
+ return boxed().distinct().mapToInt(i -> i);
+ }
+
+ // Terminal ops from IntStream
+
+ @Override
+ public void forEach(IntConsumer action) {
+ evaluate(ForEachOps.makeInt(action, false));
+ }
+
+ @Override
+ public void forEachOrdered(IntConsumer action) {
+ evaluate(ForEachOps.makeInt(action, true));
+ }
+
+ @Override
+ public final int sum() {
+ return reduce(0, Integer::sum);
+ }
+
+ @Override
+ public final OptionalInt min() {
+ return reduce(Math::min);
+ }
+
+ @Override
+ public final OptionalInt max() {
+ return reduce(Math::max);
+ }
+
+ @Override
+ public final long count() {
+ return longs().map(e -> 1L).sum();
+ }
+
+ @Override
+ public final OptionalDouble average() {
+ long[] avg = collect(() -> new long[2],
+ (ll, i) -> {
+ ll[0]++;
+ ll[1] += i;
+ },
+ (ll, rr) -> {
+ ll[0] += rr[0];
+ ll[1] += rr[1];
+ });
+ return avg[0] > 0
+ ? OptionalDouble.of((double) avg[1] / avg[0])
+ : OptionalDouble.empty();
+ }
+
+ @Override
+ public final IntSummaryStatistics summaryStatistics() {
+ return collect(IntSummaryStatistics::new, IntSummaryStatistics::accept,
+ IntSummaryStatistics::combine);
+ }
+
+ @Override
+ public final int reduce(int identity, IntBinaryOperator op) {
+ return evaluate(ReduceOps.makeInt(identity, op));
+ }
+
+ @Override
+ public final OptionalInt reduce(IntBinaryOperator op) {
+ return evaluate(ReduceOps.makeInt(op));
+ }
+
+ @Override
+ public final <R> R collect(Supplier<R> resultFactory,
+ ObjIntConsumer<R> accumulator,
+ BiConsumer<R, R> combiner) {
+ BinaryOperator<R> operator = (left, right) -> {
+ combiner.accept(left, right);
+ return left;
+ };
+ return evaluate(ReduceOps.makeInt(resultFactory, accumulator, operator));
+ }
+
+ @Override
+ public final boolean anyMatch(IntPredicate predicate) {
+ return evaluate(MatchOps.makeInt(predicate, MatchOps.MatchKind.ANY));
+ }
+
+ @Override
+ public final boolean allMatch(IntPredicate predicate) {
+ return evaluate(MatchOps.makeInt(predicate, MatchOps.MatchKind.ALL));
+ }
+
+ @Override
+ public final boolean noneMatch(IntPredicate predicate) {
+ return evaluate(MatchOps.makeInt(predicate, MatchOps.MatchKind.NONE));
+ }
+
+ @Override
+ public final OptionalInt findFirst() {
+ return evaluate(FindOps.makeInt(true));
+ }
+
+ @Override
+ public final OptionalInt findAny() {
+ return evaluate(FindOps.makeInt(false));
+ }
+
+ @Override
+ public final int[] toArray() {
+ return Nodes.flattenInt((Node.OfInt) evaluateToArrayNode(Integer[]::new))
+ .asIntArray();
+ }
+
+ //
+
+ /**
+ * Source stage of an IntStream.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @since 1.8
+ */
+ static class Head<E_IN> extends IntPipeline<E_IN> {
+ /**
+ * Constructor for the source stage of an IntStream.
+ *
+ * @param source {@code Supplier<Spliterator>} describing the stream
+ * source
+ * @param sourceFlags the source flags for the stream source, described
+ * in {@link StreamOpFlag}
+ * @param parallel {@code true} if the pipeline is parallel
+ */
+ Head(Supplier<? extends Spliterator<Integer>> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ /**
+ * Constructor for the source stage of an IntStream.
+ *
+ * @param source {@code Spliterator} describing the stream source
+ * @param sourceFlags the source flags for the stream source, described
+ * in {@link StreamOpFlag}
+ * @param parallel {@code true} if the pipeline is parallel
+ */
+ Head(Spliterator<Integer> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ @Override
+ final boolean opIsStateful() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ final Sink<E_IN> opWrapSink(int flags, Sink<Integer> sink) {
+ throw new UnsupportedOperationException();
+ }
+
+ // Optimized sequential terminal operations for the head of the pipeline
+
+ @Override
+ public void forEach(IntConsumer action) {
+ if (!isParallel()) {
+ adapt(sourceStageSpliterator()).forEachRemaining(action);
+ }
+ else {
+ super.forEach(action);
+ }
+ }
+
+ @Override
+ public void forEachOrdered(IntConsumer action) {
+ if (!isParallel()) {
+ adapt(sourceStageSpliterator()).forEachRemaining(action);
+ }
+ else {
+ super.forEachOrdered(action);
+ }
+ }
+ }
+
+ /**
+ * Base class for a stateless intermediate stage of an IntStream
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @since 1.8
+ */
+ abstract static class StatelessOp<E_IN> extends IntPipeline<E_IN> {
+ /**
+ * Construct a new IntStream by appending a stateless intermediate
+ * operation to an existing stream.
+ * @param upstream The upstream pipeline stage
+ * @param inputShape The stream shape for the upstream pipeline stage
+ * @param opFlags Operation flags for the new stage
+ */
+ StatelessOp(AbstractPipeline<?, E_IN, ?> upstream,
+ StreamShape inputShape,
+ int opFlags) {
+ super(upstream, opFlags);
+ assert upstream.getOutputShape() == inputShape;
+ }
+
+ @Override
+ final boolean opIsStateful() {
+ return false;
+ }
+ }
+
+ /**
+ * Base class for a stateful intermediate stage of an IntStream.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @since 1.8
+ */
+ abstract static class StatefulOp<E_IN> extends IntPipeline<E_IN> {
+ /**
+ * Construct a new IntStream by appending a stateful intermediate
+ * operation to an existing stream.
+ * @param upstream The upstream pipeline stage
+ * @param inputShape The stream shape for the upstream pipeline stage
+ * @param opFlags Operation flags for the new stage
+ */
+ StatefulOp(AbstractPipeline<?, E_IN, ?> upstream,
+ StreamShape inputShape,
+ int opFlags) {
+ super(upstream, opFlags);
+ assert upstream.getOutputShape() == inputShape;
+ }
+
+ @Override
+ final boolean opIsStateful() {
+ return true;
+ }
+
+ @Override
+ abstract <P_IN> Node<Integer> opEvaluateParallel(PipelineHelper<Integer> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<Integer[]> generator);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/IntStream.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,808 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Arrays;
+import java.util.IntSummaryStatistics;
+import java.util.Objects;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.function.IntBinaryOperator;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.IntPredicate;
+import java.util.function.IntSupplier;
+import java.util.function.IntToDoubleFunction;
+import java.util.function.IntToLongFunction;
+import java.util.function.IntUnaryOperator;
+import java.util.function.ObjIntConsumer;
+import java.util.function.Supplier;
+
+/**
+ * A sequence of primitive integer elements supporting sequential and parallel
+ * bulk operations. Streams support lazy intermediate operations (transforming
+ * a stream to another stream) such as {@code filter} and {@code map}, and terminal
+ * operations (consuming the contents of a stream to produce a result or
+ * side-effect), such as {@code forEach}, {@code findFirst}, and {@code
+ * iterator}. Once an operation has been performed on a stream, it
+ * is considered <em>consumed</em> and no longer usable for other operations.
+ *
+ * <p>For sequential stream pipelines, all operations are performed in the
+ * <a href="package-summary.html#Ordering">encounter order</a> of the pipeline
+ * source, if the pipeline source has a defined encounter order.
+ *
+ * <p>For parallel stream pipelines, unless otherwise specified, intermediate
+ * stream operations preserve the <a href="package-summary.html#Ordering">
+ * encounter order</a> of their source, and terminal operations
+ * respect the encounter order of their source, if the source
+ * has an encounter order. Provided that and parameters to stream operations
+ * satisfy the <a href="package-summary.html#NonInterference">non-interference
+ * requirements</a>, and excepting differences arising from the absence of
+ * a defined encounter order, the result of a stream pipeline should be the
+ * stable across multiple executions of the same operations on the same source.
+ * However, the timing and thread in which side-effects occur (for those
+ * operations which are allowed to produce side-effects, such as
+ * {@link #forEach(IntConsumer)}), are explicitly nondeterministic for parallel
+ * execution of stream pipelines.
+ *
+ * <p>Unless otherwise noted, passing a {@code null} argument to any stream
+ * method may result in a {@link NullPointerException}.
+ *
+ * @apiNote
+ * Streams are not data structures; they do not manage the storage for their
+ * elements, nor do they support access to individual elements. However,
+ * you can use the {@link #iterator()} or {@link #spliterator()} operations to
+ * perform a controlled traversal.
+ *
+ * @since 1.8
+ * @see <a href="package-summary.html">java.util.stream</a>
+ */
+public interface IntStream extends BaseStream<Integer, IntStream> {
+
+ /**
+ * Returns a stream consisting of the elements of this stream that match
+ * the given predicate.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> predicate to apply to
+ * each element to determine if it should be included
+ * @return the new stream
+ */
+ IntStream filter(IntPredicate predicate);
+
+ /**
+ * Returns a stream consisting of the results of applying the given
+ * function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ IntStream map(IntUnaryOperator mapper);
+
+ /**
+ * Returns an object-valued {@code Stream} consisting of the results of
+ * applying the given function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">
+ * intermediate operation</a>.
+ *
+ * @param <U> the element type of the new stream
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ <U> Stream<U> mapToObj(IntFunction<? extends U> mapper);
+
+ /**
+ * Returns a {@code LongStream} consisting of the results of applying the
+ * given function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ LongStream mapToLong(IntToLongFunction mapper);
+
+ /**
+ * Returns a {@code DoubleStream} consisting of the results of applying the
+ * given function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ DoubleStream mapToDouble(IntToDoubleFunction mapper);
+
+ /**
+ * Returns a stream consisting of the results of replacing each element of
+ * this stream with the contents of the stream produced by applying the
+ * provided mapping function to each element.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @apiNote
+ * The {@code flatMap()} operation has the effect of applying a one-to-many
+ * tranformation to the elements of the stream, and then flattening the
+ * resulting elements into a new stream. For example, if {@code orders}
+ * is a stream of purchase orders, and each purchase order contains a
+ * collection of line items, then the following produces a stream of line
+ * items:
+ * <pre>{@code
+ * orderStream.flatMap(order -> order.getLineItems().stream())...
+ * }</pre>
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to
+ * each element which produces an {@code IntStream} of new
+ * values
+ * @return the new stream
+ * @see Stream#flatMap(Function)
+ */
+ IntStream flatMap(IntFunction<? extends IntStream> mapper);
+
+ /**
+ * Returns a stream consisting of the distinct elements of this stream.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">stateful
+ * intermediate operation</a>.
+ *
+ * @return the new stream
+ */
+ IntStream distinct();
+
+ /**
+ * Returns a stream consisting of the elements of this stream in sorted
+ * order.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">stateful
+ * intermediate operation</a>.
+ *
+ * @return the new stream
+ */
+ IntStream sorted();
+
+ /**
+ * Returns a stream consisting of the elements of this stream, additionally
+ * performing the provided action on each element as elements are consumed
+ * from the resulting stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * <p>For parallel stream pipelines, the action may be called at
+ * whatever time and in whatever thread the element is made available by the
+ * upstream operation. If the action modifies shared state,
+ * it is responsible for providing the required synchronization.
+ *
+ * @apiNote This method exists mainly to support debugging, where you want
+ * to see the elements as they flow past a certain point in a pipeline:
+ * <pre>{@code
+ * list.stream()
+ * .filter(filteringFunction)
+ * .peek(e -> {System.out.println("Filtered value: " + e); });
+ * .map(mappingFunction)
+ * .peek(e -> {System.out.println("Mapped value: " + e); });
+ * .collect(Collectors.toIntSummaryStastistics());
+ * }</pre>
+ *
+ * @param consumer a <a href="package-summary.html#NonInterference">
+ * non-interfering</a> action to perform on the elements as
+ * they are consumed from the stream
+ * @return the new stream
+ */
+ IntStream peek(IntConsumer consumer);
+
+ /**
+ * Returns a stream consisting of the elements of this stream, truncated
+ * to be no longer than {@code maxSize} in length.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * stateful intermediate operation</a>.
+ *
+ * @param maxSize the number of elements the stream should be limited to
+ * @return the new stream
+ * @throws IllegalArgumentException if {@code maxSize} is negative
+ */
+ IntStream limit(long maxSize);
+
+ /**
+ * Returns a stream consisting of the remaining elements of this stream
+ * after indexing {@code startInclusive} elements into the stream. If the
+ * {@code startInclusive} index lies past the end of this stream then an
+ * empty stream will be returned.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">stateful
+ * intermediate operation</a>.
+ *
+ * @param startInclusive the number of leading elements to skip
+ * @return the new stream
+ * @throws IllegalArgumentException if {@code startInclusive} is negative
+ */
+ IntStream substream(long startInclusive);
+
+ /**
+ * Returns a stream consisting of the remaining elements of this stream
+ * after indexing {@code startInclusive} elements into the stream and
+ * truncated to contain no more than {@code endExclusive - startInclusive}
+ * elements. If the {@code startInclusive} index lies past the end
+ * of this stream then an empty stream will be returned.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * stateful intermediate operation</a>.
+ *
+ * @param startInclusive the starting position of the substream, inclusive
+ * @param endExclusive the ending position of the substream, exclusive
+ * @return the new stream
+ * @throws IllegalArgumentException if {@code startInclusive} or
+ * {@code endExclusive} is negative or {@code startInclusive} is greater
+ * than {@code endExclusive}
+ */
+ IntStream substream(long startInclusive, long endExclusive);
+
+ /**
+ * Performs an action for each element of this stream.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * <p>For parallel stream pipelines, this operation does <em>not</em>
+ * guarantee to respect the encounter order of the stream, as doing so
+ * would sacrifice the benefit of parallelism. For any given element, the
+ * action may be performed at whatever time and in whatever thread the
+ * library chooses. If the action accesses shared state, it is
+ * responsible for providing the required synchronization.
+ *
+ * @param action a <a href="package-summary.html#NonInterference">
+ * non-interfering</a> action to perform on the elements
+ */
+ void forEach(IntConsumer action);
+
+ /**
+ * Performs an action for each element of this stream, guaranteeing that
+ * each element is processed in encounter order for streams that have a
+ * defined encounter order.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @param action a <a href="package-summary.html#NonInterference">
+ * non-interfering</a> action to perform on the elements
+ * @see #forEach(IntConsumer)
+ */
+ void forEachOrdered(IntConsumer action);
+
+ /**
+ * Returns an array containing the elements of this stream.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @return an array containing the elements of this stream
+ */
+ int[] toArray();
+
+ /**
+ * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+ * elements of this stream, using the provided identity value and an
+ * <a href="package-summary.html#Associativity">associative</a>
+ * accumulation function, and returns the reduced value. This is equivalent
+ * to:
+ * <pre>{@code
+ * int result = identity;
+ * for (int element : this stream)
+ * result = accumulator.apply(result, element)
+ * return result;
+ * }</pre>
+ *
+ * but is not constrained to execute sequentially.
+ *
+ * <p>The {@code identity} value must be an identity for the accumulator
+ * function. This means that for all {@code x},
+ * {@code accumulator.apply(identity, x)} is equal to {@code x}.
+ * The {@code accumulator} function must be an
+ * <a href="package-summary.html#Associativity">associative</a> function.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @apiNote Sum, min, max, and average are all special cases of reduction.
+ * Summing a stream of numbers can be expressed as:
+ *
+ * <pre>{@code
+ * int sum = integers.reduce(0, (a, b) -> a+b);
+ * }</pre>
+ *
+ * or more compactly:
+ *
+ * <pre>{@code
+ * int sum = integers.reduce(0, Integer::sum);
+ * }</pre>
+ *
+ * <p>While this may seem a more roundabout way to perform an aggregation
+ * compared to simply mutating a running total in a loop, reduction
+ * operations parallelize more gracefully, without needing additional
+ * synchronization and with greatly reduced risk of data races.
+ *
+ * @param identity the identity value for the accumulating function
+ * @param op an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for combining two values
+ * @return the result of the reduction
+ * @see #sum()
+ * @see #min()
+ * @see #max()
+ * @see #average()
+ */
+ int reduce(int identity, IntBinaryOperator op);
+
+ /**
+ * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+ * elements of this stream, using an
+ * <a href="package-summary.html#Associativity">associative</a> accumulation
+ * function, and returns an {@code OptionalInt} describing the reduced value,
+ * if any. This is equivalent to:
+ * <pre>{@code
+ * boolean foundAny = false;
+ * int result = null;
+ * for (int element : this stream) {
+ * if (!foundAny) {
+ * foundAny = true;
+ * result = element;
+ * }
+ * else
+ * result = accumulator.apply(result, element);
+ * }
+ * return foundAny ? OptionalInt.of(result) : OptionalInt.empty();
+ * }</pre>
+ *
+ * but is not constrained to execute sequentially.
+ *
+ * <p>The {@code accumulator} function must be an
+ * <a href="package-summary.html#Associativity">associative</a> function.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @param op an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for combining two values
+ * @return the result of the reduction
+ * @see #reduce(int, IntBinaryOperator)
+ */
+ OptionalInt reduce(IntBinaryOperator op);
+
+ /**
+ * Performs a <a href="package-summary.html#MutableReduction">mutable
+ * reduction</a> operation on the elements of this stream. A mutable
+ * reduction is one in which the reduced value is a mutable value holder,
+ * such as an {@code ArrayList}, and elements are incorporated by updating
+ * the state of the result, rather than by replacing the result. This
+ * produces a result equivalent to:
+ * <pre>{@code
+ * R result = resultFactory.get();
+ * for (int element : this stream)
+ * accumulator.accept(result, element);
+ * return result;
+ * }</pre>
+ *
+ * <p>Like {@link #reduce(int, IntBinaryOperator)}, {@code collect} operations
+ * can be parallelized without requiring additional synchronization.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @param <R> type of the result
+ * @param resultFactory a function that creates a new result container.
+ * For a parallel execution, this function may be
+ * called multiple times and must return a fresh value
+ * each time.
+ * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for incorporating an additional
+ * element into a result
+ * @param combiner an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for combining two values, which
+ * must be compatible with the accumulator function
+ * @return the result of the reduction
+ * @see Stream#collect(Supplier, BiConsumer, BiConsumer)
+ */
+ <R> R collect(Supplier<R> resultFactory,
+ ObjIntConsumer<R> accumulator,
+ BiConsumer<R, R> combiner);
+
+ /**
+ * Returns the sum of elements in this stream. This is a special case
+ * of a <a href="package-summary.html#MutableReduction">reduction</a>
+ * and is equivalent to:
+ * <pre>{@code
+ * return reduce(0, Integer::sum);
+ * }</pre>
+ *
+ * @return the sum of elements in this stream
+ */
+ int sum();
+
+ /**
+ * Returns an {@code OptionalInt} describing the minimum element of this
+ * stream, or an empty optional if this stream is empty. This is a special
+ * case of a <a href="package-summary.html#MutableReduction">reduction</a>
+ * and is equivalent to:
+ * <pre>{@code
+ * return reduce(Integer::min);
+ * }</pre>
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+ *
+
+ * @return an {@code OptionalInt} containing the minimum element of this
+ * stream, or an empty {@code OptionalInt} if the stream is empty
+ */
+ OptionalInt min();
+
+ /**
+ * Returns an {@code OptionalInt} describing the maximum element of this
+ * stream, or an empty optional if this stream is empty. This is a special
+ * case of a <a href="package-summary.html#MutableReduction">reduction</a>
+ * and is equivalent to:
+ * <pre>{@code
+ * return reduce(Integer::max);
+ * }</pre>
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @return an {@code OptionalInt} containing the maximum element of this
+ * stream, or an empty {@code OptionalInt} if the stream is empty
+ */
+ OptionalInt max();
+
+ /**
+ * Returns the count of elements in this stream. This is a special case of
+ * a <a href="package-summary.html#MutableReduction">reduction</a> and is
+ * equivalent to:
+ * <pre>{@code
+ * return mapToLong(e -> 1L).sum();
+ * }</pre>
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+ *
+ * @return the count of elements in this stream
+ */
+ long count();
+
+ /**
+ * Returns an {@code OptionalDouble} describing the average of elements of
+ * this stream, or an empty optional if this stream is empty. This is a
+ * special case of a
+ * <a href="package-summary.html#MutableReduction">reduction</a>.
+ *
+ * @return an {@code OptionalDouble} containing the average element of this
+ * stream, or an empty optional if the stream is empty
+ */
+ OptionalDouble average();
+
+ /**
+ * Returns an {@code IntSummaryStatistics} describing various
+ * summary data about the elements of this stream. This is a special
+ * case of a <a href="package-summary.html#MutableReduction">reduction</a>.
+ *
+ * @return an {@code IntSummaryStatistics} describing various summary data
+ * about the elements of this stream
+ */
+ IntSummaryStatistics summaryStatistics();
+
+ /**
+ * Returns whether any elements of this stream match the provided
+ * predicate. May not evaluate the predicate on all elements if not
+ * necessary for determining the result.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> predicate to apply to elements of this
+ * stream
+ * @return {@code true} if any elements of the stream match the provided
+ * predicate otherwise {@code false}
+ */
+ boolean anyMatch(IntPredicate predicate);
+
+ /**
+ * Returns whether all elements of this stream match the provided predicate.
+ * May not evaluate the predicate on all elements if not necessary for
+ * determining the result.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> predicate to apply to elements of this
+ * stream
+ * @return {@code true} if all elements of the stream match the provided
+ * predicate otherwise {@code false}
+ */
+ boolean allMatch(IntPredicate predicate);
+
+ /**
+ * Returns whether no elements of this stream match the provided predicate.
+ * May not evaluate the predicate on all elements if not necessary for
+ * determining the result.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> predicate to apply to elements of this
+ * stream
+ * @return {@code true} if no elements of the stream match the provided
+ * predicate otherwise {@code false}
+ */
+ boolean noneMatch(IntPredicate predicate);
+
+ /**
+ * Returns an {@link OptionalInt} describing the first element of this
+ * stream (in the encounter order), or an empty {@code OptionalInt} if the
+ * stream is empty. If the stream has no encounter order, than any element
+ * may be returned.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @return an {@code OptionalInt} describing the first element of this stream,
+ * or an empty {@code OptionalInt} if the stream is empty
+ */
+ OptionalInt findFirst();
+
+ /**
+ * Returns an {@link OptionalInt} describing some element of the stream, or
+ * an empty {@code OptionalInt} if the stream is empty.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * <p>The behavior of this operation is explicitly nondeterministic; it is
+ * free to select any element in the stream. This is to allow for maximal
+ * performance in parallel operations; the cost is that multiple invocations
+ * on the same source may not return the same result. (If the first element
+ * in the encounter order is desired, use {@link #findFirst()} instead.)
+ *
+ * @return an {@code OptionalInt} describing some element of this stream, or
+ * an empty {@code OptionalInt} if the stream is empty
+ * @see #findFirst()
+ */
+ OptionalInt findAny();
+
+ /**
+ * Returns a {@code LongStream} consisting of the elements of this stream,
+ * converted to {@code long}.
+ *
+ * @return a {@code LongStream} consisting of the elements of this stream,
+ * converted to {@code long}
+ */
+ LongStream longs();
+
+ /**
+ * Returns a {@code DoubleStream} consisting of the elements of this stream,
+ * converted to {@code double}.
+ *
+ * @return a {@code DoubleStream} consisting of the elements of this stream,
+ * converted to {@code double}
+ */
+ DoubleStream doubles();
+
+ /**
+ * Returns a {@code Stream} consisting of the elements of this stream,
+ * each boxed to an {@code Integer}.
+ *
+ * @return a {@code Stream} consistent of the elements of this stream,
+ * each boxed to an {@code Integer}
+ */
+ Stream<Integer> boxed();
+
+ @Override
+ IntStream sequential();
+
+ @Override
+ IntStream parallel();
+
+ @Override
+ PrimitiveIterator.OfInt iterator();
+
+ @Override
+ Spliterator.OfInt spliterator();
+
+ // Static factories
+
+ /**
+ * Returns a builder for an {@code IntStream}.
+ *
+ * @return a stream builder
+ */
+ public static StreamBuilder.OfInt builder() {
+ return new Streams.IntStreamBuilderImpl();
+ }
+
+ /**
+ * Returns an empty sequential {@code IntStream}.
+ *
+ * @return an empty sequential stream
+ */
+ public static IntStream empty() {
+ return StreamSupport.intStream(Spliterators.emptyIntSpliterator());
+ }
+
+ /**
+ * Returns a sequential {@code IntStream} containing a single element.
+ *
+ * @param t the single element
+ * @return a singleton sequential stream
+ */
+ public static IntStream of(int t) {
+ return StreamSupport.intStream(new Streams.IntStreamBuilderImpl(t));
+ }
+
+ /**
+ * Returns a sequential stream whose elements are the specified values.
+ *
+ * @param values the elements of the new stream
+ * @return the new stream
+ */
+ public static IntStream of(int... values) {
+ return Arrays.stream(values);
+ }
+
+ /**
+ * Returns an infinite sequential {@code IntStream} produced by iterative
+ * application of a function {@code f} to an initial element {@code seed},
+ * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)},
+ * {@code f(f(seed))}, etc.
+ *
+ * <p>The first element (position {@code 0}) in the {@code IntStream} will be
+ * the provided {@code seed}. For {@code n > 0}, the element at position
+ * {@code n}, will be the result of applying the function {@code f} to the
+ * element at position {@code n - 1}.
+ *
+ * @param seed the initial element
+ * @param f a function to be applied to to the previous element to produce
+ * a new element
+ * @return A new sequential {@code IntStream}
+ */
+ public static IntStream iterate(final int seed, final IntUnaryOperator f) {
+ Objects.requireNonNull(f);
+ final PrimitiveIterator.OfInt iterator = new PrimitiveIterator.OfInt() {
+ int t = seed;
+
+ @Override
+ public boolean hasNext() {
+ return true;
+ }
+
+ @Override
+ public int nextInt() {
+ int v = t;
+ t = f.applyAsInt(t);
+ return v;
+ }
+ };
+ return StreamSupport.intStream(Spliterators.spliteratorUnknownSize(
+ iterator,
+ Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+ }
+
+ /**
+ * Returns a sequential {@code IntStream} where each element is
+ * generated by an {@code IntSupplier}. This is suitable for generating
+ * constant streams, streams of random elements, etc.
+ *
+ * @param s the {@code IntSupplier} for generated elements
+ * @return a new sequential {@code IntStream}
+ */
+ public static IntStream generate(IntSupplier s) {
+ Objects.requireNonNull(s);
+ return StreamSupport.intStream(Spliterators.spliteratorUnknownSize(
+ new PrimitiveIterator.OfInt() {
+ @Override
+ public boolean hasNext() { return true; }
+
+ @Override
+ public int nextInt() { return s.getAsInt(); }
+ },
+ Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+ }
+
+ /**
+ * Returns a sequential {@code IntStream} from {@code startInclusive}
+ * (inclusive) to {@code endExclusive} (exclusive) by an incremental step of
+ * 1.
+ *
+ * @implSpec
+ * The implementation behaves as if:
+ * <pre>{@code
+ * intRange(startInclusive, endExclusive, 1);
+ * }</pre>
+ *
+ * @param startInclusive the (inclusive) initial value
+ * @param endExclusive the exclusive upper bound
+ * @return a sequential {@code IntStream} for the range of {@code int}
+ * elements
+ */
+ public static IntStream range(int startInclusive, int endExclusive) {
+ return range(startInclusive, endExclusive, 1);
+ }
+
+ /**
+ * Returns a sequential {@code IntStream} from {@code startInclusive}
+ * (inclusive) to {@code endExclusive} (exclusive) by a positive {@code
+ * step}. If {@code startInclusive} is greater than or equal to {@code
+ * endExclusive}, an empty stream is returned.
+ *
+ * <p>An equivalent sequence of increasing values can be produced
+ * sequentially using a {@code for} loop as follows:
+ * <pre>{@code
+ * for (int i = startInclusive; i < endExclusive ; i += step) { ... }
+ * }</pre>
+ *
+ * @param startInclusive the (inclusive) initial value
+ * @param endExclusive the exclusive upper bound
+ * @param step the positive difference between consecutive values
+ * @return a sequential {@code IntStream} for the range of {@code int}
+ * elements
+ * @throws IllegalArgumentException if {@code step} is less than or equal to
+ * 0
+ */
+ public static IntStream range(int startInclusive, int endExclusive, int step) {
+ if (step <= 0) {
+ throw new IllegalArgumentException(String.format("Illegal step: %d", step));
+ } else if (startInclusive >= endExclusive) {
+ return empty();
+ } else {
+ return StreamSupport.intStream(new Streams.RangeIntSpliterator(startInclusive, endExclusive, step));
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/LongPipeline.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,610 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.LongSummaryStatistics;
+import java.util.Objects;
+import java.util.OptionalDouble;
+import java.util.OptionalLong;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.BinaryOperator;
+import java.util.function.IntFunction;
+import java.util.function.LongBinaryOperator;
+import java.util.function.LongConsumer;
+import java.util.function.LongFunction;
+import java.util.function.LongPredicate;
+import java.util.function.LongToDoubleFunction;
+import java.util.function.LongToIntFunction;
+import java.util.function.LongUnaryOperator;
+import java.util.function.ObjLongConsumer;
+import java.util.function.Supplier;
+
+/**
+ * Abstract base class for an intermediate pipeline stage or pipeline source
+ * stage implementing whose elements are of type {@code long}.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @since 1.8
+ */
+abstract class LongPipeline<E_IN>
+ extends AbstractPipeline<E_IN, Long, LongStream>
+ implements LongStream {
+
+ /**
+ * Constructor for the head of a stream pipeline.
+ *
+ * @param source {@code Supplier<Spliterator>} describing the stream source
+ * @param sourceFlags the source flags for the stream source, described in
+ * {@link StreamOpFlag}
+ * @param parallel {@code true} if the pipeline is parallel
+ */
+ LongPipeline(Supplier<? extends Spliterator<Long>> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ /**
+ * Constructor for the head of a stream pipeline.
+ *
+ * @param source {@code Spliterator} describing the stream source
+ * @param sourceFlags the source flags for the stream source, described in
+ * {@link StreamOpFlag}
+ * @param parallel {@code true} if the pipeline is parallel
+ */
+ LongPipeline(Spliterator<Long> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ /**
+ * Constructor for appending an intermediate operation onto an existing pipeline.
+ *
+ * @param upstream the upstream element source.
+ * @param opFlags the operation flags
+ */
+ LongPipeline(AbstractPipeline<?, E_IN, ?> upstream, int opFlags) {
+ super(upstream, opFlags);
+ }
+
+ /**
+ * Adapt a {@code Sink<Long> to an {@code LongConsumer}, ideally simply
+ * by casting.
+ */
+ private static LongConsumer adapt(Sink<Long> sink) {
+ if (sink instanceof LongConsumer) {
+ return (LongConsumer) sink;
+ } else {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(AbstractPipeline.class,
+ "using LongStream.adapt(Sink<Long> s)");
+ return sink::accept;
+ }
+ }
+
+ /**
+ * Adapt a {@code Spliterator<Long>} to a {@code Spliterator.OfLong}.
+ *
+ * @implNote
+ * The implementation attempts to cast to a Spliterator.OfLong, and throws
+ * an exception if this cast is not possible.
+ */
+ private static Spliterator.OfLong adapt(Spliterator<Long> s) {
+ if (s instanceof Spliterator.OfLong) {
+ return (Spliterator.OfLong) s;
+ } else {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(AbstractPipeline.class,
+ "using LongStream.adapt(Spliterator<Long> s)");
+ throw new UnsupportedOperationException("LongStream.adapt(Spliterator<Long> s)");
+ }
+ }
+
+
+ // Shape-specific methods
+
+ @Override
+ final StreamShape getOutputShape() {
+ return StreamShape.LONG_VALUE;
+ }
+
+ @Override
+ final <P_IN> Node<Long> evaluateToNode(PipelineHelper<Long> helper,
+ Spliterator<P_IN> spliterator,
+ boolean flattenTree,
+ IntFunction<Long[]> generator) {
+ return Nodes.collectLong(helper, spliterator, flattenTree);
+ }
+
+ @Override
+ final <P_IN> Spliterator<Long> wrap(PipelineHelper<Long> ph,
+ Supplier<Spliterator<P_IN>> supplier,
+ boolean isParallel) {
+ return new StreamSpliterators.LongWrappingSpliterator<>(ph, supplier, isParallel);
+ }
+
+ @Override
+ final Spliterator.OfLong lazySpliterator(Supplier<? extends Spliterator<Long>> supplier) {
+ return new StreamSpliterators.DelegatingSpliterator.OfLong((Supplier<Spliterator.OfLong>) supplier);
+ }
+
+ @Override
+ final void forEachWithCancel(Spliterator<Long> spliterator, Sink<Long> sink) {
+ Spliterator.OfLong spl = adapt(spliterator);
+ LongConsumer adaptedSink = adapt(sink);
+ do { } while (!sink.cancellationRequested() && spl.tryAdvance(adaptedSink));
+ }
+
+ @Override
+ final Node.Builder<Long> makeNodeBuilder(long exactSizeIfKnown, IntFunction<Long[]> generator) {
+ return Nodes.longBuilder(exactSizeIfKnown);
+ }
+
+
+ // LongStream
+
+ @Override
+ public final PrimitiveIterator.OfLong iterator() {
+ return Spliterators.iteratorFromSpliterator(spliterator());
+ }
+
+ @Override
+ public final Spliterator.OfLong spliterator() {
+ return adapt(super.spliterator());
+ }
+
+ // Stateless intermediate ops from LongStream
+
+ @Override
+ public final DoubleStream doubles() {
+ return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
+ return new Sink.ChainedLong(sink) {
+ @Override
+ public void accept(long t) {
+ downstream.accept((double) t);
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final Stream<Long> boxed() {
+ return mapToObj(Long::valueOf);
+ }
+
+ @Override
+ public final LongStream map(LongUnaryOperator mapper) {
+ Objects.requireNonNull(mapper);
+ return new StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+ return new Sink.ChainedLong(sink) {
+ @Override
+ public void accept(long t) {
+ downstream.accept(mapper.applyAsLong(t));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final <U> Stream<U> mapToObj(LongFunction<? extends U> mapper) {
+ Objects.requireNonNull(mapper);
+ return new ReferencePipeline.StatelessOp<Long, U>(this, StreamShape.LONG_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Long> opWrapSink(int flags, Sink<U> sink) {
+ return new Sink.ChainedLong(sink) {
+ @Override
+ public void accept(long t) {
+ downstream.accept(mapper.apply(t));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final IntStream mapToInt(LongToIntFunction mapper) {
+ Objects.requireNonNull(mapper);
+ return new IntPipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Long> opWrapSink(int flags, Sink<Integer> sink) {
+ return new Sink.ChainedLong(sink) {
+ @Override
+ public void accept(long t) {
+ downstream.accept(mapper.applyAsInt(t));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
+ Objects.requireNonNull(mapper);
+ return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
+ return new Sink.ChainedLong(sink) {
+ @Override
+ public void accept(long t) {
+ downstream.accept(mapper.applyAsDouble(t));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final LongStream flatMap(LongFunction<? extends LongStream> mapper) {
+ return new StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+ @Override
+ Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+ return new Sink.ChainedLong(sink) {
+ public void accept(long t) {
+ // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+ LongStream result = mapper.apply(t);
+ if (result != null)
+ result.sequential().forEach(i -> downstream.accept(i));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public LongStream unordered() {
+ if (!isOrdered())
+ return this;
+ return new StatelessOp<Long>(this, StreamShape.LONG_VALUE, StreamOpFlag.NOT_ORDERED) {
+ @Override
+ Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+ return sink;
+ }
+ };
+ }
+
+ @Override
+ public final LongStream filter(LongPredicate predicate) {
+ Objects.requireNonNull(predicate);
+ return new StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+ StreamOpFlag.NOT_SIZED) {
+ @Override
+ Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+ return new Sink.ChainedLong(sink) {
+ @Override
+ public void accept(long t) {
+ if (predicate.test(t))
+ downstream.accept(t);
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final LongStream peek(LongConsumer consumer) {
+ Objects.requireNonNull(consumer);
+ return new StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+ 0) {
+ @Override
+ Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+ return new Sink.ChainedLong(sink) {
+ @Override
+ public void accept(long t) {
+ consumer.accept(t);
+ downstream.accept(t);
+ }
+ };
+ }
+ };
+ }
+
+ // Stateful intermediate ops from LongStream
+
+ private LongStream slice(long skip, long limit) {
+ return SliceOps.makeLong(this, skip, limit);
+ }
+
+ @Override
+ public final LongStream limit(long maxSize) {
+ if (maxSize < 0)
+ throw new IllegalArgumentException(Long.toString(maxSize));
+ return slice(0, maxSize);
+ }
+
+ @Override
+ public final LongStream substream(long startingOffset) {
+ if (startingOffset < 0)
+ throw new IllegalArgumentException(Long.toString(startingOffset));
+ if (startingOffset == 0)
+ return this;
+ else
+ return slice(startingOffset, -1);
+ }
+
+ @Override
+ public final LongStream substream(long startingOffset, long endingOffset) {
+ if (startingOffset < 0 || endingOffset < startingOffset)
+ throw new IllegalArgumentException(String.format("substream(%d, %d)", startingOffset, endingOffset));
+ return slice(startingOffset, endingOffset - startingOffset);
+ }
+
+ @Override
+ public final LongStream sorted() {
+ return SortedOps.makeLong(this);
+ }
+
+ @Override
+ public final LongStream distinct() {
+ // While functional and quick to implement, this approach is not very efficient.
+ // An efficient version requires a long-specific map/set implementation.
+ return boxed().distinct().mapToLong(i -> (long) i);
+ }
+
+ // Terminal ops from LongStream
+
+ @Override
+ public void forEach(LongConsumer action) {
+ evaluate(ForEachOps.makeLong(action, false));
+ }
+
+ @Override
+ public void forEachOrdered(LongConsumer action) {
+ evaluate(ForEachOps.makeLong(action, true));
+ }
+
+ @Override
+ public final long sum() {
+ // use better algorithm to compensate for intermediate overflow?
+ return reduce(0, Long::sum);
+ }
+
+ @Override
+ public final OptionalLong min() {
+ return reduce(Math::min);
+ }
+
+ @Override
+ public final OptionalLong max() {
+ return reduce(Math::max);
+ }
+
+ @Override
+ public final OptionalDouble average() {
+ long[] avg = collect(() -> new long[2],
+ (ll, i) -> {
+ ll[0]++;
+ ll[1] += i;
+ },
+ (ll, rr) -> {
+ ll[0] += rr[0];
+ ll[1] += rr[1];
+ });
+ return avg[0] > 0
+ ? OptionalDouble.of((double) avg[1] / avg[0])
+ : OptionalDouble.empty();
+ }
+
+ @Override
+ public final long count() {
+ return map(e -> 1L).sum();
+ }
+
+ @Override
+ public final LongSummaryStatistics summaryStatistics() {
+ return collect(LongSummaryStatistics::new, LongSummaryStatistics::accept,
+ LongSummaryStatistics::combine);
+ }
+
+ @Override
+ public final long reduce(long identity, LongBinaryOperator op) {
+ return evaluate(ReduceOps.makeLong(identity, op));
+ }
+
+ @Override
+ public final OptionalLong reduce(LongBinaryOperator op) {
+ return evaluate(ReduceOps.makeLong(op));
+ }
+
+ @Override
+ public final <R> R collect(Supplier<R> resultFactory,
+ ObjLongConsumer<R> accumulator,
+ BiConsumer<R, R> combiner) {
+ BinaryOperator<R> operator = (left, right) -> {
+ combiner.accept(left, right);
+ return left;
+ };
+ return evaluate(ReduceOps.makeLong(resultFactory, accumulator, operator));
+ }
+
+ @Override
+ public final boolean anyMatch(LongPredicate predicate) {
+ return evaluate(MatchOps.makeLong(predicate, MatchOps.MatchKind.ANY));
+ }
+
+ @Override
+ public final boolean allMatch(LongPredicate predicate) {
+ return evaluate(MatchOps.makeLong(predicate, MatchOps.MatchKind.ALL));
+ }
+
+ @Override
+ public final boolean noneMatch(LongPredicate predicate) {
+ return evaluate(MatchOps.makeLong(predicate, MatchOps.MatchKind.NONE));
+ }
+
+ @Override
+ public final OptionalLong findFirst() {
+ return evaluate(FindOps.makeLong(true));
+ }
+
+ @Override
+ public final OptionalLong findAny() {
+ return evaluate(FindOps.makeLong(false));
+ }
+
+ @Override
+ public final long[] toArray() {
+ return Nodes.flattenLong((Node.OfLong) evaluateToArrayNode(Long[]::new)).asLongArray();
+ }
+
+
+ //
+
+ /**
+ * Source stage of a LongPipeline.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @since 1.8
+ */
+ static class Head<E_IN> extends LongPipeline<E_IN> {
+ /**
+ * Constructor for the source stage of a LongStream.
+ *
+ * @param source {@code Supplier<Spliterator>} describing the stream
+ * source
+ * @param sourceFlags the source flags for the stream source, described
+ * in {@link StreamOpFlag}
+ * @param parallel {@code true} if the pipeline is parallel
+ */
+ Head(Supplier<? extends Spliterator<Long>> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ /**
+ * Constructor for the source stage of a LongStream.
+ *
+ * @param source {@code Spliterator} describing the stream source
+ * @param sourceFlags the source flags for the stream source, described
+ * in {@link StreamOpFlag}
+ * @param parallel {@code true} if the pipeline is parallel
+ */
+ Head(Spliterator<Long> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ @Override
+ final boolean opIsStateful() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ final Sink<E_IN> opWrapSink(int flags, Sink<Long> sink) {
+ throw new UnsupportedOperationException();
+ }
+
+ // Optimized sequential terminal operations for the head of the pipeline
+
+ @Override
+ public void forEach(LongConsumer action) {
+ if (!isParallel()) {
+ adapt(sourceStageSpliterator()).forEachRemaining(action);
+ } else {
+ super.forEach(action);
+ }
+ }
+
+ @Override
+ public void forEachOrdered(LongConsumer action) {
+ if (!isParallel()) {
+ adapt(sourceStageSpliterator()).forEachRemaining(action);
+ } else {
+ super.forEachOrdered(action);
+ }
+ }
+ }
+
+ /** Base class for a stateless intermediate stage of a LongStream.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @since 1.8
+ */
+ abstract static class StatelessOp<E_IN> extends LongPipeline<E_IN> {
+ /**
+ * Construct a new LongStream by appending a stateless intermediate
+ * operation to an existing stream.
+ * @param upstream The upstream pipeline stage
+ * @param inputShape The stream shape for the upstream pipeline stage
+ * @param opFlags Operation flags for the new stage
+ */
+ StatelessOp(AbstractPipeline<?, E_IN, ?> upstream,
+ StreamShape inputShape,
+ int opFlags) {
+ super(upstream, opFlags);
+ assert upstream.getOutputShape() == inputShape;
+ }
+
+ @Override
+ final boolean opIsStateful() {
+ return false;
+ }
+ }
+
+ /**
+ * Base class for a stateful intermediate stage of a LongStream.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @since 1.8
+ */
+ abstract static class StatefulOp<E_IN> extends LongPipeline<E_IN> {
+ /**
+ * Construct a new LongStream by appending a stateful intermediate
+ * operation to an existing stream.
+ * @param upstream The upstream pipeline stage
+ * @param inputShape The stream shape for the upstream pipeline stage
+ * @param opFlags Operation flags for the new stage
+ */
+ StatefulOp(AbstractPipeline<?, E_IN, ?> upstream,
+ StreamShape inputShape,
+ int opFlags) {
+ super(upstream, opFlags);
+ assert upstream.getOutputShape() == inputShape;
+ }
+
+ @Override
+ final boolean opIsStateful() {
+ return true;
+ }
+
+ @Override
+ abstract <P_IN> Node<Long> opEvaluateParallel(PipelineHelper<Long> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<Long[]> generator);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/LongStream.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,799 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Arrays;
+import java.util.LongSummaryStatistics;
+import java.util.Objects;
+import java.util.OptionalDouble;
+import java.util.OptionalLong;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.function.LongBinaryOperator;
+import java.util.function.LongConsumer;
+import java.util.function.LongFunction;
+import java.util.function.LongPredicate;
+import java.util.function.LongSupplier;
+import java.util.function.LongToDoubleFunction;
+import java.util.function.LongToIntFunction;
+import java.util.function.LongUnaryOperator;
+import java.util.function.ObjLongConsumer;
+import java.util.function.Supplier;
+
+/**
+ * A sequence of primitive long elements supporting sequential and parallel
+ * bulk operations. Streams support lazy intermediate operations (transforming
+ * a stream to another stream) such as {@code filter} and {@code map}, and terminal
+ * operations (consuming the contents of a stream to produce a result or
+ * side-effect), such as {@code forEach}, {@code findFirst}, and {@code
+ * iterator}. Once an operation has been performed on a stream, it
+ * is considered <em>consumed</em> and no longer usable for other operations.
+ *
+ * <p>For sequential stream pipelines, all operations are performed in the
+ * <a href="package-summary.html#Ordering">encounter order</a> of the pipeline
+ * source, if the pipeline source has a defined encounter order.
+ *
+ * <p>For parallel stream pipelines, unless otherwise specified, intermediate
+ * stream operations preserve the <a href="package-summary.html#Ordering">
+ * encounter order</a> of their source, and terminal operations
+ * respect the encounter order of their source, if the source
+ * has an encounter order. Provided that and parameters to stream operations
+ * satisfy the <a href="package-summary.html#NonInterference">non-interference
+ * requirements</a>, and excepting differences arising from the absence of
+ * a defined encounter order, the result of a stream pipeline should be the
+ * stable across multiple executions of the same operations on the same source.
+ * However, the timing and thread in which side-effects occur (for those
+ * operations which are allowed to produce side-effects, such as
+ * {@link #forEach(LongConsumer)}), are explicitly nondeterministic for parallel
+ * execution of stream pipelines.
+ *
+ * <p>Unless otherwise noted, passing a {@code null} argument to any stream
+ * method may result in a {@link NullPointerException}.
+ *
+ * @apiNote
+ * Streams are not data structures; they do not manage the storage for their
+ * elements, nor do they support access to individual elements. However,
+ * you can use the {@link #iterator()} or {@link #spliterator()} operations to
+ * perform a controlled traversal.
+ *
+ * @since 1.8
+ * @see <a href="package-summary.html">java.util.stream</a>
+ */
+public interface LongStream extends BaseStream<Long, LongStream> {
+
+ /**
+ * Returns a stream consisting of the elements of this stream that match
+ * the given predicate.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> predicate to apply to
+ * each element to determine if it should be included
+ * @return the new stream
+ */
+ LongStream filter(LongPredicate predicate);
+
+ /**
+ * Returns a stream consisting of the results of applying the given
+ * function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ LongStream map(LongUnaryOperator mapper);
+
+ /**
+ * Returns an object-valued {@code Stream} consisting of the results of
+ * applying the given function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">
+ * intermediate operation</a>.
+ *
+ * @param <U> the element type of the new stream
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ <U> Stream<U> mapToObj(LongFunction<? extends U> mapper);
+
+ /**
+ * Returns an {@code IntStream} consisting of the results of applying the
+ * given function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ IntStream mapToInt(LongToIntFunction mapper);
+
+ /**
+ * Returns a {@code DoubleStream} consisting of the results of applying the
+ * given function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ DoubleStream mapToDouble(LongToDoubleFunction mapper);
+
+ /**
+ * Returns a stream consisting of the results of replacing each element of
+ * this stream with the contents of the stream produced by applying the
+ * provided mapping function to each element.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @apiNote
+ * The {@code flatMap()} operation has the effect of applying a one-to-many
+ * tranformation to the elements of the stream, and then flattening the
+ * resulting elements into a new stream. For example, if {@code orders}
+ * is a stream of purchase orders, and each purchase order contains a
+ * collection of line items, then the following produces a stream of line
+ * items:
+ * <pre>{@code
+ * orderStream.flatMap(order -> order.getLineItems().stream())...
+ * }</pre>
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to
+ * each element which produces an {@code LongStream} of new
+ * values
+ * @return the new stream
+ * @see Stream#flatMap(Function)
+ */
+ LongStream flatMap(LongFunction<? extends LongStream> mapper);
+
+ /**
+ * Returns a stream consisting of the distinct elements of this stream.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">stateful
+ * intermediate operation</a>.
+ *
+ * @return the new stream
+ */
+ LongStream distinct();
+
+ /**
+ * Returns a stream consisting of the elements of this stream in sorted
+ * order.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">stateful
+ * intermediate operation</a>.
+ *
+ * @return the new stream
+ */
+ LongStream sorted();
+
+ /**
+ * Returns a stream consisting of the elements of this stream, additionally
+ * performing the provided action on each element as elements are consumed
+ * from the resulting stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * <p>For parallel stream pipelines, the action may be called at
+ * whatever time and in whatever thread the element is made available by the
+ * upstream operation. If the action modifies shared state,
+ * it is responsible for providing the required synchronization.
+ *
+ * @apiNote This method exists mainly to support debugging, where you want
+ * to see the elements as they flow past a certain point in a pipeline:
+ * <pre>{@code
+ * list.stream()
+ * .filter(filteringFunction)
+ * .peek(e -> {System.out.println("Filtered value: " + e); });
+ * .map(mappingFunction)
+ * .peek(e -> {System.out.println("Mapped value: " + e); });
+ * .collect(Collectors.toLongSummaryStastistics());
+ * }</pre>
+ *
+ * @param consumer a <a href="package-summary.html#NonInterference">
+ * non-interfering</a> action to perform on the elements as
+ * they are consumed from the stream
+ * @return the new stream
+ */
+ LongStream peek(LongConsumer consumer);
+
+ /**
+ * Returns a stream consisting of the elements of this stream, truncated
+ * to be no longer than {@code maxSize} in length.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * stateful intermediate operation</a>.
+ *
+ * @param maxSize the number of elements the stream should be limited to
+ * @return the new stream
+ * @throws IllegalArgumentException if {@code maxSize} is negative
+ */
+ LongStream limit(long maxSize);
+
+ /**
+ * Returns a stream consisting of the remaining elements of this stream
+ * after indexing {@code startInclusive} elements into the stream. If the
+ * {@code startInclusive} index lies past the end of this stream then an
+ * empty stream will be returned.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">stateful
+ * intermediate operation</a>.
+ *
+ * @param startInclusive the number of leading elements to skip
+ * @return the new stream
+ * @throws IllegalArgumentException if {@code startInclusive} is negative
+ */
+ LongStream substream(long startInclusive);
+
+ /**
+ * Returns a stream consisting of the remaining elements of this stream
+ * after indexing {@code startInclusive} elements into the stream and
+ * truncated to contain no more than {@code endExclusive - startInclusive}
+ * elements. If the {@code startInclusive} index lies past the end
+ * of this stream then an empty stream will be returned.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * stateful intermediate operation</a>.
+ *
+ * @param startInclusive the starting position of the substream, inclusive
+ * @param endExclusive the ending position of the substream, exclusive
+ * @return the new stream
+ * @throws IllegalArgumentException if {@code startInclusive} or
+ * {@code endExclusive} is negative or {@code startInclusive} is greater
+ * than {@code endExclusive}
+ */
+ LongStream substream(long startInclusive, long endExclusive);
+
+ /**
+ * Performs an action for each element of this stream.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * <p>For parallel stream pipelines, this operation does <em>not</em>
+ * guarantee to respect the encounter order of the stream, as doing so
+ * would sacrifice the benefit of parallelism. For any given element, the
+ * action may be performed at whatever time and in whatever thread the
+ * library chooses. If the action accesses shared state, it is
+ * responsible for providing the required synchronization.
+ *
+ * @param action a <a href="package-summary.html#NonInterference">
+ * non-interfering</a> action to perform on the elements
+ */
+ void forEach(LongConsumer action);
+
+ /**
+ * Performs an action for each element of this stream, guaranteeing that
+ * each element is processed in encounter order for streams that have a
+ * defined encounter order.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @param action a <a href="package-summary.html#NonInterference">
+ * non-interfering</a> action to perform on the elements
+ * @see #forEach(LongConsumer)
+ */
+ void forEachOrdered(LongConsumer action);
+
+ /**
+ * Returns an array containing the elements of this stream.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @return an array containing the elements of this stream
+ */
+ long[] toArray();
+
+ /**
+ * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+ * elements of this stream, using the provided identity value and an
+ * <a href="package-summary.html#Associativity">associative</a>
+ * accumulation function, and returns the reduced value. This is equivalent
+ * to:
+ * <pre>{@code
+ * long result = identity;
+ * for (long element : this stream)
+ * result = accumulator.apply(result, element)
+ * return result;
+ * }</pre>
+ *
+ * but is not constrained to execute sequentially.
+ *
+ * <p>The {@code identity} value must be an identity for the accumulator
+ * function. This means that for all {@code x},
+ * {@code accumulator.apply(identity, x)} is equal to {@code x}.
+ * The {@code accumulator} function must be an
+ * <a href="package-summary.html#Associativity">associative</a> function.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @apiNote Sum, min, max, and average are all special cases of reduction.
+ * Summing a stream of numbers can be expressed as:
+ *
+ * <pre>{@code
+ * long sum = integers.reduce(0, (a, b) -> a+b);
+ * }</pre>
+ *
+ * or more compactly:
+ *
+ * <pre>{@code
+ * long sum = integers.reduce(0, Long::sum);
+ * }</pre>
+ *
+ * <p>While this may seem a more roundabout way to perform an aggregation
+ * compared to simply mutating a running total in a loop, reduction
+ * operations parallelize more gracefully, without needing additional
+ * synchronization and with greatly reduced risk of data races.
+ *
+ * @param identity the identity value for the accumulating function
+ * @param op an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for combining two values
+ * @return the result of the reduction
+ * @see #sum()
+ * @see #min()
+ * @see #max()
+ * @see #average()
+ */
+ long reduce(long identity, LongBinaryOperator op);
+
+ /**
+ * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+ * elements of this stream, using an
+ * <a href="package-summary.html#Associativity">associative</a> accumulation
+ * function, and returns an {@code OptionalLong} describing the reduced value,
+ * if any. This is equivalent to:
+ * <pre>{@code
+ * boolean foundAny = false;
+ * long result = null;
+ * for (long element : this stream) {
+ * if (!foundAny) {
+ * foundAny = true;
+ * result = element;
+ * }
+ * else
+ * result = accumulator.apply(result, element);
+ * }
+ * return foundAny ? OptionalLong.of(result) : OptionalLong.empty();
+ * }</pre>
+ *
+ * but is not constrained to execute sequentially.
+ *
+ * <p>The {@code accumulator} function must be an
+ * <a href="package-summary.html#Associativity">associative</a> function.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @param op an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for combining two values
+ * @return the result of the reduction
+ * @see #reduce(long, LongBinaryOperator)
+ */
+ OptionalLong reduce(LongBinaryOperator op);
+
+ /**
+ * Performs a <a href="package-summary.html#MutableReduction">mutable
+ * reduction</a> operation on the elements of this stream. A mutable
+ * reduction is one in which the reduced value is a mutable value holder,
+ * such as an {@code ArrayList}, and elements are incorporated by updating
+ * the state of the result, rather than by replacing the result. This
+ * produces a result equivalent to:
+ * <pre>{@code
+ * R result = resultFactory.get();
+ * for (long element : this stream)
+ * accumulator.accept(result, element);
+ * return result;
+ * }</pre>
+ *
+ * <p>Like {@link #reduce(long, LongBinaryOperator)}, {@code collect} operations
+ * can be parallelized without requiring additional synchronization.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @param <R> type of the result
+ * @param resultFactory a function that creates a new result container.
+ * For a parallel execution, this function may be
+ * called multiple times and must return a fresh value
+ * each time.
+ * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for incorporating an additional
+ * element into a result
+ * @param combiner an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for combining two values, which
+ * must be compatible with the accumulator function
+ * @return the result of the reduction
+ * @see Stream#collect(Supplier, BiConsumer, BiConsumer)
+ */
+ <R> R collect(Supplier<R> resultFactory,
+ ObjLongConsumer<R> accumulator,
+ BiConsumer<R, R> combiner);
+
+ /**
+ * Returns the sum of elements in this stream. This is a special case
+ * of a <a href="package-summary.html#MutableReduction">reduction</a>
+ * and is equivalent to:
+ * <pre>{@code
+ * return reduce(0, Long::sum);
+ * }</pre>
+ *
+ * @return the sum of elements in this stream
+ */
+ long sum();
+
+ /**
+ * Returns an {@code OptionalLong} describing the minimum element of this
+ * stream, or an empty optional if this stream is empty. This is a special
+ * case of a <a href="package-summary.html#MutableReduction">reduction</a>
+ * and is equivalent to:
+ * <pre>{@code
+ * return reduce(Long::min);
+ * }</pre>
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+ *
+
+ * @return an {@code OptionalLong} containing the minimum element of this
+ * stream, or an empty {@code OptionalLong} if the stream is empty
+ */
+ OptionalLong min();
+
+ /**
+ * Returns an {@code OptionalLong} describing the maximum element of this
+ * stream, or an empty optional if this stream is empty. This is a special
+ * case of a <a href="package-summary.html#MutableReduction">reduction</a>
+ * and is equivalent to:
+ * <pre>{@code
+ * return reduce(Long::max);
+ * }</pre>
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @return an {@code OptionalLong} containing the maximum element of this
+ * stream, or an empty {@code OptionalLong} if the stream is empty
+ */
+ OptionalLong max();
+
+ /**
+ * Returns the count of elements in this stream. This is a special case of
+ * a <a href="package-summary.html#MutableReduction">reduction</a> and is
+ * equivalent to:
+ * <pre>{@code
+ * return map(e -> 1L).sum();
+ * }</pre>
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+ *
+ * @return the count of elements in this stream
+ */
+ long count();
+
+ /**
+ * Returns an {@code OptionalDouble} describing the average of elements of
+ * this stream, or an empty optional if this stream is empty. This is a
+ * special case of a
+ * <a href="package-summary.html#MutableReduction">reduction</a>.
+ *
+ * @return an {@code OptionalDouble} containing the average element of this
+ * stream, or an empty optional if the stream is empty
+ */
+ OptionalDouble average();
+
+ /**
+ * Returns a {@code LongSummaryStatistics} describing various summary data
+ * about the elements of this stream. This is a special case of a
+ * <a href="package-summary.html#MutableReduction">reduction</a>.
+ *
+ * @return a {@code LongSummaryStatistics} describing various summary data
+ * about the elements of this stream
+ */
+ LongSummaryStatistics summaryStatistics();
+
+ /**
+ * Returns whether any elements of this stream match the provided
+ * predicate. May not evaluate the predicate on all elements if not
+ * necessary for determining the result.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> predicate to apply to elements of this
+ * stream
+ * @return {@code true} if any elements of the stream match the provided
+ * predicate otherwise {@code false}
+ */
+ boolean anyMatch(LongPredicate predicate);
+
+ /**
+ * Returns whether all elements of this stream match the provided predicate.
+ * May not evaluate the predicate on all elements if not necessary for
+ * determining the result.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> predicate to apply to elements of this
+ * stream
+ * @return {@code true} if all elements of the stream match the provided
+ * predicate otherwise {@code false}
+ */
+ boolean allMatch(LongPredicate predicate);
+
+ /**
+ * Returns whether no elements of this stream match the provided predicate.
+ * May not evaluate the predicate on all elements if not necessary for
+ * determining the result.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> predicate to apply to elements of this
+ * stream
+ * @return {@code true} if no elements of the stream match the provided
+ * predicate otherwise {@code false}
+ */
+ boolean noneMatch(LongPredicate predicate);
+
+ /**
+ * Returns an {@link OptionalLong} describing the first element of this
+ * stream (in the encounter order), or an empty {@code OptionalLong} if the
+ * stream is empty. If the stream has no encounter order, than any element
+ * may be returned.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @return an {@code OptionalLong} describing the first element of this
+ * stream, or an empty {@code OptionalLong} if the stream is empty
+ */
+ OptionalLong findFirst();
+
+ /**
+ * Returns an {@link OptionalLong} describing some element of the stream, or
+ * an empty {@code OptionalLong} if the stream is empty.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * <p>The behavior of this operation is explicitly nondeterministic; it is
+ * free to select any element in the stream. This is to allow for maximal
+ * performance in parallel operations; the cost is that multiple invocations
+ * on the same source may not return the same result. (If the first element
+ * in the encounter order is desired, use {@link #findFirst()} instead.)
+ *
+ * @return an {@code OptionalLong} describing some element of this stream,
+ * or an empty {@code OptionalLong} if the stream is empty
+ * @see #findFirst()
+ */
+ OptionalLong findAny();
+
+ /**
+ * Returns a {@code DoubleStream} consisting of the elements of this stream,
+ * converted to {@code double}.
+ *
+ * @return a {@code DoubleStream} consisting of the elements of this stream,
+ * converted to {@code double}
+ */
+ DoubleStream doubles();
+
+ /**
+ * Returns a {@code Stream} consisting of the elements of this stream,
+ * each boxed to a {@code Long}.
+ *
+ * @return a {@code Stream} consistent of the elements of this stream,
+ * each boxed to {@code Long}
+ */
+ Stream<Long> boxed();
+
+ @Override
+ LongStream sequential();
+
+ @Override
+ LongStream parallel();
+
+ @Override
+ PrimitiveIterator.OfLong iterator();
+
+ @Override
+ Spliterator.OfLong spliterator();
+
+ // Static factories
+
+ /**
+ * Returns a builder for a {@code LongStream}.
+ *
+ * @return a stream builder
+ */
+ public static StreamBuilder.OfLong builder() {
+ return new Streams.LongStreamBuilderImpl();
+ }
+
+ /**
+ * Returns an empty sequential {@code LongStream}.
+ *
+ * @return an empty sequential stream
+ */
+ public static LongStream empty() {
+ return StreamSupport.longStream(Spliterators.emptyLongSpliterator());
+ }
+
+ /**
+ * Returns a sequential {@code LongStream} containing a single element.
+ *
+ * @param t the single element
+ * @return a singleton sequential stream
+ */
+ public static LongStream of(long t) {
+ return StreamSupport.longStream(new Streams.LongStreamBuilderImpl(t));
+ }
+
+ /**
+ * Returns a sequential stream whose elements are the specified values.
+ *
+ * @param values the elements of the new stream
+ * @return the new stream
+ */
+ public static LongStream of(long... values) {
+ return Arrays.stream(values);
+ }
+
+ /**
+ * Returns an infinite sequential {@code LongStream} produced by iterative
+ * application of a function {@code f} to an initial element {@code seed},
+ * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)},
+ * {@code f(f(seed))}, etc.
+ *
+ * <p>The first element (position {@code 0}) in the {@code LongStream} will
+ * be the provided {@code seed}. For {@code n > 0}, the element at position
+ * {@code n}, will be the result of applying the function {@code f} to the
+ * element at position {@code n - 1}.
+ *
+ * @param seed the initial element
+ * @param f a function to be applied to to the previous element to produce
+ * a new element
+ * @return a new sequential {@code LongStream}
+ */
+ public static LongStream iterate(final long seed, final LongUnaryOperator f) {
+ Objects.requireNonNull(f);
+ final PrimitiveIterator.OfLong iterator = new PrimitiveIterator.OfLong() {
+ long t = seed;
+
+ @Override
+ public boolean hasNext() {
+ return true;
+ }
+
+ @Override
+ public long nextLong() {
+ long v = t;
+ t = f.applyAsLong(t);
+ return v;
+ }
+ };
+ return StreamSupport.longStream(Spliterators.spliteratorUnknownSize(
+ iterator,
+ Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+ }
+
+ /**
+ * Returns a sequential {@code LongStream} where each element is generated
+ * by a {@code LongSupplier}. This is suitable for generating constant
+ * streams, streams of random elements, etc.
+ *
+ * @param s the {@code LongSupplier} for generated elements
+ * @return a new sequential {@code LongStream}
+ */
+ public static LongStream generate(LongSupplier s) {
+ Objects.requireNonNull(s);
+ return StreamSupport.longStream(Spliterators.spliteratorUnknownSize(
+ new PrimitiveIterator.OfLong() {
+ @Override
+ public boolean hasNext() { return true; }
+
+ @Override
+ public long nextLong() { return s.getAsLong(); }
+ },
+ Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+ }
+
+ /**
+ * Returns a sequential {@code LongStream} from {@code startInclusive}
+ * (inclusive) to {@code endExclusive} (exclusive) by an incremental step of
+ * 1.
+ *
+ * @implSpec
+ * The implementation behaves as if:
+ * <pre>{@code
+ * longRange(startInclusive, endExclusive, 1);
+ * }</pre>
+ *
+ * @param startInclusive the (inclusive) initial value
+ * @param endExclusive the exclusive upper bound
+ * @return a sequential {@code LongStream} for the range of {@code long}
+ * elements
+ */
+ public static LongStream range(long startInclusive, final long endExclusive) {
+ return range(startInclusive, endExclusive, 1);
+ }
+
+ /**
+ * Returns a sequential {@code LongStream} from {@code startInclusive}
+ * (inclusive) to {@code endExclusive} (exclusive) by {@code step}. If
+ * {@code startInclusive} is greater than or equal to {@code
+ * endExclusive}, an empty stream is returned.
+ *
+ * <p>An equivalent sequence of increasing values can be produced
+ * sequentially using a {@code for} loop as follows:
+ * <pre>{@code
+ * for (long i = startInclusive; i < endExclusive ; i += step) { ... }
+ * }</pre>
+ *
+ * @param startInclusive the (inclusive) initial value
+ * @param endExclusive the exclusive upper bound
+ * @param step the difference between consecutive values
+ * @return a sequential {@code LongStream} for the range of {@code long}
+ * elements
+ * @throws IllegalArgumentException if {@code step} is less than or equal to
+ * 0
+ */
+ public static LongStream range(long startInclusive, final long endExclusive, final long step) {
+ if (step <= 0) {
+ throw new IllegalArgumentException(String.format("Illegal step: %d", step));
+ } else if (startInclusive >= endExclusive) {
+ return empty();
+ } else {
+ return StreamSupport.longStream(new Streams.RangeLongSpliterator(startInclusive, endExclusive, step));
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/MatchOps.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,337 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.function.DoublePredicate;
+import java.util.function.IntPredicate;
+import java.util.function.LongPredicate;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+
+/**
+ * Factory for instances of a short-circuiting {@code TerminalOp} that implement
+ * quantified predicate matching on the elements of a stream. Supported variants
+ * include match-all, match-any, and match-none.
+ *
+ * @since 1.8
+ */
+final class MatchOps {
+
+ private MatchOps() { }
+
+ /**
+ * Enum describing quantified match options -- all match, any match, none
+ * match.
+ */
+ enum MatchKind {
+ /** Do all elements match the predicate? */
+ ANY(true, true),
+
+ /** Do any elements match the predicate? */
+ ALL(false, false),
+
+ /** Do no elements match the predicate? */
+ NONE(true, false);
+
+ private final boolean stopOnPredicateMatches;
+ private final boolean shortCircuitResult;
+
+ private MatchKind(boolean stopOnPredicateMatches,
+ boolean shortCircuitResult) {
+ this.stopOnPredicateMatches = stopOnPredicateMatches;
+ this.shortCircuitResult = shortCircuitResult;
+ }
+ }
+
+ /**
+ * Constructs a quantified predicate matcher for a Stream.
+ *
+ * @param <T> the type of stream elements
+ * @param predicate the {@code Predicate} to apply to stream elements
+ * @param matchKind the kind of quantified match (all, any, none)
+ * @return a {@code TerminalOp} implementing the desired quantified match
+ * criteria
+ */
+ public static <T> TerminalOp<T, Boolean> makeRef(Predicate<? super T> predicate,
+ MatchKind matchKind) {
+ Objects.requireNonNull(predicate);
+ Objects.requireNonNull(matchKind);
+ class MatchSink extends BooleanTerminalSink<T> {
+ MatchSink() {
+ super(matchKind);
+ }
+
+ @Override
+ public void accept(T t) {
+ if (!stop && predicate.test(t) == matchKind.stopOnPredicateMatches) {
+ stop = true;
+ value = matchKind.shortCircuitResult;
+ }
+ }
+ }
+
+ // @@@ Workaround for JDK-8011591 -- when fixed, replace s with constructor ref
+ Supplier<BooleanTerminalSink<T>> s = new Supplier<BooleanTerminalSink<T>>() {
+ @Override
+ public BooleanTerminalSink<T> get() {return new MatchSink();}
+ };
+ return new MatchOp<>(StreamShape.REFERENCE, matchKind, s);
+ }
+
+ /**
+ * Constructs a quantified predicate matcher for an {@code IntStream}.
+ *
+ * @param predicate the {@code Predicate} to apply to stream elements
+ * @param matchKind the kind of quantified match (all, any, none)
+ * @return a {@code TerminalOp} implementing the desired quantified match
+ * criteria
+ */
+ public static TerminalOp<Integer, Boolean> makeInt(IntPredicate predicate,
+ MatchKind matchKind) {
+ Objects.requireNonNull(predicate);
+ Objects.requireNonNull(matchKind);
+ class MatchSink extends BooleanTerminalSink<Integer> implements Sink.OfInt {
+ MatchSink() {
+ super(matchKind);
+ }
+
+ @Override
+ public void accept(int t) {
+ if (!stop && predicate.test(t) == matchKind.stopOnPredicateMatches) {
+ stop = true;
+ value = matchKind.shortCircuitResult;
+ }
+ }
+ }
+
+ // @@@ Workaround for JDK-8011591 -- when fixed, replace s with constructor ref
+ Supplier<BooleanTerminalSink<Integer>> s = new Supplier<BooleanTerminalSink<Integer>>() {
+ @Override
+ public BooleanTerminalSink<Integer> get() {return new MatchSink();}
+ };
+ return new MatchOp<>(StreamShape.INT_VALUE, matchKind, s);
+ }
+
+ /**
+ * Constructs a quantified predicate matcher for a {@code LongStream}.
+ *
+ * @param predicate the {@code Predicate} to apply to stream elements
+ * @param matchKind the kind of quantified match (all, any, none)
+ * @return a {@code TerminalOp} implementing the desired quantified match
+ * criteria
+ */
+ public static TerminalOp<Long, Boolean> makeLong(LongPredicate predicate,
+ MatchKind matchKind) {
+ Objects.requireNonNull(predicate);
+ Objects.requireNonNull(matchKind);
+ class MatchSink extends BooleanTerminalSink<Long> implements Sink.OfLong {
+
+ MatchSink() {
+ super(matchKind);
+ }
+
+ @Override
+ public void accept(long t) {
+ if (!stop && predicate.test(t) == matchKind.stopOnPredicateMatches) {
+ stop = true;
+ value = matchKind.shortCircuitResult;
+ }
+ }
+ }
+
+ // @@@ Workaround for JDK-8011591 -- when fixed, replace s with constructor ref
+ Supplier<BooleanTerminalSink<Long>> s = new Supplier<BooleanTerminalSink<Long>>() {
+ @Override
+ public BooleanTerminalSink<Long> get() {return new MatchSink();}
+ };
+ return new MatchOp<>(StreamShape.LONG_VALUE, matchKind, s);
+ }
+
+ /**
+ * Constructs a quantified predicate matcher for a {@code DoubleStream}.
+ *
+ * @param predicate the {@code Predicate} to apply to stream elements
+ * @param matchKind the kind of quantified match (all, any, none)
+ * @return a {@code TerminalOp} implementing the desired quantified match
+ * criteria
+ */
+ public static TerminalOp<Double, Boolean> makeDouble(DoublePredicate predicate,
+ MatchKind matchKind) {
+ Objects.requireNonNull(predicate);
+ Objects.requireNonNull(matchKind);
+ class MatchSink extends BooleanTerminalSink<Double> implements Sink.OfDouble {
+
+ MatchSink() {
+ super(matchKind);
+ }
+
+ @Override
+ public void accept(double t) {
+ if (!stop && predicate.test(t) == matchKind.stopOnPredicateMatches) {
+ stop = true;
+ value = matchKind.shortCircuitResult;
+ }
+ }
+ }
+
+ // @@@ Workaround for JDK-8011591 -- when fixed, replace s with constructor ref
+ Supplier<BooleanTerminalSink<Double>> s = new Supplier<BooleanTerminalSink<Double>>() {
+ @Override
+ public BooleanTerminalSink<Double> get() {return new MatchSink();}
+ };
+ return new MatchOp<>(StreamShape.DOUBLE_VALUE, matchKind, s);
+ }
+
+ /**
+ * A short-circuiting {@code TerminalOp} that evaluates a predicate on the
+ * elements of a stream and determines whether all, any or none of those
+ * elements match the predicate.
+ *
+ * @param <T> the output type of the stream pipeline
+ */
+ private static final class MatchOp<T> implements TerminalOp<T, Boolean> {
+ private final StreamShape inputShape;
+ final MatchKind matchKind;
+ final Supplier<BooleanTerminalSink<T>> sinkSupplier;
+
+ /**
+ * Constructs a {@code MatchOp}.
+ *
+ * @param shape the output shape of the stream pipeline
+ * @param matchKind the kind of quantified match (all, any, none)
+ * @param sinkSupplier {@code Supplier} for a {@code Sink} of the
+ * appropriate shape which implements the matching operation
+ */
+ MatchOp(StreamShape shape,
+ MatchKind matchKind,
+ Supplier<BooleanTerminalSink<T>> sinkSupplier) {
+ this.inputShape = shape;
+ this.matchKind = matchKind;
+ this.sinkSupplier = sinkSupplier;
+ }
+
+ @Override
+ public int getOpFlags() {
+ return StreamOpFlag.IS_SHORT_CIRCUIT | StreamOpFlag.NOT_ORDERED;
+ }
+
+ @Override
+ public StreamShape inputShape() {
+ return inputShape;
+ }
+
+ @Override
+ public <S> Boolean evaluateSequential(PipelineHelper<T> helper,
+ Spliterator<S> spliterator) {
+ return helper.wrapAndCopyInto(sinkSupplier.get(), spliterator).getAndClearState();
+ }
+
+ @Override
+ public <S> Boolean evaluateParallel(PipelineHelper<T> helper,
+ Spliterator<S> spliterator) {
+ // Approach for parallel implementation:
+ // - Decompose as per usual
+ // - run match on leaf chunks, call result "b"
+ // - if b == matchKind.shortCircuitOn, complete early and return b
+ // - else if we complete normally, return !shortCircuitOn
+
+ return new MatchTask<>(this, helper, spliterator).invoke();
+ }
+ }
+
+ /**
+ * Boolean specific terminal sink to avoid the boxing costs when returning
+ * results. Subclasses implement the shape-specific functionality.
+ *
+ * @param <T> The output type of the stream pipeline
+ */
+ private static abstract class BooleanTerminalSink<T> implements Sink<T> {
+ boolean stop;
+ boolean value;
+
+ BooleanTerminalSink(MatchKind matchKind) {
+ value = !matchKind.shortCircuitResult;
+ }
+
+ public boolean getAndClearState() {
+ return value;
+ }
+
+ @Override
+ public boolean cancellationRequested() {
+ return stop;
+ }
+ }
+
+ /**
+ * ForkJoinTask implementation to implement a parallel short-circuiting
+ * quantified match
+ *
+ * @param <P_IN> the type of source elements for the pipeline
+ * @param <P_OUT> the type of output elements for the pipeline
+ */
+ private static final class MatchTask<P_IN, P_OUT>
+ extends AbstractShortCircuitTask<P_IN, P_OUT, Boolean, MatchTask<P_IN, P_OUT>> {
+ private final MatchOp<P_OUT> op;
+
+ /**
+ * Constructor for root node
+ */
+ MatchTask(MatchOp<P_OUT> op, PipelineHelper<P_OUT> helper,
+ Spliterator<P_IN> spliterator) {
+ super(helper, spliterator);
+ this.op = op;
+ }
+
+ /**
+ * Constructor for non-root node
+ */
+ MatchTask(MatchTask<P_IN, P_OUT> parent, Spliterator<P_IN> spliterator) {
+ super(parent, spliterator);
+ this.op = parent.op;
+ }
+
+ @Override
+ protected MatchTask<P_IN, P_OUT> makeChild(Spliterator<P_IN> spliterator) {
+ return new MatchTask<>(this, spliterator);
+ }
+
+ @Override
+ protected Boolean doLeaf() {
+ boolean b = helper.wrapAndCopyInto(op.sinkSupplier.get(), spliterator).getAndClearState();
+ if (b == op.matchKind.shortCircuitResult)
+ shortCircuit(b);
+ return null;
+ }
+
+ @Override
+ protected Boolean getEmptyResult() {
+ return !op.matchKind.shortCircuitResult;
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Node.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,557 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Spliterator;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.LongConsumer;
+
+/**
+ * An immutable container for describing an ordered sequence of elements of some
+ * type {@code T}.
+ *
+ * <p>A {@code Node} contains a fixed number of elements, which can be accessed
+ * via the {@link #count}, {@link #spliterator}, {@link #forEach},
+ * {@link #asArray}, or {@link #copyInto} methods. A {@code Node} may have zero
+ * or more child {@code Node}s; if it has no children (accessed via
+ * {@link #getChildCount} and {@link #getChild(int)}, it is considered <em>flat
+ * </em> or a <em>leaf</em>; if it has children, it is considered an
+ * <em>internal</em> node. The size of an internal node is the sum of sizes of
+ * its children.
+ *
+ * @apiNote
+ * <p>A {@code Node} typically does not store the elements directly, but instead
+ * mediates access to one or more existing (effectively immutable) data
+ * structures such as a {@code Collection}, array, or a set of other
+ * {@code Node}s. Commonly {@code Node}s are formed into a tree whose shape
+ * corresponds to the computation tree that produced the elements that are
+ * contained in the leaf nodes. The use of {@code Node} within the stream
+ * framework is largely to avoid copying data unnecessarily during parallel
+ * operations.
+ *
+ * @param <T> the type of elements.
+ * @since 1.8
+ */
+interface Node<T> {
+
+ /**
+ * Returns a {@link Spliterator} describing the elements contained in this
+ * {@code Node}.
+ *
+ * @return a {@code Spliterator} describing the elements contained in this
+ * {@code Node}
+ */
+ Spliterator<T> spliterator();
+
+ /**
+ * Traverses the elements of this node, and invoke the provided
+ * {@code Consumer} with each element. Elements are provided in encounter
+ * order if the source for the {@code Node} has a defined encounter order.
+ *
+ * @param consumer a {@code Consumer} that is to be invoked with each
+ * element in this {@code Node}
+ */
+ void forEach(Consumer<? super T> consumer);
+
+ /**
+ * Returns the number of child nodes of this node.
+ *
+ * @implSpec The default implementation returns zero.
+ *
+ * @return the number of child nodes
+ */
+ default int getChildCount() {
+ return 0;
+ }
+
+ /**
+ * Retrieves the child {@code Node} at a given index.
+ *
+ * @implSpec The default implementation always throws
+ * {@code IndexOutOfBoundsException}.
+ *
+ * @param i the index to the child node
+ * @return the child node
+ * @throws IndexOutOfBoundsException if the index is less than 0 or greater
+ * than or equal to the number of child nodes
+ */
+ default Node<T> getChild(int i) {
+ throw new IndexOutOfBoundsException();
+ }
+
+ /**
+ * Provides an array view of the contents of this node.
+ *
+ * <p>Depending on the underlying implementation, this may return a
+ * reference to an internal array rather than a copy. Since the returned
+ * array may be shared, the returned array should not be modified. The
+ * {@code generator} function may be consulted to create the array if a new
+ * array needs to be created.
+ *
+ * @param generator a factory function which takes an integer parameter and
+ * returns a new, empty array of that size and of the appropriate
+ * array type
+ * @return an array containing the contents of this {@code Node}
+ */
+ T[] asArray(IntFunction<T[]> generator);
+
+ /**
+ * Copies the content of this {@code Node} into an array, starting at a
+ * given offset into the array. It is the caller's responsibility to ensure
+ * there is sufficient room in the array.
+ *
+ * @param array the array into which to copy the contents of this
+ * {@code Node}
+ * @param offset the starting offset within the array
+ * @throws IndexOutOfBoundsException if copying would cause access of data
+ * outside array bounds
+ * @throws NullPointerException if {@code array} is {@code null}
+ */
+ void copyInto(T[] array, int offset);
+
+ /**
+ * Gets the {@code StreamShape} associated with this {@code Node}.
+ *
+ * @implSpec The default in {@code Node} returns
+ * {@code StreamShape.REFERENCE}
+ *
+ * @return the stream shape associated with this node
+ */
+ default StreamShape getShape() {
+ return StreamShape.REFERENCE;
+ }
+
+ /**
+ * Returns the number of elements contained in this node.
+ *
+ * @return the number of elements contained in this node
+ */
+ long count();
+
+ /**
+ * A mutable builder for a {@code Node} that implements {@link Sink}, which
+ * builds a flat node containing the elements that have been pushed to it.
+ */
+ interface Builder<T> extends Sink<T> {
+
+ /**
+ * Builds the node. Should be called after all elements have been
+ * pushed and signalled with an invocation of {@link Sink#end()}.
+ *
+ * @return the resulting {@code Node}
+ */
+ Node<T> build();
+
+ /**
+ * Specialized @{code Node.Builder} for int elements
+ */
+ interface OfInt extends Node.Builder<Integer>, Sink.OfInt {
+ @Override
+ Node.OfInt build();
+ }
+
+ /**
+ * Specialized @{code Node.Builder} for long elements
+ */
+ interface OfLong extends Node.Builder<Long>, Sink.OfLong {
+ @Override
+ Node.OfLong build();
+ }
+
+ /**
+ * Specialized @{code Node.Builder} for double elements
+ */
+ interface OfDouble extends Node.Builder<Double>, Sink.OfDouble {
+ @Override
+ Node.OfDouble build();
+ }
+ }
+
+ /**
+ * Specialized {@code Node} for int elements
+ */
+ interface OfInt extends Node<Integer> {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return a {@link Spliterator.OfInt} describing the elements of this
+ * node
+ */
+ @Override
+ Spliterator.OfInt spliterator();
+
+ /**
+ * {@inheritDoc}
+ *
+ * @param consumer a {@code Consumer} that is to be invoked with each
+ * element in this {@code Node}. If this is an
+ * {@code IntConsumer}, it is cast to {@code IntConsumer} so the
+ * elements may be processed without boxing.
+ */
+ @Override
+ default void forEach(Consumer<? super Integer> consumer) {
+ if (consumer instanceof IntConsumer) {
+ forEach((IntConsumer) consumer);
+ }
+ else {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(getClass(), "{0} calling Node.OfInt.forEachRemaining(Consumer)");
+ spliterator().forEachRemaining(consumer);
+ }
+ }
+
+ /**
+ * Traverses the elements of this node, and invoke the provided
+ * {@code IntConsumer} with each element.
+ *
+ * @param consumer a {@code IntConsumer} that is to be invoked with each
+ * element in this {@code Node}
+ */
+ void forEach(IntConsumer consumer);
+
+ /**
+ * {@inheritDoc}
+ *
+ * @implSpec the default implementation invokes the generator to create
+ * an instance of an Integer[] array with a length of {@link #count()}
+ * and then invokes {@link #copyInto(Integer[], int)} with that
+ * Integer[] array at an offset of 0. This is not efficient and it is
+ * recommended to invoke {@link #asIntArray()}.
+ */
+ @Override
+ default Integer[] asArray(IntFunction<Integer[]> generator) {
+ Integer[] boxed = generator.apply((int) count());
+ copyInto(boxed, 0);
+ return boxed;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @implSpec the default implementation invokes {@link #asIntArray()} to
+ * obtain an int[] array then and copies the elements from that int[]
+ * array into the boxed Integer[] array. This is not efficient and it
+ * is recommended to invoke {@link #copyInto(int[], int)}.
+ */
+ @Override
+ default void copyInto(Integer[] boxed, int offset) {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(getClass(), "{0} calling Node.OfInt.copyInto(Integer[], int)");
+
+ int[] array = asIntArray();
+ for (int i = 0; i < array.length; i++) {
+ boxed[offset + i] = array[i];
+ }
+ }
+
+ @Override
+ default Node.OfInt getChild(int i) {
+ throw new IndexOutOfBoundsException();
+ }
+
+ /**
+ * Views this node as an int[] array.
+ *
+ * <p>Depending on the underlying implementation this may return a
+ * reference to an internal array rather than a copy. It is the callers
+ * responsibility to decide if either this node or the array is utilized
+ * as the primary reference for the data.</p>
+ *
+ * @return an array containing the contents of this {@code Node}
+ */
+ int[] asIntArray();
+
+ /**
+ * Copies the content of this {@code Node} into an int[] array, starting
+ * at a given offset into the array. It is the caller's responsibility
+ * to ensure there is sufficient room in the array.
+ *
+ * @param array the array into which to copy the contents of this
+ * {@code Node}
+ * @param offset the starting offset within the array
+ * @throws IndexOutOfBoundsException if copying would cause access of
+ * data outside array bounds
+ * @throws NullPointerException if {@code array} is {@code null}
+ */
+ void copyInto(int[] array, int offset);
+
+ /**
+ * {@inheritDoc}
+ * @implSpec The default in {@code Node.OfInt} returns
+ * {@code StreamShape.INT_VALUE}
+ */
+ default StreamShape getShape() {
+ return StreamShape.INT_VALUE;
+ }
+
+ }
+
+ /**
+ * Specialized {@code Node} for long elements
+ */
+ interface OfLong extends Node<Long> {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return a {@link Spliterator.OfLong} describing the elements of this
+ * node
+ */
+ @Override
+ Spliterator.OfLong spliterator();
+
+ /**
+ * {@inheritDoc}
+ *
+ * @param consumer A {@code Consumer} that is to be invoked with each
+ * element in this {@code Node}. If this is an
+ * {@code LongConsumer}, it is cast to {@code LongConsumer} so
+ * the elements may be processed without boxing.
+ */
+ @Override
+ default void forEach(Consumer<? super Long> consumer) {
+ if (consumer instanceof LongConsumer) {
+ forEach((LongConsumer) consumer);
+ }
+ else {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(getClass(), "{0} calling Node.OfLong.forEachRemaining(Consumer)");
+ spliterator().forEachRemaining(consumer);
+ }
+ }
+
+ /**
+ * Traverses the elements of this node, and invoke the provided
+ * {@code LongConsumer} with each element.
+ *
+ * @param consumer a {@code LongConsumer} that is to be invoked with
+ * each element in this {@code Node}
+ */
+ void forEach(LongConsumer consumer);
+
+ /**
+ * {@inheritDoc}
+ *
+ * @implSpec the default implementation invokes the generator to create
+ * an instance of a Long[] array with a length of {@link #count()} and
+ * then invokes {@link #copyInto(Long[], int)} with that Long[] array at
+ * an offset of 0. This is not efficient and it is recommended to
+ * invoke {@link #asLongArray()}.
+ */
+ @Override
+ default Long[] asArray(IntFunction<Long[]> generator) {
+ Long[] boxed = generator.apply((int) count());
+ copyInto(boxed, 0);
+ return boxed;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @implSpec the default implementation invokes {@link #asLongArray()}
+ * to obtain a long[] array then and copies the elements from that
+ * long[] array into the boxed Long[] array. This is not efficient and
+ * it is recommended to invoke {@link #copyInto(long[], int)}.
+ */
+ @Override
+ default void copyInto(Long[] boxed, int offset) {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(getClass(), "{0} calling Node.OfInt.copyInto(Long[], int)");
+
+ long[] array = asLongArray();
+ for (int i = 0; i < array.length; i++) {
+ boxed[offset + i] = array[i];
+ }
+ }
+
+ @Override
+ default Node.OfLong getChild(int i) {
+ throw new IndexOutOfBoundsException();
+ }
+
+ /**
+ * Views this node as a long[] array.
+ *
+ * <p/>Depending on the underlying implementation this may return a
+ * reference to an internal array rather than a copy. It is the callers
+ * responsibility to decide if either this node or the array is utilized
+ * as the primary reference for the data.
+ *
+ * @return an array containing the contents of this {@code Node}
+ */
+ long[] asLongArray();
+
+ /**
+ * Copies the content of this {@code Node} into a long[] array, starting
+ * at a given offset into the array. It is the caller's responsibility
+ * to ensure there is sufficient room in the array.
+ *
+ * @param array the array into which to copy the contents of this
+ * {@code Node}
+ * @param offset the starting offset within the array
+ * @throws IndexOutOfBoundsException if copying would cause access of
+ * data outside array bounds
+ * @throws NullPointerException if {@code array} is {@code null}
+ */
+ void copyInto(long[] array, int offset);
+
+ /**
+ * {@inheritDoc}
+ * @implSpec The default in {@code Node.OfLong} returns
+ * {@code StreamShape.LONG_VALUE}
+ */
+ default StreamShape getShape() {
+ return StreamShape.LONG_VALUE;
+ }
+
+
+ }
+
+ /**
+ * Specialized {@code Node} for double elements
+ */
+ interface OfDouble extends Node<Double> {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return A {@link Spliterator.OfDouble} describing the elements of
+ * this node
+ */
+ @Override
+ Spliterator.OfDouble spliterator();
+
+ /**
+ * {@inheritDoc}
+ *
+ * @param consumer A {@code Consumer} that is to be invoked with each
+ * element in this {@code Node}. If this is an
+ * {@code DoubleConsumer}, it is cast to {@code DoubleConsumer}
+ * so the elements may be processed without boxing.
+ */
+ @Override
+ default void forEach(Consumer<? super Double> consumer) {
+ if (consumer instanceof DoubleConsumer) {
+ forEach((DoubleConsumer) consumer);
+ }
+ else {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(getClass(), "{0} calling Node.OfLong.forEachRemaining(Consumer)");
+ spliterator().forEachRemaining(consumer);
+ }
+ }
+
+ /**
+ * Traverses the elements of this node, and invoke the provided
+ * {@code DoubleConsumer} with each element.
+ *
+ * @param consumer A {@code DoubleConsumer} that is to be invoked with
+ * each element in this {@code Node}
+ */
+ void forEach(DoubleConsumer consumer);
+
+ //
+
+ /**
+ * {@inheritDoc}
+ *
+ * @implSpec the default implementation invokes the generator to create
+ * an instance of a Double[] array with a length of {@link #count()} and
+ * then invokes {@link #copyInto(Double[], int)} with that Double[]
+ * array at an offset of 0. This is not efficient and it is recommended
+ * to invoke {@link #asDoubleArray()}.
+ */
+ @Override
+ default Double[] asArray(IntFunction<Double[]> generator) {
+ Double[] boxed = generator.apply((int) count());
+ copyInto(boxed, 0);
+ return boxed;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @implSpec the default implementation invokes {@link #asDoubleArray()}
+ * to obtain a double[] array then and copies the elements from that
+ * double[] array into the boxed Double[] array. This is not efficient
+ * and it is recommended to invoke {@link #copyInto(double[], int)}.
+ */
+ @Override
+ default void copyInto(Double[] boxed, int offset) {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(getClass(), "{0} calling Node.OfDouble.copyInto(Double[], int)");
+
+ double[] array = asDoubleArray();
+ for (int i = 0; i < array.length; i++) {
+ boxed[offset + i] = array[i];
+ }
+ }
+
+ @Override
+ default Node.OfDouble getChild(int i) {
+ throw new IndexOutOfBoundsException();
+ }
+
+ /**
+ * Views this node as a double[] array.
+ *
+ * <p/>Depending on the underlying implementation this may return a
+ * reference to an internal array rather than a copy. It is the callers
+ * responsibility to decide if either this node or the array is utilized
+ * as the primary reference for the data.
+ *
+ * @return an array containing the contents of this {@code Node}
+ */
+ double[] asDoubleArray();
+
+ /**
+ * Copies the content of this {@code Node} into a double[] array, starting
+ * at a given offset into the array. It is the caller's responsibility
+ * to ensure there is sufficient room in the array.
+ *
+ * @param array the array into which to copy the contents of this
+ * {@code Node}
+ * @param offset the starting offset within the array
+ * @throws IndexOutOfBoundsException if copying would cause access of
+ * data outside array bounds
+ * @throws NullPointerException if {@code array} is {@code null}
+ */
+ void copyInto(double[] array, int offset);
+
+ /**
+ * {@inheritDoc}
+ *
+ * @implSpec The default in {@code Node.OfDouble} returns
+ * {@code StreamShape.DOUBLE_VALUE}
+ */
+ default StreamShape getShape() {
+ return StreamShape.DOUBLE_VALUE;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Nodes.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,2467 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.ArrayDeque;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Deque;
+import java.util.List;
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.concurrent.CountedCompleter;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.LongConsumer;
+
+/**
+ * Factory methods for constructing implementations of {@link Node} and
+ * {@link Node.Builder} and their primitive specializations. Fork/Join tasks
+ * for collecting output from a {@link PipelineHelper} to a {@link Node} and
+ * flattening {@link Node}s.
+ *
+ * @since 1.8
+ */
+final class Nodes {
+
+ private Nodes() {
+ throw new Error("no instances");
+ }
+
+ /**
+ * The maximum size of an array that can be allocated.
+ */
+ static final long MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
+
+ private static final Node EMPTY_NODE = new EmptyNode.OfRef();
+ private static final Node.OfInt EMPTY_INT_NODE = new EmptyNode.OfInt();
+ private static final Node.OfLong EMPTY_LONG_NODE = new EmptyNode.OfLong();
+ private static final Node.OfDouble EMPTY_DOUBLE_NODE = new EmptyNode.OfDouble();
+
+ // General shape-based node creation methods
+
+ /**
+ * Produces an empty node whose count is zero, has no children and no content.
+ *
+ * @param <T> the type of elements of the created node
+ * @param shape the shape of the node to be created
+ * @return an empty node.
+ */
+ @SuppressWarnings("unchecked")
+ static <T> Node<T> emptyNode(StreamShape shape) {
+ switch (shape) {
+ case REFERENCE: return (Node<T>) EMPTY_NODE;
+ case INT_VALUE: return (Node<T>) EMPTY_INT_NODE;
+ case LONG_VALUE: return (Node<T>) EMPTY_LONG_NODE;
+ case DOUBLE_VALUE: return (Node<T>) EMPTY_DOUBLE_NODE;
+ default:
+ throw new IllegalStateException("Unknown shape " + shape);
+ }
+ }
+
+ /**
+ * Produces a concatenated {@link Node} that has two or more children.
+ * <p>The count of the concatenated node is equal to the sum of the count
+ * of each child. Traversal of the concatenated node traverses the content
+ * of each child in encounter order of the list of children. Splitting a
+ * spliterator obtained from the concatenated node preserves the encounter
+ * order of the list of children.
+ *
+ * <p>The result may be a concatenated node, the input sole node if the size
+ * of the list is 1, or an empty node.
+ *
+ * @param <T> the type of elements of the concatenated node
+ * @param shape the shape of the concatenated node to be created
+ * @param nodes the input nodes
+ * @return a {@code Node} covering the elements of the input nodes
+ * @throws IllegalStateException if all {@link Node} elements of the list
+ * are an not instance of type supported by this factory.
+ */
+ @SuppressWarnings("unchecked")
+ static <T> Node<T> conc(StreamShape shape, List<? extends Node<T>> nodes) {
+ int size = nodes.size();
+ if (size == 0)
+ return emptyNode(shape);
+ else if (size == 1)
+ return nodes.get(0);
+ else {
+ // Create a right-balanced tree when there are more that 2 nodes
+ switch (shape) {
+ case REFERENCE: {
+ List<Node<T>> refNodes = (List<Node<T>>) nodes;
+ ConcNode<T> c = new ConcNode<>(refNodes.get(size - 2), refNodes.get(size - 1));
+ for (int i = size - 3; i >= 0; i--) {
+ c = new ConcNode<>(refNodes.get(i), c);
+ }
+ return c;
+ }
+ case INT_VALUE: {
+ List<? extends Node.OfInt> intNodes = (List<? extends Node.OfInt>) nodes;
+ IntConcNode c = new IntConcNode(intNodes.get(size - 2), intNodes.get(size - 1));
+ for (int i = size - 3; i >= 0; i--) {
+ c = new IntConcNode(intNodes.get(i), c);
+ }
+ return (Node<T>) c;
+ }
+ case LONG_VALUE: {
+ List<? extends Node.OfLong> longNodes = (List<? extends Node.OfLong>) nodes;
+ LongConcNode c = new LongConcNode(longNodes.get(size - 2), longNodes.get(size - 1));
+ for (int i = size - 3; i >= 0; i--) {
+ c = new LongConcNode(longNodes.get(i), c);
+ }
+ return (Node<T>) c;
+ }
+ case DOUBLE_VALUE: {
+ List<? extends Node.OfDouble> doubleNodes = (List<? extends Node.OfDouble>) nodes;
+ DoubleConcNode c = new DoubleConcNode(doubleNodes.get(size - 2), doubleNodes.get(size - 1));
+ for (int i = size - 3; i >= 0; i--) {
+ c = new DoubleConcNode(doubleNodes.get(i), c);
+ }
+ return (Node<T>) c;
+ }
+ default:
+ throw new IllegalStateException("Unknown shape " + shape);
+ }
+ }
+
+ }
+
+ /**
+ * Truncate a {@link Node}, returning a node describing a subsequence of
+ * the contents of the input node.
+ *
+ * @param <T> the type of elements of the input node and truncated node
+ * @param input the input node
+ * @param from the starting offset to include in the truncated node (inclusive)
+ * @param to the ending offset ot include in the truncated node (exclusive)
+ * @param generator the array factory (only used for reference nodes)
+ * @return the truncated node
+ */
+ @SuppressWarnings("unchecked")
+ static <T> Node<T> truncateNode(Node<T> input, long from, long to, IntFunction<T[]> generator) {
+ StreamShape shape = input.getShape();
+ long size = truncatedSize(input.count(), from, to);
+ if (size == 0)
+ return emptyNode(shape);
+ else if (from == 0 && to >= input.count())
+ return input;
+
+ switch (shape) {
+ case REFERENCE: {
+ Spliterator<T> spliterator = input.spliterator();
+ Node.Builder<T> nodeBuilder = Nodes.builder(size, generator);
+ nodeBuilder.begin(size);
+ for (int i = 0; i < from && spliterator.tryAdvance(e -> { }); i++) { }
+ for (int i = 0; (i < size) && spliterator.tryAdvance(nodeBuilder); i++) { }
+ nodeBuilder.end();
+ return nodeBuilder.build();
+ }
+ case INT_VALUE: {
+ Spliterator.OfInt spliterator = ((Node.OfInt) input).spliterator();
+ Node.Builder.OfInt nodeBuilder = Nodes.intBuilder(size);
+ nodeBuilder.begin(size);
+ for (int i = 0; i < from && spliterator.tryAdvance((IntConsumer) e -> { }); i++) { }
+ for (int i = 0; (i < size) && spliterator.tryAdvance((IntConsumer) nodeBuilder); i++) { }
+ nodeBuilder.end();
+ return (Node<T>) nodeBuilder.build();
+ }
+ case LONG_VALUE: {
+ Spliterator.OfLong spliterator = ((Node.OfLong) input).spliterator();
+ Node.Builder.OfLong nodeBuilder = Nodes.longBuilder(size);
+ nodeBuilder.begin(size);
+ for (int i = 0; i < from && spliterator.tryAdvance((LongConsumer) e -> { }); i++) { }
+ for (int i = 0; (i < size) && spliterator.tryAdvance((LongConsumer) nodeBuilder); i++) { }
+ nodeBuilder.end();
+ return (Node<T>) nodeBuilder.build();
+ }
+ case DOUBLE_VALUE: {
+ Spliterator.OfDouble spliterator = ((Node.OfDouble) input).spliterator();
+ Node.Builder.OfDouble nodeBuilder = Nodes.doubleBuilder(size);
+ nodeBuilder.begin(size);
+ for (int i = 0; i < from && spliterator.tryAdvance((DoubleConsumer) e -> { }); i++) { }
+ for (int i = 0; (i < size) && spliterator.tryAdvance((DoubleConsumer) nodeBuilder); i++) { }
+ nodeBuilder.end();
+ return (Node<T>) nodeBuilder.build();
+ }
+ default:
+ throw new IllegalStateException("Unknown shape " + shape);
+ }
+ }
+
+ private static long truncatedSize(long size, long from, long to) {
+ if (from >= 0)
+ size = Math.max(0, size - from);
+ long limit = to - from;
+ if (limit >= 0)
+ size = Math.min(size, limit);
+ return size;
+ }
+
+ // Reference-based node methods
+
+ /**
+ * Produces a {@link Node} describing an array.
+ *
+ * <p>The node will hold a reference to the array and will not make a copy.
+ *
+ * @param <T> the type of elements held by the node
+ * @param array the array
+ * @return a node holding an array
+ */
+ static <T> Node<T> node(T[] array) {
+ return new ArrayNode<>(array);
+ }
+
+ /**
+ * Produces a {@link Node} describing a {@link Collection}.
+ * <p>
+ * The node will hold a reference to the collection and will not make a copy.
+ *
+ * @param <T> the type of elements held by the node
+ * @param c the collection
+ * @return a node holding a collection
+ */
+ static <T> Node<T> node(Collection<T> c) {
+ return new CollectionNode<>(c);
+ }
+
+ /**
+ * Produces a {@link Node.Builder}.
+ *
+ * @param exactSizeIfKnown -1 if a variable size builder is requested,
+ * otherwise the exact capacity desired. A fixed capacity builder will
+ * fail if the wrong number of elements are added to the builder.
+ * @param generator the array factory
+ * @param <T> the type of elements of the node builder
+ * @return a {@code Node.Builder}
+ */
+ static <T> Node.Builder<T> builder(long exactSizeIfKnown, IntFunction<T[]> generator) {
+ return (exactSizeIfKnown >= 0 && exactSizeIfKnown < MAX_ARRAY_SIZE)
+ ? new FixedNodeBuilder<>(exactSizeIfKnown, generator)
+ : builder();
+ }
+
+ /**
+ * Produces a variable size @{link Node.Builder}.
+ *
+ * @param <T> the type of elements of the node builder
+ * @return a {@code Node.Builder}
+ */
+ static <T> Node.Builder<T> builder() {
+ return new SpinedNodeBuilder<>();
+ }
+
+ // Int nodes
+
+ /**
+ * Produces a {@link Node.OfInt} describing an int[] array.
+ *
+ * <p>The node will hold a reference to the array and will not make a copy.
+ *
+ * @param array the array
+ * @return a node holding an array
+ */
+ static Node.OfInt node(int[] array) {
+ return new IntArrayNode(array);
+ }
+
+ /**
+ * Produces a {@link Node.Builder.OfInt}.
+ *
+ * @param exactSizeIfKnown -1 if a variable size builder is requested,
+ * otherwise the exact capacity desired. A fixed capacity builder will
+ * fail if the wrong number of elements are added to the builder.
+ * @return a {@code Node.Builder.OfInt}
+ */
+ static Node.Builder.OfInt intBuilder(long exactSizeIfKnown) {
+ return (exactSizeIfKnown >= 0 && exactSizeIfKnown < MAX_ARRAY_SIZE)
+ ? new IntFixedNodeBuilder(exactSizeIfKnown)
+ : intBuilder();
+ }
+
+ /**
+ * Produces a variable size @{link Node.Builder.OfInt}.
+ *
+ * @return a {@code Node.Builder.OfInt}
+ */
+ static Node.Builder.OfInt intBuilder() {
+ return new IntSpinedNodeBuilder();
+ }
+
+ // Long nodes
+
+ /**
+ * Produces a {@link Node.OfLong} describing a long[] array.
+ * <p>
+ * The node will hold a reference to the array and will not make a copy.
+ *
+ * @param array the array
+ * @return a node holding an array
+ */
+ static Node.OfLong node(final long[] array) {
+ return new LongArrayNode(array);
+ }
+
+ /**
+ * Produces a {@link Node.Builder.OfLong}.
+ *
+ * @param exactSizeIfKnown -1 if a variable size builder is requested,
+ * otherwise the exact capacity desired. A fixed capacity builder will
+ * fail if the wrong number of elements are added to the builder.
+ * @return a {@code Node.Builder.OfLong}
+ */
+ static Node.Builder.OfLong longBuilder(long exactSizeIfKnown) {
+ return (exactSizeIfKnown >= 0 && exactSizeIfKnown < MAX_ARRAY_SIZE)
+ ? new LongFixedNodeBuilder(exactSizeIfKnown)
+ : longBuilder();
+ }
+
+ /**
+ * Produces a variable size @{link Node.Builder.OfLong}.
+ *
+ * @return a {@code Node.Builder.OfLong}
+ */
+ static Node.Builder.OfLong longBuilder() {
+ return new LongSpinedNodeBuilder();
+ }
+
+ // Double nodes
+
+ /**
+ * Produces a {@link Node.OfDouble} describing a double[] array.
+ *
+ * <p>The node will hold a reference to the array and will not make a copy.
+ *
+ * @param array the array
+ * @return a node holding an array
+ */
+ static Node.OfDouble node(final double[] array) {
+ return new DoubleArrayNode(array);
+ }
+
+ /**
+ * Produces a {@link Node.Builder.OfDouble}.
+ *
+ * @param exactSizeIfKnown -1 if a variable size builder is requested,
+ * otherwise the exact capacity desired. A fixed capacity builder will
+ * fail if the wrong number of elements are added to the builder.
+ * @return a {@code Node.Builder.OfDouble}
+ */
+ static Node.Builder.OfDouble doubleBuilder(long exactSizeIfKnown) {
+ return (exactSizeIfKnown >= 0 && exactSizeIfKnown < MAX_ARRAY_SIZE)
+ ? new DoubleFixedNodeBuilder(exactSizeIfKnown)
+ : doubleBuilder();
+ }
+
+ /**
+ * Produces a variable size @{link Node.Builder.OfDouble}.
+ *
+ * @return a {@code Node.Builder.OfDouble}
+ */
+ static Node.Builder.OfDouble doubleBuilder() {
+ return new DoubleSpinedNodeBuilder();
+ }
+
+ // Parallel evaluation of pipelines to nodes
+
+ /**
+ * Collect, in parallel, elements output from a pipeline and describe those
+ * elements with a {@link Node}.
+ *
+ * @implSpec
+ * If the exact size of the output from the pipeline is known and the source
+ * {@link Spliterator} has the {@link Spliterator#SUBSIZED} characteristic,
+ * then a flat {@link Node} will be returned whose content is an array,
+ * since the size is known the array can be constructed in advance and
+ * output elements can be placed into the array concurrently by leaf
+ * tasks at the correct offsets. If the exact size is not known, output
+ * elements are collected into a conc-node whose shape mirrors that
+ * of the computation. This conc-node can then be flattened in
+ * parallel to produce a flat {@code Node} if desired.
+ *
+ * @param helper the pipeline helper describing the pipeline
+ * @param flattenTree whether a conc node should be flattened into a node
+ * describing an array before returning
+ * @param generator the array generator
+ * @return a {@link Node} describing the output elements
+ */
+ public static <P_IN, P_OUT> Node<P_OUT> collect(PipelineHelper<P_OUT> helper,
+ Spliterator<P_IN> spliterator,
+ boolean flattenTree,
+ IntFunction<P_OUT[]> generator) {
+ long size = helper.exactOutputSizeIfKnown(spliterator);
+ if (size >= 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+ if (size >= MAX_ARRAY_SIZE)
+ throw new IllegalArgumentException("Stream size exceeds max array size");
+ P_OUT[] array = generator.apply((int) size);
+ new SizedCollectorTask.OfRef<>(spliterator, helper, array).invoke();
+ return node(array);
+ } else {
+ Node<P_OUT> node = new CollectorTask<>(helper, generator, spliterator).invoke();
+ return flattenTree ? flatten(node, generator) : node;
+ }
+ }
+
+ /**
+ * Collect, in parallel, elements output from an int-valued pipeline and
+ * describe those elements with a {@link Node.OfInt}.
+ *
+ * @implSpec
+ * If the exact size of the output from the pipeline is known and the source
+ * {@link Spliterator} has the {@link Spliterator#SUBSIZED} characteristic,
+ * then a flat {@link Node} will be returned whose content is an array,
+ * since the size is known the array can be constructed in advance and
+ * output elements can be placed into the array concurrently by leaf
+ * tasks at the correct offsets. If the exact size is not known, output
+ * elements are collected into a conc-node whose shape mirrors that
+ * of the computation. This conc-node can then be flattened in
+ * parallel to produce a flat {@code Node.OfInt} if desired.
+ *
+ * @param <P_IN> the type of elements from the source Spliterator
+ * @param helper the pipeline helper describing the pipeline
+ * @param flattenTree whether a conc node should be flattened into a node
+ * describing an array before returning
+ * @return a {@link Node.OfInt} describing the output elements
+ */
+ public static <P_IN> Node.OfInt collectInt(PipelineHelper<Integer> helper,
+ Spliterator<P_IN> spliterator,
+ boolean flattenTree) {
+ long size = helper.exactOutputSizeIfKnown(spliterator);
+ if (size >= 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+ if (size >= MAX_ARRAY_SIZE)
+ throw new IllegalArgumentException("Stream size exceeds max array size");
+ int[] array = new int[(int) size];
+ new SizedCollectorTask.OfInt<>(spliterator, helper, array).invoke();
+ return node(array);
+ }
+ else {
+ Node.OfInt node = new IntCollectorTask<>(helper, spliterator).invoke();
+ return flattenTree ? flattenInt(node) : node;
+ }
+ }
+
+ /**
+ * Collect, in parallel, elements output from a long-valued pipeline and
+ * describe those elements with a {@link Node.OfLong}.
+ *
+ * @implSpec
+ * If the exact size of the output from the pipeline is known and the source
+ * {@link Spliterator} has the {@link Spliterator#SUBSIZED} characteristic,
+ * then a flat {@link Node} will be returned whose content is an array,
+ * since the size is known the array can be constructed in advance and
+ * output elements can be placed into the array concurrently by leaf
+ * tasks at the correct offsets. If the exact size is not known, output
+ * elements are collected into a conc-node whose shape mirrors that
+ * of the computation. This conc-node can then be flattened in
+ * parallel to produce a flat {@code Node.OfLong} if desired.
+ *
+ * @param <P_IN> the type of elements from the source Spliterator
+ * @param helper the pipeline helper describing the pipeline
+ * @param flattenTree whether a conc node should be flattened into a node
+ * describing an array before returning
+ * @return a {@link Node.OfLong} describing the output elements
+ */
+ public static <P_IN> Node.OfLong collectLong(PipelineHelper<Long> helper,
+ Spliterator<P_IN> spliterator,
+ boolean flattenTree) {
+ long size = helper.exactOutputSizeIfKnown(spliterator);
+ if (size >= 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+ if (size >= MAX_ARRAY_SIZE)
+ throw new IllegalArgumentException("Stream size exceeds max array size");
+ long[] array = new long[(int) size];
+ new SizedCollectorTask.OfLong<>(spliterator, helper, array).invoke();
+ return node(array);
+ }
+ else {
+ Node.OfLong node = new LongCollectorTask<>(helper, spliterator).invoke();
+ return flattenTree ? flattenLong(node) : node;
+ }
+ }
+
+ /**
+ * Collect, in parallel, elements output from n double-valued pipeline and
+ * describe those elements with a {@link Node.OfDouble}.
+ *
+ * @implSpec
+ * If the exact size of the output from the pipeline is known and the source
+ * {@link Spliterator} has the {@link Spliterator#SUBSIZED} characteristic,
+ * then a flat {@link Node} will be returned whose content is an array,
+ * since the size is known the array can be constructed in advance and
+ * output elements can be placed into the array concurrently by leaf
+ * tasks at the correct offsets. If the exact size is not known, output
+ * elements are collected into a conc-node whose shape mirrors that
+ * of the computation. This conc-node can then be flattened in
+ * parallel to produce a flat {@code Node.OfDouble} if desired.
+ *
+ * @param <P_IN> the type of elements from the source Spliterator
+ * @param helper the pipeline helper describing the pipeline
+ * @param flattenTree whether a conc node should be flattened into a node
+ * describing an array before returning
+ * @return a {@link Node.OfDouble} describing the output elements
+ */
+ public static <P_IN> Node.OfDouble collectDouble(PipelineHelper<Double> helper,
+ Spliterator<P_IN> spliterator,
+ boolean flattenTree) {
+ long size = helper.exactOutputSizeIfKnown(spliterator);
+ if (size >= 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+ if (size >= MAX_ARRAY_SIZE)
+ throw new IllegalArgumentException("Stream size exceeds max array size");
+ double[] array = new double[(int) size];
+ new SizedCollectorTask.OfDouble<>(spliterator, helper, array).invoke();
+ return node(array);
+ }
+ else {
+ Node.OfDouble node = new DoubleCollectorTask<>(helper, spliterator).invoke();
+ return flattenTree ? flattenDouble(node) : node;
+ }
+ }
+
+ // Parallel flattening of nodes
+
+ /**
+ * Flatten, in parallel, a {@link Node}. A flattened node is one that has
+ * no children. If the node is already flat, it is simply returned.
+ *
+ * @implSpec
+ * If a new node is to be created, the generator is used to create an array
+ * whose length is {@link Node#count()}. Then the node tree is traversed
+ * and leaf node elements are placed in the array concurrently by leaf tasks
+ * at the correct offsets.
+ *
+ * @param <T> type of elements contained by the node
+ * @param node the node to flatten
+ * @param generator the array factory used to create array instances
+ * @return a flat {@code Node}
+ */
+ public static <T> Node<T> flatten(Node<T> node, IntFunction<T[]> generator) {
+ if (node.getChildCount() > 0) {
+ T[] array = generator.apply((int) node.count());
+ new ToArrayTask.OfRef<>(node, array, 0).invoke();
+ return node(array);
+ } else {
+ return node;
+ }
+ }
+
+ /**
+ * Flatten, in parallel, a {@link Node.OfInt}. A flattened node is one that
+ * has no children. If the node is already flat, it is simply returned.
+ *
+ * @implSpec
+ * If a new node is to be created, a new int[] array is created whose length
+ * is {@link Node#count()}. Then the node tree is traversed and leaf node
+ * elements are placed in the array concurrently by leaf tasks at the
+ * correct offsets.
+ *
+ * @param node the node to flatten
+ * @return a flat {@code Node.OfInt}
+ */
+ public static Node.OfInt flattenInt(Node.OfInt node) {
+ if (node.getChildCount() > 0) {
+ int[] array = new int[(int) node.count()];
+ new ToArrayTask.OfInt(node, array, 0).invoke();
+ return node(array);
+ } else {
+ return node;
+ }
+ }
+
+ /**
+ * Flatten, in parallel, a {@link Node.OfLong}. A flattened node is one that
+ * has no children. If the node is already flat, it is simply returned.
+ *
+ * @implSpec
+ * If a new node is to be created, a new long[] array is created whose length
+ * is {@link Node#count()}. Then the node tree is traversed and leaf node
+ * elements are placed in the array concurrently by leaf tasks at the
+ * correct offsets.
+ *
+ * @param node the node to flatten
+ * @return a flat {@code Node.OfLong}
+ */
+ public static Node.OfLong flattenLong(Node.OfLong node) {
+ if (node.getChildCount() > 0) {
+ long[] array = new long[(int) node.count()];
+ new ToArrayTask.OfLong(node, array, 0).invoke();
+ return node(array);
+ } else {
+ return node;
+ }
+ }
+
+ /**
+ * Flatten, in parallel, a {@link Node.OfDouble}. A flattened node is one that
+ * has no children. If the node is already flat, it is simply returned.
+ *
+ * @implSpec
+ * If a new node is to be created, a new double[] array is created whose length
+ * is {@link Node#count()}. Then the node tree is traversed and leaf node
+ * elements are placed in the array concurrently by leaf tasks at the
+ * correct offsets.
+ *
+ * @param node the node to flatten
+ * @return a flat {@code Node.OfDouble}
+ */
+ public static Node.OfDouble flattenDouble(Node.OfDouble node) {
+ if (node.getChildCount() > 0) {
+ double[] array = new double[(int) node.count()];
+ new ToArrayTask.OfDouble(node, array, 0).invoke();
+ return node(array);
+ } else {
+ return node;
+ }
+ }
+
+ // Implementations
+
+ private static abstract class EmptyNode<T, T_ARR, T_CONS> implements Node<T> {
+ EmptyNode() { }
+
+ @Override
+ public T[] asArray(IntFunction<T[]> generator) {
+ return generator.apply(0);
+ }
+
+ public void copyInto(T_ARR array, int offset) { }
+
+ @Override
+ public long count() {
+ return 0;
+ }
+
+ public void forEach(T_CONS consumer) { }
+
+ private static class OfRef<T> extends EmptyNode<T, T[], Consumer<? super T>> {
+ private OfRef() {
+ super();
+ }
+
+ @Override
+ public Spliterator<T> spliterator() {
+ return Spliterators.emptySpliterator();
+ }
+ }
+
+ private static final class OfInt
+ extends EmptyNode<Integer, int[], IntConsumer>
+ implements Node.OfInt {
+
+ OfInt() { } // Avoid creation of special accessor
+
+ @Override
+ public Spliterator.OfInt spliterator() {
+ return Spliterators.emptyIntSpliterator();
+ }
+
+ @Override
+ public int[] asIntArray() {
+ return EMPTY_INT_ARRAY;
+ }
+ }
+
+ private static final class OfLong
+ extends EmptyNode<Long, long[], LongConsumer>
+ implements Node.OfLong {
+
+ OfLong() { } // Avoid creation of special accessor
+
+ @Override
+ public Spliterator.OfLong spliterator() {
+ return Spliterators.emptyLongSpliterator();
+ }
+
+ @Override
+ public long[] asLongArray() {
+ return EMPTY_LONG_ARRAY;
+ }
+ }
+
+ private static final class OfDouble
+ extends EmptyNode<Double, double[], DoubleConsumer>
+ implements Node.OfDouble {
+
+ OfDouble() { } // Avoid creation of special accessor
+
+ @Override
+ public Spliterator.OfDouble spliterator() {
+ return Spliterators.emptyDoubleSpliterator();
+ }
+
+ @Override
+ public double[] asDoubleArray() {
+ return EMPTY_DOUBLE_ARRAY;
+ }
+ }
+ }
+
+ /** Node class for a reference array */
+ private static class ArrayNode<T> implements Node<T> {
+ final T[] array;
+ int curSize;
+
+ @SuppressWarnings("unchecked")
+ ArrayNode(long size, IntFunction<T[]> generator) {
+ if (size >= MAX_ARRAY_SIZE)
+ throw new IllegalArgumentException("Stream size exceeds max array size");
+ this.array = generator.apply((int) size);
+ this.curSize = 0;
+ }
+
+ ArrayNode(T[] array) {
+ this.array = array;
+ this.curSize = array.length;
+ }
+
+ // Node
+
+ @Override
+ public Spliterator<T> spliterator() {
+ return Arrays.spliterator(array, 0, curSize);
+ }
+
+ @Override
+ public void copyInto(T[] dest, int destOffset) {
+ System.arraycopy(array, 0, dest, destOffset, curSize);
+ }
+
+ @Override
+ public T[] asArray(IntFunction<T[]> generator) {
+ if (array.length == curSize) {
+ return array;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ @Override
+ public long count() {
+ return curSize;
+ }
+
+ // Traversable
+
+ @Override
+ public void forEach(Consumer<? super T> consumer) {
+ for (int i = 0; i < curSize; i++) {
+ consumer.accept(array[i]);
+ }
+ }
+
+ //
+
+ @Override
+ public String toString() {
+ return String.format("ArrayNode[%d][%s]",
+ array.length - curSize, Arrays.toString(array));
+ }
+ }
+
+ /** Node class for a Collection */
+ private static final class CollectionNode<T> implements Node<T> {
+ private final Collection<T> c;
+
+ CollectionNode(Collection<T> c) {
+ this.c = c;
+ }
+
+ // Node
+
+ @Override
+ public Spliterator<T> spliterator() {
+ return c.stream().spliterator();
+ }
+
+ @Override
+ public void copyInto(T[] array, int offset) {
+ for (T t : c)
+ array[offset++] = t;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T[] asArray(IntFunction<T[]> generator) {
+ return c.toArray(generator.apply(c.size()));
+ }
+
+ @Override
+ public long count() {
+ return c.size();
+ }
+
+ @Override
+ public void forEach(Consumer<? super T> consumer) {
+ c.forEach(consumer);
+ }
+
+ //
+
+ @Override
+ public String toString() {
+ return String.format("CollectionNode[%d][%s]", c.size(), c);
+ }
+ }
+
+ /**
+ * Node class for an internal node with two or more children
+ */
+ static final class ConcNode<T> implements Node<T> {
+ private final Node<T> left;
+ private final Node<T> right;
+
+ private final long size;
+
+ ConcNode(Node<T> left, Node<T> right) {
+ this.left = left;
+ this.right = right;
+ // The Node count will be required when the Node spliterator is
+ // obtained and it is cheaper to aggressively calculate bottom up
+ // as the tree is built rather than later on from the top down
+ // traversing the tree
+ this.size = left.count() + right.count();
+ }
+
+ // Node
+
+ @Override
+ public Spliterator<T> spliterator() {
+ return new Nodes.InternalNodeSpliterator.OfRef<>(this);
+ }
+
+ @Override
+ public int getChildCount() {
+ return 2;
+ }
+
+ @Override
+ public Node<T> getChild(int i) {
+ if (i == 0) return left;
+ if (i == 1) return right;
+ throw new IndexOutOfBoundsException();
+ }
+
+ @Override
+ public void copyInto(T[] array, int offset) {
+ Objects.requireNonNull(array);
+ left.copyInto(array, offset);
+ right.copyInto(array, offset + (int) left.count());
+ }
+
+ @Override
+ public T[] asArray(IntFunction<T[]> generator) {
+ T[] array = generator.apply((int) count());
+ copyInto(array, 0);
+ return array;
+ }
+
+ @Override
+ public long count() {
+ return size;
+ }
+
+ @Override
+ public void forEach(Consumer<? super T> consumer) {
+ left.forEach(consumer);
+ right.forEach(consumer);
+ }
+
+ @Override
+ public String toString() {
+ if (count() < 32) {
+ return String.format("ConcNode[%s.%s]", left, right);
+ } else {
+ return String.format("ConcNode[size=%d]", count());
+ }
+ }
+ }
+
+ /** Abstract class for spliterator for all internal node classes */
+ private static abstract class InternalNodeSpliterator<T,
+ S extends Spliterator<T>,
+ N extends Node<T>, C>
+ implements Spliterator<T> {
+ // Node we are pointing to
+ // null if full traversal has occurred
+ N curNode;
+
+ // next child of curNode to consume
+ int curChildIndex;
+
+ // The spliterator of the curNode if that node is last and has no children.
+ // This spliterator will be delegated to for splitting and traversing.
+ // null if curNode has children
+ S lastNodeSpliterator;
+
+ // spliterator used while traversing with tryAdvance
+ // null if no partial traversal has occurred
+ S tryAdvanceSpliterator;
+
+ // node stack used when traversing to search and find leaf nodes
+ // null if no partial traversal has occurred
+ Deque<N> tryAdvanceStack;
+
+ InternalNodeSpliterator(N curNode) {
+ this.curNode = curNode;
+ }
+
+ /**
+ * Initiate a stack containing, in left-to-right order, the child nodes
+ * covered by this spliterator
+ */
+ protected final Deque<N> initStack() {
+ // Bias size to the case where leaf nodes are close to this node
+ // 8 is the minimum initial capacity for the ArrayDeque implementation
+ Deque<N> stack = new ArrayDeque<>(8);
+ for (int i = curNode.getChildCount() - 1; i >= curChildIndex; i--)
+ stack.addFirst((N) curNode.getChild(i));
+ return stack;
+ }
+
+ /**
+ * Depth first search, in left-to-right order, of the node tree, using
+ * an explicit stack, to find the next non-empty leaf node.
+ */
+ protected final N findNextLeafNode(Deque<N> stack) {
+ N n = null;
+ while ((n = stack.pollFirst()) != null) {
+ if (n.getChildCount() == 0) {
+ if (n.count() > 0)
+ return n;
+ } else {
+ for (int i = n.getChildCount() - 1; i >= 0; i--)
+ stack.addFirst((N) n.getChild(i));
+ }
+ }
+
+ return null;
+ }
+
+ protected final boolean internalTryAdvance(C consumer) {
+ if (curNode == null)
+ return false;
+
+ if (tryAdvanceSpliterator == null) {
+ if (lastNodeSpliterator == null) {
+ // Initiate the node stack
+ tryAdvanceStack = initStack();
+ N leaf = findNextLeafNode(tryAdvanceStack);
+ if (leaf != null)
+ tryAdvanceSpliterator = (S) leaf.spliterator();
+ else {
+ // A non-empty leaf node was not found
+ // No elements to traverse
+ curNode = null;
+ return false;
+ }
+ }
+ else
+ tryAdvanceSpliterator = lastNodeSpliterator;
+ }
+
+ boolean hasNext = tryAdvance(tryAdvanceSpliterator, consumer);
+ if (!hasNext) {
+ if (lastNodeSpliterator == null) {
+ // Advance to the spliterator of the next non-empty leaf node
+ Node<T> leaf = findNextLeafNode(tryAdvanceStack);
+ if (leaf != null) {
+ tryAdvanceSpliterator = (S) leaf.spliterator();
+ // Since the node is not-empty the spliterator can be advanced
+ return tryAdvance(tryAdvanceSpliterator, consumer);
+ }
+ }
+ // No more elements to traverse
+ curNode = null;
+ }
+ return hasNext;
+ }
+
+ protected abstract boolean tryAdvance(S spliterator, C consumer);
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public S trySplit() {
+ if (curNode == null || tryAdvanceSpliterator != null)
+ return null; // Cannot split if fully or partially traversed
+ else if (lastNodeSpliterator != null)
+ return (S) lastNodeSpliterator.trySplit();
+ else if (curChildIndex < curNode.getChildCount() - 1)
+ return (S) curNode.getChild(curChildIndex++).spliterator();
+ else {
+ curNode = (N) curNode.getChild(curChildIndex);
+ if (curNode.getChildCount() == 0) {
+ lastNodeSpliterator = (S) curNode.spliterator();
+ return (S) lastNodeSpliterator.trySplit();
+ }
+ else {
+ curChildIndex = 0;
+ return (S) curNode.getChild(curChildIndex++).spliterator();
+ }
+ }
+ }
+
+ @Override
+ public long estimateSize() {
+ if (curNode == null)
+ return 0;
+
+ // Will not reflect the effects of partial traversal.
+ // This is compliant with the specification
+ if (lastNodeSpliterator != null)
+ return lastNodeSpliterator.estimateSize();
+ else {
+ long size = 0;
+ for (int i = curChildIndex; i < curNode.getChildCount(); i++)
+ size += curNode.getChild(i).count();
+ return size;
+ }
+ }
+
+ @Override
+ public int characteristics() {
+ return Spliterator.SIZED;
+ }
+
+ private static final class OfRef<T>
+ extends InternalNodeSpliterator<T, Spliterator<T>, Node<T>, Consumer<? super T>> {
+
+ OfRef(Node<T> curNode) {
+ super(curNode);
+ }
+
+ @Override
+ public boolean tryAdvance(Consumer<? super T> consumer) {
+ return internalTryAdvance(consumer);
+ }
+
+ @Override
+ protected boolean tryAdvance(Spliterator<T> spliterator,
+ Consumer<? super T> consumer) {
+ return spliterator.tryAdvance(consumer);
+ }
+
+ @Override
+ public void forEachRemaining(Consumer<? super T> consumer) {
+ if (curNode == null)
+ return;
+
+ if (tryAdvanceSpliterator == null) {
+ if (lastNodeSpliterator == null) {
+ Deque<Node<T>> stack = initStack();
+ Node<T> leaf;
+ while ((leaf = findNextLeafNode(stack)) != null) {
+ leaf.forEach(consumer);
+ }
+ curNode = null;
+ }
+ else
+ lastNodeSpliterator.forEachRemaining(consumer);
+ }
+ else
+ while(tryAdvance(consumer)) { }
+ }
+ }
+
+ private static final class OfInt
+ extends InternalNodeSpliterator<Integer, Spliterator.OfInt, Node.OfInt, IntConsumer>
+ implements Spliterator.OfInt {
+
+ OfInt(Node.OfInt cur) {
+ super(cur);
+ }
+
+ @Override
+ public boolean tryAdvance(IntConsumer consumer) {
+ return internalTryAdvance(consumer);
+ }
+
+ @Override
+ protected boolean tryAdvance(Spliterator.OfInt spliterator,
+ IntConsumer consumer) {
+ return spliterator.tryAdvance(consumer);
+ }
+
+ @Override
+ public void forEachRemaining(IntConsumer consumer) {
+ if (curNode == null)
+ return;
+
+ if (tryAdvanceSpliterator == null) {
+ if (lastNodeSpliterator == null) {
+ Deque<Node.OfInt> stack = initStack();
+ Node.OfInt leaf;
+ while ((leaf = findNextLeafNode(stack)) != null) {
+ leaf.forEach(consumer);
+ }
+ curNode = null;
+ }
+ else
+ lastNodeSpliterator.forEachRemaining(consumer);
+ }
+ else
+ while(tryAdvance(consumer)) { }
+ }
+ }
+
+ private static final class OfLong
+ extends InternalNodeSpliterator<Long, Spliterator.OfLong, Node.OfLong, LongConsumer>
+ implements Spliterator.OfLong {
+
+ OfLong(Node.OfLong cur) {
+ super(cur);
+ }
+
+ @Override
+ public boolean tryAdvance(LongConsumer consumer) {
+ return internalTryAdvance(consumer);
+ }
+
+ @Override
+ protected boolean tryAdvance(Spliterator.OfLong spliterator,
+ LongConsumer consumer) {
+ return spliterator.tryAdvance(consumer);
+ }
+
+ @Override
+ public void forEachRemaining(LongConsumer consumer) {
+ if (curNode == null)
+ return;
+
+ if (tryAdvanceSpliterator == null) {
+ if (lastNodeSpliterator == null) {
+ Deque<Node.OfLong> stack = initStack();
+ Node.OfLong leaf;
+ while ((leaf = findNextLeafNode(stack)) != null) {
+ leaf.forEach(consumer);
+ }
+ curNode = null;
+ }
+ else
+ lastNodeSpliterator.forEachRemaining(consumer);
+ }
+ else
+ while(tryAdvance(consumer)) { }
+ }
+ }
+
+ private static final class OfDouble
+ extends InternalNodeSpliterator<Double, Spliterator.OfDouble, Node.OfDouble, DoubleConsumer>
+ implements Spliterator.OfDouble {
+
+ OfDouble(Node.OfDouble cur) {
+ super(cur);
+ }
+
+ @Override
+ public boolean tryAdvance(DoubleConsumer consumer) {
+ return internalTryAdvance(consumer);
+ }
+
+ @Override
+ protected boolean tryAdvance(Spliterator.OfDouble spliterator,
+ DoubleConsumer consumer) {
+ return spliterator.tryAdvance(consumer);
+ }
+
+ @Override
+ public void forEachRemaining(DoubleConsumer consumer) {
+ if (curNode == null)
+ return;
+
+ if (tryAdvanceSpliterator == null) {
+ if (lastNodeSpliterator == null) {
+ Deque<Node.OfDouble> stack = initStack();
+ Node.OfDouble leaf;
+ while ((leaf = findNextLeafNode(stack)) != null) {
+ leaf.forEach(consumer);
+ }
+ curNode = null;
+ }
+ else
+ lastNodeSpliterator.forEachRemaining(consumer);
+ }
+ else
+ while(tryAdvance(consumer)) { }
+ }
+ }
+ }
+
+ /**
+ * Fixed-sized builder class for reference nodes
+ */
+ private static final class FixedNodeBuilder<T>
+ extends ArrayNode<T>
+ implements Node.Builder<T> {
+
+ FixedNodeBuilder(long size, IntFunction<T[]> generator) {
+ super(size, generator);
+ assert size < MAX_ARRAY_SIZE;
+ }
+
+ @Override
+ public Node<T> build() {
+ if (curSize < array.length)
+ throw new IllegalStateException(String.format("Current size %d is less than fixed size %d",
+ curSize, array.length));
+ return this;
+ }
+
+ @Override
+ public void begin(long size) {
+ if (size != array.length)
+ throw new IllegalStateException(String.format("Begin size %d is not equal to fixed size %d",
+ size, array.length));
+ curSize = 0;
+ }
+
+ @Override
+ public void accept(T t) {
+ if (curSize < array.length) {
+ array[curSize++] = t;
+ } else {
+ throw new IllegalStateException(String.format("Accept exceeded fixed size of %d",
+ array.length));
+ }
+ }
+
+ @Override
+ public void end() {
+ if (curSize < array.length)
+ throw new IllegalStateException(String.format("End size %d is less than fixed size %d",
+ curSize, array.length));
+ }
+
+ @Override
+ public String toString() {
+ return String.format("FixedNodeBuilder[%d][%s]",
+ array.length - curSize, Arrays.toString(array));
+ }
+ }
+
+ /**
+ * Variable-sized builder class for reference nodes
+ */
+ private static final class SpinedNodeBuilder<T>
+ extends SpinedBuffer<T>
+ implements Node<T>, Node.Builder<T> {
+ private boolean building = false;
+
+ SpinedNodeBuilder() {} // Avoid creation of special accessor
+
+ @Override
+ public Spliterator<T> spliterator() {
+ assert !building : "during building";
+ return super.spliterator();
+ }
+
+ @Override
+ public void forEach(Consumer<? super T> consumer) {
+ assert !building : "during building";
+ super.forEach(consumer);
+ }
+
+ //
+ @Override
+ public void begin(long size) {
+ assert !building : "was already building";
+ building = true;
+ clear();
+ ensureCapacity(size);
+ }
+
+ @Override
+ public void accept(T t) {
+ assert building : "not building";
+ super.accept(t);
+ }
+
+ @Override
+ public void end() {
+ assert building : "was not building";
+ building = false;
+ // @@@ check begin(size) and size
+ }
+
+ @Override
+ public void copyInto(T[] array, int offset) {
+ assert !building : "during building";
+ super.copyInto(array, offset);
+ }
+
+ @Override
+ public T[] asArray(IntFunction<T[]> arrayFactory) {
+ assert !building : "during building";
+ return super.asArray(arrayFactory);
+ }
+
+ @Override
+ public Node<T> build() {
+ assert !building : "during building";
+ return this;
+ }
+ }
+
+ //
+
+ private static final int[] EMPTY_INT_ARRAY = new int[0];
+ private static final long[] EMPTY_LONG_ARRAY = new long[0];
+ private static final double[] EMPTY_DOUBLE_ARRAY = new double[0];
+
+ private abstract static class AbstractPrimitiveConcNode<E, N extends Node<E>>
+ implements Node<E> {
+ final N left;
+ final N right;
+ final long size;
+
+ AbstractPrimitiveConcNode(N left, N right) {
+ this.left = left;
+ this.right = right;
+ // The Node count will be required when the Node spliterator is
+ // obtained and it is cheaper to aggressively calculate bottom up as
+ // the tree is built rather than later on by traversing the tree
+ this.size = left.count() + right.count();
+ }
+
+ @Override
+ public int getChildCount() {
+ return 2;
+ }
+
+ @Override
+ public N getChild(int i) {
+ if (i == 0) return left;
+ if (i == 1) return right;
+ throw new IndexOutOfBoundsException();
+ }
+
+ @Override
+ public long count() {
+ return size;
+ }
+
+ @Override
+ public String toString() {
+ if (count() < 32)
+ return String.format("%s[%s.%s]", this.getClass().getName(), left, right);
+ else
+ return String.format("%s[size=%d]", this.getClass().getName(), count());
+ }
+ }
+
+ private static class IntArrayNode implements Node.OfInt {
+ final int[] array;
+ int curSize;
+
+ IntArrayNode(long size) {
+ if (size >= MAX_ARRAY_SIZE)
+ throw new IllegalArgumentException("Stream size exceeds max array size");
+ this.array = new int[(int) size];
+ this.curSize = 0;
+ }
+
+ IntArrayNode(int[] array) {
+ this.array = array;
+ this.curSize = array.length;
+ }
+
+ // Node
+
+ @Override
+ public Spliterator.OfInt spliterator() {
+ return Arrays.spliterator(array, 0, curSize);
+ }
+
+ @Override
+ public int[] asIntArray() {
+ if (array.length == curSize) {
+ return array;
+ } else {
+ return Arrays.copyOf(array, curSize);
+ }
+ }
+
+ @Override
+ public void copyInto(int[] dest, int destOffset) {
+ System.arraycopy(array, 0, dest, destOffset, curSize);
+ }
+
+ @Override
+ public long count() {
+ return curSize;
+ }
+
+ @Override
+ public void forEach(IntConsumer consumer) {
+ for (int i = 0; i < curSize; i++) {
+ consumer.accept(array[i]);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return String.format("IntArrayNode[%d][%s]",
+ array.length - curSize, Arrays.toString(array));
+ }
+ }
+
+ private static class LongArrayNode implements Node.OfLong {
+ final long[] array;
+ int curSize;
+
+ LongArrayNode(long size) {
+ if (size >= MAX_ARRAY_SIZE)
+ throw new IllegalArgumentException("Stream size exceeds max array size");
+ this.array = new long[(int) size];
+ this.curSize = 0;
+ }
+
+ LongArrayNode(long[] array) {
+ this.array = array;
+ this.curSize = array.length;
+ }
+
+ @Override
+ public Spliterator.OfLong spliterator() {
+ return Arrays.spliterator(array, 0, curSize);
+ }
+
+ @Override
+ public long[] asLongArray() {
+ if (array.length == curSize) {
+ return array;
+ } else {
+ return Arrays.copyOf(array, curSize);
+ }
+ }
+
+ @Override
+ public void copyInto(long[] dest, int destOffset) {
+ System.arraycopy(array, 0, dest, destOffset, curSize);
+ }
+
+ @Override
+ public long count() {
+ return curSize;
+ }
+
+ @Override
+ public void forEach(LongConsumer consumer) {
+ for (int i = 0; i < curSize; i++) {
+ consumer.accept(array[i]);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return String.format("LongArrayNode[%d][%s]",
+ array.length - curSize, Arrays.toString(array));
+ }
+ }
+
+ private static class DoubleArrayNode implements Node.OfDouble {
+ final double[] array;
+ int curSize;
+
+ DoubleArrayNode(long size) {
+ if (size >= MAX_ARRAY_SIZE)
+ throw new IllegalArgumentException("Stream size exceeds max array size");
+ this.array = new double[(int) size];
+ this.curSize = 0;
+ }
+
+ DoubleArrayNode(double[] array) {
+ this.array = array;
+ this.curSize = array.length;
+ }
+
+ @Override
+ public Spliterator.OfDouble spliterator() {
+ return Arrays.spliterator(array, 0, curSize);
+ }
+
+ @Override
+ public double[] asDoubleArray() {
+ if (array.length == curSize) {
+ return array;
+ } else {
+ return Arrays.copyOf(array, curSize);
+ }
+ }
+
+ @Override
+ public void copyInto(double[] dest, int destOffset) {
+ System.arraycopy(array, 0, dest, destOffset, curSize);
+ }
+
+ @Override
+ public long count() {
+ return curSize;
+ }
+
+ @Override
+ public void forEach(DoubleConsumer consumer) {
+ for (int i = 0; i < curSize; i++) {
+ consumer.accept(array[i]);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return String.format("DoubleArrayNode[%d][%s]",
+ array.length - curSize, Arrays.toString(array));
+ }
+ }
+
+ static final class IntConcNode
+ extends AbstractPrimitiveConcNode<Integer, Node.OfInt>
+ implements Node.OfInt {
+
+ IntConcNode(Node.OfInt left, Node.OfInt right) {
+ super(left, right);
+ }
+
+ @Override
+ public void forEach(IntConsumer consumer) {
+ left.forEach(consumer);
+ right.forEach(consumer);
+ }
+
+ @Override
+ public Spliterator.OfInt spliterator() {
+ return new InternalNodeSpliterator.OfInt(this);
+ }
+
+ @Override
+ public void copyInto(int[] array, int offset) {
+ left.copyInto(array, offset);
+ right.copyInto(array, offset + (int) left.count());
+ }
+
+ @Override
+ public int[] asIntArray() {
+ int[] array = new int[(int) count()];
+ copyInto(array, 0);
+ return array;
+ }
+ }
+
+ static final class LongConcNode
+ extends AbstractPrimitiveConcNode<Long, Node.OfLong>
+ implements Node.OfLong {
+
+ LongConcNode(Node.OfLong left, Node.OfLong right) {
+ super(left, right);
+ }
+
+ @Override
+ public void forEach(LongConsumer consumer) {
+ left.forEach(consumer);
+ right.forEach(consumer);
+ }
+
+ @Override
+ public Spliterator.OfLong spliterator() {
+ return new InternalNodeSpliterator.OfLong(this);
+ }
+
+ @Override
+ public void copyInto(long[] array, int offset) {
+ left.copyInto(array, offset);
+ right.copyInto(array, offset + (int) left.count());
+ }
+
+ @Override
+ public long[] asLongArray() {
+ long[] array = new long[(int) count()];
+ copyInto(array, 0);
+ return array;
+ }
+ }
+
+ static final class DoubleConcNode
+ extends AbstractPrimitiveConcNode<Double, Node.OfDouble>
+ implements Node.OfDouble {
+
+ DoubleConcNode(Node.OfDouble left, Node.OfDouble right) {
+ super(left, right);
+ }
+
+ @Override
+ public void forEach(DoubleConsumer consumer) {
+ left.forEach(consumer);
+ right.forEach(consumer);
+ }
+
+ @Override
+ public Spliterator.OfDouble spliterator() {
+ return new InternalNodeSpliterator.OfDouble(this);
+ }
+
+ @Override
+ public void copyInto(double[] array, int offset) {
+ left.copyInto(array, offset);
+ right.copyInto(array, offset + (int) left.count());
+ }
+
+ @Override
+ public double[] asDoubleArray() {
+ double[] array = new double[(int) count()];
+ copyInto(array, 0);
+ return array;
+ }
+ }
+
+ private static final class IntFixedNodeBuilder
+ extends IntArrayNode
+ implements Node.Builder.OfInt {
+
+ IntFixedNodeBuilder(long size) {
+ super(size);
+ assert size < MAX_ARRAY_SIZE;
+ }
+
+ @Override
+ public Node.OfInt build() {
+ if (curSize < array.length) {
+ throw new IllegalStateException(String.format("Current size %d is less than fixed size %d",
+ curSize, array.length));
+ }
+
+ return this;
+ }
+
+ @Override
+ public void begin(long size) {
+ if (size != array.length) {
+ throw new IllegalStateException(String.format("Begin size %d is not equal to fixed size %d",
+ size, array.length));
+ }
+
+ curSize = 0;
+ }
+
+ @Override
+ public void accept(int i) {
+ if (curSize < array.length) {
+ array[curSize++] = i;
+ } else {
+ throw new IllegalStateException(String.format("Accept exceeded fixed size of %d",
+ array.length));
+ }
+ }
+
+ @Override
+ public void end() {
+ if (curSize < array.length) {
+ throw new IllegalStateException(String.format("End size %d is less than fixed size %d",
+ curSize, array.length));
+ }
+ }
+
+ @Override
+ public String toString() {
+ return String.format("IntFixedNodeBuilder[%d][%s]",
+ array.length - curSize, Arrays.toString(array));
+ }
+ }
+
+ private static final class LongFixedNodeBuilder
+ extends LongArrayNode
+ implements Node.Builder.OfLong {
+
+ LongFixedNodeBuilder(long size) {
+ super(size);
+ assert size < MAX_ARRAY_SIZE;
+ }
+
+ @Override
+ public Node.OfLong build() {
+ if (curSize < array.length) {
+ throw new IllegalStateException(String.format("Current size %d is less than fixed size %d",
+ curSize, array.length));
+ }
+
+ return this;
+ }
+
+ @Override
+ public void begin(long size) {
+ if (size != array.length) {
+ throw new IllegalStateException(String.format("Begin size %d is not equal to fixed size %d",
+ size, array.length));
+ }
+
+ curSize = 0;
+ }
+
+ @Override
+ public void accept(long i) {
+ if (curSize < array.length) {
+ array[curSize++] = i;
+ } else {
+ throw new IllegalStateException(String.format("Accept exceeded fixed size of %d",
+ array.length));
+ }
+ }
+
+ @Override
+ public void end() {
+ if (curSize < array.length) {
+ throw new IllegalStateException(String.format("End size %d is less than fixed size %d",
+ curSize, array.length));
+ }
+ }
+
+ @Override
+ public String toString() {
+ return String.format("LongFixedNodeBuilder[%d][%s]",
+ array.length - curSize, Arrays.toString(array));
+ }
+ }
+
+ private static final class DoubleFixedNodeBuilder
+ extends DoubleArrayNode
+ implements Node.Builder.OfDouble {
+
+ DoubleFixedNodeBuilder(long size) {
+ super(size);
+ assert size < MAX_ARRAY_SIZE;
+ }
+
+ @Override
+ public Node.OfDouble build() {
+ if (curSize < array.length) {
+ throw new IllegalStateException(String.format("Current size %d is less than fixed size %d",
+ curSize, array.length));
+ }
+
+ return this;
+ }
+
+ @Override
+ public void begin(long size) {
+ if (size != array.length) {
+ throw new IllegalStateException(String.format("Begin size %d is not equal to fixed size %d",
+ size, array.length));
+ }
+
+ curSize = 0;
+ }
+
+ @Override
+ public void accept(double i) {
+ if (curSize < array.length) {
+ array[curSize++] = i;
+ } else {
+ throw new IllegalStateException(String.format("Accept exceeded fixed size of %d",
+ array.length));
+ }
+ }
+
+ @Override
+ public void end() {
+ if (curSize < array.length) {
+ throw new IllegalStateException(String.format("End size %d is less than fixed size %d",
+ curSize, array.length));
+ }
+ }
+
+ @Override
+ public String toString() {
+ return String.format("DoubleFixedNodeBuilder[%d][%s]",
+ array.length - curSize, Arrays.toString(array));
+ }
+ }
+
+ private static final class IntSpinedNodeBuilder
+ extends SpinedBuffer.OfInt
+ implements Node.OfInt, Node.Builder.OfInt {
+ private boolean building = false;
+
+ IntSpinedNodeBuilder() {} // Avoid creation of special accessor
+
+ @Override
+ public Spliterator.OfInt spliterator() {
+ assert !building : "during building";
+ return super.spliterator();
+ }
+
+ @Override
+ public void forEach(IntConsumer consumer) {
+ assert !building : "during building";
+ super.forEach(consumer);
+ }
+
+ //
+ @Override
+ public void begin(long size) {
+ assert !building : "was already building";
+ building = true;
+ clear();
+ ensureCapacity(size);
+ }
+
+ @Override
+ public void accept(int i) {
+ assert building : "not building";
+ super.accept(i);
+ }
+
+ @Override
+ public void end() {
+ assert building : "was not building";
+ building = false;
+ // @@@ check begin(size) and size
+ }
+
+ @Override
+ public void copyInto(int[] array, int offset) throws IndexOutOfBoundsException {
+ assert !building : "during building";
+ super.copyInto(array, offset);
+ }
+
+ @Override
+ public int[] asIntArray() {
+ assert !building : "during building";
+ return super.asIntArray();
+ }
+
+ @Override
+ public Node.OfInt build() {
+ assert !building : "during building";
+ return this;
+ }
+ }
+
+ private static final class LongSpinedNodeBuilder
+ extends SpinedBuffer.OfLong
+ implements Node.OfLong, Node.Builder.OfLong {
+ private boolean building = false;
+
+ LongSpinedNodeBuilder() {} // Avoid creation of special accessor
+
+ @Override
+ public Spliterator.OfLong spliterator() {
+ assert !building : "during building";
+ return super.spliterator();
+ }
+
+ @Override
+ public void forEach(LongConsumer consumer) {
+ assert !building : "during building";
+ super.forEach(consumer);
+ }
+
+ //
+ @Override
+ public void begin(long size) {
+ assert !building : "was already building";
+ building = true;
+ clear();
+ ensureCapacity(size);
+ }
+
+ @Override
+ public void accept(long i) {
+ assert building : "not building";
+ super.accept(i);
+ }
+
+ @Override
+ public void end() {
+ assert building : "was not building";
+ building = false;
+ // @@@ check begin(size) and size
+ }
+
+ @Override
+ public void copyInto(long[] array, int offset) {
+ assert !building : "during building";
+ super.copyInto(array, offset);
+ }
+
+ @Override
+ public long[] asLongArray() {
+ assert !building : "during building";
+ return super.asLongArray();
+ }
+
+ @Override
+ public Node.OfLong build() {
+ assert !building : "during building";
+ return this;
+ }
+ }
+
+ private static final class DoubleSpinedNodeBuilder
+ extends SpinedBuffer.OfDouble
+ implements Node.OfDouble, Node.Builder.OfDouble {
+ private boolean building = false;
+
+ DoubleSpinedNodeBuilder() {} // Avoid creation of special accessor
+
+ @Override
+ public Spliterator.OfDouble spliterator() {
+ assert !building : "during building";
+ return super.spliterator();
+ }
+
+ @Override
+ public void forEach(DoubleConsumer consumer) {
+ assert !building : "during building";
+ super.forEach(consumer);
+ }
+
+ //
+ @Override
+ public void begin(long size) {
+ assert !building : "was already building";
+ building = true;
+ clear();
+ ensureCapacity(size);
+ }
+
+ @Override
+ public void accept(double i) {
+ assert building : "not building";
+ super.accept(i);
+ }
+
+ @Override
+ public void end() {
+ assert building : "was not building";
+ building = false;
+ // @@@ check begin(size) and size
+ }
+
+ @Override
+ public void copyInto(double[] array, int offset) {
+ assert !building : "during building";
+ super.copyInto(array, offset);
+ }
+
+ @Override
+ public double[] asDoubleArray() {
+ assert !building : "during building";
+ return super.asDoubleArray();
+ }
+
+ @Override
+ public Node.OfDouble build() {
+ assert !building : "during building";
+ return this;
+ }
+ }
+
+ private static abstract class SizedCollectorTask<P_IN, P_OUT, T_SINK extends Sink<P_OUT>,
+ K extends SizedCollectorTask<P_IN, P_OUT, T_SINK, K>>
+ extends CountedCompleter<Void>
+ implements Sink<P_OUT> {
+ protected final Spliterator<P_IN> spliterator;
+ protected final PipelineHelper<P_OUT> helper;
+ protected final long targetSize;
+ protected long offset;
+ protected long length;
+ // For Sink implementation
+ protected int index, fence;
+
+ SizedCollectorTask(Spliterator<P_IN> spliterator,
+ PipelineHelper<P_OUT> helper,
+ int arrayLength) {
+ assert spliterator.hasCharacteristics(Spliterator.SUBSIZED);
+ this.spliterator = spliterator;
+ this.helper = helper;
+ this.targetSize = AbstractTask.suggestTargetSize(spliterator.estimateSize());
+ this.offset = 0;
+ this.length = arrayLength;
+ }
+
+ SizedCollectorTask(K parent, Spliterator<P_IN> spliterator,
+ long offset, long length, int arrayLength) {
+ super(parent);
+ assert spliterator.hasCharacteristics(Spliterator.SUBSIZED);
+ this.spliterator = spliterator;
+ this.helper = parent.helper;
+ this.targetSize = parent.targetSize;
+ this.offset = offset;
+ this.length = length;
+
+ if (offset < 0 || length < 0 || (offset + length - 1 >= arrayLength)) {
+ throw new IllegalArgumentException(
+ String.format("offset and length interval [%d, %d + %d) is not within array size interval [0, %d)",
+ offset, offset, length, arrayLength));
+ }
+ }
+
+ @Override
+ public void compute() {
+ SizedCollectorTask<P_IN, P_OUT, T_SINK, K> task = this;
+ while (true) {
+ Spliterator<P_IN> leftSplit;
+ if (!AbstractTask.suggestSplit(task.spliterator, task.targetSize)
+ || ((leftSplit = task.spliterator.trySplit()) == null)) {
+ if (task.offset + task.length >= MAX_ARRAY_SIZE)
+ throw new IllegalArgumentException("Stream size exceeds max array size");
+ T_SINK sink = (T_SINK) task;
+ task.helper.wrapAndCopyInto(sink, task.spliterator);
+ task.propagateCompletion();
+ return;
+ }
+ else {
+ task.setPendingCount(1);
+ long leftSplitSize = leftSplit.estimateSize();
+ task.makeChild(leftSplit, task.offset, leftSplitSize).fork();
+ task = task.makeChild(task.spliterator, task.offset + leftSplitSize,
+ task.length - leftSplitSize);
+ }
+ }
+ }
+
+ abstract K makeChild(Spliterator<P_IN> spliterator, long offset, long size);
+
+ @Override
+ public void begin(long size) {
+ if(size > length)
+ throw new IllegalStateException("size passed to Sink.begin exceeds array length");
+ index = (int) offset;
+ fence = (int) offset + (int) length;
+ }
+
+ static final class OfRef<P_IN, P_OUT>
+ extends SizedCollectorTask<P_IN, P_OUT, Sink<P_OUT>, OfRef<P_IN, P_OUT>>
+ implements Sink<P_OUT> {
+ private final P_OUT[] array;
+
+ OfRef(Spliterator<P_IN> spliterator, PipelineHelper<P_OUT> helper, P_OUT[] array) {
+ super(spliterator, helper, array.length);
+ this.array = array;
+ }
+
+ OfRef(OfRef<P_IN, P_OUT> parent, Spliterator<P_IN> spliterator,
+ long offset, long length) {
+ super(parent, spliterator, offset, length, parent.array.length);
+ this.array = parent.array;
+ }
+
+ @Override
+ OfRef<P_IN, P_OUT> makeChild(Spliterator<P_IN> spliterator,
+ long offset, long size) {
+ return new OfRef<>(this, spliterator, offset, size);
+ }
+
+ @Override
+ public void accept(P_OUT value) {
+ if (index >= fence) {
+ throw new IndexOutOfBoundsException(Integer.toString(index));
+ }
+ array[index++] = value;
+ }
+ }
+
+ static final class OfInt<P_IN>
+ extends SizedCollectorTask<P_IN, Integer, Sink.OfInt, OfInt<P_IN>>
+ implements Sink.OfInt {
+ private final int[] array;
+
+ OfInt(Spliterator<P_IN> spliterator, PipelineHelper<Integer> helper, int[] array) {
+ super(spliterator, helper, array.length);
+ this.array = array;
+ }
+
+ OfInt(SizedCollectorTask.OfInt<P_IN> parent, Spliterator<P_IN> spliterator,
+ long offset, long length) {
+ super(parent, spliterator, offset, length, parent.array.length);
+ this.array = parent.array;
+ }
+
+ @Override
+ SizedCollectorTask.OfInt<P_IN> makeChild(Spliterator<P_IN> spliterator,
+ long offset, long size) {
+ return new SizedCollectorTask.OfInt<>(this, spliterator, offset, size);
+ }
+
+ @Override
+ public void accept(int value) {
+ if (index >= fence) {
+ throw new IndexOutOfBoundsException(Integer.toString(index));
+ }
+ array[index++] = value;
+ }
+ }
+
+ static final class OfLong<P_IN>
+ extends SizedCollectorTask<P_IN, Long, Sink.OfLong, OfLong<P_IN>>
+ implements Sink.OfLong {
+ private final long[] array;
+
+ OfLong(Spliterator<P_IN> spliterator, PipelineHelper<Long> helper, long[] array) {
+ super(spliterator, helper, array.length);
+ this.array = array;
+ }
+
+ OfLong(SizedCollectorTask.OfLong<P_IN> parent, Spliterator<P_IN> spliterator,
+ long offset, long length) {
+ super(parent, spliterator, offset, length, parent.array.length);
+ this.array = parent.array;
+ }
+
+ @Override
+ SizedCollectorTask.OfLong<P_IN> makeChild(Spliterator<P_IN> spliterator,
+ long offset, long size) {
+ return new SizedCollectorTask.OfLong<>(this, spliterator, offset, size);
+ }
+
+ @Override
+ public void accept(long value) {
+ if (index >= fence) {
+ throw new IndexOutOfBoundsException(Integer.toString(index));
+ }
+ array[index++] = value;
+ }
+ }
+
+ static final class OfDouble<P_IN>
+ extends SizedCollectorTask<P_IN, Double, Sink.OfDouble, OfDouble<P_IN>>
+ implements Sink.OfDouble {
+ private final double[] array;
+
+ OfDouble(Spliterator<P_IN> spliterator, PipelineHelper<Double> helper, double[] array) {
+ super(spliterator, helper, array.length);
+ this.array = array;
+ }
+
+ OfDouble(SizedCollectorTask.OfDouble<P_IN> parent, Spliterator<P_IN> spliterator,
+ long offset, long length) {
+ super(parent, spliterator, offset, length, parent.array.length);
+ this.array = parent.array;
+ }
+
+ @Override
+ SizedCollectorTask.OfDouble<P_IN> makeChild(Spliterator<P_IN> spliterator,
+ long offset, long size) {
+ return new SizedCollectorTask.OfDouble<>(this, spliterator, offset, size);
+ }
+
+ @Override
+ public void accept(double value) {
+ if (index >= fence) {
+ throw new IndexOutOfBoundsException(Integer.toString(index));
+ }
+ array[index++] = value;
+ }
+ }
+ }
+
+ private static abstract class ToArrayTask<T, T_NODE extends Node<T>,
+ K extends ToArrayTask<T, T_NODE, K>>
+ extends CountedCompleter<Void> {
+ protected final T_NODE node;
+ protected final int offset;
+
+ ToArrayTask(T_NODE node, int offset) {
+ this.node = node;
+ this.offset = offset;
+ }
+
+ ToArrayTask(K parent, T_NODE node, int offset) {
+ super(parent);
+ this.node = node;
+ this.offset = offset;
+ }
+
+ abstract void copyNodeToArray();
+
+ abstract K makeChild(int childIndex, int offset);
+
+ @Override
+ public void compute() {
+ ToArrayTask<T, T_NODE, K> task = this;
+ while (true) {
+ if (task.node.getChildCount() == 0) {
+ task.copyNodeToArray();
+ task.propagateCompletion();
+ return;
+ }
+ else {
+ task.setPendingCount(task.node.getChildCount() - 1);
+
+ int size = 0;
+ int i = 0;
+ for (;i < task.node.getChildCount() - 1; i++) {
+ K leftTask = task.makeChild(i, task.offset + size);
+ size += leftTask.node.count();
+ leftTask.fork();
+ }
+ task = task.makeChild(i, task.offset + size);
+ }
+ }
+ }
+
+ private static final class OfRef<T>
+ extends ToArrayTask<T, Node<T>, OfRef<T>> {
+ private final T[] array;
+
+ private OfRef(Node<T> node, T[] array, int offset) {
+ super(node, offset);
+ this.array = array;
+ }
+
+ private OfRef(OfRef<T> parent, Node<T> node, int offset) {
+ super(parent, node, offset);
+ this.array = parent.array;
+ }
+
+ @Override
+ OfRef<T> makeChild(int childIndex, int offset) {
+ return new OfRef<>(this, node.getChild(childIndex), offset);
+ }
+
+ @Override
+ void copyNodeToArray() {
+ node.copyInto(array, offset);
+ }
+ }
+
+ private static final class OfInt
+ extends ToArrayTask<Integer, Node.OfInt, OfInt> {
+ private final int[] array;
+
+ private OfInt(Node.OfInt node, int[] array, int offset) {
+ super(node, offset);
+ this.array = array;
+ }
+
+ private OfInt(OfInt parent, Node.OfInt node, int offset) {
+ super(parent, node, offset);
+ this.array = parent.array;
+ }
+
+ @Override
+ OfInt makeChild(int childIndex, int offset) {
+ return new OfInt(this, node.getChild(childIndex), offset);
+ }
+
+ @Override
+ void copyNodeToArray() {
+ node.copyInto(array, offset);
+ }
+ }
+
+ private static final class OfLong
+ extends ToArrayTask<Long, Node.OfLong, OfLong> {
+ private final long[] array;
+
+ private OfLong(Node.OfLong node, long[] array, int offset) {
+ super(node, offset);
+ this.array = array;
+ }
+
+ private OfLong(OfLong parent, Node.OfLong node, int offset) {
+ super(parent, node, offset);
+ this.array = parent.array;
+ }
+
+ @Override
+ OfLong makeChild(int childIndex, int offset) {
+ return new OfLong(this, node.getChild(childIndex), offset);
+ }
+
+ @Override
+ void copyNodeToArray() {
+ node.copyInto(array, offset);
+ }
+ }
+
+ private static final class OfDouble
+ extends ToArrayTask<Double, Node.OfDouble, OfDouble> {
+ private final double[] array;
+
+ private OfDouble(Node.OfDouble node, double[] array, int offset) {
+ super(node, offset);
+ this.array = array;
+ }
+
+ private OfDouble(OfDouble parent, Node.OfDouble node, int offset) {
+ super(parent, node, offset);
+ this.array = parent.array;
+ }
+
+ @Override
+ OfDouble makeChild(int childIndex, int offset) {
+ return new OfDouble(this, node.getChild(childIndex), offset);
+ }
+
+ @Override
+ void copyNodeToArray() {
+ node.copyInto(array, offset);
+ }
+ }
+ }
+
+ private static final class CollectorTask<P_IN, P_OUT>
+ extends AbstractTask<P_IN, P_OUT, Node<P_OUT>, CollectorTask<P_IN, P_OUT>> {
+ private final PipelineHelper<P_OUT> helper;
+ private final IntFunction<P_OUT[]> generator;
+
+ CollectorTask(PipelineHelper<P_OUT> helper,
+ IntFunction<P_OUT[]> generator,
+ Spliterator<P_IN> spliterator) {
+ super(helper, spliterator);
+ this.helper = helper;
+ this.generator = generator;
+ }
+
+ CollectorTask(CollectorTask<P_IN, P_OUT> parent, Spliterator<P_IN> spliterator) {
+ super(parent, spliterator);
+ helper = parent.helper;
+ generator = parent.generator;
+ }
+
+ @Override
+ protected CollectorTask<P_IN, P_OUT> makeChild(Spliterator<P_IN> spliterator) {
+ return new CollectorTask<>(this, spliterator);
+ }
+
+ @Override
+ protected Node<P_OUT> doLeaf() {
+ Node.Builder<P_OUT> builder
+ = builder(helper.exactOutputSizeIfKnown(spliterator),
+ generator);
+ return helper.wrapAndCopyInto(builder, spliterator).build();
+ }
+
+ @Override
+ public void onCompletion(CountedCompleter caller) {
+ if (!isLeaf()) {
+ setLocalResult(new ConcNode<>(leftChild.getLocalResult(), rightChild.getLocalResult()));
+ }
+ super.onCompletion(caller);
+ }
+ }
+
+ private static final class IntCollectorTask<P_IN>
+ extends AbstractTask<P_IN, Integer, Node.OfInt, IntCollectorTask<P_IN>> {
+ private final PipelineHelper<Integer> helper;
+
+ IntCollectorTask(PipelineHelper<Integer> helper, Spliterator<P_IN> spliterator) {
+ super(helper, spliterator);
+ this.helper = helper;
+ }
+
+ IntCollectorTask(IntCollectorTask<P_IN> parent, Spliterator<P_IN> spliterator) {
+ super(parent, spliterator);
+ helper = parent.helper;
+ }
+
+ @Override
+ protected IntCollectorTask<P_IN> makeChild(Spliterator<P_IN> spliterator) {
+ return new IntCollectorTask<>(this, spliterator);
+ }
+
+ @Override
+ protected Node.OfInt doLeaf() {
+ Node.Builder.OfInt builder = intBuilder(helper.exactOutputSizeIfKnown(spliterator));
+ return helper.wrapAndCopyInto(builder, spliterator).build();
+ }
+
+ @Override
+ public void onCompletion(CountedCompleter caller) {
+ if (!isLeaf()) {
+ setLocalResult(new IntConcNode(leftChild.getLocalResult(), rightChild.getLocalResult()));
+ }
+ super.onCompletion(caller);
+ }
+ }
+
+ private static final class LongCollectorTask<P_IN>
+ extends AbstractTask<P_IN, Long, Node.OfLong, LongCollectorTask<P_IN>> {
+ private final PipelineHelper<Long> helper;
+
+ LongCollectorTask(PipelineHelper<Long> helper, Spliterator<P_IN> spliterator) {
+ super(helper, spliterator);
+ this.helper = helper;
+ }
+
+ LongCollectorTask(LongCollectorTask<P_IN> parent, Spliterator<P_IN> spliterator) {
+ super(parent, spliterator);
+ helper = parent.helper;
+ }
+
+ @Override
+ protected LongCollectorTask<P_IN> makeChild(Spliterator<P_IN> spliterator) {
+ return new LongCollectorTask<>(this, spliterator);
+ }
+
+ @Override
+ protected Node.OfLong doLeaf() {
+ Node.Builder.OfLong builder = longBuilder(helper.exactOutputSizeIfKnown(spliterator));
+ return helper.wrapAndCopyInto(builder, spliterator).build();
+ }
+
+ @Override
+ public void onCompletion(CountedCompleter caller) {
+ if (!isLeaf()) {
+ setLocalResult(new LongConcNode(leftChild.getLocalResult(), rightChild.getLocalResult()));
+ }
+ super.onCompletion(caller);
+ }
+ }
+
+ private static final class DoubleCollectorTask<P_IN>
+ extends AbstractTask<P_IN, Double, Node.OfDouble, DoubleCollectorTask<P_IN>> {
+ private final PipelineHelper<Double> helper;
+
+ DoubleCollectorTask(PipelineHelper<Double> helper, Spliterator<P_IN> spliterator) {
+ super(helper, spliterator);
+ this.helper = helper;
+ }
+
+ DoubleCollectorTask(DoubleCollectorTask<P_IN> parent, Spliterator<P_IN> spliterator) {
+ super(parent, spliterator);
+ helper = parent.helper;
+ }
+
+ @Override
+ protected DoubleCollectorTask<P_IN> makeChild(Spliterator<P_IN> spliterator) {
+ return new DoubleCollectorTask<>(this, spliterator);
+ }
+
+ @Override
+ protected Node.OfDouble doLeaf() {
+ Node.Builder.OfDouble builder
+ = doubleBuilder(helper.exactOutputSizeIfKnown(spliterator));
+ return helper.wrapAndCopyInto(builder, spliterator).build();
+ }
+
+ @Override
+ public void onCompletion(CountedCompleter caller) {
+ if (!isLeaf()) {
+ setLocalResult(new DoubleConcNode(leftChild.getLocalResult(), rightChild.getLocalResult()));
+ }
+ super.onCompletion(caller);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/PipelineHelper.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Spliterator;
+import java.util.function.IntFunction;
+
+/**
+ * Helper class for executing <a href="package-summary.html#StreamPipelines">
+ * stream pipelines</a>, capturing all of the information about a stream
+ * pipeline (output shape, intermediate operations, stream flags, parallelism,
+ * etc) in one place.
+ *
+ * <p>
+ * A {@code PipelineHelper} describes the initial segment of a stream pipeline,
+ * including its source, intermediate operations, and may additionally
+ * incorporate information about the terminal (or stateful) operation which
+ * follows the last intermediate operation described by this
+ * {@code PipelineHelper}. The {@code PipelineHelper} is passed to the
+ * {@link TerminalOp#evaluateParallel(PipelineHelper, java.util.Spliterator)},
+ * {@link TerminalOp#evaluateSequential(PipelineHelper, java.util.Spliterator)},
+ * and {@link AbstractPipeline#opEvaluateParallel(PipelineHelper, java.util.Spliterator,
+ * java.util.function.IntFunction)}, methods, which can use the
+ * {@code PipelineHelper} to access information about the pipeline such as
+ * input shape, output shape, stream flags, and size, and use the helper methods
+ * such as {@link #wrapAndCopyInto(Sink, Spliterator)},
+ * {@link #copyInto(Sink, Spliterator)}, and {@link #wrapSink(Sink)} to execute
+ * pipeline operations.
+ *
+ * @param <P_OUT> type of output elements from the pipeline
+ * @since 1.8
+ */
+abstract class PipelineHelper<P_OUT> {
+
+ /**
+ * Gets the combined stream and operation flags for the output of the described
+ * pipeline. This will incorporate stream flags from the stream source, all
+ * the intermediate operations and the terminal operation.
+ *
+ * @return the combined stream and operation flags
+ * @see StreamOpFlag
+ */
+ abstract int getStreamAndOpFlags();
+
+ /**
+ * Returns the exact output size of the portion of the output resulting from
+ * applying the pipeline stages described by this {@code PipelineHelper} to
+ * the the portion of the input described by the provided
+ * {@code Spliterator}, if known. If not known or known infinite, will
+ * return {@code -1}.
+ *
+ * @apiNote
+ * The exact output size is known if the {@code Spliterator} has the
+ * {@code SIZED} characteristic, and the operation flags
+ * {@link StreamOpFlag#SIZED} is known on the combined stream and operation
+ * flags.
+ *
+ * @param spliterator the spliterator describing the relevant portion of the
+ * source data
+ * @return the exact size if known, or -1 if infinite or unknown
+ */
+ abstract<P_IN> long exactOutputSizeIfKnown(Spliterator<P_IN> spliterator);
+
+ /**
+ * Applies the pipeline stages described by this {@code PipelineHelper} to
+ * the provided {@code Spliterator} and send the results to the provided
+ * {@code Sink}.
+ *
+ * @implSpec
+ * The implementation behaves as if:
+ * <pre>{@code
+ * intoWrapped(wrapSink(sink), spliterator);
+ * }</pre>
+ *
+ * @param sink the {@code Sink} to receive the results
+ * @param spliterator the spliterator describing the source input to process
+ */
+ abstract<P_IN, S extends Sink<P_OUT>> S wrapAndCopyInto(S sink, Spliterator<P_IN> spliterator);
+
+ /**
+ * Pushes elements obtained from the {@code Spliterator} into the provided
+ * {@code Sink}. If the stream pipeline is known to have short-circuiting
+ * stages in it (see {@link StreamOpFlag#SHORT_CIRCUIT}), the
+ * {@link Sink#cancellationRequested()} is checked after each
+ * element, stopping if cancellation is requested.
+ *
+ * @implSpec
+ * This method conforms to the {@code Sink} protocol of calling
+ * {@code Sink.begin} before pushing elements, via {@code Sink.accept}, and
+ * calling {@code Sink.end} after all elements have been pushed.
+ *
+ * @param wrappedSink the destination {@code Sink}
+ * @param spliterator the source {@code Spliterator}
+ */
+ abstract<P_IN> void copyInto(Sink<P_IN> wrappedSink, Spliterator<P_IN> spliterator);
+
+ /**
+ * Pushes elements obtained from the {@code Spliterator} into the provided
+ * {@code Sink}, checking {@link Sink#cancellationRequested()} after each
+ * element, and stopping if cancellation is requested.
+ *
+ * @implSpec
+ * This method conforms to the {@code Sink} protocol of calling
+ * {@code Sink.begin} before pushing elements, via {@code Sink.accept}, and
+ * calling {@code Sink.end} after all elements have been pushed or if
+ * cancellation is requested.
+ *
+ * @param wrappedSink the destination {@code Sink}
+ * @param spliterator the source {@code Spliterator}
+ */
+ abstract <P_IN> void copyIntoWithCancel(Sink<P_IN> wrappedSink, Spliterator<P_IN> spliterator);
+
+ /**
+ * Takes a {@code Sink} that accepts elements of the output type of the
+ * {@code PipelineHelper}, and wrap it with a {@code Sink} that accepts
+ * elements of the input type and implements all the intermediate operations
+ * described by this {@code PipelineHelper}, delivering the result into the
+ * provided {@code Sink}.
+ *
+ * @param sink the {@code Sink} to receive the results
+ * @return a {@code Sink} that implements the pipeline stages and sends
+ * results to the provided {@code Sink}
+ */
+ abstract<P_IN> Sink<P_IN> wrapSink(Sink<P_OUT> sink);
+
+ /**
+ * Constructs a @{link Node.Builder} compatible with the output shape of
+ * this {@code PipelineHelper}.
+ *
+ * @param exactSizeIfKnown if >=0 then a builder will be created that has a
+ * fixed capacity of exactly sizeIfKnown elements; if < 0 then the
+ * builder has variable capacity. A fixed capacity builder will fail
+ * if an element is added after the builder has reached capacity.
+ * @param generator a factory function for array instances
+ * @return a {@code Node.Builder} compatible with the output shape of this
+ * {@code PipelineHelper}
+ */
+ abstract Node.Builder<P_OUT> makeNodeBuilder(long exactSizeIfKnown,
+ IntFunction<P_OUT[]> generator);
+
+ /**
+ * Collects all output elements resulting from applying the pipeline stages
+ * to the source {@code Spliterator} into a {@code Node}.
+ *
+ * @implNote
+ * If the pipeline has no intermediate operations and the source is backed
+ * by a {@code Node} then that {@code Node} will be returned (or flattened
+ * and then returned). This reduces copying for a pipeline consisting of a
+ * stateful operation followed by a terminal operation that returns an
+ * array, such as:
+ * <pre>{@code
+ * stream.sorted().toArray();
+ * }</pre>
+ *
+ * @param spliterator the source {@code Spliterator}
+ * @param flatten if true and the pipeline is a parallel pipeline then the
+ * {@code Node} returned will contain no children, otherwise the
+ * {@code Node} may represent the root in a tree that reflects the
+ * shape of the computation tree.
+ * @param generator a factory function for array instances
+ * @return the {@code Node} containing all output elements
+ */
+ abstract<P_IN> Node<P_OUT> evaluate(Spliterator<P_IN> spliterator,
+ boolean flatten,
+ IntFunction<P_OUT[]> generator);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/ReduceOps.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,762 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Objects;
+import java.util.Optional;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.OptionalLong;
+import java.util.Spliterator;
+import java.util.concurrent.CountedCompleter;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.BinaryOperator;
+import java.util.function.DoubleBinaryOperator;
+import java.util.function.IntBinaryOperator;
+import java.util.function.LongBinaryOperator;
+import java.util.function.ObjDoubleConsumer;
+import java.util.function.ObjIntConsumer;
+import java.util.function.ObjLongConsumer;
+import java.util.function.Supplier;
+
+/**
+ * Factory for the creating instances of {@code TerminalOp) that implement
+ * reductions.
+ *
+ * @since 1.8
+ */
+final class ReduceOps {
+
+ private ReduceOps() { }
+
+ /**
+ * Constructs a {@code TerminalOp} that implements a functional reduce on
+ * reference values.
+ *
+ * @param <T> the type of the input elements
+ * @param <U> the type of the result
+ * @param seed the identity element for the reduction
+ * @param reducer the accumulating function that incorporates an additional
+ * input element into the result
+ * @param combiner the combining function that combines two intermediate
+ * results
+ * @return a {@code TerminalOp} implementing the reduction
+ */
+ public static <T, U> TerminalOp<T, U>
+ makeRef(U seed, BiFunction<U, ? super T, U> reducer, BinaryOperator<U> combiner) {
+ Objects.requireNonNull(reducer);
+ Objects.requireNonNull(combiner);
+ class ReducingSink extends Box<U> implements AccumulatingSink<T, U, ReducingSink> {
+ @Override
+ public void begin(long size) {
+ state = seed;
+ }
+
+ @Override
+ public void accept(T t) {
+ state = reducer.apply(state, t);
+ }
+
+ @Override
+ public void combine(ReducingSink other) {
+ state = combiner.apply(state, other.state);
+ }
+ }
+ return new ReduceOp<T, U, ReducingSink>(StreamShape.REFERENCE) {
+ @Override
+ public ReducingSink makeSink() {
+ return new ReducingSink();
+ }
+ };
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that implements a functional reduce on
+ * reference values producing an optional reference result.
+ *
+ * @param <T> The type of the input elements, and the type of the result
+ * @param operator The reducing function
+ * @return A {@code TerminalOp} implementing the reduction
+ */
+ public static <T> TerminalOp<T, Optional<T>>
+ makeRef(BinaryOperator<T> operator) {
+ Objects.requireNonNull(operator);
+ class ReducingSink
+ implements AccumulatingSink<T, Optional<T>, ReducingSink> {
+ private boolean empty;
+ private T state;
+
+ public void begin(long size) {
+ empty = true;
+ state = null;
+ }
+
+ @Override
+ public void accept(T t) {
+ if (empty) {
+ empty = false;
+ state = t;
+ } else {
+ state = operator.apply(state, t);
+ }
+ }
+
+ @Override
+ public Optional<T> get() {
+ return empty ? Optional.empty() : Optional.of(state);
+ }
+
+ @Override
+ public void combine(ReducingSink other) {
+ if (!other.empty)
+ accept(other.state);
+ }
+ }
+ return new ReduceOp<T, Optional<T>, ReducingSink>(StreamShape.REFERENCE) {
+ @Override
+ public ReducingSink makeSink() {
+ return new ReducingSink();
+ }
+ };
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that implements a mutable reduce on
+ * reference values.
+ *
+ * @param <T> the type of the input elements
+ * @param <R> the type of the result
+ * @param collector a {@code Collector} defining the reduction
+ * @return a {@code ReduceOp} implementing the reduction
+ */
+ public static <T,R> TerminalOp<T, R>
+ makeRef(Collector<? super T,R> collector) {
+ Supplier<R> supplier = Objects.requireNonNull(collector).resultSupplier();
+ BiFunction<R, ? super T, R> accumulator = collector.accumulator();
+ BinaryOperator<R> combiner = collector.combiner();
+ class ReducingSink extends Box<R>
+ implements AccumulatingSink<T, R, ReducingSink> {
+ @Override
+ public void begin(long size) {
+ state = supplier.get();
+ }
+
+ @Override
+ public void accept(T t) {
+ R newResult = accumulator.apply(state, t);
+ if (state != newResult)
+ state = newResult;
+ }
+
+ @Override
+ public void combine(ReducingSink other) {
+ state = combiner.apply(state, other.state);
+ }
+ }
+ return new ReduceOp<T, R, ReducingSink>(StreamShape.REFERENCE) {
+ @Override
+ public ReducingSink makeSink() {
+ return new ReducingSink();
+ }
+
+ @Override
+ public int getOpFlags() {
+ return collector.characteristics().contains(Collector.Characteristics.UNORDERED)
+ ? StreamOpFlag.NOT_ORDERED
+ : 0;
+ }
+ };
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that implements a mutable reduce on
+ * reference values.
+ *
+ * @param <T> the type of the input elements
+ * @param <R> the type of the result
+ * @param seedFactory a factory to produce a new base accumulator
+ * @param accumulator a function to incorporate an element into an
+ * accumulator
+ * @param reducer a function to combine an accumulator into another
+ * @return a {@code TerminalOp} implementing the reduction
+ */
+ public static <T, R> TerminalOp<T, R>
+ makeRef(Supplier<R> seedFactory,
+ BiConsumer<R, ? super T> accumulator,
+ BiConsumer<R,R> reducer) {
+ Objects.requireNonNull(seedFactory);
+ Objects.requireNonNull(accumulator);
+ Objects.requireNonNull(reducer);
+ class ReducingSink extends Box<R>
+ implements AccumulatingSink<T, R, ReducingSink> {
+ @Override
+ public void begin(long size) {
+ state = seedFactory.get();
+ }
+
+ @Override
+ public void accept(T t) {
+ accumulator.accept(state, t);
+ }
+
+ @Override
+ public void combine(ReducingSink other) {
+ reducer.accept(state, other.state);
+ }
+ }
+ return new ReduceOp<T, R, ReducingSink>(StreamShape.REFERENCE) {
+ @Override
+ public ReducingSink makeSink() {
+ return new ReducingSink();
+ }
+ };
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that implements a functional reduce on
+ * {@code int} values.
+ *
+ * @param identity the identity for the combining function
+ * @param operator the combining function
+ * @return a {@code TerminalOp} implementing the reduction
+ */
+ public static TerminalOp<Integer, Integer>
+ makeInt(int identity, IntBinaryOperator operator) {
+ Objects.requireNonNull(operator);
+ class ReducingSink
+ implements AccumulatingSink<Integer, Integer, ReducingSink>, Sink.OfInt {
+ private int state;
+
+ @Override
+ public void begin(long size) {
+ state = identity;
+ }
+
+ @Override
+ public void accept(int t) {
+ state = operator.applyAsInt(state, t);
+ }
+
+ @Override
+ public Integer get() {
+ return state;
+ }
+
+ @Override
+ public void combine(ReducingSink other) {
+ accept(other.state);
+ }
+ }
+ return new ReduceOp<Integer, Integer, ReducingSink>(StreamShape.INT_VALUE) {
+ @Override
+ public ReducingSink makeSink() {
+ return new ReducingSink();
+ }
+ };
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that implements a functional reduce on
+ * {@code int} values, producing an optional integer result.
+ *
+ * @param operator the combining function
+ * @return a {@code TerminalOp} implementing the reduction
+ */
+ public static TerminalOp<Integer, OptionalInt>
+ makeInt(IntBinaryOperator operator) {
+ Objects.requireNonNull(operator);
+ class ReducingSink
+ implements AccumulatingSink<Integer, OptionalInt, ReducingSink>, Sink.OfInt {
+ private boolean empty;
+ private int state;
+
+ public void begin(long size) {
+ empty = true;
+ state = 0;
+ }
+
+ @Override
+ public void accept(int t) {
+ if (empty) {
+ empty = false;
+ state = t;
+ }
+ else {
+ state = operator.applyAsInt(state, t);
+ }
+ }
+
+ @Override
+ public OptionalInt get() {
+ return empty ? OptionalInt.empty() : OptionalInt.of(state);
+ }
+
+ @Override
+ public void combine(ReducingSink other) {
+ if (!other.empty)
+ accept(other.state);
+ }
+ }
+ return new ReduceOp<Integer, OptionalInt, ReducingSink>(StreamShape.INT_VALUE) {
+ @Override
+ public ReducingSink makeSink() {
+ return new ReducingSink();
+ }
+ };
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that implements a mutable reduce on
+ * {@code int} values.
+ *
+ * @param <R> The type of the result
+ * @param supplier a factory to produce a new accumulator of the result type
+ * @param accumulator a function to incorporate an int into an
+ * accumulator
+ * @param combiner a function to combine an accumulator into another
+ * @return A {@code ReduceOp} implementing the reduction
+ */
+ public static <R> TerminalOp<Integer, R>
+ makeInt(Supplier<R> supplier,
+ ObjIntConsumer<R> accumulator,
+ BinaryOperator<R> combiner) {
+ Objects.requireNonNull(supplier);
+ Objects.requireNonNull(accumulator);
+ Objects.requireNonNull(combiner);
+ class ReducingSink extends Box<R>
+ implements AccumulatingSink<Integer, R, ReducingSink>, Sink.OfInt {
+ @Override
+ public void begin(long size) {
+ state = supplier.get();
+ }
+
+ @Override
+ public void accept(int t) {
+ accumulator.accept(state, t);
+ }
+
+ @Override
+ public void combine(ReducingSink other) {
+ state = combiner.apply(state, other.state);
+ }
+ }
+ return new ReduceOp<Integer, R, ReducingSink>(StreamShape.INT_VALUE) {
+ @Override
+ public ReducingSink makeSink() {
+ return new ReducingSink();
+ }
+ };
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that implements a functional reduce on
+ * {@code long} values.
+ *
+ * @param identity the identity for the combining function
+ * @param operator the combining function
+ * @return a {@code TerminalOp} implementing the reduction
+ */
+ public static TerminalOp<Long, Long>
+ makeLong(long identity, LongBinaryOperator operator) {
+ Objects.requireNonNull(operator);
+ class ReducingSink
+ implements AccumulatingSink<Long, Long, ReducingSink>, Sink.OfLong {
+ private long state;
+
+ @Override
+ public void begin(long size) {
+ state = identity;
+ }
+
+ @Override
+ public void accept(long t) {
+ state = operator.applyAsLong(state, t);
+ }
+
+ @Override
+ public Long get() {
+ return state;
+ }
+
+ @Override
+ public void combine(ReducingSink other) {
+ accept(other.state);
+ }
+ }
+ return new ReduceOp<Long, Long, ReducingSink>(StreamShape.LONG_VALUE) {
+ @Override
+ public ReducingSink makeSink() {
+ return new ReducingSink();
+ }
+ };
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that implements a functional reduce on
+ * {@code long} values, producing an optional long result.
+ *
+ * @param operator the combining function
+ * @return a {@code TerminalOp} implementing the reduction
+ */
+ public static TerminalOp<Long, OptionalLong>
+ makeLong(LongBinaryOperator operator) {
+ Objects.requireNonNull(operator);
+ class ReducingSink
+ implements AccumulatingSink<Long, OptionalLong, ReducingSink>, Sink.OfLong {
+ private boolean empty;
+ private long state;
+
+ public void begin(long size) {
+ empty = true;
+ state = 0;
+ }
+
+ @Override
+ public void accept(long t) {
+ if (empty) {
+ empty = false;
+ state = t;
+ }
+ else {
+ state = operator.applyAsLong(state, t);
+ }
+ }
+
+ @Override
+ public OptionalLong get() {
+ return empty ? OptionalLong.empty() : OptionalLong.of(state);
+ }
+
+ @Override
+ public void combine(ReducingSink other) {
+ if (!other.empty)
+ accept(other.state);
+ }
+ }
+ return new ReduceOp<Long, OptionalLong, ReducingSink>(StreamShape.LONG_VALUE) {
+ @Override
+ public ReducingSink makeSink() {
+ return new ReducingSink();
+ }
+ };
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that implements a mutable reduce on
+ * {@code long} values.
+ *
+ * @param <R> the type of the result
+ * @param supplier a factory to produce a new accumulator of the result type
+ * @param accumulator a function to incorporate an int into an
+ * accumulator
+ * @param combiner a function to combine an accumulator into another
+ * @return a {@code TerminalOp} implementing the reduction
+ */
+ public static <R> TerminalOp<Long, R>
+ makeLong(Supplier<R> supplier,
+ ObjLongConsumer<R> accumulator,
+ BinaryOperator<R> combiner) {
+ Objects.requireNonNull(supplier);
+ Objects.requireNonNull(accumulator);
+ Objects.requireNonNull(combiner);
+ class ReducingSink extends Box<R>
+ implements AccumulatingSink<Long, R, ReducingSink>, Sink.OfLong {
+ @Override
+ public void begin(long size) {
+ state = supplier.get();
+ }
+
+ @Override
+ public void accept(long t) {
+ accumulator.accept(state, t);
+ }
+
+ @Override
+ public void combine(ReducingSink other) {
+ state = combiner.apply(state, other.state);
+ }
+ }
+ return new ReduceOp<Long, R, ReducingSink>(StreamShape.LONG_VALUE) {
+ @Override
+ public ReducingSink makeSink() {
+ return new ReducingSink();
+ }
+ };
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that implements a functional reduce on
+ * {@code double} values.
+ *
+ * @param identity the identity for the combining function
+ * @param operator the combining function
+ * @return a {@code TerminalOp} implementing the reduction
+ */
+ public static TerminalOp<Double, Double>
+ makeDouble(double identity, DoubleBinaryOperator operator) {
+ Objects.requireNonNull(operator);
+ class ReducingSink
+ implements AccumulatingSink<Double, Double, ReducingSink>, Sink.OfDouble {
+ private double state;
+
+ @Override
+ public void begin(long size) {
+ state = identity;
+ }
+
+ @Override
+ public void accept(double t) {
+ state = operator.applyAsDouble(state, t);
+ }
+
+ @Override
+ public Double get() {
+ return state;
+ }
+
+ @Override
+ public void combine(ReducingSink other) {
+ accept(other.state);
+ }
+ }
+ return new ReduceOp<Double, Double, ReducingSink>(StreamShape.DOUBLE_VALUE) {
+ @Override
+ public ReducingSink makeSink() {
+ return new ReducingSink();
+ }
+ };
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that implements a functional reduce on
+ * {@code double} values, producing an optional double result.
+ *
+ * @param operator the combining function
+ * @return a {@code TerminalOp} implementing the reduction
+ */
+ public static TerminalOp<Double, OptionalDouble>
+ makeDouble(DoubleBinaryOperator operator) {
+ Objects.requireNonNull(operator);
+ class ReducingSink
+ implements AccumulatingSink<Double, OptionalDouble, ReducingSink>, Sink.OfDouble {
+ private boolean empty;
+ private double state;
+
+ public void begin(long size) {
+ empty = true;
+ state = 0;
+ }
+
+ @Override
+ public void accept(double t) {
+ if (empty) {
+ empty = false;
+ state = t;
+ }
+ else {
+ state = operator.applyAsDouble(state, t);
+ }
+ }
+
+ @Override
+ public OptionalDouble get() {
+ return empty ? OptionalDouble.empty() : OptionalDouble.of(state);
+ }
+
+ @Override
+ public void combine(ReducingSink other) {
+ if (!other.empty)
+ accept(other.state);
+ }
+ }
+ return new ReduceOp<Double, OptionalDouble, ReducingSink>(StreamShape.DOUBLE_VALUE) {
+ @Override
+ public ReducingSink makeSink() {
+ return new ReducingSink();
+ }
+ };
+ }
+
+ /**
+ * Constructs a {@code TerminalOp} that implements a mutable reduce on
+ * {@code double} values.
+ *
+ * @param <R> the type of the result
+ * @param supplier a factory to produce a new accumulator of the result type
+ * @param accumulator a function to incorporate an int into an
+ * accumulator
+ * @param combiner a function to combine an accumulator into another
+ * @return a {@code TerminalOp} implementing the reduction
+ */
+ public static <R> TerminalOp<Double, R>
+ makeDouble(Supplier<R> supplier,
+ ObjDoubleConsumer<R> accumulator,
+ BinaryOperator<R> combiner) {
+ Objects.requireNonNull(supplier);
+ Objects.requireNonNull(accumulator);
+ Objects.requireNonNull(combiner);
+ class ReducingSink extends Box<R>
+ implements AccumulatingSink<Double, R, ReducingSink>, Sink.OfDouble {
+ @Override
+ public void begin(long size) {
+ state = supplier.get();
+ }
+
+ @Override
+ public void accept(double t) {
+ accumulator.accept(state, t);
+ }
+
+ @Override
+ public void combine(ReducingSink other) {
+ state = combiner.apply(state, other.state);
+ }
+ }
+ return new ReduceOp<Double, R, ReducingSink>(StreamShape.DOUBLE_VALUE) {
+ @Override
+ public ReducingSink makeSink() {
+ return new ReducingSink();
+ }
+ };
+ }
+
+ /**
+ * A type of {@code TerminalSink} that implements an associative reducing
+ * operation on elements of type {@code T} and producing a result of type
+ * {@code R}.
+ *
+ * @param <T> the type of input element to the combining operation
+ * @param <R> the result type
+ * @param <K> the type of the {@code AccumulatingSink}.
+ */
+ private interface AccumulatingSink<T, R, K extends AccumulatingSink<T, R, K>>
+ extends TerminalSink<T, R> {
+ public void combine(K other);
+ }
+
+ /**
+ * State box for a single state element, used as a base class for
+ * {@code AccumulatingSink} instances
+ *
+ * @param <U> The type of the state element
+ */
+ private static abstract class Box<U> {
+ U state;
+
+ Box() {} // Avoid creation of special accessor
+
+ public U get() {
+ return state;
+ }
+ }
+
+ /**
+ * A {@code TerminalOp} that evaluates a stream pipeline and sends the
+ * output into an {@code AccumulatingSink}, which performs a reduce
+ * operation. The {@code AccumulatingSink} must represent an associative
+ * reducing operation.
+ *
+ * @param <T> the output type of the stream pipeline
+ * @param <R> the result type of the reducing operation
+ * @param <S> the type of the {@code AccumulatingSink}
+ */
+ private static abstract class ReduceOp<T, R, S extends AccumulatingSink<T, R, S>>
+ implements TerminalOp<T, R> {
+ private final StreamShape inputShape;
+
+ /**
+ * Create a {@code ReduceOp} of the specified stream shape which uses
+ * the specified {@code Supplier} to create accumulating sinks.
+ *
+ * @param shape The shape of the stream pipeline
+ */
+ ReduceOp(StreamShape shape) {
+ inputShape = shape;
+ }
+
+ public abstract S makeSink();
+
+ @Override
+ public StreamShape inputShape() {
+ return inputShape;
+ }
+
+ @Override
+ public <P_IN> R evaluateSequential(PipelineHelper<T> helper,
+ Spliterator<P_IN> spliterator) {
+ return helper.wrapAndCopyInto(makeSink(), spliterator).get();
+ }
+
+ @Override
+ public <P_IN> R evaluateParallel(PipelineHelper<T> helper,
+ Spliterator<P_IN> spliterator) {
+ return new ReduceTask<>(this, helper, spliterator).invoke().get();
+ }
+ }
+
+ /**
+ * A {@code ForkJoinTask} for performing a parallel reduce operation.
+ */
+ private static final class ReduceTask<P_IN, P_OUT, R,
+ S extends AccumulatingSink<P_OUT, R, S>>
+ extends AbstractTask<P_IN, P_OUT, S, ReduceTask<P_IN, P_OUT, R, S>> {
+ private final ReduceOp<P_OUT, R, S> op;
+
+ ReduceTask(ReduceOp<P_OUT, R, S> op,
+ PipelineHelper<P_OUT> helper,
+ Spliterator<P_IN> spliterator) {
+ super(helper, spliterator);
+ this.op = op;
+ }
+
+ ReduceTask(ReduceTask<P_IN, P_OUT, R, S> parent,
+ Spliterator<P_IN> spliterator) {
+ super(parent, spliterator);
+ this.op = parent.op;
+ }
+
+ @Override
+ protected ReduceTask<P_IN, P_OUT, R, S> makeChild(Spliterator<P_IN> spliterator) {
+ return new ReduceTask<>(this, spliterator);
+ }
+
+ @Override
+ protected S doLeaf() {
+ return helper.wrapAndCopyInto(op.makeSink(), spliterator);
+ }
+
+ @Override
+ public void onCompletion(CountedCompleter caller) {
+ if (!isLeaf()) {
+ S leftResult = leftChild.getLocalResult();
+ leftResult.combine(rightChild.getLocalResult());
+ setLocalResult(leftResult);
+ }
+ // GC spliterator, left and right child
+ super.onCompletion(caller);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/ReferencePipeline.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,632 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Comparator;
+import java.util.Comparators;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.BinaryOperator;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.Function;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.LongConsumer;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+import java.util.function.ToDoubleFunction;
+import java.util.function.ToIntFunction;
+import java.util.function.ToLongFunction;
+
+/**
+ * Abstract base class for an intermediate pipeline stage or pipeline source
+ * stage implementing whose elements are of type {@code U}.
+ *
+ * @param <P_IN> type of elements in the upstream source
+ * @param <P_OUT> type of elements in produced by this stage
+ *
+ * @since 1.8
+ */
+abstract class ReferencePipeline<P_IN, P_OUT>
+ extends AbstractPipeline<P_IN, P_OUT, Stream<P_OUT>>
+ implements Stream<P_OUT> {
+
+ /**
+ * Constructor for the head of a stream pipeline.
+ *
+ * @param source {@code Supplier<Spliterator>} describing the stream source
+ * @param sourceFlags the source flags for the stream source, described in
+ * {@link StreamOpFlag}
+ * @param parallel {@code true} if the pipeline is parallel
+ */
+ ReferencePipeline(Supplier<? extends Spliterator<?>> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ /**
+ * Constructor for the head of a stream pipeline.
+ *
+ * @param source {@code Spliterator} describing the stream source
+ * @param sourceFlags The source flags for the stream source, described in
+ * {@link StreamOpFlag}
+ * @param parallel {@code true} if the pipeline is parallel
+ */
+ ReferencePipeline(Spliterator<?> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ /**
+ * Constructor for appending an intermediate operation onto an existing
+ * pipeline.
+ *
+ * @param upstream the upstream element source.
+ */
+ ReferencePipeline(AbstractPipeline<?, P_IN, ?> upstream, int opFlags) {
+ super(upstream, opFlags);
+ }
+
+ // Shape-specific methods
+
+ @Override
+ final StreamShape getOutputShape() {
+ return StreamShape.REFERENCE;
+ }
+
+ @Override
+ final <P_IN> Node<P_OUT> evaluateToNode(PipelineHelper<P_OUT> helper,
+ Spliterator<P_IN> spliterator,
+ boolean flattenTree,
+ IntFunction<P_OUT[]> generator) {
+ return Nodes.collect(helper, spliterator, flattenTree, generator);
+ }
+
+ @Override
+ final <P_IN> Spliterator<P_OUT> wrap(PipelineHelper<P_OUT> ph,
+ Supplier<Spliterator<P_IN>> supplier,
+ boolean isParallel) {
+ return new StreamSpliterators.WrappingSpliterator<>(ph, supplier, isParallel);
+ }
+
+ @Override
+ final Spliterator<P_OUT> lazySpliterator(Supplier<? extends Spliterator<P_OUT>> supplier) {
+ return new StreamSpliterators.DelegatingSpliterator<>(supplier);
+ }
+
+ @Override
+ final void forEachWithCancel(Spliterator<P_OUT> spliterator, Sink<P_OUT> sink) {
+ do { } while (!sink.cancellationRequested() && spliterator.tryAdvance(sink));
+ }
+
+ @Override
+ final Node.Builder<P_OUT> makeNodeBuilder(long exactSizeIfKnown, IntFunction<P_OUT[]> generator) {
+ return Nodes.builder(exactSizeIfKnown, generator);
+ }
+
+
+ // BaseStream
+
+ @Override
+ public final Iterator<P_OUT> iterator() {
+ return Spliterators.iteratorFromSpliterator(spliterator());
+ }
+
+
+ // Stream
+
+ // Stateless intermediate operations from Stream
+
+ @Override
+ public Stream<P_OUT> unordered() {
+ if (!isOrdered())
+ return this;
+ return new StatelessOp<P_OUT, P_OUT>(this, StreamShape.REFERENCE, StreamOpFlag.NOT_ORDERED) {
+ @Override
+ Sink<P_OUT> opWrapSink(int flags, Sink<P_OUT> sink) {
+ return sink;
+ }
+ };
+ }
+
+ @Override
+ public final Stream<P_OUT> filter(Predicate<? super P_OUT> predicate) {
+ Objects.requireNonNull(predicate);
+ return new StatelessOp<P_OUT, P_OUT>(this, StreamShape.REFERENCE,
+ StreamOpFlag.NOT_SIZED) {
+ @Override
+ Sink<P_OUT> opWrapSink(int flags, Sink<P_OUT> sink) {
+ return new Sink.ChainedReference<P_OUT>(sink) {
+ @Override
+ public void accept(P_OUT u) {
+ if (predicate.test(u))
+ downstream.accept(u);
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final <R> Stream<R> map(Function<? super P_OUT, ? extends R> mapper) {
+ Objects.requireNonNull(mapper);
+ return new StatelessOp<P_OUT, R>(this, StreamShape.REFERENCE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<P_OUT> opWrapSink(int flags, Sink<R> sink) {
+ return new Sink.ChainedReference<P_OUT>(sink) {
+ @Override
+ public void accept(P_OUT u) {
+ downstream.accept(mapper.apply(u));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final IntStream mapToInt(ToIntFunction<? super P_OUT> mapper) {
+ Objects.requireNonNull(mapper);
+ return new IntPipeline.StatelessOp<P_OUT>(this, StreamShape.REFERENCE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<P_OUT> opWrapSink(int flags, Sink<Integer> sink) {
+ return new Sink.ChainedReference<P_OUT>(sink) {
+ @Override
+ public void accept(P_OUT u) {
+ downstream.accept(mapper.applyAsInt(u));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final LongStream mapToLong(ToLongFunction<? super P_OUT> mapper) {
+ Objects.requireNonNull(mapper);
+ return new LongPipeline.StatelessOp<P_OUT>(this, StreamShape.REFERENCE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<P_OUT> opWrapSink(int flags, Sink<Long> sink) {
+ return new Sink.ChainedReference<P_OUT>(sink) {
+ @Override
+ public void accept(P_OUT u) {
+ downstream.accept(mapper.applyAsLong(u));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final DoubleStream mapToDouble(ToDoubleFunction<? super P_OUT> mapper) {
+ Objects.requireNonNull(mapper);
+ return new DoublePipeline.StatelessOp<P_OUT>(this, StreamShape.REFERENCE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+ @Override
+ Sink<P_OUT> opWrapSink(int flags, Sink<Double> sink) {
+ return new Sink.ChainedReference<P_OUT>(sink) {
+ @Override
+ public void accept(P_OUT u) {
+ downstream.accept(mapper.applyAsDouble(u));
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final <R> Stream<R> flatMap(Function<? super P_OUT, ? extends Stream<? extends R>> mapper) {
+ Objects.requireNonNull(mapper);
+ // We can do better than this, by polling cancellationRequested when stream is infinite
+ return new StatelessOp<P_OUT, R>(this, StreamShape.REFERENCE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+ @Override
+ Sink<P_OUT> opWrapSink(int flags, Sink<R> sink) {
+ return new Sink.ChainedReference<P_OUT>(sink) {
+ public void accept(P_OUT u) {
+ // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+ Stream<? extends R> result = mapper.apply(u);
+ if (result != null)
+ result.sequential().forEach(downstream);
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final IntStream flatMapToInt(Function<? super P_OUT, ? extends IntStream> mapper) {
+ Objects.requireNonNull(mapper);
+ // We can do better than this, by polling cancellationRequested when stream is infinite
+ return new IntPipeline.StatelessOp<P_OUT>(this, StreamShape.REFERENCE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+ @Override
+ Sink<P_OUT> opWrapSink(int flags, Sink<Integer> sink) {
+ return new Sink.ChainedReference<P_OUT>(sink) {
+ IntConsumer downstreamAsInt = downstream::accept;
+ public void accept(P_OUT u) {
+ // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+ IntStream result = mapper.apply(u);
+ if (result != null)
+ result.sequential().forEach(downstreamAsInt);
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final DoubleStream flatMapToDouble(Function<? super P_OUT, ? extends DoubleStream> mapper) {
+ Objects.requireNonNull(mapper);
+ // We can do better than this, by polling cancellationRequested when stream is infinite
+ return new DoublePipeline.StatelessOp<P_OUT>(this, StreamShape.REFERENCE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+ @Override
+ Sink<P_OUT> opWrapSink(int flags, Sink<Double> sink) {
+ return new Sink.ChainedReference<P_OUT>(sink) {
+ DoubleConsumer downstreamAsDouble = downstream::accept;
+ public void accept(P_OUT u) {
+ // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+ DoubleStream result = mapper.apply(u);
+ if (result != null)
+ result.sequential().forEach(downstreamAsDouble);
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final LongStream flatMapToLong(Function<? super P_OUT, ? extends LongStream> mapper) {
+ Objects.requireNonNull(mapper);
+ // We can do better than this, by polling cancellationRequested when stream is infinite
+ return new LongPipeline.StatelessOp<P_OUT>(this, StreamShape.REFERENCE,
+ StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+ @Override
+ Sink<P_OUT> opWrapSink(int flags, Sink<Long> sink) {
+ return new Sink.ChainedReference<P_OUT>(sink) {
+ LongConsumer downstreamAsLong = downstream::accept;
+ public void accept(P_OUT u) {
+ // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+ LongStream result = mapper.apply(u);
+ if (result != null)
+ result.sequential().forEach(downstreamAsLong);
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public final Stream<P_OUT> peek(Consumer<? super P_OUT> tee) {
+ Objects.requireNonNull(tee);
+ return new StatelessOp<P_OUT, P_OUT>(this, StreamShape.REFERENCE,
+ 0) {
+ @Override
+ Sink<P_OUT> opWrapSink(int flags, Sink<P_OUT> sink) {
+ return new Sink.ChainedReference<P_OUT>(sink) {
+ @Override
+ public void accept(P_OUT u) {
+ tee.accept(u);
+ downstream.accept(u);
+ }
+ };
+ }
+ };
+ }
+
+ // Stateful intermediate operations from Stream
+
+ @Override
+ public final Stream<P_OUT> distinct() {
+ return DistinctOps.makeRef(this);
+ }
+
+ @Override
+ public final Stream<P_OUT> sorted() {
+ return SortedOps.makeRef(this);
+ }
+
+ @Override
+ public final Stream<P_OUT> sorted(Comparator<? super P_OUT> comparator) {
+ return SortedOps.makeRef(this, comparator);
+ }
+
+ private Stream<P_OUT> slice(long skip, long limit) {
+ return SliceOps.makeRef(this, skip, limit);
+ }
+
+ @Override
+ public final Stream<P_OUT> limit(long maxSize) {
+ if (maxSize < 0)
+ throw new IllegalArgumentException(Long.toString(maxSize));
+ return slice(0, maxSize);
+ }
+
+ @Override
+ public final Stream<P_OUT> substream(long startingOffset) {
+ if (startingOffset < 0)
+ throw new IllegalArgumentException(Long.toString(startingOffset));
+ if (startingOffset == 0)
+ return this;
+ else
+ return slice(startingOffset, -1);
+ }
+
+ @Override
+ public final Stream<P_OUT> substream(long startingOffset, long endingOffset) {
+ if (startingOffset < 0 || endingOffset < startingOffset)
+ throw new IllegalArgumentException(String.format("substream(%d, %d)", startingOffset, endingOffset));
+ return slice(startingOffset, endingOffset - startingOffset);
+ }
+
+ // Terminal operations from Stream
+
+ @Override
+ public void forEach(Consumer<? super P_OUT> action) {
+ evaluate(ForEachOps.makeRef(action, false));
+ }
+
+ @Override
+ public void forEachOrdered(Consumer<? super P_OUT> action) {
+ evaluate(ForEachOps.makeRef(action, true));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public final <A> A[] toArray(IntFunction<A[]> generator) {
+ // Since A has no relation to U (not possible to declare that A is an upper bound of U)
+ // there will be no static type checking.
+ // Therefore use a raw type and assume A == U rather than propagating the separation of A and U
+ // throughout the code-base.
+ // The runtime type of U is never checked for equality with the component type of the runtime type of A[].
+ // Runtime checking will be performed when an element is stored in A[], thus if A is not a
+ // super type of U an ArrayStoreException will be thrown.
+ IntFunction rawGenerator = (IntFunction) generator;
+ return (A[]) Nodes.flatten(evaluateToArrayNode(rawGenerator), rawGenerator)
+ .asArray(rawGenerator);
+ }
+
+ @Override
+ public final Object[] toArray() {
+ return toArray(Object[]::new);
+ }
+
+ @Override
+ public final boolean anyMatch(Predicate<? super P_OUT> predicate) {
+ return evaluate(MatchOps.makeRef(predicate, MatchOps.MatchKind.ANY));
+ }
+
+ @Override
+ public final boolean allMatch(Predicate<? super P_OUT> predicate) {
+ return evaluate(MatchOps.makeRef(predicate, MatchOps.MatchKind.ALL));
+ }
+
+ @Override
+ public final boolean noneMatch(Predicate<? super P_OUT> predicate) {
+ return evaluate(MatchOps.makeRef(predicate, MatchOps.MatchKind.NONE));
+ }
+
+ @Override
+ public final Optional<P_OUT> findFirst() {
+ return evaluate(FindOps.makeRef(true));
+ }
+
+ @Override
+ public final Optional<P_OUT> findAny() {
+ return evaluate(FindOps.makeRef(false));
+ }
+
+ @Override
+ public final P_OUT reduce(final P_OUT identity, final BinaryOperator<P_OUT> accumulator) {
+ return evaluate(ReduceOps.makeRef(identity, accumulator, accumulator));
+ }
+
+ @Override
+ public final Optional<P_OUT> reduce(BinaryOperator<P_OUT> accumulator) {
+ return evaluate(ReduceOps.makeRef(accumulator));
+ }
+
+ @Override
+ public final <R> R reduce(R identity, BiFunction<R, ? super P_OUT, R> accumulator, BinaryOperator<R> combiner) {
+ return evaluate(ReduceOps.makeRef(identity, accumulator, combiner));
+ }
+
+ @Override
+ public final <R> R collect(Collector<? super P_OUT, R> collector) {
+ if (isParallel()
+ && (collector.characteristics().contains(Collector.Characteristics.CONCURRENT))
+ && (!isOrdered() || collector.characteristics().contains(Collector.Characteristics.UNORDERED))) {
+ R container = collector.resultSupplier().get();
+ BiFunction<R, ? super P_OUT, R> accumulator = collector.accumulator();
+ forEach(u -> accumulator.apply(container, u));
+ return container;
+ }
+ return evaluate(ReduceOps.makeRef(collector));
+ }
+
+ @Override
+ public final <R> R collect(Supplier<R> resultFactory,
+ BiConsumer<R, ? super P_OUT> accumulator,
+ BiConsumer<R, R> combiner) {
+ return evaluate(ReduceOps.makeRef(resultFactory, accumulator, combiner));
+ }
+
+ @Override
+ public final Optional<P_OUT> max(Comparator<? super P_OUT> comparator) {
+ return reduce(Comparators.greaterOf(comparator));
+ }
+
+ @Override
+ public final Optional<P_OUT> min(Comparator<? super P_OUT> comparator) {
+ return reduce(Comparators.lesserOf(comparator));
+
+ }
+
+ @Override
+ public final long count() {
+ return mapToLong(e -> 1L).sum();
+ }
+
+
+ //
+
+ /**
+ * Source stage of a ReferencePipeline.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @param <E_OUT> type of elements in produced by this stage
+ * @since 1.8
+ */
+ static class Head<E_IN, E_OUT> extends ReferencePipeline<E_IN, E_OUT> {
+ /**
+ * Constructor for the source stage of a Stream.
+ *
+ * @param source {@code Supplier<Spliterator>} describing the stream
+ * source
+ * @param sourceFlags the source flags for the stream source, described
+ * in {@link StreamOpFlag}
+ */
+ Head(Supplier<? extends Spliterator<?>> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ /**
+ * Constructor for the source stage of a Stream.
+ *
+ * @param source {@code Spliterator} describing the stream source
+ * @param sourceFlags the source flags for the stream source, described
+ * in {@link StreamOpFlag}
+ */
+ Head(Spliterator<?> source,
+ int sourceFlags, boolean parallel) {
+ super(source, sourceFlags, parallel);
+ }
+
+ @Override
+ final boolean opIsStateful() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ final Sink<E_IN> opWrapSink(int flags, Sink<E_OUT> sink) {
+ throw new UnsupportedOperationException();
+ }
+
+ // Optimized sequential terminal operations for the head of the pipeline
+
+ @Override
+ public void forEach(Consumer<? super E_OUT> action) {
+ if (!isParallel()) {
+ sourceStageSpliterator().forEachRemaining(action);
+ }
+ else {
+ super.forEach(action);
+ }
+ }
+
+ @Override
+ public void forEachOrdered(Consumer<? super E_OUT> action) {
+ if (!isParallel()) {
+ sourceStageSpliterator().forEachRemaining(action);
+ }
+ else {
+ super.forEachOrdered(action);
+ }
+ }
+ }
+
+ /**
+ * Base class for a stateless intermediate stage of a Stream.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @param <E_OUT> type of elements in produced by this stage
+ * @since 1.8
+ */
+ abstract static class StatelessOp<E_IN, E_OUT>
+ extends ReferencePipeline<E_IN, E_OUT> {
+ /**
+ * Construct a new Stream by appending a stateless intermediate
+ * operation to an existing stream.
+ *
+ * @param upstream The upstream pipeline stage
+ * @param inputShape The stream shape for the upstream pipeline stage
+ * @param opFlags Operation flags for the new stage
+ */
+ StatelessOp(AbstractPipeline<?, E_IN, ?> upstream,
+ StreamShape inputShape,
+ int opFlags) {
+ super(upstream, opFlags);
+ assert upstream.getOutputShape() == inputShape;
+ }
+
+ @Override
+ final boolean opIsStateful() {
+ return false;
+ }
+ }
+
+ /**
+ * Base class for a stateful intermediate stage of a Stream.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @param <E_OUT> type of elements in produced by this stage
+ * @since 1.8
+ */
+ abstract static class StatefulOp<E_IN, E_OUT>
+ extends ReferencePipeline<E_IN, E_OUT> {
+ /**
+ * Construct a new Stream by appending a stateful intermediate operation
+ * to an existing stream.
+ * @param upstream The upstream pipeline stage
+ * @param inputShape The stream shape for the upstream pipeline stage
+ * @param opFlags Operation flags for the new stage
+ */
+ StatefulOp(AbstractPipeline<?, E_IN, ?> upstream,
+ StreamShape inputShape,
+ int opFlags) {
+ super(upstream, opFlags);
+ assert upstream.getOutputShape() == inputShape;
+ }
+
+ @Override
+ final boolean opIsStateful() {
+ return true;
+ }
+
+ @Override
+ abstract <P_IN> Node<E_OUT> opEvaluateParallel(PipelineHelper<E_OUT> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<E_OUT[]> generator);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Sink.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,362 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Objects;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.LongConsumer;
+
+/**
+ * An extension of {@link Consumer} used to conduct values through the stages of
+ * a stream pipeline, with additional methods to manage size information,
+ * control flow, etc. Before calling the {@code accept()} method on a
+ * {@code Sink} for the first time, you must first call the {@code begin()}
+ * method to inform it that data is coming (optionally informing the sink how
+ * much data is coming), and after all data has been sent, you must call the
+ * {@code end()} method. After calling {@code end()}, you should not call
+ * {@code accept()} without again calling {@code begin()}. {@code Sink} also
+ * offers a mechanism by which the sink can cooperatively signal that it does
+ * not wish to receive any more data (the {@code cancellationRequested()}
+ * method), which a source can poll before sending more data to the
+ * {@code Sink}.
+ *
+ * <p>A sink may be in one of two states: an initial state and an active state.
+ * It starts out in the initial state; the {@code begin()} method transitions
+ * it to the active state, and the {@code end()} method transitions it back into
+ * the initial state, where it can be re-used. Data-accepting methods (such as
+ * {@code accept()} are only valid in the active state.
+ *
+ * @apiNote
+ * A stream pipeline consists of a source, zero or more intermediate stages
+ * (such as filtering or mapping), and a terminal stage, such as reduction or
+ * for-each. For concreteness, consider the pipeline:
+ *
+ * <pre>{@code
+ * int longestStringLengthStartingWithA
+ * = strings.stream()
+ * .filter(s -> s.startsWith("A"))
+ * .mapToInt(String::length)
+ * .max();
+ * }</pre>
+ *
+ * <p>Here, we have three stages, filtering, mapping, and reducing. The
+ * filtering stage consumes strings and emits a subset of those strings; the
+ * mapping stage consumes strings and emits ints; the reduction stage consumes
+ * those ints and computes the maximal value.
+ *
+ * <p>A {@code Sink} instance is used to represent each stage of this pipeline,
+ * whether the stage accepts objects, ints, longs, or doubles. Sink has entry
+ * points for {@code accept(Object)}, {@code accept(int)}, etc, so that we do
+ * not need a specialized interface for each primitive specialization. (It
+ * might be called a "kitchen sink" for this omnivorous tendency.) The entry
+ * point to the pipeline is the {@code Sink} for the filtering stage, which
+ * sends some elements "downstream" -- into the {@code Sink} for the mapping
+ * stage, which in turn sends integral values downstream into the {@code Sink}
+ * for the reduction stage. The {@code Sink} implementations associated with a
+ * given stage is expected to know the data type for the next stage, and call
+ * the correct {@code accept} method on its downstream {@code Sink}. Similarly,
+ * each stage must implement the correct {@code accept} method corresponding to
+ * the data type it accepts.
+ *
+ * <p>The specialized subtypes such as {@link Sink.OfInt} override
+ * {@code accept(Object)} to call the appropriate primitive specialization of
+ * {@code accept}, implement the appropriate primitive specialization of
+ * {@code Consumer}, and re-abstract the appropriate primitive specialization of
+ * {@code accept}.
+ *
+ * <p>The chaining subtypes such as {@link ChainedInt} not only implement
+ * {@code Sink.OfInt}, but also maintain a {@code downstream} field which
+ * represents the downstream {@code Sink}, and implement the methods
+ * {@code begin()}, {@code end()}, and {@code cancellationRequested()} to
+ * delegate to the downstream {@code Sink}. Most implementations of
+ * intermediate operations will use these chaining wrappers. For example, the
+ * mapping stage in the above example would look like:
+ *
+ * <pre>{@code
+ * IntSink is = new Sink.ChainedReference<U>(sink) {
+ * public void accept(U u) {
+ * downstream.accept(mapper.applyAsInt(u));
+ * }
+ * };
+ * }</pre>
+ *
+ * <p>Here, we implement {@code Sink.ChainedReference<U>}, meaning that we expect
+ * to receive elements of type {@code U} as input, and pass the downstream sink
+ * to the constructor. Because the next stage expects to receive integers, we
+ * must call the {@code accept(int)} method when emitting values to the downstream.
+ * The {@code accept()} method applies the mapping function from {@code U} to
+ * {@code int} and passes the resulting value to the downstream {@code Sink}.
+ *
+ * @param <T> type of elements for value streams
+ * @since 1.8
+ */
+interface Sink<T> extends Consumer<T> {
+ /**
+ * Resets the sink state to receive a fresh data set. This must be called
+ * before sending any data to the sink. After calling {@link #end()},
+ * you may call this method to reset the sink for another calculation.
+ * @param size The exact size of the data to be pushed downstream, if
+ * known or {@code -1} if unknown or infinite.
+ *
+ * <p>Prior to this call, the sink must be in the initial state, and after
+ * this call it is in the active state.
+ */
+ default void begin(long size) {}
+
+ /**
+ * Indicates that all elements have been pushed. If the {@code Sink} is
+ * stateful, it should send any stored state downstream at this time, and
+ * should clear any accumulated state (and associated resources).
+ *
+ * <p>Prior to this call, the sink must be in the active state, and after
+ * this call it is returned to the initial state.
+ */
+ default void end() {}
+
+ /**
+ * Indicates that this {@code Sink} does not wish to receive any more data.
+ *
+ * @implSpec The default implementation always returns false.
+ *
+ * @return true if cancellation is requested
+ */
+ default boolean cancellationRequested() {
+ return false;
+ }
+
+ /**
+ * Accepts an int value.
+ *
+ * @implSpec The default implementation throws IllegalStateException.
+ *
+ * @throws IllegalStateException if this sink does not accept int values
+ */
+ default void accept(int value) {
+ throw new IllegalStateException("called wrong accept method");
+ }
+
+ /**
+ * Accepts a long value.
+ *
+ * @implSpec The default implementation throws IllegalStateException.
+ *
+ * @throws IllegalStateException if this sink does not accept long values
+ */
+ default void accept(long value) {
+ throw new IllegalStateException("called wrong accept method");
+ }
+
+ /**
+ * Accepts a double value.
+ *
+ * @implSpec The default implementation throws IllegalStateException.
+ *
+ * @throws IllegalStateException if this sink does not accept double values
+ */
+ default void accept(double value) {
+ throw new IllegalStateException("called wrong accept method");
+ }
+
+ /**
+ * {@code Sink} that implements {@code Sink<Integer>}, re-abstracts
+ * {@code accept(int)}, and wires {@code accept(Integer)} to bridge to
+ * {@code accept(int)}.
+ */
+ interface OfInt extends Sink<Integer>, IntConsumer {
+ @Override
+ void accept(int value);
+
+ @Override
+ default void accept(Integer i) {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(getClass(), "{0} calling Sink.OfInt.accept(Integer)");
+ accept(i.intValue());
+ }
+ }
+
+ /**
+ * {@code Sink} that implements {@code Sink<Long>}, re-abstracts
+ * {@code accept(long)}, and wires {@code accept(Long)} to bridge to
+ * {@code accept(long)}.
+ */
+ interface OfLong extends Sink<Long>, LongConsumer {
+ @Override
+ void accept(long value);
+
+ @Override
+ default void accept(Long i) {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(getClass(), "{0} calling Sink.OfLong.accept(Long)");
+ accept(i.longValue());
+ }
+ }
+
+ /**
+ * {@code Sink} that implements {@code Sink<Double>}, re-abstracts
+ * {@code accept(double)}, and wires {@code accept(Double)} to bridge to
+ * {@code accept(double)}.
+ */
+ interface OfDouble extends Sink<Double>, DoubleConsumer {
+ @Override
+ void accept(double value);
+
+ @Override
+ default void accept(Double i) {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(getClass(), "{0} calling Sink.OfDouble.accept(Double)");
+ accept(i.doubleValue());
+ }
+ }
+
+ /**
+ * Abstract {@code Sink} implementation for creating chains of
+ * sinks. The {@code begin}, {@code end}, and
+ * {@code cancellationRequested} methods are wired to chain to the
+ * downstream {@code Sink}. This implementation takes a downstream
+ * {@code Sink} of unknown input shape and produces a {@code Sink<T>}. The
+ * implementation of the {@code accept()} method must call the correct
+ * {@code accept()} method on the downstream {@code Sink}.
+ */
+ static abstract class ChainedReference<T> implements Sink<T> {
+ protected final Sink downstream;
+
+ public ChainedReference(Sink downstream) {
+ this.downstream = Objects.requireNonNull(downstream);
+ }
+
+ @Override
+ public void begin(long size) {
+ downstream.begin(size);
+ }
+
+ @Override
+ public void end() {
+ downstream.end();
+ }
+
+ @Override
+ public boolean cancellationRequested() {
+ return downstream.cancellationRequested();
+ }
+ }
+
+ /**
+ * Abstract {@code Sink} implementation designed for creating chains of
+ * sinks. The {@code begin}, {@code end}, and
+ * {@code cancellationRequested} methods are wired to chain to the
+ * downstream {@code Sink}. This implementation takes a downstream
+ * {@code Sink} of unknown input shape and produces a {@code Sink.OfInt}.
+ * The implementation of the {@code accept()} method must call the correct
+ * {@code accept()} method on the downstream {@code Sink}.
+ */
+ static abstract class ChainedInt implements Sink.OfInt {
+ protected final Sink downstream;
+
+ public ChainedInt(Sink downstream) {
+ this.downstream = Objects.requireNonNull(downstream);
+ }
+
+ @Override
+ public void begin(long size) {
+ downstream.begin(size);
+ }
+
+ @Override
+ public void end() {
+ downstream.end();
+ }
+
+ @Override
+ public boolean cancellationRequested() {
+ return downstream.cancellationRequested();
+ }
+ }
+
+ /**
+ * Abstract {@code Sink} implementation designed for creating chains of
+ * sinks. The {@code begin}, {@code end}, and
+ * {@code cancellationRequested} methods are wired to chain to the
+ * downstream {@code Sink}. This implementation takes a downstream
+ * {@code Sink} of unknown input shape and produces a {@code Sink.OfLong}.
+ * The implementation of the {@code accept()} method must call the correct
+ * {@code accept()} method on the downstream {@code Sink}.
+ */
+ static abstract class ChainedLong implements Sink.OfLong {
+ protected final Sink downstream;
+
+ public ChainedLong(Sink downstream) {
+ this.downstream = Objects.requireNonNull(downstream);
+ }
+
+ @Override
+ public void begin(long size) {
+ downstream.begin(size);
+ }
+
+ @Override
+ public void end() {
+ downstream.end();
+ }
+
+ @Override
+ public boolean cancellationRequested() {
+ return downstream.cancellationRequested();
+ }
+ }
+
+ /**
+ * Abstract {@code Sink} implementation designed for creating chains of
+ * sinks. The {@code begin}, {@code end}, and
+ * {@code cancellationRequested} methods are wired to chain to the
+ * downstream {@code Sink}. This implementation takes a downstream
+ * {@code Sink} of unknown input shape and produces a {@code Sink.OfDouble}.
+ * The implementation of the {@code accept()} method must call the correct
+ * {@code accept()} method on the downstream {@code Sink}.
+ */
+ static abstract class ChainedDouble implements Sink.OfDouble {
+ protected final Sink downstream;
+
+ public ChainedDouble(Sink downstream) {
+ this.downstream = Objects.requireNonNull(downstream);
+ }
+
+ @Override
+ public void begin(long size) {
+ downstream.begin(size);
+ }
+
+ @Override
+ public void end() {
+ downstream.end();
+ }
+
+ @Override
+ public boolean cancellationRequested() {
+ return downstream.cancellationRequested();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/SliceOps.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,511 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Spliterator;
+import java.util.concurrent.CountedCompleter;
+import java.util.function.IntFunction;
+
+/**
+ * Factory for instances of a short-circuiting stateful intermediate operations
+ * that produce subsequences of their input stream.
+ *
+ * @since 1.8
+ */
+final class SliceOps {
+
+ // No instances
+ private SliceOps() { }
+
+ /**
+ * Appends a "slice" operation to the provided stream. The slice operation
+ * may be may be skip-only, limit-only, or skip-and-limit.
+ *
+ * @param <T> the type of both input and output elements
+ * @param upstream a reference stream with element type T
+ * @param skip the number of elements to skip. Must be >= 0.
+ * @param limit the maximum size of the resulting stream, or -1 if no limit
+ * is to be imposed
+ */
+ public static <T> Stream<T> makeRef(AbstractPipeline<?, T, ?> upstream,
+ long skip, long limit) {
+ if (skip < 0)
+ throw new IllegalArgumentException("Skip must be non-negative: " + skip);
+
+ return new ReferencePipeline.StatefulOp<T,T>(upstream, StreamShape.REFERENCE,
+ flags(limit)) {
+ @Override
+ <P_IN> Node<T> opEvaluateParallel(PipelineHelper<T> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<T[]> generator) {
+ return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke();
+ }
+
+ @Override
+ Sink<T> opWrapSink(int flags, Sink<T> sink) {
+ return new Sink.ChainedReference<T>(sink) {
+ long n = skip;
+ long m = limit >= 0 ? limit : Long.MAX_VALUE;
+
+ @Override
+ public void accept(T t) {
+ if (n == 0) {
+ if (m > 0) {
+ m--;
+ downstream.accept(t);
+ }
+ }
+ else {
+ n--;
+ }
+ }
+
+ @Override
+ public boolean cancellationRequested() {
+ return m == 0 || downstream.cancellationRequested();
+ }
+ };
+ }
+ };
+ }
+
+ /**
+ * Appends a "slice" operation to the provided IntStream. The slice
+ * operation may be may be skip-only, limit-only, or skip-and-limit.
+ *
+ * @param upstream An IntStream
+ * @param skip The number of elements to skip. Must be >= 0.
+ * @param limit The maximum size of the resulting stream, or -1 if no limit
+ * is to be imposed
+ */
+ public static IntStream makeInt(AbstractPipeline<?, Integer, ?> upstream,
+ long skip, long limit) {
+ if (skip < 0)
+ throw new IllegalArgumentException("Skip must be non-negative: " + skip);
+
+ return new IntPipeline.StatefulOp<Integer>(upstream, StreamShape.INT_VALUE,
+ flags(limit)) {
+ @Override
+ <P_IN> Node<Integer> opEvaluateParallel(PipelineHelper<Integer> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<Integer[]> generator) {
+ return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke();
+ }
+
+ @Override
+ Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+ return new Sink.ChainedInt(sink) {
+ long n = skip;
+ long m = limit >= 0 ? limit : Long.MAX_VALUE;
+
+ @Override
+ public void accept(int t) {
+ if (n == 0) {
+ if (m > 0) {
+ m--;
+ downstream.accept(t);
+ }
+ }
+ else {
+ n--;
+ }
+ }
+
+ @Override
+ public boolean cancellationRequested() {
+ return m == 0 || downstream.cancellationRequested();
+ }
+ };
+ }
+ };
+ }
+
+ /**
+ * Appends a "slice" operation to the provided LongStream. The slice
+ * operation may be may be skip-only, limit-only, or skip-and-limit.
+ *
+ * @param upstream A LongStream
+ * @param skip The number of elements to skip. Must be >= 0.
+ * @param limit The maximum size of the resulting stream, or -1 if no limit
+ * is to be imposed
+ */
+ public static LongStream makeLong(AbstractPipeline<?, Long, ?> upstream,
+ long skip, long limit) {
+ if (skip < 0)
+ throw new IllegalArgumentException("Skip must be non-negative: " + skip);
+
+ return new LongPipeline.StatefulOp<Long>(upstream, StreamShape.LONG_VALUE,
+ flags(limit)) {
+ @Override
+ <P_IN> Node<Long> opEvaluateParallel(PipelineHelper<Long> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<Long[]> generator) {
+ return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke();
+ }
+
+ @Override
+ Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+ return new Sink.ChainedLong(sink) {
+ long n = skip;
+ long m = limit >= 0 ? limit : Long.MAX_VALUE;
+
+ @Override
+ public void accept(long t) {
+ if (n == 0) {
+ if (m > 0) {
+ m--;
+ downstream.accept(t);
+ }
+ }
+ else {
+ n--;
+ }
+ }
+
+ @Override
+ public boolean cancellationRequested() {
+ return m == 0 || downstream.cancellationRequested();
+ }
+ };
+ }
+ };
+ }
+
+ /**
+ * Appends a "slice" operation to the provided DoubleStream. The slice
+ * operation may be may be skip-only, limit-only, or skip-and-limit.
+ *
+ * @param upstream A DoubleStream
+ * @param skip The number of elements to skip. Must be >= 0.
+ * @param limit The maximum size of the resulting stream, or -1 if no limit
+ * is to be imposed
+ */
+ public static DoubleStream makeDouble(AbstractPipeline<?, Double, ?> upstream,
+ long skip, long limit) {
+ if (skip < 0)
+ throw new IllegalArgumentException("Skip must be non-negative: " + skip);
+
+ return new DoublePipeline.StatefulOp<Double>(upstream, StreamShape.DOUBLE_VALUE,
+ flags(limit)) {
+ @Override
+ <P_IN> Node<Double> opEvaluateParallel(PipelineHelper<Double> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<Double[]> generator) {
+ return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke();
+ }
+
+ @Override
+ Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+ return new Sink.ChainedDouble(sink) {
+ long n = skip;
+ long m = limit >= 0 ? limit : Long.MAX_VALUE;
+
+ @Override
+ public void accept(double t) {
+ if (n == 0) {
+ if (m > 0) {
+ m--;
+ downstream.accept(t);
+ }
+ }
+ else {
+ n--;
+ }
+ }
+
+ @Override
+ public boolean cancellationRequested() {
+ return m == 0 || downstream.cancellationRequested();
+ }
+ };
+ }
+ };
+ }
+
+ private static int flags(long limit) {
+ return StreamOpFlag.NOT_SIZED | ((limit != -1) ? StreamOpFlag.IS_SHORT_CIRCUIT : 0);
+ }
+
+ // Parallel strategy -- two cases
+ // IF we have full size information
+ // - decompose, keeping track of each leaf's (offset, size)
+ // - calculate leaf only if intersection between (offset, size) and desired slice
+ // - Construct a Node containing the appropriate sections of the appropriate leaves
+ // IF we don't
+ // - decompose, and calculate size of each leaf
+ // - on complete of any node, compute completed initial size from the root, and if big enough, cancel later nodes
+ // - @@@ this can be significantly improved
+
+ // @@@ Currently we don't do the sized version at all
+
+ // @@@ Should take into account ORDERED flag; if not ORDERED, we can limit in temporal order instead
+
+ /**
+ * {@code ForkJoinTask} implementing slice computation.
+ *
+ * @param <P_IN> Input element type to the stream pipeline
+ * @param <P_OUT> Output element type from the stream pipeline
+ */
+ private static final class SliceTask<P_IN, P_OUT>
+ extends AbstractShortCircuitTask<P_IN, P_OUT, Node<P_OUT>, SliceTask<P_IN, P_OUT>> {
+ private final AbstractPipeline<P_OUT, P_OUT, ?> op;
+ private final IntFunction<P_OUT[]> generator;
+ private final long targetOffset, targetSize;
+ private long thisNodeSize;
+
+ private volatile boolean completed;
+
+ SliceTask(AbstractPipeline<?, P_OUT, ?> op,
+ PipelineHelper<P_OUT> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<P_OUT[]> generator,
+ long offset, long size) {
+ super(helper, spliterator);
+ this.op = (AbstractPipeline<P_OUT, P_OUT, ?>) op;
+ this.generator = generator;
+ this.targetOffset = offset;
+ this.targetSize = size;
+ }
+
+ SliceTask(SliceTask<P_IN, P_OUT> parent, Spliterator<P_IN> spliterator) {
+ super(parent, spliterator);
+ this.op = parent.op;
+ this.generator = parent.generator;
+ this.targetOffset = parent.targetOffset;
+ this.targetSize = parent.targetSize;
+ }
+
+ @Override
+ protected SliceTask<P_IN, P_OUT> makeChild(Spliterator<P_IN> spliterator) {
+ return new SliceTask<>(this, spliterator);
+ }
+
+ @Override
+ protected final Node<P_OUT> getEmptyResult() {
+ return Nodes.emptyNode(op.getOutputShape());
+ }
+
+ @Override
+ protected final Node<P_OUT> doLeaf() {
+ if (isRoot()) {
+ long sizeIfKnown = StreamOpFlag.SIZED.isPreserved(op.sourceOrOpFlags)
+ ? op.exactOutputSizeIfKnown(spliterator)
+ : -1;
+ final Node.Builder<P_OUT> nb = op.makeNodeBuilder(sizeIfKnown, generator);
+ Sink<P_OUT> opSink = op.opWrapSink(op.sourceOrOpFlags, nb);
+
+ if (!StreamOpFlag.SHORT_CIRCUIT.isKnown(op.sourceOrOpFlags))
+ helper.wrapAndCopyInto(opSink, spliterator);
+ else
+ helper.copyIntoWithCancel(helper.wrapSink(opSink), spliterator);
+ return nb.build();
+ }
+ else {
+ Node<P_OUT> node = helper.wrapAndCopyInto(helper.makeNodeBuilder(-1, generator),
+ spliterator).build();
+ thisNodeSize = node.count();
+ completed = true;
+ return node;
+ }
+ }
+
+ @Override
+ public final void onCompletion(CountedCompleter<?> caller) {
+ if (!isLeaf()) {
+ thisNodeSize = leftChild.thisNodeSize + rightChild.thisNodeSize;
+ completed = true;
+
+ if (isRoot()) {
+ // Only collect nodes once absolute size information is known
+
+ ArrayList<Node<P_OUT>> nodes = new ArrayList<>();
+ visit(nodes, 0);
+ Node<P_OUT> result;
+ if (nodes.size() == 0)
+ result = Nodes.emptyNode(op.getOutputShape());
+ else if (nodes.size() == 1)
+ result = nodes.get(0);
+ else
+ // This will create a tree of depth 1 and will not be a sub-tree
+ // for leaf nodes within the require range
+ result = Nodes.conc(op.getOutputShape(), nodes);
+ setLocalResult(result);
+ }
+ }
+ if (targetSize >= 0) {
+ if (((SliceTask<P_IN, P_OUT>) getRoot()).leftSize() >= targetOffset + targetSize)
+ cancelLaterNodes();
+ }
+ // Don't call super.onCompletion(), we don't look at the child nodes until farther up the tree
+ }
+
+ /** Compute the cumulative size of the longest leading prefix of completed children */
+ private long leftSize() {
+ if (completed)
+ return thisNodeSize;
+ else if (isLeaf())
+ return 0;
+ else {
+ long leftSize = 0;
+ for (SliceTask<P_IN, P_OUT> child = leftChild, p = null; child != p;
+ p = child, child = rightChild) {
+ if (child.completed)
+ leftSize += child.thisNodeSize;
+ else {
+ leftSize += child.leftSize();
+ break;
+ }
+ }
+ return leftSize;
+ }
+ }
+
+ private void visit(List<Node<P_OUT>> results, int offset) {
+ if (!isLeaf()) {
+ for (SliceTask<P_IN, P_OUT> child = leftChild, p = null; child != p;
+ p = child, child = rightChild) {
+ child.visit(results, offset);
+ offset += child.thisNodeSize;
+ }
+ }
+ else {
+ if (results.size() == 0) {
+ if (offset + thisNodeSize >= targetOffset)
+ results.add(truncateNode(getLocalResult(),
+ Math.max(0, targetOffset - offset),
+ targetSize >= 0 ? Math.max(0, offset + thisNodeSize - (targetOffset + targetSize)) : 0));
+ }
+ else {
+ if (targetSize == -1 || offset < targetOffset + targetSize) {
+ results.add(truncateNode(getLocalResult(),
+ 0,
+ targetSize >= 0 ? Math.max(0, offset + thisNodeSize - (targetOffset + targetSize)) : 0));
+ }
+ }
+ }
+ }
+
+ /**
+ * Return a new node describing the result of truncating an existing Node
+ * at the left and/or right.
+ */
+ private Node<P_OUT> truncateNode(Node<P_OUT> input,
+ long skipLeft, long skipRight) {
+ if (skipLeft == 0 && skipRight == 0)
+ return input;
+ else {
+ return Nodes.truncateNode(input, skipLeft, thisNodeSize - skipRight, generator);
+ }
+ }
+ }
+
+ // @@@ Currently unused -- optimization for when all sizes are known
+// private static class SizedSliceTask<S, T> extends AbstractShortCircuitTask<S, T, Node<T>, SizedSliceTask<S, T>> {
+// private final int targetOffset, targetSize;
+// private final int offset, size;
+//
+// private SizedSliceTask(ParallelPipelineHelper<S, T> helper, int offset, int size) {
+// super(helper);
+// targetOffset = offset;
+// targetSize = size;
+// this.offset = 0;
+// this.size = spliterator.getSizeIfKnown();
+// }
+//
+// private SizedSliceTask(SizedSliceTask<S, T> parent, Spliterator<S> spliterator) {
+// // Makes assumptions about order in which siblings are created and linked into parent!
+// super(parent, spliterator);
+// targetOffset = parent.targetOffset;
+// targetSize = parent.targetSize;
+// int siblingSizes = 0;
+// for (SizedSliceTask<S, T> sibling = parent.children; sibling != null; sibling = sibling.nextSibling)
+// siblingSizes += sibling.size;
+// size = spliterator.getSizeIfKnown();
+// offset = parent.offset + siblingSizes;
+// }
+//
+// @Override
+// protected SizedSliceTask<S, T> makeChild(Spliterator<S> spliterator) {
+// return new SizedSliceTask<>(this, spliterator);
+// }
+//
+// @Override
+// protected Node<T> getEmptyResult() {
+// return Nodes.emptyNode();
+// }
+//
+// @Override
+// public boolean taskCanceled() {
+// if (offset > targetOffset+targetSize || offset+size < targetOffset)
+// return true;
+// else
+// return super.taskCanceled();
+// }
+//
+// @Override
+// protected Node<T> doLeaf() {
+// int skipLeft = Math.max(0, targetOffset - offset);
+// int skipRight = Math.max(0, offset + size - (targetOffset + targetSize));
+// if (skipLeft == 0 && skipRight == 0)
+// return helper.into(Nodes.<T>makeBuilder(spliterator.getSizeIfKnown())).build();
+// else {
+// // If we're the first or last node that intersects the target range, peel off irrelevant elements
+// int truncatedSize = size - skipLeft - skipRight;
+// NodeBuilder<T> builder = Nodes.<T>makeBuilder(truncatedSize);
+// Sink<S> wrappedSink = helper.wrapSink(builder);
+// wrappedSink.begin(truncatedSize);
+// Iterator<S> iterator = spliterator.iterator();
+// for (int i=0; i<skipLeft; i++)
+// iterator.next();
+// for (int i=0; i<truncatedSize; i++)
+// wrappedSink.apply(iterator.next());
+// wrappedSink.end();
+// return builder.build();
+// }
+// }
+//
+// @Override
+// public void onCompletion(CountedCompleter<?> caller) {
+// if (!isLeaf()) {
+// Node<T> result = null;
+// for (SizedSliceTask<S, T> child = children.nextSibling; child != null; child = child.nextSibling) {
+// Node<T> childResult = child.getRawResult();
+// if (childResult == null)
+// continue;
+// else if (result == null)
+// result = childResult;
+// else
+// result = Nodes.node(result, childResult);
+// }
+// setRawResult(result);
+// if (offset <= targetOffset && offset+size >= targetOffset+targetSize)
+// shortCircuit(result);
+// }
+// }
+// }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/SortedOps.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,547 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Comparators;
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.concurrent.ForkJoinTask;
+import java.util.function.IntFunction;
+
+
+/**
+ * Factory methods for transforming streams into sorted streams.
+ *
+ * @since 1.8
+ */
+final class SortedOps {
+
+ private SortedOps() { }
+
+ /**
+ * Appends a "sorted" operation to the provided stream.
+ *
+ * @param <T> the type of both input and output elements
+ * @param upstream a reference stream with element type T
+ */
+ static <T> Stream<T> makeRef(AbstractPipeline<?, T, ?> upstream) {
+ return new OfRef<>(upstream);
+ }
+
+ /**
+ * Appends a "sorted" operation to the provided stream.
+ *
+ * @param <T> the type of both input and output elements
+ * @param upstream a reference stream with element type T
+ * @param comparator the comparator to order elements by
+ */
+ static <T> Stream<T> makeRef(AbstractPipeline<?, T, ?> upstream,
+ Comparator<? super T> comparator) {
+ return new OfRef<>(upstream, comparator);
+ }
+
+ /**
+ * Appends a "sorted" operation to the provided stream.
+ *
+ * @param <T> the type of both input and output elements
+ * @param upstream a reference stream with element type T
+ */
+ static <T> IntStream makeInt(AbstractPipeline<?, Integer, ?> upstream) {
+ return new OfInt(upstream);
+ }
+
+ /**
+ * Appends a "sorted" operation to the provided stream.
+ *
+ * @param <T> the type of both input and output elements
+ * @param upstream a reference stream with element type T
+ */
+ static <T> LongStream makeLong(AbstractPipeline<?, Long, ?> upstream) {
+ return new OfLong(upstream);
+ }
+
+ /**
+ * Appends a "sorted" operation to the provided stream.
+ *
+ * @param <T> the type of both input and output elements
+ * @param upstream a reference stream with element type T
+ */
+ static <T> DoubleStream makeDouble(AbstractPipeline<?, Double, ?> upstream) {
+ return new OfDouble(upstream);
+ }
+
+ /**
+ * Specialized subtype for sorting reference streams
+ */
+ private static final class OfRef<T> extends ReferencePipeline.StatefulOp<T, T> {
+ /**
+ * Comparator used for sorting
+ */
+ private final boolean isNaturalSort;
+ private final Comparator<? super T> comparator;
+
+ /**
+ * Sort using natural order of {@literal <T>} which must be
+ * {@code Comparable}.
+ */
+ OfRef(AbstractPipeline<?, T, ?> upstream) {
+ super(upstream, StreamShape.REFERENCE,
+ StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SORTED);
+ this.isNaturalSort = true;
+ // Will throw CCE when we try to sort if T is not Comparable
+ this.comparator = (Comparator<? super T>) Comparators.naturalOrder();
+ }
+
+ /**
+ * Sort using the provided comparator.
+ *
+ * @param comparator The comparator to be used to evaluate ordering.
+ */
+ OfRef(AbstractPipeline<?, T, ?> upstream, Comparator<? super T> comparator) {
+ super(upstream, StreamShape.REFERENCE,
+ StreamOpFlag.IS_ORDERED | StreamOpFlag.NOT_SORTED);
+ this.isNaturalSort = false;
+ this.comparator = Objects.requireNonNull(comparator);
+ }
+
+ @Override
+ public Sink<T> opWrapSink(int flags, Sink sink) {
+ Objects.requireNonNull(sink);
+
+ // If the input is already naturally sorted and this operation
+ // also naturally sorted then this is a no-op
+ if (StreamOpFlag.SORTED.isKnown(flags) && isNaturalSort)
+ return sink;
+ else if (StreamOpFlag.SIZED.isKnown(flags))
+ return new SizedRefSortingSink<>(sink, comparator);
+ else
+ return new RefSortingSink<>(sink, comparator);
+ }
+
+ @Override
+ public <P_IN> Node<T> opEvaluateParallel(PipelineHelper<T> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<T[]> generator) {
+ // If the input is already naturally sorted and this operation
+ // naturally sorts then collect the output
+ if (StreamOpFlag.SORTED.isKnown(helper.getStreamAndOpFlags()) && isNaturalSort) {
+ return helper.evaluate(spliterator, false, generator);
+ }
+ else {
+ // @@@ Weak two-pass parallel implementation; parallel collect, parallel sort
+ T[] flattenedData = helper.evaluate(spliterator, true, generator).asArray(generator);
+ Arrays.parallelSort(flattenedData, comparator);
+ return Nodes.node(flattenedData);
+ }
+ }
+ }
+
+ /**
+ * Specialized subtype for sorting int streams.
+ */
+ private static final class OfInt extends IntPipeline.StatefulOp<Integer> {
+ OfInt(AbstractPipeline<?, Integer, ?> upstream) {
+ super(upstream, StreamShape.INT_VALUE,
+ StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SORTED);
+ }
+
+ @Override
+ public Sink<Integer> opWrapSink(int flags, Sink sink) {
+ Objects.requireNonNull(sink);
+
+ if (StreamOpFlag.SORTED.isKnown(flags))
+ return sink;
+ else if (StreamOpFlag.SIZED.isKnown(flags))
+ return new SizedIntSortingSink(sink);
+ else
+ return new IntSortingSink(sink);
+ }
+
+ @Override
+ public <P_IN> Node<Integer> opEvaluateParallel(PipelineHelper<Integer> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<Integer[]> generator) {
+ if (StreamOpFlag.SORTED.isKnown(helper.getStreamAndOpFlags())) {
+ return helper.evaluate(spliterator, false, generator);
+ }
+ else {
+ Node.OfInt n = (Node.OfInt) helper.evaluate(spliterator, true, generator);
+
+ int[] content = n.asIntArray();
+ Arrays.parallelSort(content);
+
+ return Nodes.node(content);
+ }
+ }
+ }
+
+ /**
+ * Specialized subtype for sorting long streams.
+ */
+ private static final class OfLong extends LongPipeline.StatefulOp<Long> {
+ OfLong(AbstractPipeline<?, Long, ?> upstream) {
+ super(upstream, StreamShape.LONG_VALUE,
+ StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SORTED);
+ }
+
+ @Override
+ public Sink<Long> opWrapSink(int flags, Sink sink) {
+ Objects.requireNonNull(sink);
+
+ if (StreamOpFlag.SORTED.isKnown(flags))
+ return sink;
+ else if (StreamOpFlag.SIZED.isKnown(flags))
+ return new SizedLongSortingSink(sink);
+ else
+ return new LongSortingSink(sink);
+ }
+
+ @Override
+ public <P_IN> Node<Long> opEvaluateParallel(PipelineHelper<Long> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<Long[]> generator) {
+ if (StreamOpFlag.SORTED.isKnown(helper.getStreamAndOpFlags())) {
+ return helper.evaluate(spliterator, false, generator);
+ }
+ else {
+ Node.OfLong n = (Node.OfLong) helper.evaluate(spliterator, true, generator);
+
+ long[] content = n.asLongArray();
+ Arrays.parallelSort(content);
+
+ return Nodes.node(content);
+ }
+ }
+ }
+
+ /**
+ * Specialized subtype for sorting double streams.
+ */
+ private static final class OfDouble extends DoublePipeline.StatefulOp<Double> {
+ OfDouble(AbstractPipeline<?, Double, ?> upstream) {
+ super(upstream, StreamShape.DOUBLE_VALUE,
+ StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SORTED);
+ }
+
+ @Override
+ public Sink<Double> opWrapSink(int flags, Sink sink) {
+ Objects.requireNonNull(sink);
+
+ if (StreamOpFlag.SORTED.isKnown(flags))
+ return sink;
+ else if (StreamOpFlag.SIZED.isKnown(flags))
+ return new SizedDoubleSortingSink(sink);
+ else
+ return new DoubleSortingSink(sink);
+ }
+
+ @Override
+ public <P_IN> Node<Double> opEvaluateParallel(PipelineHelper<Double> helper,
+ Spliterator<P_IN> spliterator,
+ IntFunction<Double[]> generator) {
+ if (StreamOpFlag.SORTED.isKnown(helper.getStreamAndOpFlags())) {
+ return helper.evaluate(spliterator, false, generator);
+ }
+ else {
+ Node.OfDouble n = (Node.OfDouble) helper.evaluate(spliterator, true, generator);
+
+ double[] content = n.asDoubleArray();
+ Arrays.parallelSort(content);
+
+ return Nodes.node(content);
+ }
+ }
+ }
+
+ /**
+ * {@link ForkJoinTask} for implementing sort on SIZED reference streams.
+ */
+ private static final class SizedRefSortingSink<T> extends Sink.ChainedReference<T> {
+ private final Comparator<? super T> comparator;
+ private T[] array;
+ private int offset;
+
+ SizedRefSortingSink(Sink sink, Comparator<? super T> comparator) {
+ super(sink);
+ this.comparator = comparator;
+ }
+
+ @Override
+ public void begin(long size) {
+ if (size >= Nodes.MAX_ARRAY_SIZE)
+ throw new IllegalArgumentException("Stream size exceeds max array size");
+ array = (T[]) new Object[(int) size];
+ }
+
+ @Override
+ public void end() {
+ // Need to use offset rather than array.length since the downstream
+ // many be short-circuiting
+ // @@@ A better approach is to know if the downstream short-circuits
+ // and check sink.cancellationRequested
+ Arrays.sort(array, 0, offset, comparator);
+ downstream.begin(offset);
+ for (int i = 0; i < offset; i++)
+ downstream.accept(array[i]);
+ downstream.end();
+ array = null;
+ }
+
+ @Override
+ public void accept(T t) {
+ array[offset++] = t;
+ }
+ }
+
+ /**
+ * {@link Sink} for implementing sort on reference streams.
+ */
+ private static final class RefSortingSink<T> extends Sink.ChainedReference<T> {
+ private final Comparator<? super T> comparator;
+ private ArrayList<T> list;
+
+ RefSortingSink(Sink sink, Comparator<? super T> comparator) {
+ super(sink);
+ this.comparator = comparator;
+ }
+
+ @Override
+ public void begin(long size) {
+ list = (size >= 0) ? new ArrayList<T>((int) size) : new ArrayList<T>();
+ }
+
+ @Override
+ public void end() {
+ list.sort(comparator);
+ downstream.begin(list.size());
+ list.forEach(downstream::accept);
+ downstream.end();
+ list = null;
+ }
+
+ @Override
+ public void accept(T t) {
+ list.add(t);
+ }
+ }
+
+ /**
+ * {@link Sink} for implementing sort on SIZED int streams.
+ */
+ private static final class SizedIntSortingSink extends Sink.ChainedInt {
+ private int[] array;
+ private int offset;
+
+ SizedIntSortingSink(Sink downstream) {
+ super(downstream);
+ }
+
+ @Override
+ public void begin(long size) {
+ if (size >= Nodes.MAX_ARRAY_SIZE)
+ throw new IllegalArgumentException("Stream size exceeds max array size");
+ array = new int[(int) size];
+ }
+
+ @Override
+ public void end() {
+ Arrays.sort(array, 0, offset);
+ downstream.begin(offset);
+ for (int i = 0; i < offset; i++)
+ downstream.accept(array[i]);
+ downstream.end();
+ array = null;
+ }
+
+ @Override
+ public void accept(int t) {
+ array[offset++] = t;
+ }
+ }
+
+ /**
+ * {@link Sink} for implementing sort on int streams.
+ */
+ private static final class IntSortingSink extends Sink.ChainedInt {
+ private SpinedBuffer.OfInt b;
+
+ IntSortingSink(Sink sink) {
+ super(sink);
+ }
+
+ @Override
+ public void begin(long size) {
+ b = (size > 0) ? new SpinedBuffer.OfInt((int) size) : new SpinedBuffer.OfInt();
+ }
+
+ @Override
+ public void end() {
+ int[] ints = b.asIntArray();
+ Arrays.sort(ints);
+ downstream.begin(ints.length);
+ for (int anInt : ints)
+ downstream.accept(anInt);
+ downstream.end();
+ }
+
+ @Override
+ public void accept(int t) {
+ b.accept(t);
+ }
+ }
+
+ /**
+ * {@link Sink} for implementing sort on SIZED long streams.
+ */
+ private static final class SizedLongSortingSink extends Sink.ChainedLong {
+ private long[] array;
+ private int offset;
+
+ SizedLongSortingSink(Sink downstream) {
+ super(downstream);
+ }
+
+ @Override
+ public void begin(long size) {
+ if (size >= Nodes.MAX_ARRAY_SIZE)
+ throw new IllegalArgumentException("Stream size exceeds max array size");
+ array = new long[(int) size];
+ }
+
+ @Override
+ public void end() {
+ Arrays.sort(array, 0, offset);
+ downstream.begin(offset);
+ for (int i = 0; i < offset; i++)
+ downstream.accept(array[i]);
+ downstream.end();
+ array = null;
+ }
+
+ @Override
+ public void accept(long t) {
+ array[offset++] = t;
+ }
+ }
+
+ /**
+ * {@link Sink} for implementing sort on long streams.
+ */
+ private static final class LongSortingSink extends Sink.ChainedLong {
+ private SpinedBuffer.OfLong b;
+
+ LongSortingSink(Sink sink) {
+ super(sink);
+ }
+
+ @Override
+ public void begin(long size) {
+ b = (size > 0) ? new SpinedBuffer.OfLong((int) size) : new SpinedBuffer.OfLong();
+ }
+
+ @Override
+ public void end() {
+ long[] longs = b.asLongArray();
+ Arrays.sort(longs);
+ downstream.begin(longs.length);
+ for (long aLong : longs)
+ downstream.accept(aLong);
+ downstream.end();
+ }
+
+ @Override
+ public void accept(long t) {
+ b.accept(t);
+ }
+ }
+
+ /**
+ * {@link Sink} for implementing sort on SIZED double streams.
+ */
+ private static final class SizedDoubleSortingSink extends Sink.ChainedDouble {
+ private double[] array;
+ private int offset;
+
+ SizedDoubleSortingSink(Sink downstream) {
+ super(downstream);
+ }
+
+ @Override
+ public void begin(long size) {
+ if (size >= Nodes.MAX_ARRAY_SIZE)
+ throw new IllegalArgumentException("Stream size exceeds max array size");
+ array = new double[(int) size];
+ }
+
+ @Override
+ public void end() {
+ Arrays.sort(array, 0, offset);
+ downstream.begin(offset);
+ for (int i = 0; i < offset; i++)
+ downstream.accept(array[i]);
+ downstream.end();
+ array = null;
+ }
+
+ @Override
+ public void accept(double t) {
+ array[offset++] = t;
+ }
+ }
+
+ /**
+ * {@link Sink} for implementing sort on double streams.
+ */
+ private static final class DoubleSortingSink extends Sink.ChainedDouble {
+ private SpinedBuffer.OfDouble b;
+
+ DoubleSortingSink(Sink sink) {
+ super(sink);
+ }
+
+ @Override
+ public void begin(long size) {
+ b = (size > 0) ? new SpinedBuffer.OfDouble((int) size) : new SpinedBuffer.OfDouble();
+ }
+
+ @Override
+ public void end() {
+ double[] doubles = b.asDoubleArray();
+ Arrays.sort(doubles);
+ downstream.begin(doubles.length);
+ for (double aDouble : doubles)
+ downstream.accept(aDouble);
+ downstream.end();
+ }
+
+ @Override
+ public void accept(double t) {
+ b.accept(t);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/SpinedBuffer.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,958 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.LongConsumer;
+
+/**
+ * An ordered collection of elements. Elements can be added, but not removed.
+ * Goes through a building phase, during which elements can be added, and a
+ * traversal phase, during which elements can be traversed in order but no
+ * further modifications are possible.
+ *
+ * <p> One or more arrays are used to store elements. The use of a multiple
+ * arrays has better performance characteristics than a single array used by
+ * {@link ArrayList}, as when the capacity of the list needs to be increased
+ * no copying of elements is required. This is usually beneficial in the case
+ * where the results will be traversed a small number of times.
+ *
+ * @param <E> the type of elements in this list
+ * @since 1.8
+ */
+class SpinedBuffer<E>
+ extends AbstractSpinedBuffer
+ implements Consumer<E>, Iterable<E> {
+
+ /*
+ * We optimistically hope that all the data will fit into the first chunk,
+ * so we try to avoid inflating the spine[] and priorElementCount[] arrays
+ * prematurely. So methods must be prepared to deal with these arrays being
+ * null. If spine is non-null, then spineIndex points to the current chunk
+ * within the spine, otherwise it is zero. The spine and priorElementCount
+ * arrays are always the same size, and for any i <= spineIndex,
+ * priorElementCount[i] is the sum of the sizes of all the prior chunks.
+ *
+ * The curChunk pointer is always valid. The elementIndex is the index of
+ * the next element to be written in curChunk; this may be past the end of
+ * curChunk so we have to check before writing. When we inflate the spine
+ * array, curChunk becomes the first element in it. When we clear the
+ * buffer, we discard all chunks except the first one, which we clear,
+ * restoring it to the initial single-chunk state.
+ */
+
+ /**
+ * Chunk that we're currently writing into; may or may not be aliased with
+ * the first element of the spine.
+ */
+ protected E[] curChunk;
+
+ /**
+ * All chunks, or null if there is only one chunk.
+ */
+ protected E[][] spine;
+
+ /**
+ * Constructs an empty list with the specified initial capacity.
+ *
+ * @param initialCapacity the initial capacity of the list
+ * @throws IllegalArgumentException if the specified initial capacity
+ * is negative
+ */
+ SpinedBuffer(int initialCapacity) {
+ super(initialCapacity);
+ curChunk = (E[]) new Object[1 << initialChunkPower];
+ }
+
+ /**
+ * Constructs an empty list with an initial capacity of sixteen.
+ */
+ SpinedBuffer() {
+ super();
+ curChunk = (E[]) new Object[1 << initialChunkPower];
+ }
+
+ /**
+ * Returns the current capacity of the buffer
+ */
+ protected long capacity() {
+ return (spineIndex == 0)
+ ? curChunk.length
+ : priorElementCount[spineIndex] + spine[spineIndex].length;
+ }
+
+ private void inflateSpine() {
+ if (spine == null) {
+ spine = (E[][]) new Object[MIN_SPINE_SIZE][];
+ priorElementCount = new long[MIN_SPINE_SIZE];
+ spine[0] = curChunk;
+ }
+ }
+
+ /**
+ * Ensure that the buffer has at least capacity to hold the target size
+ */
+ protected final void ensureCapacity(long targetSize) {
+ long capacity = capacity();
+ if (targetSize > capacity) {
+ inflateSpine();
+ for (int i=spineIndex+1; targetSize > capacity; i++) {
+ if (i >= spine.length) {
+ int newSpineSize = spine.length * 2;
+ spine = Arrays.copyOf(spine, newSpineSize);
+ priorElementCount = Arrays.copyOf(priorElementCount, newSpineSize);
+ }
+ int nextChunkSize = chunkSize(i);
+ spine[i] = (E[]) new Object[nextChunkSize];
+ priorElementCount[i] = priorElementCount[i-1] + spine[i-1].length;
+ capacity += nextChunkSize;
+ }
+ }
+ }
+
+ /**
+ * Force the buffer to increase its capacity.
+ */
+ protected void increaseCapacity() {
+ ensureCapacity(capacity() + 1);
+ }
+
+ /**
+ * Retrieve the element at the specified index.
+ */
+ public E get(long index) {
+ // @@@ can further optimize by caching last seen spineIndex,
+ // which is going to be right most of the time
+ if (spineIndex == 0) {
+ if (index < elementIndex)
+ return curChunk[((int) index)];
+ else
+ throw new IndexOutOfBoundsException(Long.toString(index));
+ }
+
+ if (index >= count())
+ throw new IndexOutOfBoundsException(Long.toString(index));
+
+ for (int j=0; j <= spineIndex; j++)
+ if (index < priorElementCount[j] + spine[j].length)
+ return spine[j][((int) (index - priorElementCount[j]))];
+
+ throw new IndexOutOfBoundsException(Long.toString(index));
+ }
+
+ /**
+ * Copy the elements, starting at the specified offset, into the specified
+ * array.
+ */
+ public void copyInto(E[] array, int offset) {
+ long finalOffset = offset + count();
+ if (finalOffset > array.length || finalOffset < offset) {
+ throw new IndexOutOfBoundsException("does not fit");
+ }
+
+ if (spineIndex == 0)
+ System.arraycopy(curChunk, 0, array, offset, elementIndex);
+ else {
+ // full chunks
+ for (int i=0; i < spineIndex; i++) {
+ System.arraycopy(spine[i], 0, array, offset, spine[i].length);
+ offset += spine[i].length;
+ }
+ if (elementIndex > 0)
+ System.arraycopy(curChunk, 0, array, offset, elementIndex);
+ }
+ }
+
+ /**
+ * Create a new array using the specified array factory, and copy the
+ * elements into it.
+ */
+ public E[] asArray(IntFunction<E[]> arrayFactory) {
+ // @@@ will fail for size == MAX_VALUE
+ E[] result = arrayFactory.apply((int) count());
+
+ copyInto(result, 0);
+
+ return result;
+ }
+
+ @Override
+ public void clear() {
+ if (spine != null) {
+ curChunk = spine[0];
+ for (int i=0; i<curChunk.length; i++)
+ curChunk[i] = null;
+ spine = null;
+ priorElementCount = null;
+ }
+ else {
+ for (int i=0; i<elementIndex; i++)
+ curChunk[i] = null;
+ }
+ elementIndex = 0;
+ spineIndex = 0;
+ }
+
+ @Override
+ public Iterator<E> iterator() {
+ return Spliterators.iteratorFromSpliterator(spliterator());
+ }
+
+ @Override
+ public void forEach(Consumer<? super E> consumer) {
+ // completed chunks, if any
+ for (int j = 0; j < spineIndex; j++)
+ for (E t : spine[j])
+ consumer.accept(t);
+
+ // current chunk
+ for (int i=0; i<elementIndex; i++)
+ consumer.accept(curChunk[i]);
+ }
+
+ @Override
+ public void accept(E e) {
+ if (elementIndex == curChunk.length) {
+ inflateSpine();
+ if (spineIndex+1 >= spine.length || spine[spineIndex+1] == null)
+ increaseCapacity();
+ elementIndex = 0;
+ ++spineIndex;
+ curChunk = spine[spineIndex];
+ }
+ curChunk[elementIndex++] = e;
+ }
+
+ @Override
+ public String toString() {
+ List<E> list = new ArrayList<>();
+ forEach(list::add);
+ return "SpinedBuffer:" + list.toString();
+ }
+
+ private static final int SPLITERATOR_CHARACTERISTICS
+ = Spliterator.SIZED | Spliterator.ORDERED | Spliterator.SUBSIZED;
+
+ /**
+ * Return a {@link Spliterator} describing the contents of the buffer.
+ */
+ public Spliterator<E> spliterator() {
+ return new Spliterator<E>() {
+ // The current spine index
+ int splSpineIndex;
+
+ // The current element index into the current spine
+ int splElementIndex;
+
+ // When splSpineIndex >= spineIndex and splElementIndex >= elementIndex then
+ // this spliterator is fully traversed
+ // tryAdvance can set splSpineIndex > spineIndex if the last spine is full
+
+ // The current spine array
+ E[] splChunk = (spine == null) ? curChunk : spine[0];
+
+ @Override
+ public long estimateSize() {
+ return (spine == null)
+ ? (elementIndex - splElementIndex)
+ : count() - (priorElementCount[splSpineIndex] + splElementIndex);
+ }
+
+ @Override
+ public int characteristics() {
+ return SPLITERATOR_CHARACTERISTICS;
+ }
+
+ @Override
+ public boolean tryAdvance(Consumer<? super E> consumer) {
+ if (splSpineIndex < spineIndex
+ || (splSpineIndex == spineIndex && splElementIndex < elementIndex)) {
+ consumer.accept(splChunk[splElementIndex++]);
+
+ if (splElementIndex == splChunk.length) {
+ splElementIndex = 0;
+ ++splSpineIndex;
+ if (spine != null && splSpineIndex < spine.length)
+ splChunk = spine[splSpineIndex];
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void forEachRemaining(Consumer<? super E> consumer) {
+ if (splSpineIndex < spineIndex
+ || (splSpineIndex == spineIndex && splElementIndex < elementIndex)) {
+ int i = splElementIndex;
+ // completed chunks, if any
+ for (int sp = splSpineIndex; sp < spineIndex; sp++) {
+ E[] chunk = spine[sp];
+ for (; i < chunk.length; i++) {
+ consumer.accept(chunk[i]);
+ }
+ i = 0;
+ }
+
+ // current chunk
+ E[] chunk = curChunk;
+ int hElementIndex = elementIndex;
+ for (; i < hElementIndex; i++) {
+ consumer.accept(chunk[i]);
+ }
+
+ splSpineIndex = spineIndex;
+ splElementIndex = elementIndex;
+ }
+ }
+
+ @Override
+ public Spliterator<E> trySplit() {
+ if (splSpineIndex < spineIndex) {
+ Spliterator<E> ret = Arrays.spliterator(spine[splSpineIndex],
+ splElementIndex, spine[splSpineIndex].length);
+ splChunk = spine[++splSpineIndex];
+ splElementIndex = 0;
+ return ret;
+ }
+ else if (splSpineIndex == spineIndex) {
+ int t = (elementIndex - splElementIndex) / 2;
+ if (t == 0)
+ return null;
+ else {
+ Spliterator<E> ret = Arrays.spliterator(curChunk, splElementIndex, splElementIndex + t);
+ splElementIndex += t;
+ return ret;
+ }
+ }
+ else {
+ return null;
+ }
+ }
+ };
+ }
+
+ /**
+ * An ordered collection of primitive values. Elements can be added, but
+ * not removed. Goes through a building phase, during which elements can be
+ * added, and a traversal phase, during which elements can be traversed in
+ * order but no further modifications are possible.
+ *
+ * <p> One or more arrays are used to store elements. The use of a multiple
+ * arrays has better performance characteristics than a single array used by
+ * {@link ArrayList}, as when the capacity of the list needs to be increased
+ * no copying of elements is required. This is usually beneficial in the case
+ * where the results will be traversed a small number of times.
+ *
+ * @param <E> the wrapper type for this primitive type
+ * @param <T_ARR> the array type for this primitive type
+ * @param <T_CONS> the Consumer type for this primitive type
+ */
+ abstract static class OfPrimitive<E, T_ARR, T_CONS>
+ extends AbstractSpinedBuffer implements Iterable<E> {
+
+ /*
+ * We optimistically hope that all the data will fit into the first chunk,
+ * so we try to avoid inflating the spine[] and priorElementCount[] arrays
+ * prematurely. So methods must be prepared to deal with these arrays being
+ * null. If spine is non-null, then spineIndex points to the current chunk
+ * within the spine, otherwise it is zero. The spine and priorElementCount
+ * arrays are always the same size, and for any i <= spineIndex,
+ * priorElementCount[i] is the sum of the sizes of all the prior chunks.
+ *
+ * The curChunk pointer is always valid. The elementIndex is the index of
+ * the next element to be written in curChunk; this may be past the end of
+ * curChunk so we have to check before writing. When we inflate the spine
+ * array, curChunk becomes the first element in it. When we clear the
+ * buffer, we discard all chunks except the first one, which we clear,
+ * restoring it to the initial single-chunk state.
+ */
+
+ // The chunk we're currently writing into
+ T_ARR curChunk;
+
+ // All chunks, or null if there is only one chunk
+ T_ARR[] spine;
+
+ /**
+ * Constructs an empty list with the specified initial capacity.
+ *
+ * @param initialCapacity the initial capacity of the list
+ * @throws IllegalArgumentException if the specified initial capacity
+ * is negative
+ */
+ OfPrimitive(int initialCapacity) {
+ super(initialCapacity);
+ curChunk = newArray(1 << initialChunkPower);
+ }
+
+ /**
+ * Constructs an empty list with an initial capacity of sixteen.
+ */
+ OfPrimitive() {
+ super();
+ curChunk = newArray(1 << initialChunkPower);
+ }
+
+ @Override
+ public abstract Iterator<E> iterator();
+
+ @Override
+ public abstract void forEach(Consumer<? super E> consumer);
+
+ /** Create a new array-of-array of the proper type and size */
+ protected abstract T_ARR[] newArrayArray(int size);
+
+ /** Create a new array of the proper type and size */
+ protected abstract T_ARR newArray(int size);
+
+ /** Get the length of an array */
+ protected abstract int arrayLength(T_ARR array);
+
+ /** Iterate an array with the provided consumer */
+ protected abstract void arrayForEach(T_ARR array, int from, int to,
+ T_CONS consumer);
+
+ protected long capacity() {
+ return (spineIndex == 0)
+ ? arrayLength(curChunk)
+ : priorElementCount[spineIndex] + arrayLength(spine[spineIndex]);
+ }
+
+ private void inflateSpine() {
+ if (spine == null) {
+ spine = newArrayArray(MIN_SPINE_SIZE);
+ priorElementCount = new long[MIN_SPINE_SIZE];
+ spine[0] = curChunk;
+ }
+ }
+
+ protected final void ensureCapacity(long targetSize) {
+ long capacity = capacity();
+ if (targetSize > capacity) {
+ inflateSpine();
+ for (int i=spineIndex+1; targetSize > capacity; i++) {
+ if (i >= spine.length) {
+ int newSpineSize = spine.length * 2;
+ spine = Arrays.copyOf(spine, newSpineSize);
+ priorElementCount = Arrays.copyOf(priorElementCount, newSpineSize);
+ }
+ int nextChunkSize = chunkSize(i);
+ spine[i] = newArray(nextChunkSize);
+ priorElementCount[i] = priorElementCount[i-1] + arrayLength(spine[i - 1]);
+ capacity += nextChunkSize;
+ }
+ }
+ }
+
+ protected void increaseCapacity() {
+ ensureCapacity(capacity() + 1);
+ }
+
+ protected int chunkFor(long index) {
+ if (spineIndex == 0) {
+ if (index < elementIndex)
+ return 0;
+ else
+ throw new IndexOutOfBoundsException(Long.toString(index));
+ }
+
+ if (index >= count())
+ throw new IndexOutOfBoundsException(Long.toString(index));
+
+ for (int j=0; j <= spineIndex; j++)
+ if (index < priorElementCount[j] + arrayLength(spine[j]))
+ return j;
+
+ throw new IndexOutOfBoundsException(Long.toString(index));
+ }
+
+ public void copyInto(T_ARR array, int offset) {
+ long finalOffset = offset + count();
+ if (finalOffset > arrayLength(array) || finalOffset < offset) {
+ throw new IndexOutOfBoundsException("does not fit");
+ }
+
+ if (spineIndex == 0)
+ System.arraycopy(curChunk, 0, array, offset, elementIndex);
+ else {
+ // full chunks
+ for (int i=0; i < spineIndex; i++) {
+ System.arraycopy(spine[i], 0, array, offset, arrayLength(spine[i]));
+ offset += arrayLength(spine[i]);
+ }
+ if (elementIndex > 0)
+ System.arraycopy(curChunk, 0, array, offset, elementIndex);
+ }
+ }
+
+ public T_ARR asPrimitiveArray() {
+ // @@@ will fail for size == MAX_VALUE
+ T_ARR result = newArray((int) count());
+ copyInto(result, 0);
+ return result;
+ }
+
+ protected void preAccept() {
+ if (elementIndex == arrayLength(curChunk)) {
+ inflateSpine();
+ if (spineIndex+1 >= spine.length || spine[spineIndex+1] == null)
+ increaseCapacity();
+ elementIndex = 0;
+ ++spineIndex;
+ curChunk = spine[spineIndex];
+ }
+ }
+
+ public void clear() {
+ if (spine != null) {
+ curChunk = spine[0];
+ spine = null;
+ priorElementCount = null;
+ }
+ elementIndex = 0;
+ spineIndex = 0;
+ }
+
+ public void forEach(T_CONS consumer) {
+ // completed chunks, if any
+ for (int j = 0; j < spineIndex; j++)
+ arrayForEach(spine[j], 0, arrayLength(spine[j]), consumer);
+
+ // current chunk
+ arrayForEach(curChunk, 0, elementIndex, consumer);
+ }
+
+ abstract class BaseSpliterator<T_SPLITER extends Spliterator<E>>
+ implements Spliterator<E> {
+ // The current spine index
+ int splSpineIndex;
+
+ // The current element index into the current spine
+ int splElementIndex;
+
+ // When splSpineIndex >= spineIndex and splElementIndex >= elementIndex then
+ // this spliterator is fully traversed
+ // tryAdvance can set splSpineIndex > spineIndex if the last spine is full
+
+ // The current spine array
+ T_ARR splChunk = (spine == null) ? curChunk : spine[0];
+
+ abstract void arrayForOne(T_ARR array, int index, T_CONS consumer);
+
+ abstract T_SPLITER arraySpliterator(T_ARR array, int offset, int len);
+
+ @Override
+ public long estimateSize() {
+ return (spine == null)
+ ? (elementIndex - splElementIndex)
+ : count() - (priorElementCount[splSpineIndex] + splElementIndex);
+ }
+
+ @Override
+ public int characteristics() {
+ return SPLITERATOR_CHARACTERISTICS;
+ }
+
+ public boolean tryAdvance(T_CONS consumer) {
+ if (splSpineIndex < spineIndex
+ || (splSpineIndex == spineIndex && splElementIndex < elementIndex)) {
+ arrayForOne(splChunk, splElementIndex++, consumer);
+
+ if (splElementIndex == arrayLength(splChunk)) {
+ splElementIndex = 0;
+ ++splSpineIndex;
+ if (spine != null && splSpineIndex < spine.length)
+ splChunk = spine[splSpineIndex];
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public void forEachRemaining(T_CONS consumer) {
+ if (splSpineIndex < spineIndex
+ || (splSpineIndex == spineIndex && splElementIndex < elementIndex)) {
+ int i = splElementIndex;
+ // completed chunks, if any
+ for (int sp = splSpineIndex; sp < spineIndex; sp++) {
+ T_ARR chunk = spine[sp];
+ arrayForEach(chunk, i, arrayLength(chunk), consumer);
+ i = 0;
+ }
+
+ arrayForEach(curChunk, i, elementIndex, consumer);
+
+ splSpineIndex = spineIndex;
+ splElementIndex = elementIndex;
+ }
+ }
+
+ @Override
+ public T_SPLITER trySplit() {
+ if (splSpineIndex < spineIndex) {
+ T_SPLITER ret = arraySpliterator(spine[splSpineIndex], splElementIndex,
+ arrayLength(spine[splSpineIndex]) - splElementIndex);
+ splChunk = spine[++splSpineIndex];
+ splElementIndex = 0;
+ return ret;
+ }
+ else if (splSpineIndex == spineIndex) {
+ int t = (elementIndex - splElementIndex) / 2;
+ if (t == 0)
+ return null;
+ else {
+ T_SPLITER ret = arraySpliterator(curChunk, splElementIndex, t);
+ splElementIndex += t;
+ return ret;
+ }
+ }
+ else {
+ return null;
+ }
+ }
+ }
+ }
+
+ /**
+ * An ordered collection of {@code int} values.
+ */
+ static class OfInt extends SpinedBuffer.OfPrimitive<Integer, int[], IntConsumer>
+ implements IntConsumer {
+ OfInt() { }
+
+ OfInt(int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ @Override
+ public void forEach(Consumer<? super Integer> consumer) {
+ if (consumer instanceof IntConsumer) {
+ forEach((IntConsumer) consumer);
+ }
+ else {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(getClass(), "{0} calling SpinedBuffer.OfInt.forEach(Consumer)");
+ spliterator().forEachRemaining(consumer);
+ }
+ }
+
+ @Override
+ protected int[][] newArrayArray(int size) {
+ return new int[size][];
+ }
+
+ @Override
+ protected int[] newArray(int size) {
+ return new int[size];
+ }
+
+ @Override
+ protected int arrayLength(int[] array) {
+ return array.length;
+ }
+
+ @Override
+ protected void arrayForEach(int[] array,
+ int from, int to,
+ IntConsumer consumer) {
+ for (int i = from; i < to; i++)
+ consumer.accept(array[i]);
+ }
+
+ @Override
+ public void accept(int i) {
+ preAccept();
+ curChunk[elementIndex++] = i;
+ }
+
+ public int get(long index) {
+ int ch = chunkFor(index);
+ if (spineIndex == 0 && ch == 0)
+ return curChunk[(int) index];
+ else
+ return spine[ch][(int) (index-priorElementCount[ch])];
+ }
+
+ public int[] asIntArray() {
+ return asPrimitiveArray();
+ }
+
+ @Override
+ public PrimitiveIterator.OfInt iterator() {
+ return Spliterators.iteratorFromSpliterator(spliterator());
+ }
+
+ public Spliterator.OfInt spliterator() {
+ class Splitr extends BaseSpliterator<Spliterator.OfInt>
+ implements Spliterator.OfInt {
+
+ @Override
+ void arrayForOne(int[] array, int index, IntConsumer consumer) {
+ consumer.accept(array[index]);
+ }
+
+ @Override
+ Spliterator.OfInt arraySpliterator(int[] array, int offset, int len) {
+ return Arrays.spliterator(array, offset, offset+len);
+ }
+ };
+ return new Splitr();
+ }
+
+ @Override
+ public String toString() {
+ int[] array = asIntArray();
+ if (array.length < 200) {
+ return String.format("%s[length=%d, chunks=%d]%s",
+ getClass().getSimpleName(), array.length,
+ spineIndex, Arrays.toString(array));
+ }
+ else {
+ int[] array2 = Arrays.copyOf(array, 200);
+ return String.format("%s[length=%d, chunks=%d]%s...",
+ getClass().getSimpleName(), array.length,
+ spineIndex, Arrays.toString(array2));
+ }
+ }
+ }
+
+ /**
+ * An ordered collection of {@code long} values.
+ */
+ static class OfLong extends SpinedBuffer.OfPrimitive<Long, long[], LongConsumer>
+ implements LongConsumer {
+ OfLong() { }
+
+ OfLong(int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ @Override
+ public void forEach(Consumer<? super Long> consumer) {
+ if (consumer instanceof LongConsumer) {
+ forEach((LongConsumer) consumer);
+ }
+ else {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(getClass(), "{0} calling SpinedBuffer.OfLong.forEach(Consumer)");
+ spliterator().forEachRemaining(consumer);
+ }
+ }
+
+ @Override
+ protected long[][] newArrayArray(int size) {
+ return new long[size][];
+ }
+
+ @Override
+ protected long[] newArray(int size) {
+ return new long[size];
+ }
+
+ @Override
+ protected int arrayLength(long[] array) {
+ return array.length;
+ }
+
+ @Override
+ protected void arrayForEach(long[] array,
+ int from, int to,
+ LongConsumer consumer) {
+ for (int i = from; i < to; i++)
+ consumer.accept(array[i]);
+ }
+
+ @Override
+ public void accept(long i) {
+ preAccept();
+ curChunk[elementIndex++] = i;
+ }
+
+ public long get(long index) {
+ int ch = chunkFor(index);
+ if (spineIndex == 0 && ch == 0)
+ return curChunk[(int) index];
+ else
+ return spine[ch][(int) (index-priorElementCount[ch])];
+ }
+
+ public long[] asLongArray() {
+ return asPrimitiveArray();
+ }
+
+ @Override
+ public PrimitiveIterator.OfLong iterator() {
+ return Spliterators.iteratorFromSpliterator(spliterator());
+ }
+
+
+ public Spliterator.OfLong spliterator() {
+ class Splitr extends BaseSpliterator<Spliterator.OfLong>
+ implements Spliterator.OfLong {
+ @Override
+ void arrayForOne(long[] array, int index, LongConsumer consumer) {
+ consumer.accept(array[index]);
+ }
+
+ @Override
+ Spliterator.OfLong arraySpliterator(long[] array, int offset, int len) {
+ return Arrays.spliterator(array, offset, offset+len);
+ }
+ };
+ return new Splitr();
+ }
+
+ @Override
+ public String toString() {
+ long[] array = asLongArray();
+ if (array.length < 200) {
+ return String.format("%s[length=%d, chunks=%d]%s",
+ getClass().getSimpleName(), array.length,
+ spineIndex, Arrays.toString(array));
+ }
+ else {
+ long[] array2 = Arrays.copyOf(array, 200);
+ return String.format("%s[length=%d, chunks=%d]%s...",
+ getClass().getSimpleName(), array.length,
+ spineIndex, Arrays.toString(array2));
+ }
+ }
+ }
+
+ /**
+ * An ordered collection of {@code double} values.
+ */
+ static class OfDouble
+ extends SpinedBuffer.OfPrimitive<Double, double[], DoubleConsumer>
+ implements DoubleConsumer {
+ OfDouble() { }
+
+ OfDouble(int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ @Override
+ public void forEach(Consumer<? super Double> consumer) {
+ if (consumer instanceof DoubleConsumer) {
+ forEach((DoubleConsumer) consumer);
+ }
+ else {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(getClass(), "{0} calling SpinedBuffer.OfDouble.forEach(Consumer)");
+ spliterator().forEachRemaining(consumer);
+ }
+ }
+
+ @Override
+ protected double[][] newArrayArray(int size) {
+ return new double[size][];
+ }
+
+ @Override
+ protected double[] newArray(int size) {
+ return new double[size];
+ }
+
+ @Override
+ protected int arrayLength(double[] array) {
+ return array.length;
+ }
+
+ @Override
+ protected void arrayForEach(double[] array,
+ int from, int to,
+ DoubleConsumer consumer) {
+ for (int i = from; i < to; i++)
+ consumer.accept(array[i]);
+ }
+
+ @Override
+ public void accept(double i) {
+ preAccept();
+ curChunk[elementIndex++] = i;
+ }
+
+ public double get(long index) {
+ int ch = chunkFor(index);
+ if (spineIndex == 0 && ch == 0)
+ return curChunk[(int) index];
+ else
+ return spine[ch][(int) (index-priorElementCount[ch])];
+ }
+
+ public double[] asDoubleArray() {
+ return asPrimitiveArray();
+ }
+
+ @Override
+ public PrimitiveIterator.OfDouble iterator() {
+ return Spliterators.iteratorFromSpliterator(spliterator());
+ }
+
+ public Spliterator.OfDouble spliterator() {
+ class Splitr extends BaseSpliterator<Spliterator.OfDouble>
+ implements Spliterator.OfDouble {
+ @Override
+ void arrayForOne(double[] array, int index, DoubleConsumer consumer) {
+ consumer.accept(array[index]);
+ }
+
+ @Override
+ Spliterator.OfDouble arraySpliterator(double[] array, int offset, int len) {
+ return Arrays.spliterator(array, offset, offset+len);
+ }
+ }
+ return new Splitr();
+ }
+
+ @Override
+ public String toString() {
+ double[] array = asDoubleArray();
+ if (array.length < 200) {
+ return String.format("%s[length=%d, chunks=%d]%s",
+ getClass().getSimpleName(), array.length,
+ spineIndex, Arrays.toString(array));
+ }
+ else {
+ double[] array2 = Arrays.copyOf(array, 200);
+ return String.format("%s[length=%d, chunks=%d]%s...",
+ getClass().getSimpleName(), array.length,
+ spineIndex, Arrays.toString(array2));
+ }
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Stream.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,893 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.BinaryOperator;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.IntFunction;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+import java.util.function.ToDoubleFunction;
+import java.util.function.ToIntFunction;
+import java.util.function.ToLongFunction;
+import java.util.function.UnaryOperator;
+
+// @@@ Specification to-do list @@@
+// - Describe the difference between sequential and parallel streams
+// - More general information about reduce, better definitions for associativity, more description of
+// how reduce employs parallelism, more examples
+// - Role of stream flags in various operations, specifically ordering
+// - Whether each op preserves encounter order
+// @@@ Specification to-do list @@@
+
+/**
+ * A sequence of elements supporting sequential and parallel bulk operations.
+ * Streams support lazy intermediate operations (transforming a stream to
+ * another stream) such as {@code filter} and {@code map}, and terminal
+ * operations (consuming the contents of a stream to produce a result or
+ * side-effect), such as {@code forEach}, {@code findFirst}, and {@code
+ * iterator}. Once an operation has been performed on a stream, it
+ * is considered <em>consumed</em> and no longer usable for other operations.
+ *
+ * <p>For sequential stream pipelines, all operations are performed in the
+ * <a href="package-summary.html#Ordering">encounter order</a> of the pipeline
+ * source, if the pipeline source has a defined encounter order.
+ *
+ * <p>For parallel stream pipelines, unless otherwise specified, intermediate
+ * stream operations preserve the <a href="package-summary.html#Ordering">
+ * encounter order</a> of their source, and terminal operations
+ * respect the encounter order of their source, if the source
+ * has an encounter order. Provided that and parameters to stream operations
+ * satisfy the <a href="package-summary.html#NonInterference">non-interference
+ * requirements</a>, and excepting differences arising from the absence of
+ * a defined encounter order, the result of a stream pipeline should be the
+ * stable across multiple executions of the same operations on the same source.
+ * However, the timing and thread in which side-effects occur (for those
+ * operations which are allowed to produce side-effects, such as
+ * {@link #forEach(Consumer)}), are explicitly nondeterministic for parallel
+ * execution of stream pipelines.
+ *
+ * <p>Unless otherwise noted, passing a {@code null} argument to any stream
+ * method may result in a {@link NullPointerException}.
+ *
+ * @apiNote
+ * Streams are not data structures; they do not manage the storage for their
+ * elements, nor do they support access to individual elements. However,
+ * you can use the {@link #iterator()} or {@link #spliterator()} operations to
+ * perform a controlled traversal.
+ *
+ * @param <T> type of elements
+ * @since 1.8
+ * @see <a href="package-summary.html">java.util.stream</a>
+ */
+public interface Stream<T> extends BaseStream<T, Stream<T>> {
+
+ /**
+ * Returns a stream consisting of the elements of this stream that match
+ * the given predicate.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> predicate to apply to
+ * each element to determine if it should be included
+ * @return the new stream
+ */
+ Stream<T> filter(Predicate<? super T> predicate);
+
+ /**
+ * Returns a stream consisting of the results of applying the given
+ * function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param <R> The element type of the new stream
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ <R> Stream<R> map(Function<? super T, ? extends R> mapper);
+
+ /**
+ * Returns an {@code IntStream} consisting of the results of applying the
+ * given function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">
+ * intermediate operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ IntStream mapToInt(ToIntFunction<? super T> mapper);
+
+ /**
+ * Returns a {@code LongStream} consisting of the results of applying the
+ * given function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ LongStream mapToLong(ToLongFunction<? super T> mapper);
+
+ /**
+ * Returns a {@code DoubleStream} consisting of the results of applying the
+ * given function to the elements of this stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element
+ * @return the new stream
+ */
+ DoubleStream mapToDouble(ToDoubleFunction<? super T> mapper);
+
+ /**
+ * Returns a stream consisting of the results of replacing each element of
+ * this stream with the contents of the stream produced by applying the
+ * provided mapping function to each element. If the result of the mapping
+ * function is {@code null}, this is treated as if the result is an empty
+ * stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @apiNote
+ * The {@code flatMap()} operation has the effect of applying a one-to-many
+ * tranformation to the elements of the stream, and then flattening the
+ * resulting elements into a new stream. For example, if {@code orders}
+ * is a stream of purchase orders, and each purchase order contains a
+ * collection of line items, then the following produces a stream of line
+ * items:
+ * <pre>{@code
+ * orderStream.flatMap(order -> order.getLineItems().stream())...
+ * }</pre>
+ *
+ * @param <R> The element type of the new stream
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element which produces a stream of new values
+ * @return the new stream
+ */
+ <R> Stream<R> flatMap(Function<? super T, ? extends Stream<? extends R>> mapper);
+
+ /**
+ * Returns an {@code IntStream} consisting of the results of replacing each
+ * element of this stream with the contents of the stream produced by
+ * applying the provided mapping function to each element. If the result of
+ * the mapping function is {@code null}, this is treated as if the result is
+ * an empty stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element which produces a stream of new values
+ * @return the new stream
+ */
+ IntStream flatMapToInt(Function<? super T, ? extends IntStream> mapper);
+
+ /**
+ * Returns a {@code LongStream} consisting of the results of replacing each
+ * element of this stream with the contents of the stream produced
+ * by applying the provided mapping function to each element. If the result
+ * of the mapping function is {@code null}, this is treated as if the
+ * result is an empty stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to
+ * each element which produces a stream of new values
+ * @return the new stream
+ */
+ LongStream flatMapToLong(Function<? super T, ? extends LongStream> mapper);
+
+ /**
+ * Returns a {@code DoubleStream} consisting of the results of replacing each
+ * element of this stream with the contents of the stream produced
+ * by applying the provided mapping function to each element. If the result
+ * of the mapping function is {@code null}, this is treated as if the result
+ * is an empty stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * @param mapper a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> function to apply to each
+ * element which produces a stream of new values
+ * @return the new stream
+ */
+ DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper);
+
+ /**
+ * Returns a stream consisting of the distinct elements (according to
+ * {@link Object#equals(Object)}) of this stream.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">stateful
+ * intermediate operation</a>.
+ *
+ * @return the new stream
+ */
+ Stream<T> distinct();
+
+ /**
+ * Returns a stream consisting of the elements of this stream, sorted
+ * according to natural order. If the elements of this stream are not
+ * {@code Comparable}, a {@code java.lang.ClassCastException} may be thrown
+ * when the stream pipeline is executed.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">stateful
+ * intermediate operation</a>.
+ *
+ * @return the new stream
+ */
+ Stream<T> sorted();
+
+ /**
+ * Returns a stream consisting of the elements of this stream, sorted
+ * according to the provided {@code Comparator}.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">stateful
+ * intermediate operation</a>.
+ *
+ * @param comparator a <a href="package-summary.html#NonInterference">
+ * non-interfering, stateless</a> {@code Comparator} to
+ * be used to compare stream elements
+ * @return the new stream
+ */
+ Stream<T> sorted(Comparator<? super T> comparator);
+
+ /**
+ * Returns a stream consisting of the elements of this stream, additionally
+ * performing the provided action on each element as elements are consumed
+ * from the resulting stream.
+ *
+ * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+ * operation</a>.
+ *
+ * <p>For parallel stream pipelines, the action may be called at
+ * whatever time and in whatever thread the element is made available by the
+ * upstream operation. If the action modifies shared state,
+ * it is responsible for providing the required synchronization.
+ *
+ * @apiNote This method exists mainly to support debugging, where you want
+ * to see the elements as they flow past a certain point in a pipeline:
+ * <pre>{@code
+ * list.stream()
+ * .filter(filteringFunction)
+ * .peek(e -> {System.out.println("Filtered value: " + e); });
+ * .map(mappingFunction)
+ * .peek(e -> {System.out.println("Mapped value: " + e); });
+ * .collect(Collectors.intoList());
+ * }</pre>
+ *
+ * @param consumer a <a href="package-summary.html#NonInterference">
+ * non-interfering</a> action to perform on the elements as
+ * they are consumed from the stream
+ * @return the new stream
+ */
+ Stream<T> peek(Consumer<? super T> consumer);
+
+ /**
+ * Returns a stream consisting of the elements of this stream, truncated
+ * to be no longer than {@code maxSize} in length.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * stateful intermediate operation</a>.
+ *
+ * @param maxSize the number of elements the stream should be limited to
+ * @return the new stream
+ * @throws IllegalArgumentException if {@code maxSize} is negative
+ */
+ Stream<T> limit(long maxSize);
+
+ /**
+ * Returns a stream consisting of the remaining elements of this stream
+ * after indexing {@code startInclusive} elements into the stream. If the
+ * {@code startInclusive} index lies past the end of this stream then an
+ * empty stream will be returned.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">stateful
+ * intermediate operation</a>.
+ *
+ * @param startInclusive the number of leading elements to skip
+ * @return the new stream
+ * @throws IllegalArgumentException if {@code startInclusive} is negative
+ */
+ Stream<T> substream(long startInclusive);
+
+ /**
+ * Returns a stream consisting of the remaining elements of this stream
+ * after indexing {@code startInclusive} elements into the stream and
+ * truncated to contain no more than {@code endExclusive - startInclusive}
+ * elements. If the {@code startInclusive} index lies past the end
+ * of this stream then an empty stream will be returned.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * stateful intermediate operation</a>.
+ *
+ * @param startInclusive the starting position of the substream, inclusive
+ * @param endExclusive the ending position of the substream, exclusive
+ * @return the new stream
+ * @throws IllegalArgumentException if {@code startInclusive} or
+ * {@code endExclusive} is negative or {@code startInclusive} is greater
+ * than {@code endExclusive}
+ */
+ Stream<T> substream(long startInclusive, long endExclusive);
+
+ /**
+ * Performs an action for each element of this stream.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * <p>For parallel stream pipelines, this operation does <em>not</em>
+ * guarantee to respect the encounter order of the stream, as doing so
+ * would sacrifice the benefit of parallelism. For any given element, the
+ * action may be performed at whatever time and in whatever thread the
+ * library chooses. If the action accesses shared state, it is
+ * responsible for providing the required synchronization.
+ *
+ * @param action a <a href="package-summary.html#NonInterference">
+ * non-interfering</a> action to perform on the elements
+ */
+ void forEach(Consumer<? super T> action);
+
+ /**
+ * Performs an action for each element of this stream, guaranteeing that
+ * each element is processed in encounter order for streams that have a
+ * defined encounter order.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @param action a <a href="package-summary.html#NonInterference">
+ * non-interfering</a> action to perform on the elements
+ * @see #forEach(Consumer)
+ */
+ void forEachOrdered(Consumer<? super T> action);
+
+ /**
+ * Returns an array containing the elements of this stream.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @return an array containing the elements of this stream
+ */
+ Object[] toArray();
+
+ /**
+ * Returns an array containing the elements of this stream, using the
+ * provided {@code generator} function to allocate the returned array.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @param <A> the element type of the resulting array
+ * @param generator a function which produces a new array of the desired
+ * type and the provided length
+ * @return an array containing the elements in this stream
+ * @throws ArrayStoreException if the runtime type of the array returned
+ * from the array generator is not a supertype of the runtime type of every
+ * element in this stream
+ */
+ <A> A[] toArray(IntFunction<A[]> generator);
+
+ /**
+ * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+ * elements of this stream, using the provided identity value and an
+ * <a href="package-summary.html#Associativity">associative</a>
+ * accumulation function, and returns the reduced value. This is equivalent
+ * to:
+ * <pre>{@code
+ * T result = identity;
+ * for (T element : this stream)
+ * result = accumulator.apply(result, element)
+ * return result;
+ * }</pre>
+ *
+ * but is not constrained to execute sequentially.
+ *
+ * <p>The {@code identity} value must be an identity for the accumulator
+ * function. This means that for all {@code t},
+ * {@code accumulator.apply(identity, t)} is equal to {@code t}.
+ * The {@code accumulator} function must be an
+ * <a href="package-summary.html#Associativity">associative</a> function.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @apiNote Sum, min, max, average, and string concatenation are all special
+ * cases of reduction. Summing a stream of numbers can be expressed as:
+ *
+ * <pre>{@code
+ * Integer sum = integers.reduce(0, (a, b) -> a+b);
+ * }</pre>
+ *
+ * or more compactly:
+ *
+ * <pre>{@code
+ * Integer sum = integers.reduce(0, Integer::sum);
+ * }</pre>
+ *
+ * <p>While this may seem a more roundabout way to perform an aggregation
+ * compared to simply mutating a running total in a loop, reduction
+ * operations parallelize more gracefully, without needing additional
+ * synchronization and with greatly reduced risk of data races.
+ *
+ * @param identity the identity value for the accumulating function
+ * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for combining two values
+ * @return the result of the reduction
+ */
+ T reduce(T identity, BinaryOperator<T> accumulator);
+
+ /**
+ * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+ * elements of this stream, using an
+ * <a href="package-summary.html#Associativity">associative</a> accumulation
+ * function, and returns an {@code Optional} describing the reduced value,
+ * if any. This is equivalent to:
+ * <pre>{@code
+ * boolean foundAny = false;
+ * T result = null;
+ * for (T element : this stream) {
+ * if (!foundAny) {
+ * foundAny = true;
+ * result = element;
+ * }
+ * else
+ * result = accumulator.apply(result, element);
+ * }
+ * return foundAny ? Optional.of(result) : Optional.empty();
+ * }</pre>
+ *
+ * but is not constrained to execute sequentially.
+ *
+ * <p>The {@code accumulator} function must be an
+ * <a href="package-summary.html#Associativity">associative</a> function.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for combining two values
+ * @return the result of the reduction
+ * @see #reduce(Object, BinaryOperator)
+ * @see #min(java.util.Comparator)
+ * @see #max(java.util.Comparator)
+ */
+ Optional<T> reduce(BinaryOperator<T> accumulator);
+
+ /**
+ * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+ * elements of this stream, using the provided identity, accumulation
+ * function, and a combining functions. This is equivalent to:
+ * <pre>{@code
+ * U result = identity;
+ * for (T element : this stream)
+ * result = accumulator.apply(result, element)
+ * return result;
+ * }</pre>
+ *
+ * but is not constrained to execute sequentially.
+ *
+ * <p>The {@code identity} value must be an identity for the combiner
+ * function. This means that for all {@code u}, {@code combiner(identity, u)}
+ * is equal to {@code u}. Additionally, the {@code combiner} function
+ * must be compatible with the {@code accumulator} function; for all
+ * {@code u} and {@code t}, the following must hold:
+ * <pre>{@code
+ * combiner.apply(u, accumulator.apply(identity, t)) == accumulator.apply(u, t)
+ * }</pre>
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @apiNote Many reductions using this form can be represented more simply
+ * by an explicit combination of {@code map} and {@code reduce} operations.
+ * The {@code accumulator} function acts as a fused mapper and accumulator,
+ * which can sometimes be more efficient than separate mapping and reduction,
+ * such as in the case where knowing the previously reduced value allows you
+ * to avoid some computation.
+ *
+ * @param <U> The type of the result
+ * @param identity the identity value for the combiner function
+ * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for incorporating an additional
+ * element into a result
+ * @param combiner an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for combining two values, which
+ * must be compatible with the accumulator function
+ * @return the result of the reduction
+ * @see #reduce(BinaryOperator)
+ * @see #reduce(Object, BinaryOperator)
+ */
+ <U> U reduce(U identity,
+ BiFunction<U, ? super T, U> accumulator,
+ BinaryOperator<U> combiner);
+
+ /**
+ * Performs a <a href="package-summary.html#MutableReduction">mutable
+ * reduction</a> operation on the elements of this stream. A mutable
+ * reduction is one in which the reduced value is a mutable value holder,
+ * such as an {@code ArrayList}, and elements are incorporated by updating
+ * the state of the result, rather than by replacing the result. This
+ * produces a result equivalent to:
+ * <pre>{@code
+ * R result = resultFactory.get();
+ * for (T element : this stream)
+ * accumulator.accept(result, element);
+ * return result;
+ * }</pre>
+ *
+ * <p>Like {@link #reduce(Object, BinaryOperator)}, {@code collect} operations
+ * can be parallelized without requiring additional synchronization.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @apiNote There are many existing classes in the JDK whose signatures are
+ * a good match for use as arguments to {@code collect()}. For example,
+ * the following will accumulate strings into an ArrayList:
+ * <pre>{@code
+ * List<String> asList = stringStream.collect(ArrayList::new, ArrayList::add, ArrayList::addAll);
+ * }</pre>
+ *
+ * <p>The following will take a stream of strings and concatenates them into a
+ * single string:
+ * <pre>{@code
+ * String concat = stringStream.collect(StringBuilder::new, StringBuilder::append,
+ * StringBuilder::append)
+ * .toString();
+ * }</pre>
+ *
+ * @param <R> type of the result
+ * @param resultFactory a function that creates a new result container.
+ * For a parallel execution, this function may be
+ * called multiple times and must return a fresh value
+ * each time.
+ * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for incorporating an additional
+ * element into a result
+ * @param combiner an <a href="package-summary.html#Associativity">associative</a>
+ * <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> function for combining two values, which
+ * must be compatible with the accumulator function
+ * @return the result of the reduction
+ */
+ <R> R collect(Supplier<R> resultFactory,
+ BiConsumer<R, ? super T> accumulator,
+ BiConsumer<R, R> combiner);
+
+ /**
+ * Performs a <a href="package-summary.html#MutableReduction">mutable
+ * reduction</a> operation on the elements of this stream using a
+ * {@code Collector} object to describe the reduction. A {@code Collector}
+ * encapsulates the functions used as arguments to
+ * {@link #collect(Supplier, BiConsumer, BiConsumer)}, allowing for reuse of
+ * collection strategies, and composition of collect operations such as
+ * multiple-level grouping or partitioning.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * <p>When executed in parallel, multiple intermediate results may be
+ * instantiated, populated, and merged, so as to maintain isolation of
+ * mutable data structures. Therefore, even when executed in parallel
+ * with non-thread-safe data structures (such as {@code ArrayList}), no
+ * additional synchronization is needed for a parallel reduction.
+ *
+ * @apiNote
+ * The following will accumulate strings into an ArrayList:
+ * <pre>{@code
+ * List<String> asList = stringStream.collect(Collectors.toList());
+ * }</pre>
+ *
+ * <p>The following will classify {@code Person} objects by city:
+ * <pre>{@code
+ * Map<String, Collection<Person>> peopleByCity
+ * = personStream.collect(Collectors.groupBy(Person::getCity));
+ * }</pre>
+ *
+ * <p>The following will classify {@code Person} objects by state and city,
+ * cascading two {@code Collector}s together:
+ * <pre>{@code
+ * Map<String, Map<String, Collection<Person>>> peopleByStateAndCity
+ * = personStream.collect(Collectors.groupBy(Person::getState,
+ * Collectors.groupBy(Person::getCity)));
+ * }</pre>
+ *
+ * @param <R> the type of the result
+ * @param collector the {@code Collector} describing the reduction
+ * @return the result of the reduction
+ * @see #collect(Supplier, BiConsumer, BiConsumer)
+ * @see Collectors
+ */
+ <R> R collect(Collector<? super T, R> collector);
+
+ /**
+ * Returns the minimum element of this stream according to the provided
+ * {@code Comparator}. This is a special case of a
+ * <a href="package-summary.html#MutableReduction">reduction</a>.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+ *
+ * @param comparator a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> {@code Comparator} to use to compare
+ * elements of this stream
+ * @return an {@code Optional} describing the minimum element of this stream,
+ * or an empty {@code Optional} if the stream is empty
+ */
+ Optional<T> min(Comparator<? super T> comparator);
+
+ /**
+ * Returns the maximum element of this stream according to the provided
+ * {@code Comparator}. This is a special case of a
+ * <a href="package-summary.html#MutableReduction">reduction</a>.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal
+ * operation</a>.
+ *
+ * @param comparator a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> {@code Comparator} to use to compare
+ * elements of this stream
+ * @return an {@code Optional} describing the maximum element of this stream,
+ * or an empty {@code Optional} if the stream is empty
+ */
+ Optional<T> max(Comparator<? super T> comparator);
+
+ /**
+ * Returns the count of elements in this stream. This is a special case of
+ * a <a href="package-summary.html#MutableReduction">reduction</a> and is
+ * equivalent to:
+ * <pre>{@code
+ * return mapToLong(e -> 1L).sum();
+ * }</pre>
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+ *
+ * @return the count of elements in this stream
+ */
+ long count();
+
+ /**
+ * Returns whether any elements of this stream match the provided
+ * predicate. May not evaluate the predicate on all elements if not
+ * necessary for determining the result.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> predicate to apply to elements of this
+ * stream
+ * @return {@code true} if any elements of the stream match the provided
+ * predicate otherwise {@code false}
+ */
+ boolean anyMatch(Predicate<? super T> predicate);
+
+ /**
+ * Returns whether all elements of this stream match the provided predicate.
+ * May not evaluate the predicate on all elements if not necessary for
+ * determining the result.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> predicate to apply to elements of this
+ * stream
+ * @return {@code true} if all elements of the stream match the provided
+ * predicate otherwise {@code false}
+ */
+ boolean allMatch(Predicate<? super T> predicate);
+
+ /**
+ * Returns whether no elements of this stream match the provided predicate.
+ * May not evaluate the predicate on all elements if not necessary for
+ * determining the result.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+ * stateless</a> predicate to apply to elements of this
+ * stream
+ * @return {@code true} if no elements of the stream match the provided
+ * predicate otherwise {@code false}
+ */
+ boolean noneMatch(Predicate<? super T> predicate);
+
+ /**
+ * Returns an {@link Optional} describing the first element of this stream
+ * (in the encounter order), or an empty {@code Optional} if the stream is
+ * empty. If the stream has no encounter order, than any element may be
+ * returned.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * @return an {@code Optional} describing the first element of this stream,
+ * or an empty {@code Optional} if the stream is empty
+ * @throws NullPointerException if the element selected is null
+ */
+ Optional<T> findFirst();
+
+ /**
+ * Returns an {@link Optional} describing some element of the stream, or an
+ * empty {@code Optional} if the stream is empty.
+ *
+ * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+ * terminal operation</a>.
+ *
+ * <p>The behavior of this operation is explicitly nondeterministic; it is
+ * free to select any element in the stream. This is to allow for maximal
+ * performance in parallel operations; the cost is that multiple invocations
+ * on the same source may not return the same result. (If the first element
+ * in the encounter order is desired, use {@link #findFirst()} instead.)
+ *
+ * @return an {@code Optional} describing some element of this stream, or an
+ * empty {@code Optional} if the stream is empty
+ * @throws NullPointerException if the element selected is null
+ * @see #findFirst()
+ */
+ Optional<T> findAny();
+
+ // Static factories
+
+ /**
+ * Returns a builder for a {@code Stream}.
+ *
+ * @param <T> type of elements
+ * @return a stream builder
+ */
+ public static<T> StreamBuilder<T> builder() {
+ return new Streams.StreamBuilderImpl<>();
+ }
+
+ /**
+ * Returns an empty sequential {@code Stream}.
+ *
+ * @param <T> the type of stream elements
+ * @return an empty sequential stream
+ */
+ public static<T> Stream<T> empty() {
+ return StreamSupport.stream(Spliterators.<T>emptySpliterator());
+ }
+
+ /**
+ * Returns a sequential {@code Stream} containing a single element.
+ *
+ * @param t the single element
+ * @param <T> the type of stream elements
+ * @return a singleton sequential stream
+ */
+ public static<T> Stream<T> of(T t) {
+ return StreamSupport.stream(new Streams.StreamBuilderImpl<>(t));
+ }
+
+ /**
+ * Returns a sequential stream whose elements are the specified values.
+ *
+ * @param <T> the type of stream elements
+ * @param values the elements of the new stream
+ * @return the new stream
+ */
+ @SafeVarargs
+ public static<T> Stream<T> of(T... values) {
+ return Arrays.stream(values);
+ }
+
+ /**
+ * Returns an infinite sequential {@code Stream} produced by iterative
+ * application of a function {@code f} to an initial element {@code seed},
+ * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)},
+ * {@code f(f(seed))}, etc.
+ *
+ * <p>The first element (position {@code 0}) in the {@code Stream} will be
+ * the provided {@code seed}. For {@code n > 0}, the element at position
+ * {@code n}, will be the result of applying the function {@code f} to the
+ * element at position {@code n - 1}.
+ *
+ * @param <T> the type of stream elements
+ * @param seed the initial element
+ * @param f a function to be applied to to the previous element to produce
+ * a new element
+ * @return a new sequential {@code Stream}
+ */
+ public static<T> Stream<T> iterate(final T seed, final UnaryOperator<T> f) {
+ Objects.requireNonNull(f);
+ final Iterator<T> iterator = new Iterator<T>() {
+ @SuppressWarnings("unchecked")
+ T t = (T) Streams.NONE;
+
+ @Override
+ public boolean hasNext() {
+ return true;
+ }
+
+ @Override
+ public T next() {
+ return t = (t == Streams.NONE) ? seed : f.apply(t);
+ }
+ };
+ return StreamSupport.stream(Spliterators.spliteratorUnknownSize(
+ iterator,
+ Spliterator.ORDERED | Spliterator.IMMUTABLE));
+ }
+
+ /**
+ * Returns a sequential {@code Stream} where each element is
+ * generated by a {@code Supplier}. This is suitable for generating
+ * constant streams, streams of random elements, etc.
+ *
+ * @param <T> the type of stream elements
+ * @param s the {@code Supplier} of generated elements
+ * @return a new sequential {@code Stream}
+ */
+ public static<T> Stream<T> generate(Supplier<T> s) {
+ Objects.requireNonNull(s);
+ return StreamSupport.stream(Spliterators.spliteratorUnknownSize(
+ new Iterator<T>() {
+ @Override
+ public boolean hasNext() { return true; }
+
+ @Override
+ public T next() { return s.get(); }
+ },
+ Spliterator.ORDERED | Spliterator.IMMUTABLE));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/StreamBuilder.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.LongConsumer;
+
+/**
+ * A mutable builder for a {@code Stream}. This allows the creation of a
+ * {@code Stream} by generating elements individually and adding them to the
+ * {@code StreamBuilder} (without the copying overhead that comes from using
+ * an {@code ArrayList} as a temporary buffer.)
+ *
+ * <p>A {@code StreamBuilder} has a lifecycle, where it starts in a building
+ * phase, during which elements can be added, and then transitions to a built
+ * phase, after which elements may not be added. The built phase begins
+ * when the {@link #build()}} method is called, which creates an ordered
+ * {@code Stream} whose elements are the elements that were added to the stream
+ * builder, in the order they were added.
+ *
+ * <p>Primitive specializations of {@code StreamBuilder} are provided
+ * for {@link OfInt int}, {@link OfLong long}, and {@link OfDouble double}
+ * values.
+ *
+ * @param <T> the type of stream elements
+ * @see Stream#builder()
+ * @since 1.8
+ */
+public interface StreamBuilder<T> extends Consumer<T> {
+
+ /**
+ * Adds an element to the stream being built.
+ *
+ * @throws IllegalStateException if the builder has already transitioned to
+ * the built state
+ */
+ @Override
+ void accept(T t);
+
+ /**
+ * Adds an element to the stream being built.
+ *
+ * @implSpec
+ * The default implementation behaves as if:
+ * <pre>{@code
+ * accept(t)
+ * return this;
+ * }</pre>
+ *
+ * @param t the element to add
+ * @return {@code this} builder
+ * @throws IllegalStateException if the builder has already transitioned to
+ * the built state
+ */
+ default StreamBuilder<T> add(T t) {
+ accept(t);
+ return this;
+ }
+
+ /**
+ * Builds the stream, transitioning this builder to the built state.
+ * An {@code IllegalStateException} is thrown if there are further attempts
+ * to operate on the builder after it has entered the built state.
+ *
+ * @return the built stream
+ * @throws IllegalStateException if the builder has already transitioned to
+ * the built state
+ */
+ Stream<T> build();
+
+ /**
+ * A mutable builder for an {@code IntStream}.
+ *
+ * <p>A stream builder has a lifecycle, where it starts in a building
+ * phase, during which elements can be added, and then transitions to a
+ * built phase, after which elements may not be added. The built phase
+ * begins when the {@link #build()}} method is called, which creates an
+ * ordered stream whose elements are the elements that were added to the
+ * stream builder, in the order they were added.
+ *
+ * @see IntStream#builder()
+ * @since 1.8
+ */
+ interface OfInt extends IntConsumer {
+
+ /**
+ * Adds an element to the stream being built.
+ *
+ * @throws IllegalStateException if the builder has already transitioned
+ * to the built state
+ */
+ @Override
+ void accept(int t);
+
+ /**
+ * Adds an element to the stream being built.
+ *
+ * @implSpec
+ * The default implementation behaves as if:
+ * <pre>{@code
+ * accept(t)
+ * return this;
+ * }</pre>
+ *
+ * @param t the element to add
+ * @return {@code this} builder
+ * @throws IllegalStateException if the builder has already transitioned
+ * to the built state
+ */
+ default StreamBuilder.OfInt add(int t) {
+ accept(t);
+ return this;
+ }
+
+ /**
+ * Builds the stream, transitioning this builder to the built state.
+ * An {@code IllegalStateException} is thrown if there are further
+ * attempts to operate on the builder after it has entered the built
+ * state.
+ *
+ * @return the built stream
+ * @throws IllegalStateException if the builder has already transitioned to
+ * the built state
+ */
+ IntStream build();
+ }
+
+ /**
+ * A mutable builder for a {@code LongStream}.
+ *
+ * <p>A stream builder has a lifecycle, where it starts in a building
+ * phase, during which elements can be added, and then transitions to a
+ * built phase, after which elements may not be added. The built phase
+ * begins when the {@link #build()}} method is called, which creates an
+ * ordered stream whose elements are the elements that were added to the
+ * stream builder, in the order they were added.
+ *
+ * @see LongStream#builder()
+ * @since 1.8
+ */
+ interface OfLong extends LongConsumer {
+
+ /**
+ * Adds an element to the stream being built.
+ *
+ * @throws IllegalStateException if the builder has already transitioned
+ * to the built state
+ */
+ @Override
+ void accept(long t);
+
+ /**
+ * Adds an element to the stream being built.
+ *
+ * @implSpec
+ * The default implementation behaves as if:
+ * <pre>{@code
+ * accept(t)
+ * return this;
+ * }</pre>
+ *
+ * @param t the element to add
+ * @return {@code this} builder
+ * @throws IllegalStateException if the builder has already transitioned
+ * to the built state
+ */
+ default StreamBuilder.OfLong add(long t) {
+ accept(t);
+ return this;
+ }
+
+ /**
+ * Builds the stream, transitioning this builder to the built state.
+ * An {@code IllegalStateException} is thrown if there are further
+ * attempts to operate on the builder after it has entered the built
+ * state.
+ *
+ * @return the built stream
+ * @throws IllegalStateException if the builder has already transitioned
+ * to the built state
+ */
+ LongStream build();
+ }
+
+ /**
+ * A mutable builder for a {@code DoubleStream}.
+ *
+ * @see LongStream#builder()
+ * @since 1.8
+ */
+ interface OfDouble extends DoubleConsumer {
+
+ /**
+ * Adds an element to the stream being built.
+ *
+ * <p>A stream builder has a lifecycle, where it starts in a building
+ * phase, during which elements can be added, and then transitions to a
+ * built phase, after which elements may not be added. The built phase
+ * begins when the {@link #build()}} method is called, which creates an
+ * ordered stream whose elements are the elements that were added to the
+ * stream builder, in the order they were added.
+ *
+ * @throws IllegalStateException if the builder has already transitioned
+ * to the built state
+ */
+ @Override
+ void accept(double t);
+
+ /**
+ * Adds an element to the stream being built.
+ *
+ * @implSpec
+ * The default implementation behaves as if:
+ * <pre>{@code
+ * accept(t)
+ * return this;
+ * }</pre>
+ *
+ * @param t the element to add
+ * @return {@code this} builder
+ * @throws IllegalStateException if the builder has already transitioned
+ * to the built state
+ */
+ default StreamBuilder.OfDouble add(double t) {
+ accept(t);
+ return this;
+ }
+
+ /**
+ * Builds the stream, transitioning this builder to the built state.
+ * An {@code IllegalStateException} is thrown if there are further
+ * attempts to operate on the builder after it has entered the built
+ * state.
+ *
+ * @return the built stream
+ * @throws IllegalStateException if the builder has already transitioned
+ * to the built state
+ */
+ DoubleStream build();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/StreamOpFlag.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,753 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Spliterator;
+
+/**
+ * Flags corresponding to characteristics of streams and operations. Flags are
+ * utilized by the stream framework to control, specialize or optimize
+ * computation.
+ *
+ * <p>
+ * Stream flags may be used to describe characteristics of several different
+ * entities associated with streams: stream sources, intermediate operations,
+ * and terminal operations. Not all stream flags are meaningful for all
+ * entities; the following table summarizes which flags are meaningful in what
+ * contexts:
+ *
+ * <div>
+ * <table>
+ * <caption>Type Characteristics</caption>
+ * <thead class="tableSubHeadingColor">
+ * <tr>
+ * <th colspan="2"> </th>
+ * <th>{@code DISTINCT}</th>
+ * <th>{@code SORTED}</th>
+ * <th>{@code ORDERED}</th>
+ * <th>{@code SIZED}</th>
+ * <th>{@code SHORT_CIRCUIT}</th>
+ * </tr>
+ * </thead>
+ * <tbody>
+ * <tr>
+ * <th colspan="2" class="tableSubHeadingColor">Stream source</th>
+ * <td>Y</td>
+ * <td>Y</td>
+ * <td>Y</td>
+ * <td>Y</td>
+ * <td>N</td>
+ * </tr>
+ * <tr>
+ * <th colspan="2" class="tableSubHeadingColor">Intermediate operation</th>
+ * <td>PCI</td>
+ * <td>PCI</td>
+ * <td>PCI</td>
+ * <td>PC</td>
+ * <td>PI</td>
+ * </tr>
+ * <tr>
+ * <th colspan="2" class="tableSubHeadingColor">Terminal operation</th>
+ * <td>N</td>
+ * <td>N</td>
+ * <td>PC</td>
+ * <td>N</td>
+ * <td>PI</td>
+ * </tr>
+ * </tbody>
+ * <tfoot>
+ * <tr>
+ * <th class="tableSubHeadingColor" colspan="2">Legend</th>
+ * <th colspan="6" rowspan="7"> </th>
+ * </tr>
+ * <tr>
+ * <th class="tableSubHeadingColor">Flag</th>
+ * <th class="tableSubHeadingColor">Meaning</th>
+ * <th colspan="6"></th>
+ * </tr>
+ * <tr><td>Y</td><td>Allowed</td></tr>
+ * <tr><td>N</td><td>Invalid</td></tr>
+ * <tr><td>P</td><td>Preserves</td></tr>
+ * <tr><td>C</td><td>Clears</td></tr>
+ * <tr><td>I</td><td>Injects</td></tr>
+ * </tfoot>
+ * </table>
+ * </div>
+ *
+ * <p>In the above table, "PCI" means "may preserve, clear, or inject"; "PC"
+ * means "may preserve or clear", "PI" means "may preserve or inject", and "N"
+ * means "not valid".
+ *
+ * <p>Stream flags are represented by unioned bit sets, so that a single word
+ * may describe all the characteristics of a given stream entity, and that, for
+ * example, the flags for a stream source can be efficiently combined with the
+ * flags for later operations on that stream.
+ *
+ * <p>The bit masks {@link #STREAM_MASK}, {@link #OP_MASK}, and
+ * {@link #TERMINAL_OP_MASK} can be ANDed with a bit set of stream flags to
+ * produce a mask containing only the valid flags for that entity type.
+ *
+ * <p>When describing a stream source, one only need describe what
+ * characteristics that stream has; when describing a stream operation, one need
+ * describe whether the operation preserves, injects, or clears that
+ * characteristic. Accordingly, two bits are used for each flag, so as to allow
+ * representing not only the presence of of a characteristic, but how an
+ * operation modifies that characteristic. There are two common forms in which
+ * flag bits are combined into an {@code int} bit set. <em>Stream flags</em>
+ * are a unioned bit set constructed by ORing the enum characteristic values of
+ * {@link #set()} (or, more commonly, ORing the corresponding static named
+ * constants prefixed with {@code IS_}). <em>Operation flags</em> are a unioned
+ * bit set constructed by ORing the enum characteristic values of {@link #set()}
+ * or {@link #clear()} (to inject, or clear, respectively, the corresponding
+ * flag), or more commonly ORing the corresponding named constants prefixed with
+ * {@code IS_} or {@code NOT_}. Flags that are not marked with {@code IS_} or
+ * {@code NOT_} are implicitly treated as preserved. Care must be taken when
+ * combining bitsets that the correct combining operations are applied in the
+ * correct order.
+ *
+ * <p>
+ * With the exception of {@link #SHORT_CIRCUIT}, stream characteristics can be
+ * derived from the equivalent {@link java.util.Spliterator} characteristics:
+ * {@link java.util.Spliterator#DISTINCT}, {@link java.util.Spliterator#SORTED},
+ * {@link java.util.Spliterator#ORDERED}, and
+ * {@link java.util.Spliterator#SIZED}. A spliterator characteristics bit set
+ * can be converted to stream flags using the method
+ * {@link #fromCharacteristics(java.util.Spliterator)} and converted back using
+ * {@link #toCharacteristics(int)}. (The bit set
+ * {@link #SPLITERATOR_CHARACTERISTICS_MASK} is used to AND with a bit set to
+ * produce a valid spliterator characteristics bit set that can be converted to
+ * stream flags.)
+ *
+ * <p>
+ * The source of a stream encapsulates a spliterator. The characteristics of
+ * that source spliterator when transformed to stream flags will be a proper
+ * subset of stream flags of that stream.
+ * For example:
+ * <pre> {@code
+ * Spliterator s = ...;
+ * Stream stream = Streams.stream(s);
+ * flagsFromSplitr = fromCharacteristics(s.characteristics());
+ * assert(flagsFromSplitr & stream.getStreamFlags() == flagsFromSplitr);
+ * }</pre>
+ *
+ * <p>
+ * An intermediate operation, performed on an input stream to create a new
+ * output stream, may preserve, clear or inject stream or operation
+ * characteristics. Similarly, a terminal operation, performed on an input
+ * stream to produce an output result may preserve, clear or inject stream or
+ * operation characteristics. Preservation means that if that characteristic
+ * is present on the input, then it is also present on the output. Clearing
+ * means that the characteristic is not present on the output regardless of the
+ * input. Injection means that the characteristic is present on the output
+ * regardless of the input. If a characteristic is not cleared or injected then
+ * it is implicitly preserved.
+ *
+ * <p>
+ * A pipeline consists of a stream source encapsulating a spliterator, one or
+ * more intermediate operations, and finally a terminal operation that produces
+ * a result. At each stage of the pipeline, a combined stream and operation
+ * flags can be calculated, using {@link #combineOpFlags(int, int)}. Such flags
+ * ensure that preservation, clearing and injecting information is retained at
+ * each stage.
+ *
+ * The combined stream and operation flags for the source stage of the pipeline
+ * is calculated as follows:
+ * <pre> {@code
+ * int flagsForSourceStage = combineOpFlags(sourceFlags, INITIAL_OPS_VALUE);
+ * }</pre>
+ *
+ * The combined stream and operation flags of each subsequent intermediate
+ * operation stage in the pipeline is calculated as follows:
+ * <pre> {@code
+ * int flagsForThisStage = combineOpFlags(flagsForPreviousStage, thisOpFlags);
+ * }</pre>
+ *
+ * Finally the flags output from the last intermediate operation of the pipeline
+ * are combined with the operation flags of the terminal operation to produce
+ * the flags output from the pipeline.
+ *
+ * <p>Those flags can then be used to apply optimizations. For example, if
+ * {@code SIZED.isKnown(flags)} returns true then the stream size remains
+ * constant throughout the pipeline, this information can be utilized to
+ * pre-allocate data structures and combined with
+ * {@link java.util.Spliterator#SUBSIZED} that information can be utilized to
+ * perform concurrent in-place updates into a shared array.
+ *
+ * For specific details see the {@link AbstractPipeline} constructors.
+ *
+ * @since 1.8
+ */
+enum StreamOpFlag {
+
+ /*
+ * Each characteristic takes up 2 bits in a bit set to accommodate
+ * preserving, clearing and setting/injecting information.
+ *
+ * This applies to stream flags, intermediate/terminal operation flags, and
+ * combined stream and operation flags. Even though the former only requires
+ * 1 bit of information per characteristic, is it more efficient when
+ * combining flags to align set and inject bits.
+ *
+ * Characteristics belong to certain types, see the Type enum. Bit masks for
+ * the types are constructed as per the following table:
+ *
+ * DISTINCT SORTED ORDERED SIZED SHORT_CIRCUIT
+ * SPLITERATOR 01 01 01 01 00
+ * STREAM 01 01 01 01 00
+ * OP 11 11 11 10 01
+ * TERMINAL_OP 00 00 10 00 01
+ * UPSTREAM_TERMINAL_OP 00 00 10 00 00
+ *
+ * 01 = set/inject
+ * 10 = clear
+ * 11 = preserve
+ *
+ * Construction of the columns is performed using a simple builder for
+ * non-zero values.
+ */
+
+
+ // The following flags correspond to characteristics on Spliterator
+ // and the values MUST be equal.
+ //
+
+ /**
+ * Characteristic value signifying that, for each pair of
+ * encountered elements in a stream {@code x, y}, {@code !x.equals(y)}.
+ * <p>
+ * A stream may have this value or an intermediate operation can preserve,
+ * clear or inject this value.
+ */
+ // 0, 0x00000001
+ // Matches Spliterator.DISTINCT
+ DISTINCT(0,
+ set(Type.SPLITERATOR).set(Type.STREAM).setAndClear(Type.OP)),
+
+ /**
+ * Characteristic value signifying that encounter order follows a natural
+ * sort order of comparable elements.
+ * <p>
+ * A stream can have this value or an intermediate operation can preserve,
+ * clear or inject this value.
+ * <p>
+ * Note: The {@link java.util.Spliterator#SORTED} characteristic can define
+ * a sort order with an associated non-null comparator. Augmenting flag
+ * state with addition properties such that those properties can be passed
+ * to operations requires some disruptive changes for a singular use-case.
+ * Furthermore, comparing comparators for equality beyond that of identity
+ * is likely to be unreliable. Therefore the {@code SORTED} characteristic
+ * for a defined non-natural sort order is not mapped internally to the
+ * {@code SORTED} flag.
+ */
+ // 1, 0x00000004
+ // Matches Spliterator.SORTED
+ SORTED(1,
+ set(Type.SPLITERATOR).set(Type.STREAM).setAndClear(Type.OP)),
+
+ /**
+ * Characteristic value signifying that an encounter order is
+ * defined for stream elements.
+ * <p>
+ * A stream can have this value, an intermediate operation can preserve,
+ * clear or inject this value, or a terminal operation can preserve or clear
+ * this value.
+ */
+ // 2, 0x00000010
+ // Matches Spliterator.ORDERED
+ ORDERED(2,
+ set(Type.SPLITERATOR).set(Type.STREAM).setAndClear(Type.OP).clear(Type.TERMINAL_OP)
+ .clear(Type.UPSTREAM_TERMINAL_OP)),
+
+ /**
+ * Characteristic value signifying that size of the stream
+ * is of a known finite size that is equal to the known finite
+ * size of the source spliterator input to the first stream
+ * in the pipeline.
+ * <p>
+ * A stream can have this value or an intermediate operation can preserve or
+ * clear this value.
+ */
+ // 3, 0x00000040
+ // Matches Spliterator.SIZED
+ SIZED(3,
+ set(Type.SPLITERATOR).set(Type.STREAM).clear(Type.OP)),
+
+ // The following Spliterator characteristics are not currently used but a
+ // gap in the bit set is deliberately retained to enable corresponding
+ // stream flags if//when required without modification to other flag values.
+ //
+ // 4, 0x00000100 NONNULL(4, ...
+ // 5, 0x00000400 IMMUTABLE(5, ...
+ // 6, 0x00001000 CONCURRENT(6, ...
+ // 7, 0x00004000 SUBSIZED(7, ...
+
+ // The following 4 flags are currently undefined and a free for any further
+ // spliterator characteristics.
+ //
+ // 8, 0x00010000
+ // 9, 0x00040000
+ // 10, 0x00100000
+ // 11, 0x00400000
+
+ // The following flags are specific to streams and operations
+ //
+
+ /**
+ * Characteristic value signifying that an operation may short-circuit the
+ * stream.
+ * <p>
+ * An intermediate operation can preserve or inject this value,
+ * or a terminal operation can preserve or inject this value.
+ */
+ // 12, 0x01000000
+ SHORT_CIRCUIT(12,
+ set(Type.OP).set(Type.TERMINAL_OP));
+
+ // The following 2 flags are currently undefined and a free for any further
+ // stream flags if/when required
+ //
+ // 13, 0x04000000
+ // 14, 0x10000000
+ // 15, 0x40000000
+
+ /**
+ * Type of a flag
+ */
+ enum Type {
+ /**
+ * The flag is associated with spliterator characteristics.
+ */
+ SPLITERATOR,
+
+ /**
+ * The flag is associated with stream flags.
+ */
+ STREAM,
+
+ /**
+ * The flag is associated with intermediate operation flags.
+ */
+ OP,
+
+ /**
+ * The flag is associated with terminal operation flags.
+ */
+ TERMINAL_OP,
+
+ /**
+ * The flag is associated with terminal operation flags that are
+ * propagated upstream across the last stateful operation boundary
+ */
+ UPSTREAM_TERMINAL_OP
+ }
+
+ /**
+ * The bit pattern for setting/injecting a flag.
+ */
+ private static final int SET_BITS = 0b01;
+
+ /**
+ * The bit pattern for clearing a flag.
+ */
+ private static final int CLEAR_BITS = 0b10;
+
+ /**
+ * The bit pattern for preserving a flag.
+ */
+ private static final int PRESERVE_BITS = 0b11;
+
+ private static MaskBuilder set(Type t) {
+ return new MaskBuilder(new EnumMap<>(Type.class)).set(t);
+ }
+
+ private static class MaskBuilder {
+ final Map<Type, Integer> map;
+
+ MaskBuilder(Map<Type, Integer> map) {
+ this.map = map;
+ }
+
+ MaskBuilder mask(Type t, Integer i) {
+ map.put(t, i);
+ return this;
+ }
+
+ MaskBuilder set(Type t) {
+ return mask(t, SET_BITS);
+ }
+
+ MaskBuilder clear(Type t) {
+ return mask(t, CLEAR_BITS);
+ }
+
+ MaskBuilder setAndClear(Type t) {
+ return mask(t, PRESERVE_BITS);
+ }
+
+ Map<Type, Integer> build() {
+ for (Type t : Type.values()) {
+ map.putIfAbsent(t, 0b00);
+ }
+ return map;
+ }
+ }
+
+ /**
+ * The mask table for a flag, this is used to determine if a flag
+ * corresponds to a certain flag type and for creating mask constants.
+ */
+ private final Map<Type, Integer> maskTable;
+
+ /**
+ * The bit position in the bit mask.
+ */
+ private final int bitPosition;
+
+ /**
+ * The set 2 bit set offset at the bit position.
+ */
+ private final int set;
+
+ /**
+ * The clear 2 bit set offset at the bit position.
+ */
+ private final int clear;
+
+ /**
+ * The preserve 2 bit set offset at the bit position.
+ */
+ private final int preserve;
+
+ private StreamOpFlag(int position, MaskBuilder maskBuilder) {
+ this.maskTable = maskBuilder.build();
+ // Two bits per flag
+ position *= 2;
+ this.bitPosition = position;
+ this.set = SET_BITS << position;
+ this.clear = CLEAR_BITS << position;
+ this.preserve = PRESERVE_BITS << position;
+ }
+
+ /**
+ * Gets the bitmap associated with setting this characteristic.
+ *
+ * @return the bitmap for setting this characteristic
+ */
+ int set() {
+ return set;
+ }
+
+ /**
+ * Gets the bitmap associated with clearing this characteristic.
+ *
+ * @return the bitmap for clearing this characteristic
+ */
+ int clear() {
+ return clear;
+ }
+
+ /**
+ * Determines if this flag is a stream-based flag.
+ *
+ * @return true if a stream-based flag, otherwise false.
+ */
+ boolean isStreamFlag() {
+ return maskTable.get(Type.STREAM) > 0;
+ }
+
+ /**
+ * Checks if this flag is set on stream flags, injected on operation flags,
+ * and injected on combined stream and operation flags.
+ *
+ * @param flags the stream flags, operation flags, or combined stream and
+ * operation flags
+ * @return true if this flag is known, otherwise false.
+ */
+ boolean isKnown(int flags) {
+ return (flags & preserve) == set;
+ }
+
+ /**
+ * Checks if this flag is cleared on operation flags or combined stream and
+ * operation flags.
+ *
+ * @param flags the operation flags or combined stream and operations flags.
+ * @return true if this flag is preserved, otherwise false.
+ */
+ boolean isCleared(int flags) {
+ return (flags & preserve) == clear;
+ }
+
+ /**
+ * Checks if this flag is preserved on combined stream and operation flags.
+ *
+ * @param flags the combined stream and operations flags.
+ * @return true if this flag is preserved, otherwise false.
+ */
+ boolean isPreserved(int flags) {
+ return (flags & preserve) == preserve;
+ }
+
+ /**
+ * Determines if this flag can be set for a flag type.
+ *
+ * @param t the flag type.
+ * @return true if this flag can be set for the flag type, otherwise false.
+ */
+ boolean canSet(Type t) {
+ return (maskTable.get(t) & SET_BITS) > 0;
+ }
+
+ /**
+ * The bit mask for spliterator characteristics
+ */
+ static final int SPLITERATOR_CHARACTERISTICS_MASK = createMask(Type.SPLITERATOR);
+
+ /**
+ * The bit mask for source stream flags.
+ */
+ static final int STREAM_MASK = createMask(Type.STREAM);
+
+ /**
+ * The bit mask for intermediate operation flags.
+ */
+ static final int OP_MASK = createMask(Type.OP);
+
+ /**
+ * The bit mask for terminal operation flags.
+ */
+ static final int TERMINAL_OP_MASK = createMask(Type.TERMINAL_OP);
+
+ /**
+ * The bit mask for upstream terminal operation flags.
+ */
+ static final int UPSTREAM_TERMINAL_OP_MASK = createMask(Type.UPSTREAM_TERMINAL_OP);
+
+ private static int createMask(Type t) {
+ int mask = 0;
+ for (StreamOpFlag flag : StreamOpFlag.values()) {
+ mask |= flag.maskTable.get(t) << flag.bitPosition;
+ }
+ return mask;
+ }
+
+ /**
+ * Complete flag mask.
+ */
+ private static final int FLAG_MASK = createFlagMask();
+
+ private static int createFlagMask() {
+ int mask = 0;
+ for (StreamOpFlag flag : StreamOpFlag.values()) {
+ mask |= flag.preserve;
+ }
+ return mask;
+ }
+
+ /**
+ * Flag mask for stream flags that are set.
+ */
+ private static final int FLAG_MASK_IS = STREAM_MASK;
+
+ /**
+ * Flag mask for stream flags that are cleared.
+ */
+ private static final int FLAG_MASK_NOT = STREAM_MASK << 1;
+
+ /**
+ * The initial value to be combined with the stream flags of the first
+ * stream in the pipeline.
+ */
+ static final int INITIAL_OPS_VALUE = FLAG_MASK_IS | FLAG_MASK_NOT;
+
+ /**
+ * The bit value to set or inject {@link #DISTINCT}.
+ */
+ static final int IS_DISTINCT = DISTINCT.set;
+
+ /**
+ * The bit value to clear {@link #DISTINCT}.
+ */
+ static final int NOT_DISTINCT = DISTINCT.clear;
+
+ /**
+ * The bit value to set or inject {@link #SORTED}.
+ */
+ static final int IS_SORTED = SORTED.set;
+
+ /**
+ * The bit value to clear {@link #SORTED}.
+ */
+ static final int NOT_SORTED = SORTED.clear;
+
+ /**
+ * The bit value to set or inject {@link #ORDERED}.
+ */
+ static final int IS_ORDERED = ORDERED.set;
+
+ /**
+ * The bit value to clear {@link #ORDERED}.
+ */
+ static final int NOT_ORDERED = ORDERED.clear;
+
+ /**
+ * The bit value to set {@link #SIZED}.
+ */
+ static final int IS_SIZED = SIZED.set;
+
+ /**
+ * The bit value to clear {@link #SIZED}.
+ */
+ static final int NOT_SIZED = SIZED.clear;
+
+ /**
+ * The bit value to inject {@link #SHORT_CIRCUIT}.
+ */
+ static final int IS_SHORT_CIRCUIT = SHORT_CIRCUIT.set;
+
+ private static int getMask(int flags) {
+ return (flags == 0)
+ ? FLAG_MASK
+ : ~(flags | ((FLAG_MASK_IS & flags) << 1) | ((FLAG_MASK_NOT & flags) >> 1));
+ }
+
+ /**
+ * Combines stream or operation flags with previously combined stream and
+ * operation flags to produce updated combined stream and operation flags.
+ * <p>
+ * A flag set on stream flags or injected on operation flags,
+ * and injected combined stream and operation flags,
+ * will be injected on the updated combined stream and operation flags.
+ *
+ * <p>
+ * A flag set on stream flags or injected on operation flags,
+ * and cleared on the combined stream and operation flags,
+ * will be cleared on the updated combined stream and operation flags.
+ *
+ * <p>
+ * A flag set on the stream flags or injected on operation flags,
+ * and preserved on the combined stream and operation flags,
+ * will be injected on the updated combined stream and operation flags.
+ *
+ * <p>
+ * A flag not set on the stream flags or cleared/preserved on operation
+ * flags, and injected on the combined stream and operation flags,
+ * will be injected on the updated combined stream and operation flags.
+ *
+ * <p>
+ * A flag not set on the stream flags or cleared/preserved on operation
+ * flags, and cleared on the combined stream and operation flags,
+ * will be cleared on the updated combined stream and operation flags.
+ *
+ * <p>
+ * A flag not set on the stream flags,
+ * and preserved on the combined stream and operation flags
+ * will be preserved on the updated combined stream and operation flags.
+ *
+ * <p>
+ * A flag cleared on operation flags,
+ * and preserved on the combined stream and operation flags
+ * will be cleared on the updated combined stream and operation flags.
+ *
+ * <p>
+ * A flag preserved on operation flags,
+ * and preserved on the combined stream and operation flags
+ * will be preserved on the updated combined stream and operation flags.
+ *
+ * @param newStreamOrOpFlags the stream or operation flags.
+ * @param prevCombOpFlags previously combined stream and operation flags.
+ * The value {#link INITIAL_OPS_VALUE} must be used as the seed value.
+ * @return the updated combined stream and operation flags.
+ */
+ static int combineOpFlags(int newStreamOrOpFlags, int prevCombOpFlags) {
+ // 0x01 or 0x10 nibbles are transformed to 0x11
+ // 0x00 nibbles remain unchanged
+ // Then all the bits are flipped
+ // Then the result is logically or'ed with the operation flags.
+ return (prevCombOpFlags & StreamOpFlag.getMask(newStreamOrOpFlags)) | newStreamOrOpFlags;
+ }
+
+ /**
+ * Converts combined stream and operation flags to stream flags.
+ *
+ * <p>Each flag injected on the combined stream and operation flags will be
+ * set on the stream flags.
+ *
+ * @param combOpFlags the combined stream and operation flags.
+ * @return the stream flags.
+ */
+ static int toStreamFlags(int combOpFlags) {
+ // By flipping the nibbles 0x11 become 0x00 and 0x01 become 0x10
+ // Shift left 1 to restore set flags and mask off anything other than the set flags
+ return ((~combOpFlags) >> 1) & FLAG_MASK_IS & combOpFlags;
+ }
+
+ /**
+ * Converts stream flags to a spliterator characteristic bit set.
+ *
+ * @param streamFlags the stream flags.
+ * @return the spliterator characteristic bit set.
+ */
+ static int toCharacteristics(int streamFlags) {
+ return streamFlags & SPLITERATOR_CHARACTERISTICS_MASK;
+ }
+
+ /**
+ * Converts a spliterator characteristic bit set to stream flags.
+ *
+ * @implSpec
+ * If the spliterator is naturally {@code SORTED} (the associated
+ * {@code Comparator} is {@code null}) then the characteristic is converted
+ * to the {@link #SORTED} flag, otherwise the characteristic is not
+ * converted.
+ *
+ * @param spliterator the spliterator from which to obtain characteristic
+ * bit set.
+ * @return the stream flags.
+ */
+ static int fromCharacteristics(Spliterator<?> spliterator) {
+ int characteristics = spliterator.characteristics();
+ if ((characteristics & Spliterator.SORTED) != 0 && spliterator.getComparator() != null) {
+ // Do not propagate the SORTED characteristic if it does not correspond
+ // to a natural sort order
+ return characteristics & SPLITERATOR_CHARACTERISTICS_MASK & ~Spliterator.SORTED;
+ }
+ else {
+ return characteristics & SPLITERATOR_CHARACTERISTICS_MASK;
+ }
+ }
+
+ /**
+ * Converts a spliterator characteristic bit set to stream flags.
+ *
+ * @param characteristics the spliterator characteristic bit set.
+ * @return the stream flags.
+ */
+ static int fromCharacteristics(int characteristics) {
+ return characteristics & SPLITERATOR_CHARACTERISTICS_MASK;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/StreamShape.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+/**
+ * An enum describing the known shape specializations for stream abstractions.
+ * Each will correspond to a specific subinterface of {@link BaseStream}
+ * (e.g., {@code REFERENCE} corresponds to {@code Stream}, {@code INT_VALUE}
+ * corresponds to {@code IntStream}). Each may also correspond to
+ * specializations of value-handling abstractions such as {@code Spliterator},
+ * {@code Consumer}, etc.
+ *
+ * @apiNote
+ * This enum is used by implementations to determine compatibility between
+ * streams and operations (i.e., if the output shape of a stream is compatible
+ * with the input shape of the next operation).
+ *
+ * <p>Some APIs require you to specify both a generic type and a stream shape
+ * for input or output elements, such as {@link TerminalOp} which has both
+ * generic type parameters for its input types, and a getter for the
+ * input shape. When representing primitive streams in this way, the
+ * generic type parameter should correspond to the wrapper type for that
+ * primitive type.
+ *
+ * @since 1.8
+ */
+enum StreamShape {
+ /**
+ * The shape specialization corresponding to {@code Stream} and elements
+ * that are object references.
+ */
+ REFERENCE,
+ /**
+ * The shape specialization corresponding to {@code IntStream} and elements
+ * that are {@code int} values.
+ */
+ INT_VALUE,
+ /**
+ * The shape specialization corresponding to {@code LongStream} and elements
+ * that are {@code long} values.
+ */
+ LONG_VALUE,
+ /**
+ * The shape specialization corresponding to {@code DoubleStream} and
+ * elements that are {@code double} values.
+ */
+ DOUBLE_VALUE
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/StreamSpliterators.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,636 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Comparator;
+import java.util.Spliterator;
+import java.util.function.BooleanSupplier;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.LongConsumer;
+import java.util.function.Supplier;
+
+/**
+ * Spliterator implementations for wrapping and delegating spliterators, used
+ * in the implementation of the {@link Stream#spliterator()} method.
+ *
+ * @since 1.8
+ */
+class StreamSpliterators {
+
+ /**
+ * Abstract wrapping spliterator that binds to the spliterator of a
+ * pipeline helper on first operation.
+ *
+ * <p>This spliterator is not late-binding and will bind to the source
+ * spliterator when first operated on.
+ *
+ * <p>A wrapping spliterator produced from a sequential stream
+ * cannot be split if there are stateful operations present.
+ */
+ private static abstract class AbstractWrappingSpliterator<P_IN, P_OUT,
+ T_BUFFER extends AbstractSpinedBuffer>
+ implements Spliterator<P_OUT> {
+
+ // @@@ Detect if stateful operations are present or not
+ // If not then can split otherwise cannot
+
+ /**
+ * True if this spliterator supports splitting
+ */
+ final boolean isParallel;
+
+ final PipelineHelper<P_OUT> ph;
+
+ /**
+ * Supplier for the source spliterator. Client provides either a
+ * spliterator or a supplier.
+ */
+ private Supplier<Spliterator<P_IN>> spliteratorSupplier;
+
+ /**
+ * Source spliterator. Either provided from client or obtained from
+ * supplier.
+ */
+ Spliterator<P_IN> spliterator;
+
+ /**
+ * Sink chain for the downstream stages of the pipeline, ultimately
+ * leading to the buffer. Used during partial traversal.
+ */
+ Sink<P_IN> bufferSink;
+
+ /**
+ * A function that advances one element of the spliterator, pushing
+ * it to bufferSink. Returns whether any elements were processed.
+ * Used during partial traversal.
+ */
+ BooleanSupplier pusher;
+
+ /** Next element to consume from the buffer, used during partial traversal */
+ long nextToConsume;
+
+ /** Buffer into which elements are pushed. Used during partial traversal. */
+ T_BUFFER buffer;
+
+ /**
+ * True if full traversal has occurred (with possible cancelation).
+ * If doing a partial traversal, there may be still elements in buffer.
+ */
+ boolean finished;
+
+ /**
+ * Construct an AbstractWrappingSpliterator from a
+ * {@code Supplier<Spliterator>}.
+ */
+ AbstractWrappingSpliterator(PipelineHelper<P_OUT> ph,
+ Supplier<Spliterator<P_IN>> spliteratorSupplier,
+ boolean parallel) {
+ this.ph = ph;
+ this.spliteratorSupplier = spliteratorSupplier;
+ this.spliterator = null;
+ this.isParallel = parallel;
+ }
+
+ /**
+ * Construct an AbstractWrappingSpliterator from a
+ * {@code Spliterator}.
+ */
+ AbstractWrappingSpliterator(PipelineHelper<P_OUT> ph,
+ Spliterator<P_IN> spliterator,
+ boolean parallel) {
+ this.ph = ph;
+ this.spliteratorSupplier = null;
+ this.spliterator = spliterator;
+ this.isParallel = parallel;
+ }
+
+ /**
+ * Called before advancing to set up spliterator, if needed.
+ */
+ final void init() {
+ if (spliterator == null) {
+ spliterator = spliteratorSupplier.get();
+ spliteratorSupplier = null;
+ }
+ }
+
+ /**
+ * Get an element from the source, pushing it into the sink chain,
+ * setting up the buffer if needed
+ * @return whether there are elements to consume from the buffer
+ */
+ final boolean doAdvance() {
+ if (buffer == null) {
+ if (finished)
+ return false;
+
+ init();
+ initPartialTraversalState();
+ nextToConsume = 0;
+ bufferSink.begin(spliterator.getExactSizeIfKnown());
+ return fillBuffer();
+ }
+ else {
+ ++nextToConsume;
+ boolean hasNext = nextToConsume < buffer.count();
+ if (!hasNext) {
+ nextToConsume = 0;
+ buffer.clear();
+ hasNext = fillBuffer();
+ }
+ return hasNext;
+ }
+ }
+
+ /**
+ * Invokes the shape-specific constructor with the provided arguments
+ * and returns the result.
+ */
+ abstract AbstractWrappingSpliterator<P_IN, P_OUT, ?> wrap(Spliterator<P_IN> s);
+
+ /**
+ * Initializes buffer, sink chain, and pusher for a shape-specific
+ * implementation.
+ */
+ abstract void initPartialTraversalState();
+
+ @Override
+ public Spliterator<P_OUT> trySplit() {
+ if (isParallel && !finished) {
+ init();
+
+ Spliterator<P_IN> split = spliterator.trySplit();
+ return (split == null) ? null : wrap(split);
+ }
+ else
+ return null;
+ }
+
+ /**
+ * If the buffer is empty, push elements into the sink chain until
+ * the source is empty or cancellation is requested.
+ * @return whether there are elements to consume from the buffer
+ */
+ private boolean fillBuffer() {
+ while (buffer.count() == 0) {
+ if (bufferSink.cancellationRequested() || !pusher.getAsBoolean()) {
+ if (finished)
+ return false;
+ else {
+ bufferSink.end(); // might trigger more elements
+ finished = true;
+ }
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public final long estimateSize() {
+ init();
+ return StreamOpFlag.SIZED.isKnown(ph.getStreamAndOpFlags())
+ ? spliterator.estimateSize()
+ : Long.MAX_VALUE;
+ }
+
+ @Override
+ public final long getExactSizeIfKnown() {
+ init();
+ return StreamOpFlag.SIZED.isKnown(ph.getStreamAndOpFlags())
+ ? spliterator.getExactSizeIfKnown()
+ : -1;
+ }
+
+ @Override
+ public final int characteristics() {
+ init();
+
+ // Get the characteristics from the pipeline
+ int c = StreamOpFlag.toCharacteristics(StreamOpFlag.toStreamFlags(ph.getStreamAndOpFlags()));
+
+ // Mask off the size and uniform characteristics and replace with
+ // those of the spliterator
+ // Note that a non-uniform spliterator can change from something
+ // with an exact size to an estimate for a sub-split, for example
+ // with HashSet where the size is known at the top level spliterator
+ // but for sub-splits only an estimate is known
+ if ((c & Spliterator.SIZED) != 0) {
+ c &= ~(Spliterator.SIZED | Spliterator.SUBSIZED);
+ c |= (spliterator.characteristics() & Spliterator.SIZED & Spliterator.SUBSIZED);
+ }
+
+ return c;
+ }
+
+ @Override
+ public Comparator<? super P_OUT> getComparator() {
+ if (!hasCharacteristics(SORTED))
+ throw new IllegalStateException();
+ return null;
+ }
+
+ @Override
+ public final String toString() {
+ return String.format("%s[%s]", getClass().getName(), spliterator);
+ }
+ }
+
+ static final class WrappingSpliterator<P_IN, P_OUT>
+ extends AbstractWrappingSpliterator<P_IN, P_OUT, SpinedBuffer<P_OUT>> {
+
+ WrappingSpliterator(PipelineHelper<P_OUT> ph,
+ Supplier<Spliterator<P_IN>> supplier,
+ boolean parallel) {
+ super(ph, supplier, parallel);
+ }
+
+ WrappingSpliterator(PipelineHelper<P_OUT> ph,
+ Spliterator<P_IN> spliterator,
+ boolean parallel) {
+ super(ph, spliterator, parallel);
+ }
+
+ @Override
+ WrappingSpliterator<P_IN, P_OUT> wrap(Spliterator<P_IN> s) {
+ return new WrappingSpliterator<>(ph, s, isParallel);
+ }
+
+ @Override
+ void initPartialTraversalState() {
+ SpinedBuffer<P_OUT> b = new SpinedBuffer<>();
+ buffer = b;
+ bufferSink = ph.wrapSink(b::accept);
+ pusher = () -> spliterator.tryAdvance(bufferSink);
+ }
+
+ @Override
+ public boolean tryAdvance(Consumer<? super P_OUT> consumer) {
+ boolean hasNext = doAdvance();
+ if (hasNext)
+ consumer.accept(buffer.get(nextToConsume));
+ return hasNext;
+ }
+
+ @Override
+ public void forEachRemaining(Consumer<? super P_OUT> consumer) {
+ if (buffer == null && !finished) {
+ init();
+
+ ph.wrapAndCopyInto((Sink<P_OUT>) consumer::accept, spliterator);
+ finished = true;
+ }
+ else {
+ while (tryAdvance(consumer)) { }
+ }
+ }
+ }
+
+ static final class IntWrappingSpliterator<P_IN>
+ extends AbstractWrappingSpliterator<P_IN, Integer, SpinedBuffer.OfInt>
+ implements Spliterator.OfInt {
+
+ IntWrappingSpliterator(PipelineHelper<Integer> ph,
+ Supplier<Spliterator<P_IN>> supplier,
+ boolean parallel) {
+ super(ph, supplier, parallel);
+ }
+
+ IntWrappingSpliterator(PipelineHelper<Integer> ph,
+ Spliterator<P_IN> spliterator,
+ boolean parallel) {
+ super(ph, spliterator, parallel);
+ }
+
+ @Override
+ AbstractWrappingSpliterator<P_IN, Integer, ?> wrap(Spliterator<P_IN> s) {
+ return new IntWrappingSpliterator<>(ph, s, isParallel);
+ }
+
+ @Override
+ void initPartialTraversalState() {
+ SpinedBuffer.OfInt b = new SpinedBuffer.OfInt();
+ buffer = b;
+ bufferSink = ph.wrapSink((Sink.OfInt) b::accept);
+ pusher = () -> spliterator.tryAdvance(bufferSink);
+ }
+
+ @Override
+ public Spliterator.OfInt trySplit() {
+ return (Spliterator.OfInt) super.trySplit();
+ }
+
+ @Override
+ public boolean tryAdvance(IntConsumer consumer) {
+ boolean hasNext = doAdvance();
+ if (hasNext)
+ consumer.accept(buffer.get(nextToConsume));
+ return hasNext;
+ }
+
+ @Override
+ public void forEachRemaining(IntConsumer consumer) {
+ if (buffer == null && !finished) {
+ init();
+
+ ph.wrapAndCopyInto((Sink.OfInt) consumer::accept, spliterator);
+ finished = true;
+ }
+ else {
+ while (tryAdvance(consumer)) { }
+ }
+ }
+ }
+
+ static final class LongWrappingSpliterator<P_IN>
+ extends AbstractWrappingSpliterator<P_IN, Long, SpinedBuffer.OfLong>
+ implements Spliterator.OfLong {
+
+ LongWrappingSpliterator(PipelineHelper<Long> ph,
+ Supplier<Spliterator<P_IN>> supplier,
+ boolean parallel) {
+ super(ph, supplier, parallel);
+ }
+
+ LongWrappingSpliterator(PipelineHelper<Long> ph,
+ Spliterator<P_IN> spliterator,
+ boolean parallel) {
+ super(ph, spliterator, parallel);
+ }
+
+ @Override
+ AbstractWrappingSpliterator<P_IN, Long, ?> wrap(Spliterator<P_IN> s) {
+ return new LongWrappingSpliterator<>(ph, s, isParallel);
+ }
+
+ @Override
+ void initPartialTraversalState() {
+ SpinedBuffer.OfLong b = new SpinedBuffer.OfLong();
+ buffer = b;
+ bufferSink = ph.wrapSink((Sink.OfLong) b::accept);
+ pusher = () -> spliterator.tryAdvance(bufferSink);
+ }
+
+ @Override
+ public Spliterator.OfLong trySplit() {
+ return (Spliterator.OfLong) super.trySplit();
+ }
+
+ @Override
+ public boolean tryAdvance(LongConsumer consumer) {
+ boolean hasNext = doAdvance();
+ if (hasNext)
+ consumer.accept(buffer.get(nextToConsume));
+ return hasNext;
+ }
+
+ @Override
+ public void forEachRemaining(LongConsumer consumer) {
+ if (buffer == null && !finished) {
+ init();
+
+ ph.wrapAndCopyInto((Sink.OfLong) consumer::accept, spliterator);
+ finished = true;
+ }
+ else {
+ while (tryAdvance(consumer)) { }
+ }
+ }
+ }
+
+ static final class DoubleWrappingSpliterator<P_IN>
+ extends AbstractWrappingSpliterator<P_IN, Double, SpinedBuffer.OfDouble>
+ implements Spliterator.OfDouble {
+
+ DoubleWrappingSpliterator(PipelineHelper<Double> ph,
+ Supplier<Spliterator<P_IN>> supplier,
+ boolean parallel) {
+ super(ph, supplier, parallel);
+ }
+
+ DoubleWrappingSpliterator(PipelineHelper<Double> ph,
+ Spliterator<P_IN> spliterator,
+ boolean parallel) {
+ super(ph, spliterator, parallel);
+ }
+
+ @Override
+ AbstractWrappingSpliterator<P_IN, Double, ?> wrap(Spliterator<P_IN> s) {
+ return new DoubleWrappingSpliterator<>(ph, s, isParallel);
+ }
+
+ @Override
+ void initPartialTraversalState() {
+ SpinedBuffer.OfDouble b = new SpinedBuffer.OfDouble();
+ buffer = b;
+ bufferSink = ph.wrapSink((Sink.OfDouble) b::accept);
+ pusher = () -> spliterator.tryAdvance(bufferSink);
+ }
+
+ @Override
+ public Spliterator.OfDouble trySplit() {
+ return (Spliterator.OfDouble) super.trySplit();
+ }
+
+ @Override
+ public boolean tryAdvance(DoubleConsumer consumer) {
+ boolean hasNext = doAdvance();
+ if (hasNext)
+ consumer.accept(buffer.get(nextToConsume));
+ return hasNext;
+ }
+
+ @Override
+ public void forEachRemaining(DoubleConsumer consumer) {
+ if (buffer == null && !finished) {
+ init();
+
+ ph.wrapAndCopyInto((Sink.OfDouble) consumer::accept, spliterator);
+ finished = true;
+ }
+ else {
+ while (tryAdvance(consumer)) { }
+ }
+ }
+ }
+
+ /**
+ * Spliterator implementation that delegates to an underlying spliterator,
+ * acquiring the spliterator from a {@code Supplier<Spliterator>} on the
+ * first call to any spliterator method.
+ * @param <T>
+ */
+ static class DelegatingSpliterator<T> implements Spliterator<T> {
+ private final Supplier<Spliterator<T>> supplier;
+
+ private Spliterator<T> s;
+
+ @SuppressWarnings("unchecked")
+ DelegatingSpliterator(Supplier<? extends Spliterator<T>> supplier) {
+ this.supplier = (Supplier<Spliterator<T>>) supplier;
+ }
+
+ Spliterator<T> get() {
+ if (s == null) {
+ s = supplier.get();
+ }
+ return s;
+ }
+
+ @Override
+ public Spliterator<T> trySplit() {
+ return get().trySplit();
+ }
+
+ @Override
+ public boolean tryAdvance(Consumer<? super T> consumer) {
+ return get().tryAdvance(consumer);
+ }
+
+ @Override
+ public void forEachRemaining(Consumer<? super T> consumer) {
+ get().forEachRemaining(consumer);
+ }
+
+ @Override
+ public long estimateSize() {
+ return get().estimateSize();
+ }
+
+ @Override
+ public int characteristics() {
+ return get().characteristics();
+ }
+
+ @Override
+ public Comparator<? super T> getComparator() {
+ return get().getComparator();
+ }
+
+ @Override
+ public long getExactSizeIfKnown() {
+ return get().getExactSizeIfKnown();
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getName() + "[" + get() + "]";
+ }
+
+ static final class OfInt extends DelegatingSpliterator<Integer> implements Spliterator.OfInt {
+ private Spliterator.OfInt s;
+
+ OfInt(Supplier<Spliterator.OfInt> supplier) {
+ super(supplier);
+ }
+
+ @Override
+ Spliterator.OfInt get() {
+ if (s == null) {
+ s = (Spliterator.OfInt) super.get();
+ }
+ return s;
+ }
+
+ @Override
+ public Spliterator.OfInt trySplit() {
+ return get().trySplit();
+ }
+
+ @Override
+ public boolean tryAdvance(IntConsumer consumer) {
+ return get().tryAdvance(consumer);
+ }
+
+ @Override
+ public void forEachRemaining(IntConsumer consumer) {
+ get().forEachRemaining(consumer);
+ }
+ }
+
+ static final class OfLong extends DelegatingSpliterator<Long> implements Spliterator.OfLong {
+ private Spliterator.OfLong s;
+
+ OfLong(Supplier<Spliterator.OfLong> supplier) {
+ super(supplier);
+ }
+
+ @Override
+ Spliterator.OfLong get() {
+ if (s == null) {
+ s = (Spliterator.OfLong) super.get();
+ }
+ return s;
+ }
+
+ @Override
+ public Spliterator.OfLong trySplit() {
+ return get().trySplit();
+ }
+
+ @Override
+ public boolean tryAdvance(LongConsumer consumer) {
+ return get().tryAdvance(consumer);
+ }
+
+ @Override
+ public void forEachRemaining(LongConsumer consumer) {
+ get().forEachRemaining(consumer);
+ }
+ }
+
+ static final class OfDouble extends DelegatingSpliterator<Double> implements Spliterator.OfDouble {
+ private Spliterator.OfDouble s;
+
+ OfDouble(Supplier<Spliterator.OfDouble> supplier) {
+ super(supplier);
+ }
+
+ @Override
+ Spliterator.OfDouble get() {
+ if (s == null) {
+ s = (Spliterator.OfDouble) super.get();
+ }
+ return s;
+ }
+
+ @Override
+ public Spliterator.OfDouble trySplit() {
+ return get().trySplit();
+ }
+
+ @Override
+ public boolean tryAdvance(DoubleConsumer consumer) {
+ return get().tryAdvance(consumer);
+ }
+
+ @Override
+ public void forEachRemaining(DoubleConsumer consumer) {
+ get().forEachRemaining(consumer);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/StreamSupport.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,511 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.function.Supplier;
+
+/**
+ * Low-level utility methods for creating and manipulating streams.
+ *
+ * <p>This class is mostly for library writers presenting stream views
+ * of their data structures; most static stream methods for end users are in
+ * {@link Streams}.
+ *
+ * <p>Unless otherwise stated, streams are created as sequential
+ * streams. A sequential stream can be transformed into a parallel stream by
+ * calling the {@code parallel()} method on the created stream.
+ *
+ * @since 1.8
+ */
+public class StreamSupport {
+ /**
+ * Creates a new sequential {@code Stream} from a {@code Spliterator}.
+ *
+ * <p>The spliterator is only traversed, split, or queried for estimated
+ * size after the terminal operation of the stream pipeline commences.
+ *
+ * <p>It is strongly recommended the spliterator report a characteristic of
+ * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+ * <a href="Spliterator.html#binding">late-binding</a>. Otherwise,
+ * {@link #stream(Supplier, int)} should be used to
+ * reduce the scope of potential interference with the source. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param <T> the type of stream elements
+ * @param spliterator a {@code Spliterator} describing the stream elements
+ * @return a new sequential {@code Stream}
+ */
+ public static <T> Stream<T> stream(Spliterator<T> spliterator) {
+ Objects.requireNonNull(spliterator);
+ return new ReferencePipeline.Head<>(spliterator,
+ StreamOpFlag.fromCharacteristics(spliterator),
+ false);
+ }
+
+ /**
+ * Creates a new parallel {@code Stream} from a {@code Spliterator}.
+ *
+ * <p>The spliterator is only traversed, split, or queried for estimated
+ * size after the terminal operation of the stream pipeline commences.
+ *
+ * <p>It is strongly recommended the spliterator report a characteristic of
+ * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+ * <a href="Spliterator.html#binding">late-binding</a>. Otherwise,
+ * {@link #stream(Supplier, int)} should be used to
+ * reduce the scope of potential interference with the source. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param <T> the type of stream elements
+ * @param spliterator a {@code Spliterator} describing the stream elements
+ * @return a new parallel {@code Stream}
+ */
+ public static <T> Stream<T> parallelStream(Spliterator<T> spliterator) {
+ Objects.requireNonNull(spliterator);
+ return new ReferencePipeline.Head<>(spliterator,
+ StreamOpFlag.fromCharacteristics(spliterator),
+ true);
+ }
+
+ /**
+ * Creates a new sequential {@code Stream} from a {@code Supplier} of
+ * {@code Spliterator}.
+ *
+ * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+ * more than once, and after the terminal operation of the stream pipeline
+ * commences.
+ *
+ * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+ * or {@code CONCURRENT}, or that are
+ * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+ * more efficient to use {@link #stream(java.util.Spliterator)} instead.
+ * The use of a {@code Supplier} in this form provides a level of
+ * indirection that reduces the scope of potential interference with the
+ * source. Since the supplier is only invoked after the terminal operation
+ * commences, any modifications to the source up to the start of the
+ * terminal operation are reflected in the stream result. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param <T> the type of stream elements
+ * @param supplier a {@code Supplier} of a {@code Spliterator}
+ * @param characteristics Spliterator characteristics of the supplied
+ * {@code Spliterator}. The characteristics must be equal to
+ * {@code source.get().getCharacteristics()}.
+ * @return a new sequential {@code Stream}
+ * @see #stream(Spliterator)
+ */
+ public static <T> Stream<T> stream(Supplier<? extends Spliterator<T>> supplier,
+ int characteristics) {
+ Objects.requireNonNull(supplier);
+ return new ReferencePipeline.Head<>(supplier,
+ StreamOpFlag.fromCharacteristics(characteristics),
+ false);
+ }
+
+ /**
+ * Creates a new parallel {@code Stream} from a {@code Supplier} of
+ * {@code Spliterator}.
+ *
+ * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+ * more than once, and after the terminal operation of the stream pipeline
+ * commences.
+ *
+ * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+ * or {@code CONCURRENT}, or that are
+ * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+ * more efficient to use {@link #stream(Spliterator)} instead.
+ * The use of a {@code Supplier} in this form provides a level of
+ * indirection that reduces the scope of potential interference with the
+ * source. Since the supplier is only invoked after the terminal operation
+ * commences, any modifications to the source up to the start of the
+ * terminal operation are reflected in the stream result. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param <T> the type of stream elements
+ * @param supplier a {@code Supplier} of a {@code Spliterator}
+ * @param characteristics Spliterator characteristics of the supplied
+ * {@code Spliterator}. The characteristics must be equal to
+ * {@code source.get().getCharacteristics()}
+ * @return a new parallel {@code Stream}
+ * @see #parallelStream(Spliterator)
+ */
+ public static <T> Stream<T> parallelStream(Supplier<? extends Spliterator<T>> supplier,
+ int characteristics) {
+ Objects.requireNonNull(supplier);
+ return new ReferencePipeline.Head<>(supplier,
+ StreamOpFlag.fromCharacteristics(characteristics),
+ true);
+ }
+
+ /**
+ * Creates a new sequential {@code IntStream} from a {@code Spliterator.OfInt}.
+ *
+ * <p>The spliterator is only traversed, split, or queried for estimated size
+ * after the terminal operation of the stream pipeline commences.
+ *
+ * <p>It is strongly recommended the spliterator report a characteristic of
+ * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+ * <a href="Spliterator.html#binding">late-binding</a>. Otherwise,
+ * {@link #stream(Supplier, int)}} should be used to
+ * reduce the scope of potential interference with the source. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param spliterator a {@code Spliterator.OfInt} describing the stream elements
+ * @return a new sequential {@code IntStream}
+ */
+ public static IntStream intStream(Spliterator.OfInt spliterator) {
+ return new IntPipeline.Head<>(spliterator,
+ StreamOpFlag.fromCharacteristics(spliterator),
+ false);
+ }
+
+ /**
+ * Creates a new parallel {@code IntStream} from a {@code Spliterator.OfInt}.
+ *
+ * <p>he spliterator is only traversed, split, or queried for estimated size
+ * after the terminal operation of the stream pipeline commences.
+ *
+ * <p>It is strongly recommended the spliterator report a characteristic of
+ * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+ * <a href="Spliterator.html#binding">late-binding</a>. Otherwise,
+ * {@link #stream(Supplier, int)}} should be used to
+ * reduce the scope of potential interference with the source. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param spliterator a {@code Spliterator.OfInt} describing the stream elements
+ * @return a new parallel {@code IntStream}
+ */
+ public static IntStream intParallelStream(Spliterator.OfInt spliterator) {
+ return new IntPipeline.Head<>(spliterator,
+ StreamOpFlag.fromCharacteristics(spliterator),
+ true);
+ }
+
+ /**
+ * Creates a new sequential {@code IntStream} from a {@code Supplier} of
+ * {@code Spliterator.OfInt}.
+ *
+ * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+ * more than once, and after the terminal operation of the stream pipeline
+ * commences.
+ *
+ * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+ * or {@code CONCURRENT}, or that are
+ * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+ * more efficient to use {@link #intStream(Spliterator.OfInt)} instead.
+ * The use of a {@code Supplier} in this form provides a level of
+ * indirection that reduces the scope of potential interference with the
+ * source. Since the supplier is only invoked after the terminal operation
+ * commences, any modifications to the source up to the start of the
+ * terminal operation are reflected in the stream result. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param supplier a {@code Supplier} of a {@code Spliterator.OfInt}
+ * @param characteristics Spliterator characteristics of the supplied
+ * {@code Spliterator.OfInt}. The characteristics must be equal to
+ * {@code source.get().getCharacteristics()}
+ * @return a new sequential {@code IntStream}
+ * @see #intStream(Spliterator.OfInt)
+ */
+ public static IntStream intStream(Supplier<? extends Spliterator.OfInt> supplier,
+ int characteristics) {
+ return new IntPipeline.Head<>(supplier,
+ StreamOpFlag.fromCharacteristics(characteristics),
+ false);
+ }
+
+ /**
+ * Creates a new parallel {@code IntStream} from a {@code Supplier} of
+ * {@code Spliterator.OfInt}.
+ *
+ * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+ * more than once, and after the terminal operation of the stream pipeline
+ * commences.
+ *
+ * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+ * or {@code CONCURRENT}, or that are
+ * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+ * more efficient to use {@link #intStream(Spliterator.OfInt)} instead.
+ * The use of a {@code Supplier} in this form provides a level of
+ * indirection that reduces the scope of potential interference with the
+ * source. Since the supplier is only invoked after the terminal operation
+ * commences, any modifications to the source up to the start of the
+ * terminal operation are reflected in the stream result. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param supplier a {@code Supplier} of a {@code Spliterator.OfInt}
+ * @param characteristics Spliterator characteristics of the supplied
+ * {@code Spliterator.OfInt}. The characteristics must be equal to
+ * {@code source.get().getCharacteristics()}
+ * @return a new parallel {@code IntStream}
+ * @see #intParallelStream(Spliterator.OfInt)
+ */
+ public static IntStream intParallelStream(Supplier<? extends Spliterator.OfInt> supplier,
+ int characteristics) {
+ return new IntPipeline.Head<>(supplier,
+ StreamOpFlag.fromCharacteristics(characteristics),
+ true);
+ }
+
+ /**
+ * Creates a new sequential {@code LongStream} from a {@code Spliterator.OfLong}.
+ *
+ * <p>The spliterator is only traversed, split, or queried for estimated
+ * size after the terminal operation of the stream pipeline commences.
+ *
+ * <p>It is strongly recommended the spliterator report a characteristic of
+ * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+ * <a href="Spliterator.html#binding">late-binding</a>. Otherwise,
+ * {@link #stream(Supplier, int)} should be used to
+ * reduce the scope of potential interference with the source. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param spliterator a {@code Spliterator.OfLong} describing the stream
+ * elements
+ * @return a new sequential {@code LongStream}
+ */
+ public static LongStream longStream(Spliterator.OfLong spliterator) {
+ return new LongPipeline.Head<>(spliterator,
+ StreamOpFlag.fromCharacteristics(spliterator),
+ false);
+ }
+
+ /**
+ * Creates a new parallel {@code LongStream} from a {@code Spliterator.OfLong}.
+ *
+ * <p>The spliterator is only traversed, split, or queried for estimated
+ * size after the terminal operation of the stream pipeline commences.
+ *
+ * <p>It is strongly recommended the spliterator report a characteristic of
+ * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+ * <a href="Spliterator.html#binding">late-binding</a>. Otherwise,
+ * {@link #stream(Supplier, int)} should be used to
+ * reduce the scope of potential interference with the source. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param spliterator a {@code Spliterator.OfLong} describing the stream elements
+ * @return a new parallel {@code LongStream}
+ */
+ public static LongStream longParallelStream(Spliterator.OfLong spliterator) {
+ return new LongPipeline.Head<>(spliterator,
+ StreamOpFlag.fromCharacteristics(spliterator),
+ true);
+ }
+
+ /**
+ * Creates a new sequential {@code LongStream} from a {@code Supplier} of
+ * {@code Spliterator.OfLong}.
+ *
+ * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+ * more than once, and after the terminal operation of the stream pipeline
+ * commences.
+ *
+ * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+ * or {@code CONCURRENT}, or that are
+ * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+ * more efficient to use {@link #longStream(Spliterator.OfLong)} instead.
+ * The use of a {@code Supplier} in this form provides a level of
+ * indirection that reduces the scope of potential interference with the
+ * source. Since the supplier is only invoked after the terminal operation
+ * commences, any modifications to the source up to the start of the
+ * terminal operation are reflected in the stream result. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param supplier a {@code Supplier} of a {@code Spliterator.OfLong}
+ * @param characteristics Spliterator characteristics of the supplied
+ * {@code Spliterator.OfLong}. The characteristics must be equal to
+ * {@code source.get().getCharacteristics()}
+ * @return a new sequential {@code LongStream}
+ * @see #longStream(Spliterator.OfLong)
+ */
+ public static LongStream longStream(Supplier<? extends Spliterator.OfLong> supplier,
+ int characteristics) {
+ return new LongPipeline.Head<>(supplier,
+ StreamOpFlag.fromCharacteristics(characteristics),
+ false);
+ }
+
+ /**
+ * Creates a new parallel {@code LongStream} from a {@code Supplier} of
+ * {@code Spliterator.OfLong}.
+ *
+ * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+ * more than once, and after the terminal operation of the stream pipeline
+ * commences.
+ *
+ * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+ * or {@code CONCURRENT}, or that are
+ * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+ * more efficient to use {@link #longStream(Spliterator.OfLong)} instead.
+ * The use of a {@code Supplier} in this form provides a level of
+ * indirection that reduces the scope of potential interference with the
+ * source. Since the supplier is only invoked after the terminal operation
+ * commences, any modifications to the source up to the start of the
+ * terminal operation are reflected in the stream result. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param supplier A {@code Supplier} of a {@code Spliterator.OfLong}
+ * @param characteristics Spliterator characteristics of the supplied
+ * {@code Spliterator.OfLong}. The characteristics must be equal to
+ * {@code source.get().getCharacteristics()}
+ * @return A new parallel {@code LongStream}
+ * @see #longParallelStream(Spliterator.OfLong)
+ */
+ public static LongStream longParallelStream(Supplier<? extends Spliterator.OfLong> supplier,
+ int characteristics) {
+ return new LongPipeline.Head<>(supplier,
+ StreamOpFlag.fromCharacteristics(characteristics),
+ true);
+ }
+
+ /**
+ * Creates a new sequential {@code DoubleStream} from a
+ * {@code Spliterator.OfDouble}.
+ *
+ * <p>The spliterator is only traversed, split, or queried for estimated size
+ * after the terminal operation of the stream pipeline commences.
+ *
+ * <p>It is strongly recommended the spliterator report a characteristic of
+ * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+ * <a href="Spliterator.html#binding">late-binding</a>. Otherwise,
+ * {@link #stream(Supplier, int)} should be used to
+ * reduce the scope of potential interference with the source. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param spliterator A {@code Spliterator.OfDouble} describing the stream elements
+ * @return A new sequential {@code DoubleStream}
+ */
+ public static DoubleStream doubleStream(Spliterator.OfDouble spliterator) {
+ return new DoublePipeline.Head<>(spliterator,
+ StreamOpFlag.fromCharacteristics(spliterator),
+ false);
+ }
+
+ /**
+ * Creates a new parallel {@code DoubleStream} from a
+ * {@code Spliterator.OfDouble}.
+ *
+ * <p>The spliterator is only traversed, split, or queried for estimated size
+ * after the terminal operation of the stream pipeline commences.
+ *
+ * <p>It is strongly recommended the spliterator report a characteristic of
+ * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+ * <a href="Spliterator.html#binding">late-binding</a>. Otherwise,
+ * {@link #stream(Supplier, int)} should be used to
+ * reduce the scope of potential interference with the source. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param spliterator A {@code Spliterator.OfDouble} describing the stream elements
+ * @return A new parallel {@code DoubleStream}
+ */
+ public static DoubleStream doubleParallelStream(Spliterator.OfDouble spliterator) {
+ return new DoublePipeline.Head<>(spliterator,
+ StreamOpFlag.fromCharacteristics(spliterator),
+ true);
+ }
+
+ /**
+ * Creates a new sequential {@code DoubleStream} from a {@code Supplier} of
+ * {@code Spliterator.OfDouble}.
+ * <p>
+ * The {@link Supplier#get()} method will be invoked on the supplier no
+ * more than once, and after the terminal operation of the stream pipeline
+ * commences.
+ * <p>
+ * For spliterators that report a characteristic of {@code IMMUTABLE}
+ * or {@code CONCURRENT}, or that are
+ * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+ * more efficient to use {@link #doubleStream(Spliterator.OfDouble)} instead.
+ * The use of a {@code Supplier} in this form provides a level of
+ * indirection that reduces the scope of potential interference with the
+ * source. Since the supplier is only invoked after the terminal operation
+ * commences, any modifications to the source up to the start of the
+ * terminal operation are reflected in the stream result. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param supplier A {@code Supplier} of a {@code Spliterator.OfDouble}
+ * @param characteristics Spliterator characteristics of the supplied
+ * {@code Spliterator.OfDouble}. The characteristics must be equal to
+ * {@code source.get().getCharacteristics()}
+ * @return A new sequential {@code DoubleStream}
+ * @see #doubleStream(Spliterator.OfDouble)
+ */
+ public static DoubleStream doubleStream(Supplier<? extends Spliterator.OfDouble> supplier,
+ int characteristics) {
+ return new DoublePipeline.Head<>(supplier,
+ StreamOpFlag.fromCharacteristics(characteristics),
+ false);
+ }
+
+ /**
+ * Creates a new parallel {@code DoubleStream} from a {@code Supplier} of
+ * {@code Spliterator.OfDouble}.
+ *
+ * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+ * more than once, and after the terminal operation of the stream pipeline
+ * commences.
+ *
+ * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+ * or {@code CONCURRENT}, or that are
+ * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+ * more efficient to use {@link #doubleStream(Spliterator.OfDouble)} instead.
+ * The use of a {@code Supplier} in this form provides a level of
+ * indirection that reduces the scope of potential interference with the
+ * source. Since the supplier is only invoked after the terminal operation
+ * commences, any modifications to the source up to the start of the
+ * terminal operation are reflected in the stream result. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * @param supplier a {@code Supplier} of a {@code Spliterator.OfDouble}
+ * @param characteristics Spliterator characteristics of the supplied
+ * {@code Spliterator.OfDouble}. The characteristics must be equal to
+ * {@code source.get().getCharacteristics()}
+ * @return a new parallel {@code DoubleStream}
+ * @see #doubleParallelStream(Spliterator.OfDouble)
+ */
+ public static DoubleStream doubleParallelStream(Supplier<? extends Spliterator.OfDouble> supplier,
+ int characteristics) {
+ return new DoublePipeline.Head<>(supplier,
+ StreamOpFlag.fromCharacteristics(characteristics),
+ true);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Streams.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,656 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiFunction;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.LongConsumer;
+
+/**
+ * Utility methods for operating on and creating streams.
+ *
+ * <p>Unless otherwise stated, streams are created as sequential streams. A
+ * sequential stream can be transformed into a parallel stream by calling the
+ * {@code parallel()} method on the created stream.
+ *
+ * @since 1.8
+ */
+class Streams {
+
+ private Streams() {
+ throw new Error("no instances");
+ }
+
+ /**
+ * An object instance representing no value, that cannot be an actual
+ * data element of a stream. Used when processing streams that can contain
+ * {@code null} elements to distinguish between a {@code null} value and no
+ * value.
+ */
+ static final Object NONE = new Object();
+
+ /**
+ * An {@code int} range spliterator.
+ */
+ static final class RangeIntSpliterator implements Spliterator.OfInt {
+ private int from;
+ private final int upTo;
+ private final int step;
+
+ RangeIntSpliterator(int from, int upTo, int step) {
+ this.from = from;
+ this.upTo = upTo;
+ this.step = step;
+ }
+
+ @Override
+ public boolean tryAdvance(IntConsumer consumer) {
+ boolean hasNext = from < upTo;
+ if (hasNext) {
+ consumer.accept(from);
+ from += step;
+ }
+ return hasNext;
+ }
+
+ @Override
+ public void forEachRemaining(IntConsumer consumer) {
+ int hUpTo = upTo;
+ int hStep = step; // hoist accesses and checks from loop
+ for (int i = from; i < hUpTo; i += hStep)
+ consumer.accept(i);
+ from = upTo;
+ }
+
+ @Override
+ public long estimateSize() {
+ int d = upTo - from;
+ return (d / step) + ((d % step == 0) ? 0 : 1);
+ }
+
+ @Override
+ public int characteristics() {
+ return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED |
+ Spliterator.IMMUTABLE | Spliterator.NONNULL |
+ Spliterator.DISTINCT | Spliterator.SORTED;
+ }
+
+ @Override
+ public Comparator<? super Integer> getComparator() {
+ return null;
+ }
+
+ @Override
+ public Spliterator.OfInt trySplit() {
+ return estimateSize() <= 1
+ ? null
+ : new RangeIntSpliterator(from, from = from + midPoint(), step);
+ }
+
+ private int midPoint() {
+ // Size is known to be >= 2
+ int bisection = (upTo - from) / 2;
+ // If bisection > step then round down to nearest multiple of step
+ // otherwise round up to step
+ return bisection > step ? bisection - bisection % step : step;
+ }
+ }
+
+ /**
+ * A {@code long} range spliterator.
+ */
+ static final class RangeLongSpliterator implements Spliterator.OfLong {
+ private long from;
+ private final long upTo;
+ private final long step;
+
+ RangeLongSpliterator(long from, long upTo, long step) {
+ this.from = from;
+ this.upTo = upTo;
+ this.step = step;
+ }
+
+ @Override
+ public boolean tryAdvance(LongConsumer consumer) {
+ boolean hasNext = from < upTo;
+ if (hasNext) {
+ consumer.accept(from);
+ from += step;
+ }
+ return hasNext;
+ }
+
+ @Override
+ public void forEachRemaining(LongConsumer consumer) {
+ long hUpTo = upTo;
+ long hStep = step; // hoist accesses and checks from loop
+ for (long i = from; i < hUpTo; i += hStep)
+ consumer.accept(i);
+ from = upTo;
+ }
+
+ @Override
+ public long estimateSize() {
+ long d = upTo - from;
+ return (d / step) + ((d % step == 0) ? 0 : 1);
+ }
+
+ @Override
+ public int characteristics() {
+ return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED |
+ Spliterator.IMMUTABLE | Spliterator.NONNULL |
+ Spliterator.DISTINCT | Spliterator.SORTED;
+ }
+
+ @Override
+ public Comparator<? super Long> getComparator() {
+ return null;
+ }
+
+ @Override
+ public Spliterator.OfLong trySplit() {
+ return estimateSize() <= 1
+ ? null
+ : new RangeLongSpliterator(from, from = from + midPoint(), step);
+ }
+
+ private long midPoint() {
+ // Size is known to be >= 2
+ long bisection = (upTo - from) / 2;
+ // If bisection > step then round down to nearest multiple of step
+ // otherwise round up to step
+ return bisection > step ? bisection - bisection % step : step;
+ }
+ }
+
+ /**
+ * A {@code double} range spliterator.
+ *
+ * <p>The traversing and splitting logic is equivalent to that of
+ * {@code RangeLongSpliterator} for increasing values with a {@code step} of
+ * {@code 1}.
+ *
+ * <p>A {@code double} value is calculated from the function
+ * {@code start + i * step} where {@code i} is the absolute position of the
+ * value when traversing an instance of this class that has not been split.
+ * This ensures the same values are produced at the same absolute positions
+ * regardless of how an instance of this class is split or traversed.
+ */
+ static final class RangeDoubleSpliterator implements Spliterator.OfDouble {
+ private final double from;
+ private final double upTo;
+ private final double step;
+
+ private long lFrom;
+ private final long lUpTo;
+
+ RangeDoubleSpliterator(double from, double upTo, double step, long lFrom, long lUpTo) {
+ this.from = from;
+ this.upTo = upTo;
+ this.step = step;
+ this.lFrom = lFrom;
+ this.lUpTo = lUpTo;
+ }
+
+ @Override
+ public boolean tryAdvance(DoubleConsumer consumer) {
+ boolean hasNext = lFrom < lUpTo;
+ if (hasNext) {
+ consumer.accept(from + lFrom * step);
+ lFrom++;
+ }
+ return hasNext;
+ }
+
+ @Override
+ public void forEachRemaining(DoubleConsumer consumer) {
+ double hOrigin = from;
+ double hStep = step;
+ long hLUpTo = lUpTo;
+ long i = lFrom;
+ for (; i < hLUpTo; i++) {
+ consumer.accept(hOrigin + i * hStep);
+ }
+ lFrom = i;
+ }
+
+ @Override
+ public long estimateSize() {
+ return lUpTo - lFrom;
+ }
+
+ @Override
+ public int characteristics() {
+ return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED |
+ Spliterator.IMMUTABLE | Spliterator.NONNULL |
+ Spliterator.DISTINCT | Spliterator.SORTED;
+ }
+
+ @Override
+ public Comparator<? super Double> getComparator() {
+ return null;
+ }
+
+ @Override
+ public Spliterator.OfDouble trySplit() {
+ return estimateSize() <= 1
+ ? null
+ : new RangeDoubleSpliterator(from, upTo, step, lFrom, lFrom = lFrom + midPoint());
+ }
+
+ private long midPoint() {
+ // Size is known to be >= 2
+ return (lUpTo - lFrom) / 2;
+ }
+ }
+
+ private static abstract class AbstractStreamBuilderImpl<T, S extends Spliterator<T>> implements Spliterator<T> {
+ // >= 0 when building, < 0 when built
+ // -1 == no elements
+ // -2 == one element, held by first
+ // -3 == two or more elements, held by buffer
+ int count;
+
+ // Spliterator implementation for 0 or 1 element
+ // count == -1 for no elements
+ // count == -2 for one element held by first
+
+ @Override
+ public S trySplit() {
+ return null;
+ }
+
+ @Override
+ public long estimateSize() {
+ return -count - 1;
+ }
+
+ @Override
+ public int characteristics() {
+ return Spliterator.SIZED | Spliterator.SUBSIZED |
+ Spliterator.ORDERED | Spliterator.IMMUTABLE;
+ }
+ }
+
+ static final class StreamBuilderImpl<T>
+ extends AbstractStreamBuilderImpl<T, Spliterator<T>>
+ implements StreamBuilder<T> {
+ // The first element in the stream
+ // valid if count == 1
+ T first;
+
+ // The first and subsequent elements in the stream
+ // non-null if count == 2
+ SpinedBuffer<T> buffer;
+
+ /**
+ * Constructor for building a stream of 0 or more elements.
+ */
+ StreamBuilderImpl() { }
+
+ /**
+ * Constructor for a singleton stream.
+ *
+ * @param t the single element
+ */
+ StreamBuilderImpl(T t) {
+ first = t;
+ count = -2;
+ }
+
+ // StreamBuilder implementation
+
+ @Override
+ public void accept(T t) {
+ if (count == 0) {
+ first = t;
+ count++;
+ }
+ else if (count > 0) {
+ if (buffer == null) {
+ buffer = new SpinedBuffer<>();
+ buffer.accept(first);
+ count++;
+ }
+
+ buffer.accept(t);
+ }
+ else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public StreamBuilder<T> add(T t) {
+ accept(t);
+ return this;
+ }
+
+ @Override
+ public Stream<T> build() {
+ int c = count;
+ if (c >= 0) {
+ // Switch count to negative value signalling the builder is built
+ count = -count - 1;
+ // Use this spliterator if 0 or 1 elements, otherwise use
+ // the spliterator of the spined buffer
+ return (c < 2) ? StreamSupport.stream(this) : StreamSupport.stream(buffer.spliterator());
+ }
+
+ throw new IllegalStateException();
+ }
+
+ // Spliterator implementation for 0 or 1 element
+ // count == -1 for no elements
+ // count == -2 for one element held by first
+
+ @Override
+ public boolean tryAdvance(Consumer<? super T> action) {
+ if (count == -2) {
+ action.accept(first);
+ count = -1;
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public void forEachRemaining(Consumer<? super T> action) {
+ if (count == -2) {
+ action.accept(first);
+ count = -1;
+ }
+ }
+ }
+
+ static final class IntStreamBuilderImpl
+ extends AbstractStreamBuilderImpl<Integer, Spliterator.OfInt>
+ implements StreamBuilder.OfInt, Spliterator.OfInt {
+ // The first element in the stream
+ // valid if count == 1
+ int first;
+
+ // The first and subsequent elements in the stream
+ // non-null if count == 2
+ SpinedBuffer.OfInt buffer;
+
+ /**
+ * Constructor for building a stream of 0 or more elements.
+ */
+ IntStreamBuilderImpl() { }
+
+ /**
+ * Constructor for a singleton stream.
+ *
+ * @param t the single element
+ */
+ IntStreamBuilderImpl(int t) {
+ first = t;
+ count = -2;
+ }
+
+ // StreamBuilder implementation
+
+ @Override
+ public void accept(int t) {
+ if (count == 0) {
+ first = t;
+ count++;
+ }
+ else if (count > 0) {
+ if (buffer == null) {
+ buffer = new SpinedBuffer.OfInt();
+ buffer.accept(first);
+ count++;
+ }
+
+ buffer.accept(t);
+ }
+ else {
+ throw new IllegalStateException();
+ }
+ }
+
+ @Override
+ public IntStream build() {
+ int c = count;
+ if (c >= 0) {
+ // Switch count to negative value signalling the builder is built
+ count = -count - 1;
+ // Use this spliterator if 0 or 1 elements, otherwise use
+ // the spliterator of the spined buffer
+ return (c < 2) ? StreamSupport.intStream(this) : StreamSupport.intStream(buffer.spliterator());
+ }
+
+ throw new IllegalStateException();
+ }
+
+ // Spliterator implementation for 0 or 1 element
+ // count == -1 for no elements
+ // count == -2 for one element held by first
+
+ @Override
+ public boolean tryAdvance(IntConsumer action) {
+ if (count == -2) {
+ action.accept(first);
+ count = -1;
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public void forEachRemaining(IntConsumer action) {
+ if (count == -2) {
+ action.accept(first);
+ count = -1;
+ }
+ }
+ }
+
+ static final class LongStreamBuilderImpl
+ extends AbstractStreamBuilderImpl<Long, Spliterator.OfLong>
+ implements StreamBuilder.OfLong, Spliterator.OfLong {
+ // The first element in the stream
+ // valid if count == 1
+ long first;
+
+ // The first and subsequent elements in the stream
+ // non-null if count == 2
+ SpinedBuffer.OfLong buffer;
+
+ /**
+ * Constructor for building a stream of 0 or more elements.
+ */
+ LongStreamBuilderImpl() { }
+
+ /**
+ * Constructor for a singleton stream.
+ *
+ * @param t the single element
+ */
+ LongStreamBuilderImpl(long t) {
+ first = t;
+ count = -2;
+ }
+
+ // StreamBuilder implementation
+
+ @Override
+ public void accept(long t) {
+ if (count == 0) {
+ first = t;
+ count++;
+ }
+ else if (count > 0) {
+ if (buffer == null) {
+ buffer = new SpinedBuffer.OfLong();
+ buffer.accept(first);
+ count++;
+ }
+
+ buffer.accept(t);
+ }
+ else {
+ throw new IllegalStateException();
+ }
+ }
+
+ @Override
+ public LongStream build() {
+ int c = count;
+ if (c >= 0) {
+ // Switch count to negative value signalling the builder is built
+ count = -count - 1;
+ // Use this spliterator if 0 or 1 elements, otherwise use
+ // the spliterator of the spined buffer
+ return (c < 2) ? StreamSupport.longStream(this) : StreamSupport.longStream(buffer.spliterator());
+ }
+
+ throw new IllegalStateException();
+ }
+
+ // Spliterator implementation for 0 or 1 element
+ // count == -1 for no elements
+ // count == -2 for one element held by first
+
+ @Override
+ public boolean tryAdvance(LongConsumer action) {
+ if (count == -2) {
+ action.accept(first);
+ count = -1;
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public void forEachRemaining(LongConsumer action) {
+ if (count == -2) {
+ action.accept(first);
+ count = -1;
+ }
+ }
+ }
+
+ static final class DoubleStreamBuilderImpl
+ extends AbstractStreamBuilderImpl<Double, Spliterator.OfDouble>
+ implements StreamBuilder.OfDouble, Spliterator.OfDouble {
+ // The first element in the stream
+ // valid if count == 1
+ double first;
+
+ // The first and subsequent elements in the stream
+ // non-null if count == 2
+ SpinedBuffer.OfDouble buffer;
+
+ /**
+ * Constructor for building a stream of 0 or more elements.
+ */
+ DoubleStreamBuilderImpl() { }
+
+ /**
+ * Constructor for a singleton stream.
+ *
+ * @param t the single element
+ */
+ DoubleStreamBuilderImpl(double t) {
+ first = t;
+ count = -2;
+ }
+
+ // StreamBuilder implementation
+
+ @Override
+ public void accept(double t) {
+ if (count == 0) {
+ first = t;
+ count++;
+ }
+ else if (count > 0) {
+ if (buffer == null) {
+ buffer = new SpinedBuffer.OfDouble();
+ buffer.accept(first);
+ count++;
+ }
+
+ buffer.accept(t);
+ }
+ else {
+ throw new IllegalStateException();
+ }
+ }
+
+ @Override
+ public DoubleStream build() {
+ int c = count;
+ if (c >= 0) {
+ // Switch count to negative value signalling the builder is built
+ count = -count - 1;
+ // Use this spliterator if 0 or 1 elements, otherwise use
+ // the spliterator of the spined buffer
+ return (c < 2) ? StreamSupport.doubleStream(this) : StreamSupport.doubleStream(buffer.spliterator());
+ }
+
+ throw new IllegalStateException();
+ }
+
+ // Spliterator implementation for 0 or 1 element
+ // count == -1 for no elements
+ // count == -2 for one element held by first
+
+ @Override
+ public boolean tryAdvance(DoubleConsumer action) {
+ if (count == -2) {
+ action.accept(first);
+ count = -1;
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public void forEachRemaining(DoubleConsumer action) {
+ if (count == -2) {
+ action.accept(first);
+ count = -1;
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/TerminalOp.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Spliterator;
+
+/**
+ * An operation in a stream pipeline that takes a stream as input and produces
+ * a result or side-effect. A {@code TerminalOp} has an input type and stream
+ * shape, and a result type. A {@code TerminalOp} also has a set of
+ * <em>operation flags</em> that describes how the operation processes elements
+ * of the stream (such as short-circuiting or respecting encounter order; see
+ * {@link StreamOpFlag}).
+ *
+ * <p>A {@code TerminalOp} must provide a sequential and parallel implementation
+ * of the operation relative to a given stream source and set of intermediate
+ * operations.
+ *
+ * @param <E_IN> the type of input elements
+ * @param <R> the type of the result
+ * @since 1.8
+ */
+interface TerminalOp<E_IN, R> {
+ /**
+ * Gets the shape of the input type of this operation.
+ *
+ * @implSpec The default returns {@code StreamShape.REFERENCE}.
+ *
+ * @return StreamShape of the input type of this operation
+ */
+ default StreamShape inputShape() { return StreamShape.REFERENCE; }
+
+ /**
+ * Gets the stream flags of the operation. Terminal operations may set a
+ * limited subset of the stream flags defined in {@link StreamOpFlag}, and
+ * these flags are combined with the previously combined stream and
+ * intermediate operation flags for the pipeline.
+ *
+ * @implSpec The default implementation returns zero.
+ *
+ * @return the stream flags for this operation
+ * @see StreamOpFlag
+ */
+ default int getOpFlags() { return 0; }
+
+ /**
+ * Performs a parallel evaluation of the operation using the specified
+ * {@code PipelineHelper}, which describes the upstream intermediate
+ * operations.
+ *
+ * @implSpec The default performs a sequential evaluation of the operation
+ * using the specified {@code PipelineHelper}.
+ *
+ * @param helper the pipeline helper
+ * @param spliterator the source spliterator
+ * @return the result of the evaluation
+ */
+ default <P_IN> R evaluateParallel(PipelineHelper<E_IN> helper,
+ Spliterator<P_IN> spliterator) {
+ if (Tripwire.ENABLED)
+ Tripwire.trip(getClass(), "{0} triggering TerminalOp.evaluateParallel serial default");
+ return evaluateSequential(helper, spliterator);
+ }
+
+ /**
+ * Performs a sequential evaluation of the operation using the specified
+ * {@code PipelineHelper}, which describes the upstream intermediate
+ * operations.
+ *
+ * @param helper the pipeline helper
+ * @param spliterator the source spliterator
+ * @return the result of the evaluation
+ */
+ <P_IN> R evaluateSequential(PipelineHelper<E_IN> helper,
+ Spliterator<P_IN> spliterator);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/TerminalSink.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.function.Supplier;
+
+/**
+ * A {@link Sink} which accumulates state as elements are accepted, and allows
+ * a result to be retrieved after the computation is finished.
+ *
+ * @param <T> the type of elements to be accepted
+ * @param <R> the type of the result
+ *
+ * @since 1.8
+ */
+interface TerminalSink<T, R> extends Sink<T>, Supplier<R> { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Tripwire.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import sun.util.logging.PlatformLogger;
+
+/**
+ * Utility class for detecting inadvertent uses of boxing in
+ * {@code java.util.stream} classes. The detection is turned on or off based on
+ * whether the system property {@code org.openjdk.java.util.stream.tripwire} is
+ * considered {@code true} according to {@link Boolean#getBoolean(String)}.
+ * This should normally be turned off for production use.
+ *
+ * @apiNote
+ * Typical usage would be for boxing code to do:
+ * <pre>{@code
+ * if (Tripwire.ENABLED)
+ * Tripwire.trip(getClass(), "{0} calling Sink.OfInt.accept(Integer)");
+ * }</pre>
+ *
+ * @since 1.8
+ */
+final class Tripwire {
+ private static final String TRIPWIRE_PROPERTY = "org.openjdk.java.util.stream.tripwire";
+
+ /** Should debugging checks be enabled? */
+ static final boolean ENABLED = AccessController.doPrivileged(
+ (PrivilegedAction<Boolean>) () -> Boolean.getBoolean(TRIPWIRE_PROPERTY));
+
+ private Tripwire() { }
+
+ /**
+ * Produces a log warning, using {@code PlatformLogger.getLogger(className)},
+ * using the supplied message. The class name of {@code trippingClass} will
+ * be used as the first parameter to the message.
+ *
+ * @param trippingClass Name of the class generating the message
+ * @param msg A message format string of the type expected by
+ * {@link PlatformLogger}
+ */
+ static void trip(Class<?> trippingClass, String msg) {
+ PlatformLogger.getLogger(trippingClass.getName()).warning(msg, trippingClass.getName());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/package-info.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,566 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * <h1>java.util.stream</h1>
+ *
+ * Classes to support functional-style operations on streams of values, as in the following:
+ *
+ * <pre>{@code
+ * int sumOfWeights = blocks.stream().filter(b -> b.getColor() == RED)
+ * .mapToInt(b -> b.getWeight())
+ * .sum();
+ * }</pre>
+ *
+ * <p>Here we use {@code blocks}, which might be a {@code Collection}, as a source for a stream,
+ * and then perform a filter-map-reduce ({@code sum()} is an example of a <a href="package-summary.html#Reduction">reduction</a>
+ * operation) on the stream to obtain the sum of the weights of the red blocks.
+ *
+ * <p>The key abstraction used in this approach is {@link java.util.stream.Stream}, as well as its primitive
+ * specializations {@link java.util.stream.IntStream}, {@link java.util.stream.LongStream},
+ * and {@link java.util.stream.DoubleStream}. Streams differ from Collections in several ways:
+ *
+ * <ul>
+ * <li>No storage. A stream is not a data structure that stores elements; instead, they
+ * carry values from a source (which could be a data structure, a generator, an IO channel, etc)
+ * through a pipeline of computational operations.</li>
+ * <li>Functional in nature. An operation on a stream produces a result, but does not modify
+ * its underlying data source. For example, filtering a {@code Stream} produces a new {@code Stream},
+ * rather than removing elements from the underlying source.</li>
+ * <li>Laziness-seeking. Many stream operations, such as filtering, mapping, or duplicate removal,
+ * can be implemented lazily, exposing opportunities for optimization. (For example, "find the first
+ * {@code String} matching a pattern" need not examine all the input strings.) Stream operations
+ * are divided into intermediate ({@code Stream}-producing) operations and terminal (value-producing)
+ * operations; all intermediate operations are lazy.</li>
+ * <li>Possibly unbounded. While collections have a finite size, streams need not. Operations
+ * such as {@code limit(n)} or {@code findFirst()} can allow computations on infinite streams
+ * to complete in finite time.</li>
+ * </ul>
+ *
+ * <h2><a name="StreamPipelines">Stream pipelines</a></h2>
+ *
+ * <p>Streams are used to create <em>pipelines</em> of <a href="package-summary.html#StreamOps">operations</a>. A
+ * complete stream pipeline has several components: a source (which may be a {@code Collection},
+ * an array, a generator function, or an IO channel); zero or more <em>intermediate operations</em>
+ * such as {@code Stream.filter} or {@code Stream.map}; and a <em>terminal operation</em> such
+ * as {@code Stream.forEach} or {@code java.util.stream.Stream.reduce}. Stream operations may take as parameters
+ * <em>function values</em> (which are often lambda expressions, but could be method references
+ * or objects) which parameterize the behavior of the operation, such as a {@code Predicate}
+ * passed to the {@code Stream#filter} method.
+ *
+ * <p>Intermediate operations return a new {@code Stream}. They are lazy; executing an
+ * intermediate operation such as {@link java.util.stream.Stream#filter Stream.filter} does
+ * not actually perform any filtering, instead creating a new {@code Stream} that, when
+ * traversed, contains the elements of the initial {@code Stream} that match the
+ * given {@code Predicate}. Consuming elements from the stream source does not
+ * begin until the terminal operation is executed.
+ *
+ * <p>Terminal operations consume the {@code Stream} and produce a result or a side-effect.
+ * After a terminal operation is performed, the stream can no longer be used and you must
+ * return to the data source, or select a new data source, to get a new stream. For example,
+ * obtaining the sum of weights of all red blocks, and then of all blue blocks, requires a
+ * filter-map-reduce on two different streams:
+ * <pre>{@code
+ * int sumOfRedWeights = blocks.stream().filter(b -> b.getColor() == RED)
+ * .mapToInt(b -> b.getWeight())
+ * .sum();
+ * int sumOfBlueWeights = blocks.stream().filter(b -> b.getColor() == BLUE)
+ * .mapToInt(b -> b.getWeight())
+ * .sum();
+ * }</pre>
+ *
+ * <p>However, there are other techniques that allow you to obtain both results in a single
+ * pass if multiple traversal is impractical or inefficient. TODO provide link
+ *
+ * <h3><a name="StreamOps">Stream operations</a></h3>
+ *
+ * <p>Intermediate stream operation (such as {@code filter} or {@code sorted}) always produce a
+ * new {@code Stream}, and are always<em>lazy</em>. Executing a lazy operations does not
+ * trigger processing of the stream contents; all processing is deferred until the terminal
+ * operation commences. Processing streams lazily allows for significant efficiencies; in a
+ * pipeline such as the filter-map-sum example above, filtering, mapping, and addition can be
+ * fused into a single pass, with minimal intermediate state. Laziness also enables us to avoid
+ * examining all the data when it is not necessary; for operations such as "find the first
+ * string longer than 1000 characters", one need not examine all the input strings, just enough
+ * to find one that has the desired characteristics. (This behavior becomes even more important
+ * when the input stream is infinite and not merely large.)
+ *
+ * <p>Intermediate operations are further divided into <em>stateless</em> and <em>stateful</em>
+ * operations. Stateless operations retain no state from previously seen values when processing
+ * a new value; examples of stateless intermediate operations include {@code filter} and
+ * {@code map}. Stateful operations may incorporate state from previously seen elements in
+ * processing new values; examples of stateful intermediate operations include {@code distinct}
+ * and {@code sorted}. Stateful operations may need to process the entire input before
+ * producing a result; for example, one cannot produce any results from sorting a stream until
+ * one has seen all elements of the stream. As a result, under parallel computation, some
+ * pipelines containing stateful intermediate operations have to be executed in multiple passes.
+ * Pipelines containing exclusively stateless intermediate operations can be processed in a
+ * single pass, whether sequential or parallel.
+ *
+ * <p>Further, some operations are deemed <em>short-circuiting</em> operations. An intermediate
+ * operation is short-circuiting if, when presented with infinite input, it may produce a
+ * finite stream as a result. A terminal operation is short-circuiting if, when presented with
+ * infinite input, it may terminate in finite time. (Having a short-circuiting operation is a
+ * necessary, but not sufficient, condition for the processing of an infinite stream to
+ * terminate normally in finite time.)
+ *
+ * Terminal operations (such as {@code forEach} or {@code findFirst}) are always eager
+ * (they execute completely before returning), and produce a non-{@code Stream} result, such
+ * as a primitive value or a {@code Collection}, or have side-effects.
+ *
+ * <h3>Parallelism</h3>
+ *
+ * <p>By recasting aggregate operations as a pipeline of operations on a stream of values, many
+ * aggregate operations can be more easily parallelized. A {@code Stream} can execute either
+ * in serial or in parallel. When streams are created, they are either created as sequential
+ * or parallel streams; the parallel-ness of streams can also be switched by the
+ * {@link java.util.stream Stream#sequential()} and {@link java.util.stream.Stream#parallel()}
+ * operations. The {@code Stream} implementations in the JDK create serial streams unless
+ * parallelism is explicitly requested. For example, {@code Collection} has methods
+ * {@link java.util.Collection#stream} and {@link java.util.Collection#parallelStream},
+ * which produce sequential and parallel streams respectively; other stream-bearing methods
+ * such as {@link java.util.stream.Streams#intRange(int, int)} produce sequential
+ * streams but these can be efficiently parallelized by calling {@code parallel()} on the
+ * result. The set of operations on serial and parallel streams is identical. To execute the
+ * "sum of weights of blocks" query in parallel, we would do:
+ *
+ * <pre>{@code
+ * int sumOfWeights = blocks.parallelStream().filter(b -> b.getColor() == RED)
+ * .mapToInt(b -> b.getWeight())
+ * .sum();
+ * }</pre>
+ *
+ * <p>The only difference between the serial and parallel versions of this example code is
+ * the creation of the initial {@code Stream}. Whether a {@code Stream} will execute in serial
+ * or parallel can be determined by the {@code Stream#isParallel} method. When the terminal
+ * operation is initiated, the entire stream pipeline is either executed sequentially or in
+ * parallel, determined by the last operation that affected the stream's serial-parallel
+ * orientation (which could be the stream source, or the {@code sequential()} or
+ * {@code parallel()} methods.)
+ *
+ * <p>In order for the results of parallel operations to be deterministic and consistent with
+ * their serial equivalent, the function values passed into the various stream operations should
+ * be <a href="#NonInteference"><em>stateless</em></a>.
+ *
+ * <h3><a name="Ordering">Ordering</a></h3>
+ *
+ * <p>Streams may or may not have an <em>encounter order</em>. An encounter
+ * order specifies the order in which elements are provided by the stream to the
+ * operations pipeline. Whether or not there is an encounter order depends on
+ * the source, the intermediate operations, and the terminal operation.
+ * Certain stream sources (such as {@code List} or arrays) are intrinsically
+ * ordered, whereas others (such as {@code HashSet}) are not. Some intermediate
+ * operations may impose an encounter order on an otherwise unordered stream,
+ * such as {@link java.util.stream.Stream#sorted()}, and others may render an
+ * ordered stream unordered (such as {@link java.util.stream.Stream#unordered()}).
+ * Some terminal operations may ignore encounter order, such as
+ * {@link java.util.stream.Stream#forEach}.
+ *
+ * <p>If a Stream is ordered, most operations are constrained to operate on the
+ * elements in their encounter order; if the source of a stream is a {@code List}
+ * containing {@code [1, 2, 3]}, then the result of executing {@code map(x -> x*2)}
+ * must be {@code [2, 4, 6]}. However, if the source has no defined encounter
+ * order, than any of the six permutations of the values {@code [2, 4, 6]} would
+ * be a valid result. Many operations can still be efficiently parallelized even
+ * under ordering constraints.
+ *
+ * <p>For sequential streams, ordering is only relevant to the determinism
+ * of operations performed repeatedly on the same source. (An {@code ArrayList}
+ * is constrained to iterate elements in order; a {@code HashSet} is not, and
+ * repeated iteration might produce a different order.)
+ *
+ * <p>For parallel streams, relaxing the ordering constraint can enable
+ * optimized implementation for some operations. For example, duplicate
+ * filtration on an ordered stream must completely process the first partition
+ * before it can return any elements from a subsequent partition, even if those
+ * elements are available earlier. On the other hand, without the constraint of
+ * ordering, duplicate filtration can be done more efficiently by using
+ * a shared {@code ConcurrentHashSet}. There will be cases where the stream
+ * is structurally ordered (the source is ordered and the intermediate
+ * operations are order-preserving), but the user does not particularly care
+ * about the encounter order. In some cases, explicitly de-ordering the stream
+ * with the {@link java.util.stream.Stream#unordered()} method may result in
+ * improved parallel performance for some stateful or terminal operations.
+ *
+ * <h3><a name="Non-Interference">Non-interference</a></h3>
+ *
+ * The {@code java.util.stream} package enables you to execute possibly-parallel
+ * bulk-data operations over a variety of data sources, including even non-thread-safe
+ * collections such as {@code ArrayList}. This is possible only if we can
+ * prevent <em>interference</em> with the data source during the execution of a
+ * stream pipeline. (Execution begins when the terminal operation is invoked, and ends
+ * when the terminal operation completes.) For most data sources, preventing interference
+ * means ensuring that the data source is <em>not modified at all</em> during the execution
+ * of the stream pipeline. (Some data sources, such as concurrent collections, are
+ * specifically designed to handle concurrent modification.)
+ *
+ * <p>Accordingly, lambda expressions (or other objects implementing the appropriate functional
+ * interface) passed to stream methods should never modify the stream's data source. An
+ * implementation is said to <em>interfere</em> with the data source if it modifies, or causes
+ * to be modified, the stream's data source. The need for non-interference applies to all
+ * pipelines, not just parallel ones. Unless the stream source is concurrent, modifying a
+ * stream's data source during execution of a stream pipeline can cause exceptions, incorrect
+ * answers, or nonconformant results.
+ *
+ * <p>Further, results may be nondeterministic or incorrect if the lambda expressions passed to
+ * stream operations are <em>stateful</em>. A stateful lambda (or other object implementing the
+ * appropriate functional interface) is one whose result depends on any state which might change
+ * during the execution of the stream pipeline. An example of a stateful lambda is:
+ * <pre>{@code
+ * Set<Integer> seen = Collections.synchronizedSet(new HashSet<>());
+ * stream.parallel().map(e -> { if (seen.add(e)) return 0; else return e; })...
+ * }</pre>
+ * Here, if the mapping operation is performed in parallel, the results for the same input
+ * could vary from run to run, due to thread scheduling differences, whereas, with a stateless
+ * lambda expression the results would always be the same.
+ *
+ * <h3>Side-effects</h3>
+ *
+ * <h2><a name="Reduction">Reduction operations</a></h2>
+ *
+ * A <em>reduction</em> operation takes a stream of elements and processes them in a way
+ * that reduces to a single value or summary description, such as finding the sum or maximum
+ * of a set of numbers. (In more complex scenarios, the reduction operation might need to
+ * extract data from the elements before reducing that data to a single value, such as
+ * finding the sum of weights of a set of blocks. This would require extracting the weight
+ * from each block before summing up the weights.)
+ *
+ * <p>Of course, such operations can be readily implemented as simple sequential loops, as in:
+ * <pre>{@code
+ * int sum = 0;
+ * for (int x : numbers) {
+ * sum += x;
+ * }
+ * }</pre>
+ * However, there may be a significant advantage to preferring a {@link java.util.stream.Stream#reduce reduce operation}
+ * over a mutative accumulation such as the above -- a properly constructed reduce operation is
+ * inherently parallelizable so long as the
+ * {@link java.util.function.BinaryOperator reduction operaterator}
+ * has the right characteristics. Specifically the operator must be
+ * <a href="#Associativity">associative</a>. For example, given a
+ * stream of numbers for which we want to find the sum, we can write:
+ * <pre>{@code
+ * int sum = numbers.reduce(0, (x,y) -> x+y);
+ * }</pre>
+ * or more succinctly:
+ * <pre>{@code
+ * int sum = numbers.reduce(0, Integer::sum);
+ * }</pre>
+ *
+ * <p>(The primitive specializations of {@link java.util.stream.Stream}, such as
+ * {@link java.util.stream.IntStream}, even have convenience methods for common reductions,
+ * such as {@link java.util.stream.IntStream#sum() sum} and {@link java.util.stream.IntStream#max() max},
+ * which are implemented as simple wrappers around reduce.)
+ *
+ * <p>Reduction parallellizes well since the implementation of {@code reduce} can operate on
+ * subsets of the stream in parallel, and then combine the intermediate results to get the final
+ * correct answer. Even if you were to use a parallelizable form of the
+ * {@link java.util.stream.Stream#forEach(Consumer) forEach()} method
+ * in place of the original for-each loop above, you would still have to provide thread-safe
+ * updates to the shared accumulating variable {@code sum}, and the required synchronization
+ * would likely eliminate any performance gain from parallelism. Using a {@code reduce} method
+ * instead removes all of the burden of parallelizing the reduction operation, and the library
+ * can provide an efficient parallel implementation with no additional synchronization needed.
+ *
+ * <p>The "blocks" examples shown earlier shows how reduction combines with other operations
+ * to replace for loops with bulk operations. If {@code blocks} is a collection of {@code Block}
+ * objects, which have a {@code getWeight} method, we can find the heaviest block with:
+ * <pre>{@code
+ * OptionalInt heaviest = blocks.stream()
+ * .mapToInt(Block::getWeight)
+ * .reduce(Integer::max);
+ * }</pre>
+ *
+ * <p>In its more general form, a {@code reduce} operation on elements of type {@code <T>}
+ * yielding a result of type {@code <U>} requires three parameters:
+ * <pre>{@code
+ * <U> U reduce(U identity,
+ * BiFunction<U, ? super T, U> accumlator,
+ * BinaryOperator<U> combiner);
+ * }</pre>
+ * Here, the <em>identity</em> element is both an initial seed for the reduction, and a default
+ * result if there are no elements. The <em>accumulator</em> function takes a partial result and
+ * the next element, and produce a new partial result. The <em>combiner</em> function combines
+ * the partial results of two accumulators to produce a new partial result, and eventually the
+ * final result.
+ *
+ * <p>This form is a generalization of the two-argument form, and is also a generalization of
+ * the map-reduce construct illustrated above. If we wanted to re-cast the simple {@code sum}
+ * example using the more general form, {@code 0} would be the identity element, while
+ * {@code Integer::sum} would be both the accumulator and combiner. For the sum-of-weights
+ * example, this could be re-cast as:
+ * <pre>{@code
+ * int sumOfWeights = blocks.stream().reduce(0,
+ * (sum, b) -> sum + b.getWeight())
+ * Integer::sum);
+ * }</pre>
+ * though the map-reduce form is more readable and generally preferable. The generalized form
+ * is provided for cases where significant work can be optimized away by combining mapping and
+ * reducing into a single function.
+ *
+ * <p>More formally, the {@code identity} value must be an <em>identity</em> for the combiner
+ * function. This means that for all {@code u}, {@code combiner.apply(identity, u)} is equal
+ * to {@code u}. Additionally, the {@code combiner} function must be
+ * <a href="#Associativity">associative</a> and must be compatible with the {@code accumulator}
+ * function; for all {@code u} and {@code t}, the following must hold:
+ * <pre>{@code
+ * combiner.apply(u, accumulator.apply(identity, t)) == accumulator.apply(u, t)
+ * }</pre>
+ *
+ * <h3><a name="MutableReduction">Mutable Reduction</a></h3>
+ *
+ * A <em>mutable</em> reduction operation is similar to an ordinary reduction, in that it reduces
+ * a stream of values to a single value, but instead of producing a distinct single-valued result, it
+ * mutates a general <em>result container</em>, such as a {@code Collection} or {@code StringBuilder},
+ * as it processes the elements in the stream.
+ *
+ * <p>For example, if we wanted to take a stream of strings and concatenate them into a single
+ * long string, we <em>could</em> achieve this with ordinary reduction:
+ * <pre>{@code
+ * String concatenated = strings.reduce("", String::concat)
+ * }</pre>
+ *
+ * We would get the desired result, and it would even work in parallel. However, we might not
+ * be happy about the performance! Such an implementation would do a great deal of string
+ * copying, and the run time would be <em>O(n^2)</em> in the number of elements. A more
+ * performant approach would be to accumulate the results into a {@link java.lang.StringBuilder}, which
+ * is a mutable container for accumulating strings. We can use the same technique to
+ * parallelize mutable reduction as we do with ordinary reduction.
+ *
+ * <p>The mutable reduction operation is called {@link java.util.stream.Stream#collect(Collector) collect()}, as it
+ * collects together the desired results into a result container such as {@code StringBuilder}.
+ * A {@code collect} operation requires three things: a factory function which will construct
+ * new instances of the result container, an accumulating function that will update a result
+ * container by incorporating a new element, and a combining function that can take two
+ * result containers and merge their contents. The form of this is very similar to the general
+ * form of ordinary reduction:
+ * <pre>{@code
+ * <R> R collect(Supplier<R> resultFactory,
+ * BiConsumer<R, ? super T> accumulator,
+ * BiConsumer<R, R> combiner);
+ * }</pre>
+ * As with {@code reduce()}, the benefit of expressing {@code collect} in this abstract way is
+ * that it is directly amenable to parallelization: we can accumulate partial results in parallel
+ * and then combine them. For example, to collect the String representations of the elements
+ * in a stream into an {@code ArrayList}, we could write the obvious sequential for-each form:
+ * <pre>{@code
+ * ArrayList<String> strings = new ArrayList<>();
+ * for (T element : stream) {
+ * strings.add(element.toString());
+ * }
+ * }</pre>
+ * Or we could use a parallelizable collect form:
+ * <pre>{@code
+ * ArrayList<String> strings = stream.collect(() -> new ArrayList<>(),
+ * (c, e) -> c.add(e.toString()),
+ * (c1, c2) -> c1.addAll(c2));
+ * }</pre>
+ * or, noting that we have buried a mapping operation inside the accumulator function, more
+ * succinctly as:
+ * <pre>{@code
+ * ArrayList<String> strings = stream.map(Object::toString)
+ * .collect(ArrayList::new, ArrayList::add, ArrayList::addAll);
+ * }</pre>
+ * Here, our supplier is just the {@link java.util.ArrayList#ArrayList() ArrayList constructor}, the
+ * accumulator adds the stringified element to an {@code ArrayList}, and the combiner simply
+ * uses {@link java.util.ArrayList#addAll addAll} to copy the strings from one container into the other.
+ *
+ * <p>As with the regular reduction operation, the ability to parallelize only comes if an
+ * <a href="package-summary.html#Associativity">associativity</a> condition is met. The {@code combiner} is associative
+ * if for result containers {@code r1}, {@code r2}, and {@code r3}:
+ * <pre>{@code
+ * combiner.accept(r1, r2);
+ * combiner.accept(r1, r3);
+ * }</pre>
+ * is equivalent to
+ * <pre>{@code
+ * combiner.accept(r2, r3);
+ * combiner.accept(r1, r2);
+ * }</pre>
+ * where equivalence means that {@code r1} is left in the same state (according to the meaning
+ * of {@link java.lang.Object#equals equals} for the element types). Similarly, the {@code resultFactory}
+ * must act as an <em>identity</em> with respect to the {@code combiner} so that for any result
+ * container {@code r}:
+ * <pre>{@code
+ * combiner.accept(r, resultFactory.get());
+ * }</pre>
+ * does not modify the state of {@code r} (again according to the meaning of
+ * {@link java.lang.Object#equals equals}). Finally, the {@code accumulator} and {@code combiner} must be
+ * compatible such that for a result container {@code r} and element {@code t}:
+ * <pre>{@code
+ * r2 = resultFactory.get();
+ * accumulator.accept(r2, t);
+ * combiner.accept(r, r2);
+ * }</pre>
+ * is equivalent to:
+ * <pre>{@code
+ * accumulator.accept(r,t);
+ * }</pre>
+ * where equivalence means that {@code r} is left in the same state (again according to the
+ * meaning of {@link java.lang.Object#equals equals}).
+ *
+ * <p> The three aspects of {@code collect}: supplier, accumulator, and combiner, are often very
+ * tightly coupled, and it is convenient to introduce the notion of a {@link java.util.stream.Collector} as
+ * being an object that embodies all three aspects. There is a {@link java.util.stream.Stream#collect(Collector) collect}
+ * method that simply takes a {@code Collector} and returns the resulting container.
+ * The above example for collecting strings into a {@code List} can be rewritten using a
+ * standard {@code Collector} as:
+ * <pre>{@code
+ * ArrayList<String> strings = stream.map(Object::toString)
+ * .collect(Collectors.toList());
+ * }</pre>
+ *
+ * <h3><a name="ConcurrentReduction">Reduction, Concurrency, and Ordering</a></h3>
+ *
+ * With some complex reduction operations, for example a collect that produces a
+ * {@code Map}, such as:
+ * <pre>{@code
+ * Map<Buyer, List<Transaction>> salesByBuyer
+ * = txns.parallelStream()
+ * .collect(Collectors.groupingBy(Transaction::getBuyer));
+ * }</pre>
+ * (where {@link java.util.stream.Collectors#groupingBy} is a utility function
+ * that returns a {@link java.util.stream.Collector} for grouping sets of elements based on some key)
+ * it may actually be counterproductive to perform the operation in parallel.
+ * This is because the combining step (merging one {@code Map} into another by key)
+ * can be expensive for some {@code Map} implementations.
+ *
+ * <p>Suppose, however, that the result container used in this reduction
+ * was a concurrently modifiable collection -- such as a
+ * {@link java.util.concurrent.ConcurrentHashMap ConcurrentHashMap}. In that case,
+ * the parallel invocations of the accumulator could actually deposit their results
+ * concurrently into the same shared result container, eliminating the need for the combiner to
+ * merge distinct result containers. This potentially provides a boost
+ * to the parallel execution performance. We call this a <em>concurrent</em> reduction.
+ *
+ * <p>A {@link java.util.stream.Collector} that supports concurrent reduction is marked with the
+ * {@link java.util.stream.Collector.Characteristics#CONCURRENT} characteristic.
+ * Having a concurrent collector is a necessary condition for performing a
+ * concurrent reduction, but that alone is not sufficient. If you imagine multiple
+ * accumulators depositing results into a shared container, the order in which
+ * results are deposited is non-deterministic. Consequently, a concurrent reduction
+ * is only possible if ordering is not important for the stream being processed.
+ * The {@link java.util.stream.Stream#collect(Collector)}
+ * implementation will only perform a concurrent reduction if
+ * <ul>
+ * <li>The stream is parallel;</li>
+ * <li>The collector has the
+ * {@link java.util.stream.Collector.Characteristics#CONCURRENT} characteristic,
+ * and;</li>
+ * <li>Either the stream is unordered, or the collector has the
+ * {@link java.util.stream.Collector.Characteristics#UNORDERED} characteristic.
+ * </ul>
+ * For example:
+ * <pre>{@code
+ * Map<Buyer, List<Transaction>> salesByBuyer
+ * = txns.parallelStream()
+ * .unordered()
+ * .collect(groupingByConcurrent(Transaction::getBuyer));
+ * }</pre>
+ * (where {@link java.util.stream.Collectors#groupingByConcurrent} is the concurrent companion
+ * to {@code groupingBy}).
+ *
+ * <p>Note that if it is important that the elements for a given key appear in the
+ * order they appear in the source, then we cannot use a concurrent reduction,
+ * as ordering is one of the casualties of concurrent insertion. We would then
+ * be constrained to implement either a sequential reduction or a merge-based
+ * parallel reduction.
+ *
+ * <h2><a name="Associativity">Associativity</a></h2>
+ *
+ * An operator or function {@code op} is <em>associative</em> if the following holds:
+ * <pre>{@code
+ * (a op b) op c == a op (b op c)
+ * }</pre>
+ * The importance of this to parallel evaluation can be seen if we expand this to four terms:
+ * <pre>{@code
+ * a op b op c op d == (a op b) op (c op d)
+ * }</pre>
+ * So we can evaluate {@code (a op b)} in parallel with {@code (c op d)} and then invoke {@code op} on
+ * the results.
+ * TODO what does associative mean for mutative combining functions?
+ * FIXME: we described mutative associativity above.
+ *
+ * <h2><a name="StreamSources">Stream sources</a></h2>
+ * TODO where does this section go?
+ *
+ * XXX - change to section to stream construction gradually introducing more
+ * complex ways to construct
+ * - construction from Collection
+ * - construction from Iterator
+ * - construction from array
+ * - construction from generators
+ * - construction from spliterator
+ *
+ * XXX - the following is quite low-level but important aspect of stream constriction
+ *
+ * <p>A pipeline is initially constructed from a spliterator (see {@link java.util.Spliterator}) supplied by a stream source.
+ * The spliterator covers elements of the source and provides element traversal operations
+ * for a possibly-parallel computation. See methods on {@link java.util.stream.Streams} for construction
+ * of pipelines using spliterators.
+ *
+ * <p>A source may directly supply a spliterator. If so, the spliterator is traversed, split, or queried
+ * for estimated size after, and never before, the terminal operation commences. It is strongly recommended
+ * that the spliterator report a characteristic of {@code IMMUTABLE} or {@code CONCURRENT}, or be
+ * <em>late-binding</em> and not bind to the elements it covers until traversed, split or queried for
+ * estimated size.
+ *
+ * <p>If a source cannot directly supply a recommended spliterator then it may indirectly supply a spliterator
+ * using a {@code Supplier}. The spliterator is obtained from the supplier after, and never before, the terminal
+ * operation of the stream pipeline commences.
+ *
+ * <p>Such requirements significantly reduce the scope of potential interference to the interval starting
+ * with the commencing of the terminal operation and ending with the producing a result or side-effect. See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * XXX - move the following to the non-interference section
+ *
+ * <p>A source can be modified before the terminal operation commences and those modifications will be reflected in
+ * the covered elements. Afterwards, and depending on the properties of the source, further modifications
+ * might not be reflected and the throwing of a {@code ConcurrentModificationException} may occur.
+ *
+ * <p>For example, consider the following code:
+ * <pre>{@code
+ * List<String> l = new ArrayList(Arrays.asList("one", "two"));
+ * Stream<String> sl = l.stream();
+ * l.add("three");
+ * String s = sl.collect(toStringJoiner(" ")).toString();
+ * }</pre>
+ * First a list is created consisting of two strings: "one"; and "two". Then a stream is created from that list.
+ * Next the list is modified by adding a third string: "three". Finally the elements of the stream are collected
+ * and joined together. Since the list was modified before the terminal {@code collect} operation commenced
+ * the result will be a string of "one two three". However, if the list is modified after the terminal operation
+ * commences, as in:
+ * <pre>{@code
+ * List<String> l = new ArrayList(Arrays.asList("one", "two"));
+ * Stream<String> sl = l.stream();
+ * String s = sl.peek(s -> l.add("BAD LAMBDA")).collect(toStringJoiner(" ")).toString();
+ * }</pre>
+ * then a {@code ConcurrentModificationException} will be thrown since the {@code peek} operation will attempt
+ * to add the string "BAD LAMBDA" to the list after the terminal operation has commenced.
+ */
+
+package java.util.stream;
--- a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_de.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_de.java Wed May 01 11:34:06 2013 -0700
@@ -109,7 +109,7 @@
{"appletclassloader.getresourceasstream.verbose", "Ressource {0} als Systemressource gefunden"},
{"appletpanel.runloader.err", "Objekt oder Codeparameter."},
{"appletpanel.runloader.exception", "Ausnahme beim Deserialisieren von {0}"},
- {"appletpanel.destroyed", "Applet endg\u00FCltig gel\u00F6scht."},
+ {"appletpanel.destroyed", "Applet zerst\u00F6rt."},
{"appletpanel.loaded", "Applet geladen."},
{"appletpanel.started", "Applet gestartet."},
{"appletpanel.inited", "Applet initialisiert."},
@@ -127,8 +127,8 @@
{"appletpanel.notloaded", "Init.: Applet nicht geladen."},
{"appletpanel.notinited", "Starten: Applet nicht initialisiert."},
{"appletpanel.notstarted", "Stoppen: Applet nicht gestartet."},
- {"appletpanel.notstopped", "Endg\u00FCltig l\u00F6schen: Applet nicht gestoppt."},
- {"appletpanel.notdestroyed", "Verwerfen: Applet nicht endg\u00FCltig gel\u00F6scht."},
+ {"appletpanel.notstopped", "Zerst\u00F6ren: Applet nicht gestoppt."},
+ {"appletpanel.notdestroyed", "Verwerfen: Applet nicht zerst\u00F6rt."},
{"appletpanel.notdisposed", "Laden: Applet nicht verworfen."},
{"appletpanel.bail", "Unterbrochen: Zur\u00FCckziehen."},
{"appletpanel.filenotfound", "Datei nicht gefunden beim Suchen nach: {0}"},
--- a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_ja.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_ja.java Wed May 01 11:34:06 2013 -0700
@@ -38,7 +38,7 @@
{"appletviewer.menuitem.stop", "\u505C\u6B62"},
{"appletviewer.menuitem.save", "\u4FDD\u5B58..."},
{"appletviewer.menuitem.start", "\u958B\u59CB"},
- {"appletviewer.menuitem.clone", "\u30AF\u30ED\u30FC\u30F3\u306E\u4F5C\u6210..."},
+ {"appletviewer.menuitem.clone", "\u30AF\u30ED\u30FC\u30F3..."},
{"appletviewer.menuitem.tag", "\u30BF\u30B0..."},
{"appletviewer.menuitem.info", "\u60C5\u5831..."},
{"appletviewer.menuitem.edit", "\u7DE8\u96C6"},
--- a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_pt_BR.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_pt_BR.java Wed May 01 11:34:06 2013 -0700
@@ -87,7 +87,7 @@
{"appletviewer.main.err.prop.cantsave", "N\u00E3o \u00E9 poss\u00EDvel salvar o arquivo de propriedades do usu\u00E1rio: {0}"},
{"appletviewer.main.warn.nosecmgr", "Advert\u00EAncia: desativando a seguran\u00E7a."},
{"appletviewer.main.debug.cantfinddebug", "N\u00E3o \u00E9 poss\u00EDvel localizar o depurador!"},
- {"appletviewer.main.debug.cantfindmain", "N\u00E3o \u00E9 poss\u00EDvel localizar o m\u00E9todo principal no depurador!"},
+ {"appletviewer.main.debug.cantfindmain", "N\u00E3o \u00E9 poss\u00EDvel localizar o m\u00E9todo main no depurador!"},
{"appletviewer.main.debug.exceptionindebug", "Exce\u00E7\u00E3o no depurador!"},
{"appletviewer.main.debug.cantaccess", "N\u00E3o \u00E9 poss\u00EDvel acessar o depurador!"},
{"appletviewer.main.nosecmgr", "Advert\u00EAncia: SecurityManager n\u00E3o instalado!"},
@@ -137,7 +137,7 @@
{"appletpanel.fileexception", "exce\u00E7\u00E3o de {0} ao carregar: {1}"},
{"appletpanel.filedeath", "{0} eliminado ao carregar: {1}"},
{"appletpanel.fileerror", "erro de {0} ao carregar: {1}"},
- {"appletpanel.badattribute.exception", "Parse de HTML: valor incorreto do atributo de largura/altura"},
+ {"appletpanel.badattribute.exception", "Parsing de HTML: valor incorreto do atributo de largura/altura"},
{"appletillegalargumentexception.objectinputstream", "AppletObjectInputStream requer um carregador n\u00E3o nulo"},
{"appletprops.title", "Propriedades do AppletViewer"},
{"appletprops.label.http.server", "Servidor proxy Http:"},
--- a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_sv.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_sv.java Wed May 01 11:34:06 2013 -0700
@@ -98,11 +98,11 @@
{"appletioexception.loadclass.throw.notloaded", "klass inte inl\u00E4st: {0}"},
{"appletclassloader.loadcode.verbose", "\u00D6ppnar str\u00F6m till: {0} f\u00F6r h\u00E4mtning av {1}"},
{"appletclassloader.filenotfound", "Hittade inte fil vid s\u00F6kning efter: {0}"},
- {"appletclassloader.fileformat", "Undantag av filformat vid l\u00E4sning av: {0}"},
- {"appletclassloader.fileioexception", "I/O-undantag vid l\u00E4sning: {0}"},
- {"appletclassloader.fileexception", "{0} undantag vid l\u00E4sning: {1}"},
- {"appletclassloader.filedeath", "{0} avslutad vid l\u00E4sning: {1}"},
- {"appletclassloader.fileerror", "{0} fel vid l\u00E4sning: {1}"},
+ {"appletclassloader.fileformat", "Undantag av filformat vid laddning av: {0}"},
+ {"appletclassloader.fileioexception", "I/O-undantag vid laddning: {0}"},
+ {"appletclassloader.fileexception", "{0} undantag vid laddning: {1}"},
+ {"appletclassloader.filedeath", "{0} avslutad vid laddning: {1}"},
+ {"appletclassloader.fileerror", "{0} fel vid laddning: {1}"},
{"appletclassloader.findclass.verbose.openstream", "\u00D6ppnar str\u00F6m till: {0} f\u00F6r h\u00E4mtning av {1}"},
{"appletclassloader.getresource.verbose.forname", "AppletClassLoader.getResource f\u00F6r namnet: {0}"},
{"appletclassloader.getresource.verbose.found", "Hittade resursen: {0} som systemresurs"},
@@ -132,11 +132,11 @@
{"appletpanel.notdisposed", "Ladda: applet har inte kasserats."},
{"appletpanel.bail", "Avbruten."},
{"appletpanel.filenotfound", "Hittade inte fil vid s\u00F6kning efter: {0}"},
- {"appletpanel.fileformat", "Undantag av filformat vid l\u00E4sning av: {0}"},
- {"appletpanel.fileioexception", "I/O-undantag vid l\u00E4sning: {0}"},
- {"appletpanel.fileexception", "{0} undantag vid l\u00E4sning: {1}"},
- {"appletpanel.filedeath", "{0} avslutad vid l\u00E4sning: {1}"},
- {"appletpanel.fileerror", "{0} fel vid l\u00E4sning: {1}"},
+ {"appletpanel.fileformat", "Undantag av filformat vid laddning av: {0}"},
+ {"appletpanel.fileioexception", "I/O-undantag vid laddning: {0}"},
+ {"appletpanel.fileexception", "{0} undantag vid laddning: {1}"},
+ {"appletpanel.filedeath", "{0} avslutad vid laddning: {1}"},
+ {"appletpanel.fileerror", "{0} fel vid laddning: {1}"},
{"appletpanel.badattribute.exception", "HTML-tolkning: felaktigt v\u00E4rde f\u00F6r bredd-/h\u00F6jdattribut"},
{"appletillegalargumentexception.objectinputstream", "AppletObjectInputStream kr\u00E4ver laddare med icke-null"},
{"appletprops.title", "AppletViewer-egenskaper"},
--- a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_zh_CN.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_zh_CN.java Wed May 01 11:34:06 2013 -0700
@@ -87,7 +87,7 @@
{"appletviewer.main.err.prop.cantsave", "\u65E0\u6CD5\u4FDD\u5B58\u7528\u6237\u5C5E\u6027\u6587\u4EF6: {0}"},
{"appletviewer.main.warn.nosecmgr", "\u8B66\u544A: \u7981\u7528\u5B89\u5168\u3002"},
{"appletviewer.main.debug.cantfinddebug", "\u627E\u4E0D\u5230\u8C03\u8BD5\u5668!"},
- {"appletviewer.main.debug.cantfindmain", "\u5728\u8C03\u8BD5\u5668\u4E2D\u627E\u4E0D\u5230\u4E3B\u8981\u65B9\u6CD5!"},
+ {"appletviewer.main.debug.cantfindmain", "\u5728\u8C03\u8BD5\u5668\u4E2D\u627E\u4E0D\u5230 main \u65B9\u6CD5!"},
{"appletviewer.main.debug.exceptionindebug", "\u8C03\u8BD5\u5668\u4E2D\u5B58\u5728\u5F02\u5E38\u9519\u8BEF!"},
{"appletviewer.main.debug.cantaccess", "\u65E0\u6CD5\u8BBF\u95EE\u8C03\u8BD5\u5668!"},
{"appletviewer.main.nosecmgr", "\u8B66\u544A: \u672A\u5B89\u88C5 SecurityManager!"},
@@ -154,7 +154,7 @@
{"appletprops.choice.unsignedapplet.yes", "\u662F"},
{"appletprops.button.apply", "\u5E94\u7528"},
{"appletprops.button.cancel", "\u53D6\u6D88"},
- {"appletprops.button.reset", "\u91CD\u8BBE"},
+ {"appletprops.button.reset", "\u91CD\u7F6E"},
{"appletprops.apply.exception", "\u65E0\u6CD5\u4FDD\u5B58\u5C5E\u6027: {0}"},
/* 4066432 */
{"appletprops.title.invalidproxy", "\u6761\u76EE\u65E0\u6548"},
--- a/jdk/src/share/classes/sun/awt/resources/awt_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/awt/resources/awt_de.properties Wed May 01 11:34:06 2013 -0700
@@ -105,7 +105,7 @@
AWT.colon=Doppelpunkt
AWT.circumflex=Zirkumflex
AWT.dollar=Dollarzeichen
-AWT.euro=Euro-Zeichen
+AWT.euro=Euro
AWT.exclamationMark=Ausrufezeichen
AWT.invertedExclamationMark=Umgekehrtes Ausrufezeichen
AWT.leftParenthesis=Linke Klammer
--- a/jdk/src/share/classes/sun/awt/resources/awt_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/awt/resources/awt_es.properties Wed May 01 11:34:06 2013 -0700
@@ -4,7 +4,7 @@
#
# Modifier names
-AWT.shift=May\u00FAsculas
+AWT.shift=May\u00FAs
AWT.control=Ctrl
AWT.alt=Alt
AWT.meta=Meta
--- a/jdk/src/share/classes/sun/awt/resources/awt_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/awt/resources/awt_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -44,7 +44,7 @@
AWT.subtract=Teclado Num\u00E9rico -
AWT.decimal=Teclado Num\u00E9rico .
AWT.divide=Teclado Num\u00E9rico /
-AWT.delete=Delete
+AWT.delete=Deletar
AWT.numLock=Num Lock
AWT.scrollLock=Scroll Lock
AWT.f1=F1
--- a/jdk/src/share/classes/sun/awt/resources/awt_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/awt/resources/awt_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -174,7 +174,7 @@
AWT.InputMethodSelectionMenu=\u9009\u62E9\u8F93\u5165\u7A97\u53E3
AWT.HostInputMethodDisplayName=\u7CFB\u7EDF\u8F93\u5165\u6CD5
AWT.InputMethodLanguage.ja=\u65E5\u6587
-AWT.InputMethodLanguage.ko=\u97E9\u6587
+AWT.InputMethodLanguage.ko=\u671D\u9C9C\u6587
AWT.InputMethodLanguage.zh=\u4E2D\u6587
AWT.InputMethodLanguage.zh_CN=\u7B80\u4F53\u4E2D\u6587
AWT.InputMethodLanguage.zh_TW=\u7E41\u4F53\u4E2D\u6587
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_de.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
#
# Translators please note do not translate the options themselves
-java.launcher.opt.header = Verwendung: {0} [-options] class [args...]\n\ (zur Ausf\u00FChrung einer Klasse)\n oder {0} [-options] -jar jarfile [args...]\n\ (zur Ausf\u00FChrung einer JAR-Datei)\nwobei options Folgendes umfasst:\n
+java.launcher.opt.header = Verwendung: {0} [-options] class [args...]\n (zur Ausf\u00FChrung einer Klasse)\n oder {0} [-options] -jar jarfile [args...]\n (zur Ausf\u00FChrung einer JAR-Datei)\nwobei options Folgendes umfasst:\n
java.launcher.opt.datamodel =\ -d{0}\t Verwendet ein {0}-Bit-Datenmodell, sofern verf\u00FCgbar\n
java.launcher.opt.vmselect =\ {0}\t zur Auswahl der "{1}" VM\n
@@ -34,15 +34,21 @@
java.launcher.ergo.message2 =\ weil die Ausf\u00FChrung auf einem Server-Class-Rechner erfolgt.\n
# Translators please note do not translate the options themselves
-java.launcher.opt.footer =\ -cp <Class-Suchpfad von Verzeichnissen und ZIP-/JAR-Dateien>\n\ -classpath <Class-Suchpfad von Verzeichnissen und ZIP-/JAR-Dateien>\n\ Eine durch {0} getrennte Liste mit Verzeichnissen, JAR-Archiven\n\ und ZIP-Archiven zur Suche nach Klassendateien.\n\ -D<name>=<value>\n\ Setzt eine Systemeigenschaft\n\ -verbose[:class|gc|jni]\n\ Aktiviert die Verbose-Ausgabe\n\ -version Druckt Produktversion und beendet das Programm\n\ -version:<value>\n\ Erfordert die angegebene Version zur Ausf\u00FChrung\n\ -showversion Druckt Produktversion und f\u00E4hrt fort\n\ -jre-restrict-search | -no-jre-restrict-search\n\ Bezieht private JREs des Benutzers in Versionssuche ein bzw. schlie\u00DFt sie aus\n\ -? -help Druckt diese Hilfemeldung\n\ -X Druckt Hilfe zu Nicht-Standardoptionen\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ Aktiviert Assertionen mit angegebener Granularit\u00E4t\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ Deaktiviert Assertionen mit angegebener Granularit\u00E4t\n\ -esa | -enablesystemassertions\n\ Aktiviert Systemassertionen\n\ -dsa | -disablesystemassertions\n\ Deaktiviert Systemassertionen\n\ -agentlib:<libname>[=<options>]\n\ L\u00E4dt native Agent Library <libname>, z.B. -agentlib:hprof\n\ siehe auch, -agentlib:jdwp=help und -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ L\u00E4dt native Agent Library nach vollem Pfadnamen\n\ -javaagent:<jarpath>[=<options>]\n\ L\u00E4dt Java-Programmiersprachen-Agent, siehe java.lang.instrument\n\ -splash:<imagepath>\n\ Zeigt Startbildschirm mit angegebenem Bild\nWeitere Einzelheiten finden Sie unter http://java.sun.com/javase/reference.
+java.launcher.opt.footer =\ -cp <Klassensuchpfad von Verzeichnissen und ZIP-/JAR-Dateien>\n -classpath <Klassensuchpfad von Verzeichnissen und ZIP-/JAR-Dateien>\n Eine durch {0} getrennte Liste mit Verzeichnissen, JAR-Archiven\n und ZIP-Archiven zur Suche nach Klassendateien.\n -D<name>=<value>\n Legt eine Systemeigenschaft fest\n -verbose[:class|gc|jni]\n Aktiviert die Verbose-Ausgabe\n -version Druckt Produktversion und beendet das Programm\n -version:<value>\n Erfordert die angegebene Version zur Ausf\u00FChrung\n -showversion Druckt Produktversion und f\u00E4hrt fort\n -jre-restrict-search | -no-jre-restrict-search\n Bezieht private JREs des Benutzers in Versionssuche ein bzw. schlie\u00DFt sie aus\n -? -help Druckt diese Hilfemeldung\n -X Druckt Hilfe zu Nicht-Standardoptionen\n -ea[:<packagename>...|:<classname>]\n -enableassertions[:<packagename>...|:<classname>]\n Aktiviert Assertionen mit angegebener Granularit\u00E4t\n -da[:<packagename>...|:<classname>]\n -disableassertions[:<packagename>...|:<classname>]\n Deaktiviert Assertionen mit angegebener Granularit\u00E4t\n -esa | -enablesystemassertions\n Aktiviert Systemassertionen\n -dsa | -disablesystemassertions\n Deaktiviert Systemassertionen\n -agentlib:<libname>[=<options>]\n L\u00E4dt native Agent Library <libname>, z.B. -agentlib:hprof\n siehe auch -agentlib:jdwp=help und -agentlib:hprof=help\n -agentpath:<pathname>[=<options>]\n L\u00E4dt native Agent Library nach vollem Pfadnamen\n -javaagent:<jarpath>[=<options>]\n L\u00E4dt Java-Programmiersprachen-Agent, siehe java.lang.instrument\n -splash:<imagepath>\n Zeigt Startbildschirm mit angegebenem Bild\nWeitere Einzelheiten finden Sie unter http://www.oracle.com/technetwork/java/javase/documentation/index.html
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\ -Xmixed Ausf\u00FChrung im gemischten Modus (Standard)\n -Xint Nur Ausf\u00FChrung im interpretierten Modus\n -Xbootclasspath:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n Legt Suchpfad f\u00FCr Bootstrap-Klassen und Ressourcen fest\n -Xbootclasspath/a:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n H\u00E4ngt an das Ende des Bootstrap Classpath an\n -Xbootclasspath/p:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n Stellt Bootstrap Classpath voran\n -Xdiag Zeigt zus\u00E4tzliche Diagnosemeldungen an\n -Xnoclassgc Deaktiviert Klassen-Garbage Collection\n -Xincgc Aktiviert inkrementelle Garbage Collection\n -Xloggc:<file> Loggt GC-Status in einer Datei mit Zeitstempeln\n -Xbatch Deaktiviert Hintergrundkompilierung\n -Xms<size> Legt anf\u00E4ngliche Java Heap-Gr\u00F6\u00DFe fest\n -Xmx<size> Legt maximale Java Heap-Gr\u00F6\u00DFe fest\n -Xss<size> Legt Java-Thread-Stack-Gr\u00F6\u00DFe fest\n -Xprof Gibt CPU-Profiling-Daten aus\n -Xfuture Aktiviert strengste Pr\u00FCfungen, antizipiert zuk\u00FCnftigen Standardwert\n -Xrs Reduziert Verwendung von BS-Signalen durch Java/VM (siehe Dokumentation)\n -Xcheck:jni F\u00FChrt zus\u00E4tzliche Pr\u00FCfungen f\u00FCr JNI-Funktionen durch\n -Xshare:off Kein Versuch, gemeinsame Klassendaten zu verwenden\n -Xshare:auto Verwendet gemeinsame Klassendaten, wenn m\u00F6glich (Standard)\n -Xshare:on Erfordert die Verwendung gemeinsamer Klassendaten, sonst verl\u00E4uft der Vorgang nicht erfolgreich.\n -XshowSettings Zeigt alle Einstellungen und f\u00E4hrt fort\n -XshowSettings:all\n Zeigt alle Einstellungen und f\u00E4hrt fort\n -XshowSettings:vm Zeigt alle VM-bezogenen Einstellungen und f\u00E4hrt fort\n -XshowSettings:properties\n Zeigt alle Eigenschaftseinstellungen und f\u00E4hrt fort\n -XshowSettings:locale\n Zeigt alle gebietsschemabezogenen Einstellungen und f\u00E4hrt fort\n\nDie -X-Optionen sind keine Standardoptionen und k\u00F6nnen ohne Vorank\u00FCndigung ge\u00E4ndert werden.\n
# Translators please note do not translate the options themselves
-java.launcher.X.usage=\ -Xmixed Ausf\u00FChrung im gemischten Modus (Standard)\n\ -Xint Nur Ausf\u00FChrung im interpretierten Modus\n\ -Xbootclasspath:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n\ Legt Suchpfad f\u00FCr Bootstrap-Klassen und Ressourcen fest\n\ -Xbootclasspath/a:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n\ H\u00E4ngt an das Ende des Bootstrap Classpath an\n\ -Xbootclasspath/p:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n\ Stellt Bootstrap Classpath voran\n\ -Xdiag Zeigt zus\u00E4tzliche Diagnosemeldungen an\n\ -Xnoclassgc Deaktiviert Klassen-Garbage Collection\n\ -Xincgc Aktiviert inkrementelle Garbage Collection\n\ -Xloggc:<file> Loggt GC-Status in einer Datei mit Zeitstempeln\n\ -Xbatch Deaktiviert Hintergrundkompilierung\n\ -Xms<size> Legt anf\u00E4ngliche Java Heap-Gr\u00F6\u00DFe fest\n\ -Xmx<size> Legt maximale Java Heap-Gr\u00F6\u00DFe fest\n\ -Xss<size> Legt Java-Thread-Stack-Gr\u00F6\u00DFe fest\n\ -Xprof Gibt CPU-Profiling-Daten aus\n\ -Xfuture Aktiviert strengste Pr\u00FCfungen, antizipiert zuk\u00FCnftigen Standardwert\n\ -Xrs Reduziert Verwendung von BS-Signalen durch Java/VM (siehe Dokumentation)\n\ -Xcheck:jni F\u00FChrt zus\u00E4tzliche Pr\u00FCfungen f\u00FCr JNI-Funktionen durch\n\ -Xshare:off Kein Versuch, gemeinsame Klassendaten zu verwenden\n\ -Xshare:auto Verwendet gemeinsame Klassendaten, wenn m\u00F6glich (Standard)\n\ -Xshare:on Erfordert die Verwendung gemeinsamer Klassendaten, sonst verl\u00E4uft der Vorgang nicht erfolgreich.\n\ -XshowSettings Zeigt alle Einstellungen und f\u00E4hrt fort\n\ -XshowSettings:all\n\ Zeigt alle Einstellungen und f\u00E4hrt fort\n\ -XshowSettings:vm Zeigt alle VM-bezogenen Einstellungen und f\u00E4hrt fort\n\ -XshowSettings:properties\n\ Zeigt alle Eigenschaftseinstellungen und f\u00E4hrt fort\n\ -XshowSettings:locale\n\ Zeigt alle gebietsschemabezogenen Einstellungen und f\u00E4hrt fort\n\nDie -X-Optionen sind keine Standardoptionen und k\u00F6nnen ohne Vorank\u00FCndigung ge\u00E4ndert werden.\n
+java.launcher.X.macosx.usage=\nDie folgenden Optionen sind f\u00FCr Mac OS X spezifisch:\n -XstartOnFirstThread\n f\u00FChrt die main()-Methode f\u00FCr den ersten (AppKit) Thread aus\n -Xdock:name=<Anwendungsname>"\n \u00DCberschreibt den in der Uhr angezeigten Standardanwendungsnamen\n -Xdock:icon=<Pfad zu Symboldatei>\n \u00DCberschreibt das in der Uhr angezeigte Standardsymbol\n\n
java.launcher.cls.error1=Fehler: Hauptklasse {0} konnte nicht gefunden oder geladen werden
-java.launcher.cls.error2=Fehler: Hauptmethode ist nicht {0} in Klasse {1}. Definieren Sie die Hauptmethode als:\n\ public static void main(String[] args)
-java.launcher.cls.error3=Fehler: Hauptmethode muss einen Wert vom Typ void in Klasse {0} zur\u00FCckgeben. Definieren Sie \ndie Hauptmethode als:\n\ public static void main(String[] args)
-java.launcher.cls.error4=Fehler: Hauptmethode in Klasse {0} nicht gefunden. Definieren Sie die Hauptmethode als:\n\ public static void main(String[] args)
+java.launcher.cls.error2=Fehler: Hauptmethode ist nicht {0} in Klasse {1}. Definieren Sie die Hauptmethode als:\n public static void main(String[] args)
+java.launcher.cls.error3=Fehler: Hauptmethode muss einen Wert vom Typ void in Klasse {0} zur\u00FCckgeben. Definieren Sie \ndie Hauptmethode als:\n public static void main(String[] args)
+java.launcher.cls.error4=Fehler: Hauptmethode in Klasse {0} nicht gefunden. Definieren Sie die Hauptmethode als:\n public static void main(String[] args):\noder eine JavaFX-Anwendung muss {1} erweitern
+java.launcher.cls.error5=Fehler: Zum Ausf\u00FChren dieser Anwendung ben\u00F6tigte JavaFX-Runtime-Komponenten fehlen
java.launcher.jar.error1=Fehler: Beim Versuch, Datei {0} zu \u00F6ffnen, ist ein unerwarteter Fehler aufgetreten
java.launcher.jar.error2=Manifest in {0} nicht gefunden
java.launcher.jar.error3=kein Hauptmanifestattribut, in {0}
+java.launcher.init.error=Initialisierungsfehler
+java.launcher.javafx.error1=Fehler: Die JavaFX-Methode launchApplication hat die falsche Signatur, sie\nmuss als statisch deklariert werden und einen Wert vom Typ VOID zur\u00FCckgeben
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_es.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
#
# Translators please note do not translate the options themselves
-java.launcher.opt.header = Sintaxis: {0} [-options] class [args...]\n\ (para ejecutar una clase)\n o {0} [-options] -jar jarfile [args...]\n\ (para ejecutar un archivo jar)\ndonde las opciones incluyen:\n
+java.launcher.opt.header = Sintaxis: {0} [-options] class [args...]\n (para ejecutar una clase)\n o {0} [-options] -jar jarfile [args...]\n (para ejecutar un archivo jar)\ndonde las opciones incluyen:\n
java.launcher.opt.datamodel =\ -d{0}\t usar un modelo de datos de {0} bits, si est\u00E1 disponible\n
java.launcher.opt.vmselect =\ {0}\t para seleccionar la VM "{1}"\n
@@ -34,15 +34,21 @@
java.launcher.ergo.message2 =\ porque la ejecuci\u00F3n se est\u00E1 llevando a cabo en una m\u00E1quina de clase de servidor.\n
# Translators please note do not translate the options themselves
-java.launcher.opt.footer =\ -cp <ruta de acceso de b\u00FAsqueda de clases de los directorios y los archivos zip/jar>\n\ -classpath <ruta de acceso de b\u00FAsqueda de clases de los directorios y los archivos zip/jar>\n\ Una lista separada por {0} de directorios, archivos JAR,\n\ y archivos ZIP para buscar archivos de clase.\n\ -D<nombre>=<valor>\n\ definir una propiedad del sistema\n\ -verbose[:class|gc|jni]\n\ activar la salida verbose\n\ -version imprimir la versi\u00F3n del producto y salir\n\ -version:<valor>\n\ es necesario que se ejecute la versi\u00F3n especificada\n\ -showversion imprimir la versi\u00F3n del producto y continuar\n\ -jre-restrict-search | -no-jre-restrict-search\n\ incluir/excluir JRE privados de usuario en la b\u00FAsqueda de versi\u00F3n\n\ -? -help imprimir este mensaje de ayuda\n\ -X imprimir la ayuda sobre las opciones que no sean est\u00E1ndar\n\ -ea[:<nombre_paquete>...|:<nombre_clase>]\n\ -enableassertions[:<nombre_paquete>...|:<nombre_clase>]\n\ activar afirmaciones con la granularidad especificada\n\ -da[:<nombre_paquete>...|:<nombre_clase>]\n\ -disableassertions[:<nombre_paquete>...|:<nombre_clase>]\n\ desactivar afirmaciones con la granularidad especificada\n\ -esa | -enablesystemassertions\n\ activar afirmaciones del sistema\n\ -dsa | -disablesystemassertions\n\ desactivar afirmaciones del sistema\n\ -agentlib:<nombre_bib>[=<opciones>]\n\ cargar la biblioteca de agente nativa <nombre_bib>, como -agentlib:hprof\n\ v\u00E9ase tambi\u00E9n -agentlib:jdwp=help y -agentlib:hprof=help\n\ -agentpath:<nombre_ruta_acceso>[=<opciones>]\n\ cargar biblioteca de agente nativa con la ruta de acceso completa\n\ -javaagent:<ruta_acceso_jar>[=<opciones>]\n\ cargar agente de lenguaje de programaci\u00F3n Java, v\u00E9ase java.lang.instrument\n\ -splash:<ruta_acceso_imagen>\n\ mostrar una pantalla de presentaci\u00F3n con la imagen especificada\nConsulte http://java.sun.com/javase/reference para obtener m\u00E1s informaci\u00F3n.
+java.launcher.opt.footer =\ -cp <ruta de acceso de b\u00FAsqueda de clases de los directorios y los archivos zip/jar>\n\\ -classpath <ruta de acceso de b\u00FAsqueda de clases de los directorios y los archivos zip/jar>\n\\ Lista separada por {0} de directorios, archivos JAR\n\\ y archivos ZIP para buscar archivos de clase.\n\\ -D<nombre>=<valor>\n\\ definir una propiedad del sistema\n\\ -verbose:[class|gc|jni]\n\\ activar la salida verbose\n\\ -version imprimir la versi\u00F3n del producto y salir\n\\ -version:<valor>\n\\ es necesario que se ejecute la versi\u00F3n especificada\n\\ -showversion imprimir la versi\u00F3n del producto y continuar\n\\ -jre-restrict-search | -no-jre-restrict-search\n\\ incluir/excluir JRE privados de usuario en la b\u00FAsqueda de versi\u00F3n\n\\ -? -help imprimir este mensaje de ayuda\n\\ -X imprimir la ayuda sobre las opciones que no sean est\u00E1ndar\n\\ -ea[:<nombre_paquete>...|:<nombre_clase>]\n\\ -enableassertions[:<nombre_paquete>...|:<nombre_clase>]\n\\ activar afirmaciones con la granularidad especificada\n\\ -da[:<nombre_paquete>...|:<nombre_clase>]\n\\ -disableassertions[:<nombre_paquete>...|:<nombre_clase>]\n\\ desactivar afirmaciones con la granularidad especificada\n\\ -esa | -enablesystemassertions\n\\ activar afirmaciones del sistema\n\\ -dsa | -disablesystemassertions\n\\ desactivar afirmaciones del sistema\n\\ -agentlib:<nombre_bib>[=<opciones>]\n\\ cargar la biblioteca de agente nativa <nombre_bib>, como -agentlib:hprof\n\\ v\u00E9ase tambi\u00E9n -agentlib:jdwp=help y -agentlib:hprof=help\n\\ -agentpath:<nombre_ruta_acceso>[=<opciones>]\n\\ cargar biblioteca de agente nativa con el nombre de la ruta de acceso completa\n\\ -javaagent:<ruta_acceso_jar>[=<opciones>]\n\\ cargar agente de lenguaje de programaci\u00F3n Java, v\u00E9ase java.lang.instrument\n\\ -splash:<ruta_acceso_imagen>\n\\ mostrar una pantalla de presentaci\u00F3n con la imagen especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para obtener m\u00E1s informaci\u00F3n.
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\ -Xmixed ejecuci\u00F3n de modo mixto (por defecto)\n -Xint s\u00F3lo ejecuci\u00F3n de modo interpretado\n -Xbootclasspath:<directorios y archivos zip/jar separados por {0}>\n definir la ruta de acceso de b\u00FAsqueda para los recursos y clases de inicializaci\u00F3n de datos\n -Xbootclasspath/a:<directorios y archivos zip/jar separados por {0}>\n agregar al final de la ruta de acceso de la clase de inicializaci\u00F3n de datos\n -Xbootclasspath/p:<directorios y archivos zip/jar separados por {0}>\n anteponer a la ruta de acceso de la clase de inicializaci\u00F3n de datos\n -Xdiag mostrar mensajes de diagn\u00F3stico adicionales\n -Xnoclassgc desactivar la recolecci\u00F3n de basura de clases\n -Xincgc activar la recolecci\u00F3n de basura de clases\n -Xloggc:<archivo> registrar el estado de GC en un archivo con registros de hora\n -Xbatch desactivar compilaci\u00F3n en segundo plano\n -Xms<tama\u00F1o> definir tama\u00F1o de pila Java inicial\n -Xmx<tama\u00F1o> definir tama\u00F1o de pila Java m\u00E1ximo\n -Xss<tama\u00F1o> definir tama\u00F1o de la pila del thread de Java\n -Xprof datos de salida de creaci\u00F3n de perfil de CPU\n -Xfuture activar las comprobaciones m\u00E1s estrictas, anticip\u00E1ndose al futuro valor por defecto\n -Xrs reducir el uso de se\u00F1ales de sistema operativo por parte de Java/VM (consulte la documentaci\u00F3n)\n -Xcheck:jni realizar comprobaciones adicionales para las funciones de JNI\n -Xshare:off no intentar usar datos de clase compartidos\n -Xshare:auto usar datos de clase compartidos si es posible (valor por defecto)\n -Xshare:on es obligatorio el uso de datos de clase compartidos, de lo contrario se emitir\u00E1 un fallo.\n -XshowSettings mostrar todos los valores y continuar\n -XshowSettings:all\n mostrar todos los valores y continuar\n -XshowSettings:vm mostrar todos los valores de la VM y continuar\n -XshowSettings:properties\n mostrar todos los valores de las propiedades y continuar\n -XshowSettings:locale\n mostrar todos los valores relacionados con la configuraci\u00F3n regional y continuar\n\nLas opciones -X no son est\u00E1ndar, por lo que podr\u00EDan cambiarse sin previo aviso.\n
# Translators please note do not translate the options themselves
-java.launcher.X.usage=\ -Xmixed ejecuci\u00F3n de modo mixto (por defecto)\n\ -Xint s\u00F3lo ejecuci\u00F3n de modo interpretado\n\ -Xbootclasspath:<directorios y archivos zip/jar separados por {0}>\n\ definir la ruta de acceso de b\u00FAsqueda para los recursos y clases de inicializaci\u00F3n de datos\n\ -Xbootclasspath/a:<directorios y archivos zip/jar separados por {0}>\n\ agregar al final de la ruta de acceso de la clase de inicializaci\u00F3n de datos\n\ -Xbootclasspath/p:<directorios y archivos zip/jar separados por {0}>\n\ anteponer a la ruta de acceso de la clase de inicializaci\u00F3n de datos\n\ -Xdiag mostrar mensajes de diagn\u00F3stico adicionales\n\ -Xnoclassgc desactivar la recolecci\u00F3n de basura de clases\n\ -Xincgc activar la recolecci\u00F3n de basura de clases\n\ -Xloggc:<archivo> registrar el estado de GC en un archivo con registros de hora\n\ -Xbatch desactivar compilaci\u00F3n en segundo plano\n\ -Xms<tama\u00F1o> definir tama\u00F1o de pila Java inicial\n\ -Xmx<tama\u00F1o> definir tama\u00F1o de pila Java m\u00E1ximo\n\ -Xss<tama\u00F1o> definir tama\u00F1o de la pila del thread de Java\n\ -Xprof datos de salida de creaci\u00F3n de perfil de CPU\n\ -Xfuture activar las comprobaciones m\u00E1s estrictas, anticip\u00E1ndose al futuro valor por defecto\n\ -Xrs reducir el uso de se\u00F1ales de sistema operativo por parte de Java/VM (consulte la documentaci\u00F3n)\n\ -Xcheck:jni realizar comprobaciones adicionales para las funciones de JNI\n\ -Xshare:off no intentar usar datos de clase compartidos\n\ -Xshare:auto usar datos de clase compartidos si es posible (valor por defecto)\n\ -Xshare:on es obligatorio el uso de datos de clase compartidos, de lo contrario se emitir\u00E1 un fallo.\n\ -XshowSettings mostrar todos los valores y continuar\n\ -XshowSettings:all\n\ mostrar todos los valores y continuar\n\ -XshowSettings:vm mostrar todos los valores de la VM y continuar\n\ -XshowSettings:properties\n\ mostrar todos los valores de las propiedades y continuar\n\ -XshowSettings:locale\n\ mostrar todos los valores relacionados con la configuraci\u00F3n regional y continuar\n\nLas opciones -X no son est\u00E1ndar, por lo que podr\u00EDan cambiarse sin previo aviso.\n
+java.launcher.X.macosx.usage=\nLas siguientes opciones son espec\u00EDficas para Mac OS X:\n -XstartOnFirstThread\n ejecuta el m\u00E9todo main() del primer thread (AppKit)\n -Xdock:name=<nombre de aplicaci\u00F3n>"\n sustituye al nombre por defecto de la aplicaci\u00F3n que se muestra en el Dock\n -Xdock:icon=<ruta de acceso a archivo de icono>\n sustituye al icono por defecto que se muestra en el Dock\n\n
java.launcher.cls.error1=Error: no se ha encontrado o cargado la clase principal {0}
-java.launcher.cls.error2=Error: el m\u00E9todo principal no es {0} en la clase {1}, defina el m\u00E9todo principal del siguiente modo:\n\ public static void main(String[] args)
-java.launcher.cls.error3=Error: el m\u00E9todo principal debe devolver un valor del tipo void en la clase {0}, \ndefina el m\u00E9todo principal del siguiente modo:\n\ public static void main(String[] args)
-java.launcher.cls.error4=Error: no se ha encontrado el m\u00E9todo principal en la clase {0}, defina el m\u00E9todo principal del siguiente modo:\n\ public static void main(String[] args)
+java.launcher.cls.error2=Error: el m\u00E9todo principal no es {0} en la clase {1}, defina el m\u00E9todo principal del siguiente modo:\n public static void main(String[] args)
+java.launcher.cls.error3=Error: el m\u00E9todo principal debe devolver un valor del tipo void en la clase {0}, \ndefina el m\u00E9todo principal del siguiente modo:\n public static void main(String[] args)
+java.launcher.cls.error4=Error: no se ha encontrado el m\u00E9todo principal en la clase {0}, defina el m\u00E9todo principal del siguiente modo:\\n public static void main(String[] args)\\nde lo contrario, se deber\u00E1 ampliar una clase de aplicaci\u00F3n JavaFX {1}
+java.launcher.cls.error5=Error: faltan los componentes de JavaFX runtime y son necesarios para ejecutar esta aplicaci\u00F3n
java.launcher.jar.error1=Error: se ha producido un error inesperado al intentar abrir el archivo {0}
java.launcher.jar.error2=no se ha encontrado el manifiesto en {0}
java.launcher.jar.error3=no hay ning\u00FAn atributo de manifiesto principal en {0}
+java.launcher.init.error=error de inicializaci\u00F3n
+java.launcher.javafx.error1=Error: el m\u00E9todo launchApplication de JavaFX tiene una firma que no es correcta.\\nSe debe declarar est\u00E1tico y devolver un valor de tipo nulo
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_fr.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
#
# Translators please note do not translate the options themselves
-java.launcher.opt.header = Syntaxe : {0} [-options] class [args...]\n\ (pour l''ex\u00E9cution d''une classe)\n ou {0} [-options] -jar jarfile [args...]\n\ (pour l''ex\u00E9cution d''un fichier JAR)\no\u00F9 les options comprennent :\n
+java.launcher.opt.header = Syntaxe : {0} [-options] class [args...]\n (pour l''ex\u00E9cution d''une classe)\n ou {0} [-options] -jar jarfile [args...]\n (pour l''ex\u00E9cution d''un fichier JAR)\no\u00F9 les options comprennent :\n
java.launcher.opt.datamodel =\ -d{0}\t utilisez le mod\u00E8le de donn\u00E9es {0} bits s''il est disponible\n
java.launcher.opt.vmselect =\ {0}\t pour s\u00E9lectionner la machine virtuelle "{1}"\n
@@ -34,15 +34,21 @@
java.launcher.ergo.message2 =\ car vous ex\u00E9cutez une machine de classe de serveur.\n
# Translators please note do not translate the options themselves
-java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n\ -classpath <class search path of directories and zip/jar files>\n\ Liste de r\u00E9pertoires, d''archives JAR et\n\ d''archives ZIP s\u00E9par\u00E9s par des {0}, dans laquelle rechercher les fichiers de classe.\n\ -D<name>=<value>\n\ d\u00E9finition d''une propri\u00E9t\u00E9 syst\u00E8me\n\ -verbose[:class|gc|jni]\n\ activation de la sortie en mode verbose\n\ -version impression de la version du produit et fin de l''op\u00E9ration\n\ -version:<value>\n\ ex\u00E9cution de la version sp\u00E9cifi\u00E9e obligatoire\n\ -showversion impression de la version du produit et poursuite de l''op\u00E9ration\n\ -jre-restrict-search | -no-jre-restrict-search\n\ inclusion/exclusion des environnements JRE priv\u00E9s de l''utilisateur dans la recherche de version\n\ -? -help impression du message d''aide\n\ -X impression de l''aide sur les options non standard\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ activation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ d\u00E9sactivation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n\ -esa | -enablesystemassertions\n\ activation des assertions syst\u00E8me\n\ -dsa | -disablesystemassertions\n\ d\u00E9sactivation des assertions syst\u00E8me\n\ -agentlib:<libname>[=<options>]\n\ chargement de la biblioth\u00E8que d''agent natif <libname>, par exemple -agentlib:hprof\n\ voir \u00E9galement, -agentlib:jdwp=help et -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ chargement de la biblioth\u00E8que d''agent natif via le chemin d''acc\u00E8s complet\n\ -javaagent:<jarpath>[=<options>]\n\ chargement de l''agent du langage de programmation Java, voir java.lang.instrument\n\ -splash:<imagepath>\n\ affichage de l''\u00E9cran d''accueil avec l''image sp\u00E9cifi\u00E9e\nVoir http://java.sun.com/javase/reference pour plus de d\u00E9tails.
+java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n -classpath <class search path of directories and zip/jar files>\n Liste de r\u00E9pertoires, d''archives JAR et\n d''archives ZIP s\u00E9par\u00E9s par des {0}, dans laquelle rechercher les fichiers de classe.\n -D<name>=<value>\n d\u00E9finition d''une propri\u00E9t\u00E9 syst\u00E8me\n -verbose[:class|gc|jni]\n activation de la sortie en mode verbose\n -version impression de la version du produit et fin de l''op\u00E9ration\n -version:<value>\n ex\u00E9cution de la version sp\u00E9cifi\u00E9e obligatoire\n -showversion impression de la version du produit et poursuite de l''op\u00E9ration\n -jre-restrict-search | -no-jre-restrict-search\n inclusion/exclusion des environnements JRE priv\u00E9s de l''utilisateur dans la recherche de version\n -? -help impression du message d''aide\n -X impression de l''aide sur les options non standard\n -ea[:<packagename>...|:<classname>]\n -enableassertions[:<packagename>...|:<classname>]\n activation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n -da[:<packagename>...|:<classname>]\n -disableassertions[:<packagename>...|:<classname>]\n d\u00E9sactivation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n -esa | -enablesystemassertions\n activation des assertions syst\u00E8me\n -dsa | -disablesystemassertions\n d\u00E9sactivation des assertions syst\u00E8me\n -agentlib:<libname>[=<options>]\n chargement de la biblioth\u00E8que d''agent natif <libname>, par exemple -agentlib:hprof\n voir \u00E9galement, -agentlib:jdwp=help et -agentlib:hprof=help\n -agentpath:<pathname>[=<options>]\n chargement de la biblioth\u00E8que d''agent natif via le chemin d''acc\u00E8s complet\n -javaagent:<jarpath>[=<options>]\n chargement de l''agent du langage de programmation Java, voir java.lang.instrument\n -splash:<imagepath>\n affichage de l''\u00E9cran d''accueil avec l''image sp\u00E9cifi\u00E9e\nVoir http://www.oracle.com/technetwork/java/javase/documentation/index.html pour plus de d\u00E9tails.
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\ -Xmixed ex\u00E9cution en mode mixte (valeur par d\u00E9faut)\n -Xint ex\u00E9cution en mode interpr\u00E9t\u00E9 uniquement\n -Xbootclasspath:<directories and zip/jar files separated by {0}>\n d\u00E9finition du chemin de recherche pour les ressources et classes bootstrap\n -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n ajout \u00E0 la fin du chemin de classe bootstrap\n -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n ajout au d\u00E9but du chemin de classe bootstrap\n -Xdiag affichage de messages de diagnostic suppl\u00E9mentaires\n -Xnoclassgc d\u00E9sactivation de l''op\u00E9ration de ramasse-miette (garbage collection) de la classe\n -Xincgc activation de l''op\u00E9ration de ramasse-miette (garbage collection) incr\u00E9mentielle\n -Xloggc:<file> journalisation du statut de l''op\u00E9ration de ramasse-miette (garbage collection) dans un fichier avec horodatages\n -Xbatch d\u00E9sactivation de la compilation en arri\u00E8re-plan\n -Xms<size> d\u00E9finition de la taille initiale des portions de m\u00E9moire Java\n -Xmx<size> d\u00E9finition de la taille maximale des portions de m\u00E9moire Java\n -Xss<size> d\u00E9finition de la taille de pile de thread Java\n -Xprof sortie des donn\u00E9es de profilage de l''unit\u00E9 centrale\n -Xfuture activation des contr\u00F4les les plus stricts en vue d''anticiper la future valeur par d\u00E9faut\n -Xrs r\u00E9duction de l''utilisation des signaux OS par Java/la machine virtuelle (voir documentation)\n -Xcheck:jni ex\u00E9cution de contr\u00F4les suppl\u00E9mentaires pour les fonctions JNI\n -Xshare:off aucune tentative d''utilisation des donn\u00E9es de classe partag\u00E9es\n -Xshare:auto utilisation des donn\u00E9es de classe partag\u00E9es si possible (valeur par d\u00E9faut)\n -Xshare:on utilisation des donn\u00E9es de classe partag\u00E9es obligatoire ou \u00E9chec de l''op\u00E9ration\n -XshowSettings affichage de tous les param\u00E8tres et poursuite de l''op\u00E9ration\n -XshowSettings:all\n affichage de tous les param\u00E8tres et poursuite de l''op\u00E9ration\n -XshowSettings:vm affichage de tous les param\u00E8tres de machine virtuelle et poursuite de l''op\u00E9ration\n -XshowSettings:properties\n affichage de tous les param\u00E8tres de propri\u00E9t\u00E9 et poursuite de l''op\u00E9ration\n -XshowSettings:locale\n affichage de tous les param\u00E8tres d''environnement local et poursuite de l''op\u00E9ration\n\nLes options -X ne sont pas des options standard et peuvent faire l''objet de modifications sans pr\u00E9avis.\n
# Translators please note do not translate the options themselves
-java.launcher.X.usage=\ -Xmixed ex\u00E9cution en mode mixte (valeur par d\u00E9faut)\n\ -Xint ex\u00E9cution en mode interpr\u00E9t\u00E9 uniquement\n\ -Xbootclasspath:<directories and zip/jar files separated by {0}>\n\ d\u00E9finition du chemin de recherche pour les ressources et classes bootstrap\n\ -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n\ ajout \u00E0 la fin du chemin de classe bootstrap\n\ -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n\ ajout au d\u00E9but du chemin de classe bootstrap\n\ -Xdiag affichage de messages de diagnostic suppl\u00E9mentaires\n\ -Xnoclassgc d\u00E9sactivation de l''op\u00E9ration de ramasse-miette (garbage collection) de la classe\n\ -Xincgc activation de l''op\u00E9ration de ramasse-miette (garbage collection) incr\u00E9mentielle\n\ -Xloggc:<file> journalisation du statut de l''op\u00E9ration de ramasse-miette (garbage collection) dans un fichier avec horodatages\n\ -Xbatch d\u00E9sactivation de la compilation en arri\u00E8re-plan\n\ -Xms<size> d\u00E9finition de la taille initiale des portions de m\u00E9moire Java\n\ -Xmx<size> d\u00E9finition de la taille maximale des portions de m\u00E9moire Java\n\ -Xss<size> d\u00E9finition de la taille de pile de thread Java\n\ -Xprof sortie des donn\u00E9es de profilage de l''unit\u00E9 centrale\n\ -Xfuture activation des contr\u00F4les les plus stricts en vue d''anticiper la future valeur par d\u00E9faut\n\ -Xrs r\u00E9duction de l''utilisation des signaux OS par Java/la machine virtuelle (voir documentation)\n\ -Xcheck:jni ex\u00E9cution de contr\u00F4les suppl\u00E9mentaires pour les fonctions JNI\n\ -Xshare:off aucune tentative d''utilisation des donn\u00E9es de classe partag\u00E9es\n\ -Xshare:auto utilisation des donn\u00E9es de classe partag\u00E9es si possible (valeur par d\u00E9faut)\n\ -Xshare:on utilisation des donn\u00E9es de classe partag\u00E9es obligatoire ou \u00E9chec de l''op\u00E9ration\n\ -XshowSettings affichage de tous les param\u00E8tres et poursuite de l''op\u00E9ration\n\ -XshowSettings:all\n\ affichage de tous les param\u00E8tres et poursuite de l''op\u00E9ration\n\ -XshowSettings:vm affichage de tous les param\u00E8tres de machine virtuelle et poursuite de l''op\u00E9ration\n\ -XshowSettings:properties\n\ affichage de tous les param\u00E8tres de propri\u00E9t\u00E9 et poursuite de l''op\u00E9ration\n\ -XshowSettings:locale\n\ affichage de tous les param\u00E8tres d''environnement local et poursuite de l''op\u00E9ration\n\nLes options -X ne sont pas des options standard et peuvent faire l''objet de modifications sans pr\u00E9avis.\n
+java.launcher.X.macosx.usage=\nLes options suivantes sont propres \u00E0 Mac OS X :\n -XstartOnFirstThread\n ex\u00E9cute la m\u00E9thode main() sur le premier thread (AppKit)\n -Xdock:name=<application name>"\n remplace le nom d'application par d\u00E9faut affich\u00E9 dans l'ancrage\n -Xdock:icon=<path to icon file>\n remplace l'ic\u00F4ne par d\u00E9faut affich\u00E9e dans l'ancrage\n\n
java.launcher.cls.error1=Erreur : impossible de trouver ou charger la classe principale {0}
-java.launcher.cls.error2=Erreur : la m\u00E9thode principale n''est pas {0} dans la classe {1}, d\u00E9finissez la m\u00E9thode principale comme suit :\n\ public static void main(String[] args)
-java.launcher.cls.error3=Erreur : la m\u00E9thode principale doit renvoyer une valeur de type void dans la classe {0}, \nd\u00E9finissez la m\u00E9thode principale comme suit :\n\ public static void main(String[] args)
-java.launcher.cls.error4=Erreur : la m\u00E9thode principale est introuvable dans la classe {0}, d\u00E9finissez la m\u00E9thode principale comme suit :\n\ public static void main(String[] args)
+java.launcher.cls.error2=Erreur : la m\u00E9thode principale n''est pas {0} dans la classe {1}, d\u00E9finissez la m\u00E9thode principale comme suit :\n public static void main(String[] args)
+java.launcher.cls.error3=Erreur : la m\u00E9thode principale doit renvoyer une valeur de type void dans la classe {0}, \nd\u00E9finissez la m\u00E9thode principale comme suit :\n public static void main(String[] args)
+java.launcher.cls.error4=Erreur : la m\u00E9thode principale est introuvable dans la classe {0}, d\u00E9finissez la m\u00E9thode principale comme suit :\n public static void main(String[] args)\nou une classe d''applications JavaFX doit \u00E9tendre {1}
+java.launcher.cls.error5=Erreur : des composants d'ex\u00E9cution JavaFX obligatoires pour ex\u00E9cuter cette application sont manquants.
java.launcher.jar.error1=Erreur : une erreur inattendue est survenue lors de la tentative d''ouverture du fichier {0}
java.launcher.jar.error2=fichier manifeste introuvable dans {0}
java.launcher.jar.error3=aucun attribut manifest principal dans {0}
+java.launcher.init.error=erreur d'initialisation
+java.launcher.javafx.error1=Erreur : la signature de la m\u00E9thode launchApplication JavaFX est incorrecte, la\nm\u00E9thode doit \u00EAtre d\u00E9clar\u00E9e statique et renvoyer une valeur de type void
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_it.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_it.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
#
# Translators please note do not translate the options themselves
-java.launcher.opt.header = Uso: {0} [-opzioni] class [argomenti...]\n\ (per eseguire una classe)\n oppure {0} [-opzioni] -jar filejar [argomenti...]\n\ (per eseguire un file jar)\ndove le opzioni sono:\n
+java.launcher.opt.header = Uso: {0} [-opzioni] class [argomenti...]\n (per eseguire una classe)\n oppure {0} [-opzioni] -jar filejar [argomenti...]\n (per eseguire un file jar)\ndove le opzioni sono:\n
java.launcher.opt.datamodel =\ -d{0}\t usare un modello di dati {0}-bit se disponibile\n
java.launcher.opt.vmselect =\ {0}\t per selezionare la VM "{1}"\n
@@ -34,15 +34,21 @@
java.launcher.ergo.message2 =\ perch\u00E9 si utilizza un computer di classe server.\n
# Translators please note do not translate the options themselves
-java.launcher.opt.footer =\ -cp <classpath di ricerca di directory e file zip/jar>\n\ -classpath <classpath di ricerca di directory e file zip/jar>\n\ Una lista separata da {0} di directory, archivi JAR\n\ e archivi ZIP utilizzata per la ricerca di file di classe.\n\ -D<nome>=<valore>\n\ imposta una propriet\u00E0 di sistema\n\ -verbose[:class|gc|jni]\n\ abilita l''output descrittivo\n\ -version stampa la versione del prodotto ed esce\n\ -version:<valore>\n\ richiede l''esecuzione della versione specificata\n\ -showversion stampa la versione del prodotto e continua\n\ -jre-restrict-search | -no-jre-restrict-search\n\ include/esclude gli ambienti JRE privati dell''utente nella ricerca della versione\n\ -? -help stampa questo messaggio della Guida\n\ -X stampa la Guida sulle opzioni non standard\n\ -ea[:<nomepackage>...|:<nomeclasse>]\n\ -enableassertions[:<nomepackage>...|:<nomeclasse>]\n\ abilita le asserzioni con la granularit\u00E0 specificata\n\ -da[:<nomepackage>...|:<nomeclasse>]\n\ -disableassertions[:<nomepackage>...|:<nomeclasse>]\n\ disabilita le asserzioni con la granularit\u00E0 specificata\n\ -esa | -enablesystemassertions\n\ abilita le asserzioni di sistema\n\ -dsa | -disablesystemassertions\n\ disabilita le asserzioni di sistema\n\ -agentlib:<nomelib>[=<opzioni>]\n\ carica la libreria agenti nativa <nomelib>, ad esempio -agentlib:hprof\n\ vedere anche -agentlib:jdwp=help and -agentlib:hprof=help\n\ -agentpath:<nomepercorso>[=<opzioni>]\n\ carica la libreria agenti nativa con il percorso completo\n\ -javaagent:<percorsojar>[=<opzioni>]\n\ carica l''agente del linguaggio di programmazione Java. Vedere java.lang.instrument\n\ -splash:<percorsoimmagine>\n\ mostra la schermata iniziale con l''immagine specificata\nVedere http://java.sun.com/javase/reference per maggiori dettagli.
+java.launcher.opt.footer =\ -cp <classpath di ricerca di directory e file zip/jar>\n\\ -classpath <classpath di ricerca di directory e file zip/jar>\n\\ Una lista separata da {0} di directory, archivi JAR,\n\\ e archivi ZIP utilizzata per la ricerca di file di classe.\n\\ -D<nome>=<valore>\n\\ imposta una propriet\u00E0 di sistema\n\\ -verbose:[class|gc|jni]\n\\ abilita l''output descrittivo\n\\ -version stampa la versione del prodotto ed esce\n\\ -version:<valore>\n\\ richiede l''esecuzione della versione specificata\n\\ -showversion stampa la versione del prodotto e continua\n\\ -jre-restrict-search | -no-jre-restrict-search\n\\ include/esclude gli ambienti JRE privati dell''utente nella ricerca della versione\n\\ -? -help stampa questo messaggio della Guida\n\\ -X stampa la Guida sulle opzioni non standard\n\\ -ea[:<nomepackage>...|:<nomeclasse>]\n\\ -enableassertions[:<nomepackage>...|:<nomeclasse>]\n\\ abilita le asserzioni con la granularit\u00E0 specificata\n\\ -da[:<nomepackage>...|:<nomeclasse>]\n\\ -disableassertions[:<nomepackage>...|:<nomeclasse>]\n\\ disabilita le asserzioni con la granularit\u00E0 specificata\n\\ -esa | -enablesystemassertions\n\\ abilita le asserzioni di sistema\n\\ -dsa | -disablesystemassertions\n\\ disabilita le asserzioni di sistema\n\\ -agentlib:<nomelib>[=<opzioni>]\n\\ carica la libreria agenti nativa <nomelib>, ad esempio -agentlib:hprof\n\\ vedere anche, -agentlib:jdwp=help and -agentlib:hprof=help\n\\ -agentpath:<nomepercorso>[=<opzioni>]\n\\ carica la libreria agenti nativa con il percorso completo\n\\ -javaagent:<percorsojar>[=<opzioni>]\n\\ carica l''agente del linguaggio di programmazione Java. Vedere java.lang.instrument\n\\ -splash:<percorsoimmagine>\n\\ mostra la schermata iniziale con l''immagine specificata\nPer ulteriori dettagli, vedere http://www.oracle.com/technetwork/java/javase/documentation/index.html.
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\ -Xmixed esecuzione in modalit\u00E0 mista (impostazione predefinita)\n -Xint esecuzione solo in modalit\u00E0 convertita\n -Xbootclasspath:<directory e file zip/jar separati da {0}>\n imposta il percorso di ricerca per le classi e le risorse di bootstrap\n -Xbootclasspath/a:<directory e file zip/jar separati da {0}>\n aggiunge alla fine del classpath di bootstrap\n -Xbootclasspath/p:<directory e file zip/jar separati da {0}>\n antepone al classpath di bootstrap\n -Xdiag mostra messaggi di diagnostica aggiuntivi\n -Xnoclassgc disabilita la garbage collection della classe\n -Xincgc abilita la garbage collection incrementale\n -Xloggc:<file> registra lo stato GC in un file di log con indicatori orari\n -Xbatch disabilita la compilazione in background\n -Xms<dimensione> imposta la dimensione heap Java iniziale\n -Xmx<dimensione> imposta la dimensione heap Java massima\n -Xss<dimensione> imposta la dimensione dello stack di thread Java\n -Xprof visualizza i dati di profilo della CPU\n -Xfuture abilita i controlli pi\u00F9 limitativi anticipando le impostazioni predefinite future\n -Xrs riduce l''uso di segnali del sistema operativo da Java/VM (vedere la documentazione)\n -Xcheck:jni esegue controlli aggiuntivi per le funzioni JNI\n -Xshare:off non tenta di utilizzare i dati della classe condivisi\n -Xshare:auto utilizza i dati di classe condivisi se possibile (impostazione predefinita)\n -Xshare:on richiede l''uso dei dati di classe condivisi, altrimenti l''esecuzione non riesce.\n -XshowSettings mostra tutte le impostazioni e continua\n -XshowSettings:all\n mostra tutte le impostazioni e continua\n -XshowSettings:vm mostra tutte le impostazioni correlate alla VM e continua\n -XshowSettings:properties\n mostra tutte le impostazioni delle propriet\u00E0 e continua\n -XshowSettings:locale\n mostra tutte le impostazioni correlate alle impostazioni nazionali e continua\n\nLe opzioni -X non sono opzioni standard e sono soggette a modifiche senza preavviso.\n
# Translators please note do not translate the options themselves
-java.launcher.X.usage=\ -Xmixed esecuzione in modalit\u00E0 mista (impostazione predefinita)\n\ -Xint esecuzione solo in modalit\u00E0 convertita\n\ -Xbootclasspath:<directory e file zip/jar separati da {0}>\n\ imposta il percorso di ricerca per le classi e le risorse di bootstrap\n\ -Xbootclasspath/a:<directory e file zip/jar separati da {0}>\n\ aggiunge alla fine del classpath di bootstrap\n\ -Xbootclasspath/p:<directory e file zip/jar separati da {0}>\n\ antepone al classpath di bootstrap\n\ -Xdiag mostra messaggi di diagnostica aggiuntivi\n\ -Xnoclassgc disabilita la garbage collection della classe\n\ -Xincgc abilita la garbage collection incrementale\n\ -Xloggc:<file> registra lo stato GC in un file di log con indicatori orari\n\ -Xbatch disabilita la compilazione in background\n\ -Xms<dimensione> imposta la dimensione heap Java iniziale\n\ -Xmx<dimensione> imposta la dimensione heap Java massima\n\ -Xss<dimensione> imposta la dimensione dello stack di thread Java\n\ -Xprof visualizza i dati di profilo della CPU\n\ -Xfuture abilita i controlli pi\u00F9 limitativi anticipando le impostazioni predefinite future\n\ -Xrs riduce l''uso di segnali del sistema operativo da Java/VM (vedere la documentazione)\n\ -Xcheck:jni esegue controlli aggiuntivi per le funzioni JNI\n\ -Xshare:off non tenta di utilizzare i dati della classe condivisi\n\ -Xshare:auto utilizza i dati di classe condivisi se possibile (impostazione predefinita)\n\ -Xshare:on richiede l''uso dei dati di classe condivisi, altrimenti l''esecuzione non riesce.\n\ -XshowSettings mostra tutte le impostazioni e continua\n\ -XshowSettings:all\n\ mostra tutte le impostazioni e continua\n\ -XshowSettings:vm mostra tutte le impostazioni correlate alla VM e continua\n\ -XshowSettings:properties\n\ mostra tutte le impostazioni delle propriet\u00E0 e continua\n\ -XshowSettings:locale\n\ mostra tutte le impostazioni correlate alle impostazioni nazionali e continua\n\nLe opzioni -X non sono opzioni standard e sono soggette a modifiche senza preavviso.\n
+java.launcher.X.macosx.usage=\nLe opzioni riportate di seguito sono specifiche del sistema operativo Mac OS X:\n -XstartOnFirstThread\n Esegue il metodo main() sul primo thread (AppKit).\n -Xdock:name=<nome applicazione>"\n Sostituisce il nome applicazione predefinito visualizzato nel dock\n -Xdock:icon=<percorso file icona>\n Sostituisce l'icona predefinita visualizzata nel dock\n\n
java.launcher.cls.error1=Errore: impossibile trovare o caricare la classe principale {0}
-java.launcher.cls.error2=Errore: il metodo principale non \u00E8 {0} nella classe {1}. Definire il metodo principale come:\n\ public static void main(String[] args)
-java.launcher.cls.error3=Errore: il metodo principale deve restituire un valore di tipo void nella classe {0}. \nDefinire il metodo principale come:\n\ public static void main(String[] args)
-java.launcher.cls.error4=Errore: il metodo principale non \u00E8 stato trovato nella classe {0}. Definire il metodo principale come:\n\ public static void main(String[] args)
+java.launcher.cls.error2=Errore: il metodo principale non \u00E8 {0} nella classe {1}. Definire il metodo principale come:\n public static void main(String[] args)
+java.launcher.cls.error3=Errore: il metodo principale deve restituire un valore di tipo void nella classe {0}. \nDefinire il metodo principale come:\n public static void main(String[] args)
+java.launcher.cls.error4=Errore: il metodo principale non \u00E8 stato trovato nella classe {0}. Definire il metodo principale come:\n public static void main(String[] args)\naltrimenti una classe applicazione JavaFX deve estendere {1}
+java.launcher.cls.error5=Errore: non sono presenti i componenti runtime di JavaFX necessari per eseguire questa applicazione
java.launcher.jar.error1=Errore: si \u00E8 verificato un errore imprevisto durante il tentativo di aprire il file {0}
java.launcher.jar.error2=manifest non trovato in {0}
java.launcher.jar.error3=nessun attributo manifest principale in {0}
+java.launcher.init.error=errore di inizializzazione
+java.launcher.javafx.error1=Errore: il metodo JavaFX launchApplication dispone di una firma errata, \nla firma deve essere dichiarata static e restituire un valore di tipo void
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
#
# Translators please note do not translate the options themselves
-java.launcher.opt.header = \u4F7F\u7528\u65B9\u6CD5: {0} [-options] class [args...]\n\ (\u30AF\u30E9\u30B9\u3092\u5B9F\u884C\u3059\u308B\u5834\u5408)\n \u307E\u305F\u306F {0} [-options] -jar jarfile [args...]\n\ (jar\u30D5\u30A1\u30A4\u30EB\u3092\u5B9F\u884C\u3059\u308B\u5834\u5408)\noptions\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n
+java.launcher.opt.header = \u4F7F\u7528\u65B9\u6CD5: {0} [-options] class [args...]\n (\u30AF\u30E9\u30B9\u3092\u5B9F\u884C\u3059\u308B\u5834\u5408)\n \u307E\u305F\u306F {0} [-options] -jar jarfile [args...]\n (jar\u30D5\u30A1\u30A4\u30EB\u3092\u5B9F\u884C\u3059\u308B\u5834\u5408)\noptions\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n
java.launcher.opt.datamodel =\ -d{0}\t \u4F7F\u7528\u53EF\u80FD\u306A\u5834\u5408\u306F{0}\u30D3\u30C3\u30C8\u306E\u30C7\u30FC\u30BF\u30FB\u30E2\u30C7\u30EB\u3092\u4F7F\u7528\u3059\u308B\n
java.launcher.opt.vmselect =\ {0}\t "{1}" VM\u3092\u9078\u629E\u3059\u308B\u5834\u5408\n
@@ -34,15 +34,21 @@
java.launcher.ergo.message2 =\ \u3053\u308C\u306F\u30B5\u30FC\u30D0\u30FC\u30AF\u30E9\u30B9\u306E\u30DE\u30B7\u30F3\u3067\u5B9F\u884C\u3057\u3066\u3044\u308B\u305F\u3081\u3067\u3059\u3002\n
# Translators please note do not translate the options themselves
-java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n\ -classpath <class search path of directories and zip/jar files>\n\ \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3001\n\ JAR\u30A2\u30FC\u30AB\u30A4\u30D6\u304A\u3088\u3073ZIP\u30A2\u30FC\u30AB\u30A4\u30D6\u306E{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30EA\u30B9\u30C8\u3067\u3059\u3002\n\ -D<name>=<value>\n\ \u30B7\u30B9\u30C6\u30E0\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u8A2D\u5B9A\u3059\u308B\n\ -verbose[:class|gc|jni]\n\ \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046\n\ -version \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D42\u4E86\u3059\u308B\n\ -version:<value>\n\ \u6307\u5B9A\u3057\u305F\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u5B9F\u884C\u306B\u5FC5\u9808\u306B\u3059\u308B\n\ -showversion \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D9A\u884C\u3059\u308B\n\ -jre-restrict-search | -no-jre-restrict-search\n\ \u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30E9\u30A4\u30D9\u30FC\u30C8JRE\u3092\u30D0\u30FC\u30B8\u30E7\u30F3\u691C\u7D22\u306B\u542B\u3081\u308B/\u9664\u5916\u3059\u308B\n\ -? -help \u3053\u306E\u30D8\u30EB\u30D7\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B\n\ -X \u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u95A2\u3059\u308B\u30D8\u30EB\u30D7\u3092\u51FA\u529B\u3059\u308B\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n\ -esa | -enablesystemassertions\n\ \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n\ -dsa | -disablesystemassertions\n\ \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n\ -agentlib:<libname>[=<options>]\n\ \u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA<libname>\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002\u4F8B: -agentlib:hprof\n\ -agentlib:jdwp=help\u3068-agentlib:hprof=help\u3082\u53C2\u7167\n\ -agentpath:<pathname>[=<options>]\n\ \u30D5\u30EB\u30D1\u30B9\u540D\u3067\u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u30ED\u30FC\u30C9\u3059\u308B\n\ -javaagent:<jarpath>[=<options>]\n\ Java\u30D7\u30ED\u30B0\u30E9\u30DF\u30F3\u30B0\u8A00\u8A9E\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002java.lang.instrument\u3092\u53C2\u7167\n\ -splash:<imagepath>\n\ \u6307\u5B9A\u3057\u305F\u30A4\u30E1\u30FC\u30B8\u3067\u30B9\u30D7\u30E9\u30C3\u30B7\u30E5\u753B\u9762\u3092\u8868\u793A\u3059\u308B\n\u8A73\u7D30\u306Fhttp://java.sun.com/javase/reference\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n -classpath <class search path of directories and zip/jar files>\n \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3001\n JAR\u30A2\u30FC\u30AB\u30A4\u30D6\u304A\u3088\u3073ZIP\u30A2\u30FC\u30AB\u30A4\u30D6\u306E{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30EA\u30B9\u30C8\u3067\u3059\u3002\n -D<name>=<value>\n \u30B7\u30B9\u30C6\u30E0\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u8A2D\u5B9A\u3059\u308B\n -verbose:[class|gc|jni]\n \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046\n -version \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D42\u4E86\u3059\u308B\n -version:<value>\n \u6307\u5B9A\u3057\u305F\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u5B9F\u884C\u306B\u5FC5\u9808\u306B\u3059\u308B\n -showversion \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D9A\u884C\u3059\u308B\n -jre-restrict-search | -no-jre-restrict-search\n \u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30E9\u30A4\u30D9\u30FC\u30C8JRE\u3092\u30D0\u30FC\u30B8\u30E7\u30F3\u691C\u7D22\u306B\u542B\u3081\u308B/\u9664\u5916\u3059\u308B\n -? -help \u3053\u306E\u30D8\u30EB\u30D7\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B\n -X \u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u95A2\u3059\u308B\u30D8\u30EB\u30D7\u3092\u51FA\u529B\u3059\u308B\n -ea[:<packagename>...|:<classname>]\n -enableassertions[:<packagename>...|:<classname>]\n \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n -da[:<packagename>...|:<classname>]\n -disableassertions[:<packagename>...|:<classname>]\n \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n -esa | -enablesystemassertions\n \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n -dsa | -disablesystemassertions\n \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n -agentlib:<libname>[=<options>]\n \u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA<libname>\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002\u4F8B: -agentlib:hprof\n -agentlib:jdwp=help\u3068-agentlib:hprof=help\u3082\u53C2\u7167\n -agentpath:<pathname>[=<options>]\n \u30D5\u30EB\u30D1\u30B9\u540D\u3067\u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u30ED\u30FC\u30C9\u3059\u308B\n -javaagent:<jarpath>[=<options>]\n Java\u30D7\u30ED\u30B0\u30E9\u30DF\u30F3\u30B0\u8A00\u8A9E\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002java.lang.instrument\u3092\u53C2\u7167\n -splash:<imagepath>\n \u6307\u5B9A\u3057\u305F\u30A4\u30E1\u30FC\u30B8\u3067\u30B9\u30D7\u30E9\u30C3\u30B7\u30E5\u753B\u9762\u3092\u8868\u793A\u3059\u308B\n\u8A73\u7D30\u306Fhttp://www.oracle.com/technetwork/java/javase/documentation/index.html\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\ -Xmixed \u6DF7\u5408\u30E2\u30FC\u30C9\u306E\u5B9F\u884C(\u30C7\u30D5\u30A9\u30EB\u30C8)\n -Xint \u30A4\u30F3\u30BF\u30D7\u30EA\u30BF\u30FB\u30E2\u30FC\u30C9\u306E\u5B9F\u884C\u306E\u307F\n -Xbootclasspath:<directories and zip/jar files separated by {0}>\n \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u306E\u30AF\u30E9\u30B9\u3068\u30EA\u30BD\u30FC\u30B9\u306E\u691C\u7D22\u30D1\u30B9\u3092\u8A2D\u5B9A\u3059\u308B\n -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u6700\u5F8C\u306B\u8FFD\u52A0\u3059\u308B\n -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u524D\u306B\u4ED8\u52A0\u3059\u308B\n -Xdiag \u8FFD\u52A0\u306E\u8A3A\u65AD\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3059\u308B\n -Xnoclassgc \u30AF\u30E9\u30B9\u306E\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n -Xincgc \u5897\u5206\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n -Xloggc:<file> \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u4ED8\u3044\u305F\u30D5\u30A1\u30A4\u30EB\u306BGC\u30B9\u30C6\u30FC\u30BF\u30B9\u306E\u30ED\u30B0\u3092\u8A18\u9332\u3059\u308B\n -Xbatch \u30D0\u30C3\u30AF\u30B0\u30E9\u30A6\u30F3\u30C9\u306E\u30B3\u30F3\u30D1\u30A4\u30EB\u3092\u7121\u52B9\u306B\u3059\u308B\n -Xms<size> Java\u306E\u521D\u671F\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n -Xmx<size> Java\u306E\u6700\u5927\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n -Xss<size> Java\u306E\u30B9\u30EC\u30C3\u30C9\u30FB\u30B9\u30BF\u30C3\u30AF\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n -Xprof CPU\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u30FB\u30C7\u30FC\u30BF\u3092\u51FA\u529B\u3059\u308B\n -Xfuture \u5C06\u6765\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u898B\u8D8A\u3057\u3066\u3001\u6700\u3082\u53B3\u5BC6\u306A\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u306B\u3059\u308B\n -Xrs Java/VM\u306B\u3088\u308BOS\u30B7\u30B0\u30CA\u30EB\u306E\u4F7F\u7528\u3092\u524A\u6E1B\u3059\u308B(\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u53C2\u7167)\n -Xcheck:jni JNI\u95A2\u6570\u306B\u5BFE\u3059\u308B\u8FFD\u52A0\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u5B9F\u884C\u3059\u308B\n -Xshare:off \u5171\u6709\u30AF\u30E9\u30B9\u306E\u30C7\u30FC\u30BF\u3092\u4F7F\u7528\u3057\u3088\u3046\u3068\u3057\u306A\u3044\n -Xshare:auto \u53EF\u80FD\u3067\u3042\u308C\u3070\u5171\u6709\u30AF\u30E9\u30B9\u306E\u30C7\u30FC\u30BF\u3092\u4F7F\u7528\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)\n -Xshare:on \u5171\u6709\u30AF\u30E9\u30B9\u30FB\u30C7\u30FC\u30BF\u306E\u4F7F\u7528\u3092\u5FC5\u9808\u306B\u3057\u3001\u3067\u304D\u306A\u3051\u308C\u3070\u5931\u6557\u3059\u308B\u3002\n -XshowSettings \u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n -XshowSettings:all\n \u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n -XshowSettings:vm \u3059\u3079\u3066\u306EVM\u95A2\u9023\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n -XshowSettings:properties\n \u3059\u3079\u3066\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n -XshowSettings:locale\n \u3059\u3079\u3066\u306E\u30ED\u30B1\u30FC\u30EB\u95A2\u9023\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\n-X\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u975E\u6A19\u6E96\u306A\u306E\u3067\u3001\u4E88\u544A\u306A\u304F\u5909\u66F4\u3055\u308C\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002\n
# Translators please note do not translate the options themselves
-java.launcher.X.usage=\ -Xmixed \u6DF7\u5408\u30E2\u30FC\u30C9\u306E\u5B9F\u884C(\u30C7\u30D5\u30A9\u30EB\u30C8)\n\ -Xint \u30A4\u30F3\u30BF\u30D7\u30EA\u30BF\u30FB\u30E2\u30FC\u30C9\u306E\u5B9F\u884C\u306E\u307F\n\ -Xbootclasspath:<directories and zip/jar files separated by {0}>\n\ \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u306E\u30AF\u30E9\u30B9\u3068\u30EA\u30BD\u30FC\u30B9\u306E\u691C\u7D22\u30D1\u30B9\u3092\u8A2D\u5B9A\u3059\u308B\n\ -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n\ \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u6700\u5F8C\u306B\u8FFD\u52A0\u3059\u308B\n\ -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n\ \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u524D\u306B\u4ED8\u52A0\u3059\u308B\n\ -Xdiag \u8FFD\u52A0\u306E\u8A3A\u65AD\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3059\u308B\n\ -Xnoclassgc \u30AF\u30E9\u30B9\u306E\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n\ -Xincgc \u5897\u5206\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n\ -Xloggc:<file> \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u4ED8\u3044\u305F\u30D5\u30A1\u30A4\u30EB\u306BGC\u30B9\u30C6\u30FC\u30BF\u30B9\u306E\u30ED\u30B0\u3092\u8A18\u9332\u3059\u308B\n\ -Xbatch \u30D0\u30C3\u30AF\u30B0\u30E9\u30A6\u30F3\u30C9\u306E\u30B3\u30F3\u30D1\u30A4\u30EB\u3092\u7121\u52B9\u306B\u3059\u308B\n\ -Xms<size> Java\u306E\u521D\u671F\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n\ -Xmx<size> Java\u306E\u6700\u5C0F\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n\ -Xss<size> Java\u306E\u30B9\u30EC\u30C3\u30C9\u30FB\u30B9\u30BF\u30C3\u30AF\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n\ -Xprof CPU\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u30FB\u30C7\u30FC\u30BF\u3092\u51FA\u529B\u3059\u308B\n\ -Xfuture \u5C06\u6765\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u898B\u8D8A\u3057\u3066\u3001\u6700\u3082\u53B3\u5BC6\u306A\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u306B\u3059\u308B\n\ -Xrs Java/VM\u306B\u3088\u308BOS\u30B7\u30B0\u30CA\u30EB\u306E\u4F7F\u7528\u3092\u524A\u6E1B\u3059\u308B(\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u53C2\u7167)\n\ -Xcheck:jni JNI\u95A2\u6570\u306B\u5BFE\u3059\u308B\u8FFD\u52A0\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u5B9F\u884C\u3059\u308B\n\ -Xshare:off \u5171\u6709\u30AF\u30E9\u30B9\u306E\u30C7\u30FC\u30BF\u3092\u4F7F\u7528\u3057\u3088\u3046\u3068\u3057\u306A\u3044\n\ -Xshare:auto \u53EF\u80FD\u3067\u3042\u308C\u3070\u5171\u6709\u30AF\u30E9\u30B9\u306E\u30C7\u30FC\u30BF\u3092\u4F7F\u7528\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)\n\ -Xshare:on \u5171\u6709\u30AF\u30E9\u30B9\u30FB\u30C7\u30FC\u30BF\u306E\u4F7F\u7528\u3092\u5FC5\u9808\u306B\u3057\u3001\u3067\u304D\u306A\u3051\u308C\u3070\u5931\u6557\u3059\u308B\u3002\n\ -XshowSettings \u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\ -XshowSettings:all\n\ \u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\ -XshowSettings:vm \u3059\u3079\u3066\u306EVM\u95A2\u9023\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\ -XshowSettings:properties\n\ \u3059\u3079\u3066\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\ -XshowSettings:locale\n\ \u3059\u3079\u3066\u306E\u30ED\u30B1\u30FC\u30EB\u95A2\u9023\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\n-X\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u975E\u6A19\u6E96\u306A\u306E\u3067\u3001\u4E88\u544A\u306A\u304F\u5909\u66F4\u3055\u308C\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002\n
+java.launcher.X.macosx.usage=\n\u6B21\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306FMac OS X\u56FA\u6709\u3067\u3059\u3002\n -XstartOnFirstThread\n main()\u30E1\u30BD\u30C3\u30C9\u3092\u6700\u521D(AppKit)\u306E\u30B9\u30EC\u30C3\u30C9\u3067\u5B9F\u884C\u3059\u308B\n -Xdock:name=<application name>"\n Dock\u306B\u8868\u793A\u3055\u308C\u308B\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u540D\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n -Xdock:icon=<path to icon file>\n Dock\u306B\u8868\u793A\u3055\u308C\u308B\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30A2\u30A4\u30B3\u30F3\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n\n
java.launcher.cls.error1=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30AF\u30E9\u30B9{0}\u304C\u898B\u3064\u304B\u3089\u306A\u304B\u3063\u305F\u304B\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-java.launcher.cls.error2=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u304C\u30AF\u30E9\u30B9{1}\u306E{0}\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u6B21\u306E\u3088\u3046\u306B\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n\ public static void main(String[] args)
-java.launcher.cls.error3=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u306F\u30AF\u30E9\u30B9{0}\u306Evoid\u578B\u306E\u5024\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\u6B21\u306E\u3088\u3046\u306B\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n\ public static void main(String[] args)
-java.launcher.cls.error4=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u304C\u30AF\u30E9\u30B9{0}\u3067\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002\u6B21\u306E\u3088\u3046\u306B\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n\ public static void main(String[] args)
+java.launcher.cls.error2=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u304C\u30AF\u30E9\u30B9{1}\u306E{0}\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u6B21\u306E\u3088\u3046\u306B\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n public static void main(String[] args)
+java.launcher.cls.error3=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u306F\u30AF\u30E9\u30B9{0}\u306Evoid\u578B\u306E\u5024\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\u6B21\u306E\u3088\u3046\u306B\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n public static void main(String[] args)
+java.launcher.cls.error4=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u304C\u30AF\u30E9\u30B9{0}\u3067\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002\u6B21\u306E\u3088\u3046\u306B\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n public static void main(String[] args)\n\u307E\u305F\u306FJavaFX\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30FB\u30AF\u30E9\u30B9\u306F{1}\u3092\u62E1\u5F35\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
+java.launcher.cls.error5=\u30A8\u30E9\u30FC: JavaFX\u30E9\u30F3\u30BF\u30A4\u30E0\u30FB\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u4E0D\u8DB3\u3057\u3066\u304A\u308A\u3001\u3053\u306E\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u5B9F\u884C\u306B\u5FC5\u8981\u3067\u3059
java.launcher.jar.error1=\u30A8\u30E9\u30FC: \u30D5\u30A1\u30A4\u30EB{0}\u3092\u958B\u3053\u3046\u3068\u3057\u3066\u3044\u308B\u3068\u304D\u306B\u3001\u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
java.launcher.jar.error2={0}\u306B\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
java.launcher.jar.error3={0}\u306B\u30E1\u30A4\u30F3\u30FB\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5C5E\u6027\u304C\u3042\u308A\u307E\u305B\u3093
+java.launcher.init.error=\u521D\u671F\u5316\u30A8\u30E9\u30FC
+java.launcher.javafx.error1=\u30A8\u30E9\u30FC: JavaFX launchApplication\u30E1\u30BD\u30C3\u30C9\u306B\u8AA4\u3063\u305F\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u3042\u308A\u3001\nstatic\u3092\u5BA3\u8A00\u3057\u3066void\u578B\u306E\u5024\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_ko.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_ko.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
#
# Translators please note do not translate the options themselves
-java.launcher.opt.header = \uC0AC\uC6A9\uBC95: {0} [-options] class [args...]\n\ (\uD074\uB798\uC2A4 \uC2E4\uD589)\n \uB610\uB294 {0} [-options] -jar jarfile [args...]\n\ (jar \uD30C\uC77C \uC2E4\uD589)\n\uC5EC\uAE30\uC11C options\uB294 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4.\n
+java.launcher.opt.header = \uC0AC\uC6A9\uBC95: {0} [-options] class [args...]\n (\uD074\uB798\uC2A4 \uC2E4\uD589)\n \uB610\uB294 {0} [-options] -jar jarfile [args...]\n (jar \uD30C\uC77C \uC2E4\uD589)\n\uC5EC\uAE30\uC11C options\uB294 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4.\n
java.launcher.opt.datamodel =\ -d{0}\t \uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uACBD\uC6B0 {0}\uBE44\uD2B8 \uB370\uC774\uD130 \uBAA8\uB378\uC744 \uC0AC\uC6A9\uD569\uB2C8\uB2E4.\n
java.launcher.opt.vmselect =\ {0}\t "{1}" VM\uC744 \uC120\uD0DD\uD569\uB2C8\uB2E4.\n
@@ -34,15 +34,21 @@
java.launcher.ergo.message2 =\ \uC11C\uBC84\uAE09 \uC2DC\uC2A4\uD15C\uC5D0\uC11C \uC2E4\uD589 \uC911\uC774\uAE30 \uB54C\uBB38\uC785\uB2C8\uB2E4.\n
# Translators please note do not translate the options themselves
-java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n\ -classpath <class search path of directories and zip/jar files>\n\ \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uAC80\uC0C9\uD560 {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC,\n\ JAR \uC544\uCE74\uC774\uBE0C \uBC0F ZIP \uC544\uCE74\uC774\uBE0C \uBAA9\uB85D\uC785\uB2C8\uB2E4.\n\ -D<name>=<value>\n\ \uC2DC\uC2A4\uD15C \uC18D\uC131\uC744 \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -verbose[:class|gc|jni]\n\ \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -version \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uC885\uB8CC\uD569\uB2C8\uB2E4.\n\ -version:<value>\n\ \uC2E4\uD589\uD560 \uBC84\uC804\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.\n\ -showversion \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\ -jre-restrict-search | -no-jre-restrict-search\n\ \uBC84\uC804 \uAC80\uC0C9\uC5D0\uC11C \uC0AC\uC6A9\uC790 \uC804\uC6A9 JRE\uB97C \uD3EC\uD568/\uC81C\uC678\uD569\uB2C8\uB2E4.\n\ -? -help \uC774 \uB3C4\uC6C0\uB9D0 \uBA54\uC2DC\uC9C0\uB97C \uC778\uC1C4\uD569\uB2C8\uB2E4.\n\ -X \uBE44\uD45C\uC900 \uC635\uC158\uC5D0 \uB300\uD55C \uB3C4\uC6C0\uB9D0\uC744 \uC778\uC1C4\uD569\uB2C8\uB2E4.\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -esa | -enablesystemassertions\n\ \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -dsa | -disablesystemassertions\n\ \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -agentlib:<libname>[=<options>]\n\ <libname> \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4(\uC608: -agentlib:hprof).\n\ -agentlib:jdwp=help \uBC0F -agentlib:hprof=help\uB3C4 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n\ -agentpath:<pathname>[=<options>]\n\ \uC804\uCCB4 \uACBD\uB85C\uBA85\uC744 \uC0AC\uC6A9\uD558\uC5EC \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4.\n\ -javaagent:<jarpath>[=<options>]\n\ Java \uD504\uB85C\uADF8\uB798\uBC0D \uC5B8\uC5B4 \uC5D0\uC774\uC804\uD2B8\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4. java.lang.instrument\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n\ -splash:<imagepath>\n\ \uC774\uBBF8\uC9C0\uAC00 \uC9C0\uC815\uB41C \uC2A4\uD50C\uB798\uC2DC \uD654\uBA74\uC744 \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\uC790\uC138\uD55C \uB0B4\uC6A9\uC740 http://java.sun.com/javase/reference\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.
+java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n\\ -classpath <class search path of directories and zip/jar files>\n\\ \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uAC80\uC0C9\uD560 {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC,\n\\ JAR \uC544\uCE74\uC774\uBE0C \uBC0F ZIP \uC544\uCE74\uC774\uBE0C \uBAA9\uB85D\uC785\uB2C8\uB2E4.\n\\ -D<name>=<value>\n\\ \uC2DC\uC2A4\uD15C \uC18D\uC131\uC744 \uC124\uC815\uD569\uB2C8\uB2E4.\n\\ -verbose:[class|gc|jni]\n\\ \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\ -version \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uC885\uB8CC\uD569\uB2C8\uB2E4.\n\\ -version:<value>\n\\ \uC2E4\uD589\uD560 \uBC84\uC804\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.\n\\ -showversion \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\\ -jre-restrict-search | -no-jre-restrict-search\n\\ \uBC84\uC804 \uAC80\uC0C9\uC5D0\uC11C \uC0AC\uC6A9\uC790 \uC804\uC6A9 JRE\uB97C \uD3EC\uD568/\uC81C\uC678\uD569\uB2C8\uB2E4.\n\\ -? -help \uC774 \uB3C4\uC6C0\uB9D0 \uBA54\uC2DC\uC9C0\uB97C \uC778\uC1C4\uD569\uB2C8\uB2E4.\n\\ -X \uBE44\uD45C\uC900 \uC635\uC158\uC5D0 \uB300\uD55C \uB3C4\uC6C0\uB9D0\uC744 \uC778\uC1C4\uD569\uB2C8\uB2E4.\n\\ -ea[:<packagename>...|:<classname>]\n\\ -enableassertions[:<packagename>...|:<classname>]\n\\ \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\ -da[:<packagename>...|:<classname>]\n\\ -disableassertions[:<packagename>...|:<classname>]\n\\ \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\ -esa | -enablesystemassertions\n\\ \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\ -dsa | -disablesystemassertions\n\\ \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\ -agentlib:<libname>[=<options>]\n\\ <libname> \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4(\uC608: -agentlib:hprof).\n\\ -agentlib:jdwp=help \uBC0F -agentlib:hprof=help\uB3C4 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n\\ -agentpath:<pathname>[=<options>]\n\\ \uC804\uCCB4 \uACBD\uB85C\uBA85\uC744 \uC0AC\uC6A9\uD558\uC5EC \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4.\n\\ -javaagent:<jarpath>[=<options>]\n\\ Java \uD504\uB85C\uADF8\uB798\uBC0D \uC5B8\uC5B4 \uC5D0\uC774\uC804\uD2B8\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4. java.lang.instrument\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n\\ -splash:<imagepath>\n\\ \uC774\uBBF8\uC9C0\uAC00 \uC9C0\uC815\uB41C \uC2A4\uD50C\uB798\uC2DC \uD654\uBA74\uC744 \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\uC790\uC138\uD55C \uB0B4\uC6A9\uC740 http://www.oracle.com/technetwork/java/javase/documentation/index.html\uC744 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\ -Xmixed \uD63C\uD569 \uBAA8\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n -Xint \uD574\uC11D\uB41C \uBAA8\uB4DC\uB9CC \uC2E4\uD589\uD569\uB2C8\uB2E4.\n -Xbootclasspath:<directories and zip/jar files separated by {0}>\n \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uBC0F \uB9AC\uC18C\uC2A4\uC5D0 \uB300\uD55C \uAC80\uC0C9 \uACBD\uB85C\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uB05D\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uC55E\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n -Xdiag \uCD94\uAC00 \uC9C4\uB2E8 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n -Xnoclassgc \uD074\uB798\uC2A4\uC758 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xincgc \uC99D\uBD84\uC801\uC778 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xloggc:<file> \uC2DC\uAC04 \uAE30\uB85D\uACFC \uD568\uAED8 \uD30C\uC77C\uC5D0 GC \uC0C1\uD0DC\uB97C \uAE30\uB85D\uD569\uB2C8\uB2E4.\n -Xbatch \uBC31\uADF8\uB77C\uC6B4\uB4DC \uCEF4\uD30C\uC77C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xms<size> \uCD08\uAE30 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xmx<size> \uCD5C\uB300 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xss<size> Java \uC2A4\uB808\uB4DC \uC2A4\uD0DD \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xprof CPU \uD504\uB85C\uD30C\uC77C \uC791\uC131 \uB370\uC774\uD130\uB97C \uCD9C\uB825\uD569\uB2C8\uB2E4.\n -Xfuture \uBBF8\uB798 \uAE30\uBCF8\uAC12\uC744 \uC608\uCE21\uD558\uC5EC \uAC00\uC7A5 \uC5C4\uACA9\uD55C \uAC80\uC0AC\uB97C \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xrs Java/VM\uC5D0 \uC758\uD55C OS \uC2E0\uD638 \uC0AC\uC6A9\uC744 \uC904\uC785\uB2C8\uB2E4(\uC124\uBA85\uC11C \uCC38\uC870).\n -Xcheck:jni JNI \uD568\uC218\uC5D0 \uB300\uD55C \uCD94\uAC00 \uAC80\uC0AC\uB97C \uC218\uD589\uD569\uB2C8\uB2E4.\n -Xshare:off \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130 \uC0AC\uC6A9\uC744 \uC2DC\uB3C4\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n -Xshare:auto \uAC00\uB2A5\uD55C \uACBD\uC6B0 \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n -Xshare:on \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4. \uADF8\uB807\uC9C0 \uC54A\uC744 \uACBD\uC6B0 \uC2E4\uD328\uD569\uB2C8\uB2E4.\n -XshowSettings \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n -XshowSettings:all\n \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n -XshowSettings:vm \uBAA8\uB4E0 VM \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n -XshowSettings:properties\n \uBAA8\uB4E0 \uC18D\uC131 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n -XshowSettings:locale\n \uBAA8\uB4E0 \uB85C\uCF00\uC77C \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\n-X \uC635\uC158\uC740 \uBE44\uD45C\uC900 \uC635\uC158\uC774\uBBC0\uB85C \uD1B5\uC9C0 \uC5C6\uC774 \uBCC0\uACBD\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n
# Translators please note do not translate the options themselves
-java.launcher.X.usage=\ -Xmixed \uD63C\uD569 \uBAA8\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n\ -Xint \uD574\uC11D\uB41C \uBAA8\uB4DC\uB9CC \uC2E4\uD589\uD569\uB2C8\uB2E4.\n\ -Xbootclasspath:<directories and zip/jar files separated by {0}>\n\ \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uBC0F \uB9AC\uC18C\uC2A4\uC5D0 \uB300\uD55C \uAC80\uC0C9 \uACBD\uB85C\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n\ \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uB05D\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n\ -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n\ \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uC55E\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n\ -Xdiag \uCD94\uAC00 \uC9C4\uB2E8 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ -Xnoclassgc \uD074\uB798\uC2A4\uC758 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xincgc \uC99D\uBD84\uC801\uC778 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xloggc:<file> \uC2DC\uAC04 \uAE30\uB85D\uACFC \uD568\uAED8 \uD30C\uC77C\uC5D0 GC \uC0C1\uD0DC\uB97C \uAE30\uB85D\uD569\uB2C8\uB2E4.\n\ -Xbatch \uBC31\uADF8\uB77C\uC6B4\uB4DC \uCEF4\uD30C\uC77C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xms<size> \uCD08\uAE30 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xmx<size> \uCD5C\uB300 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xss<size> Java \uC2A4\uB808\uB4DC \uC2A4\uD0DD \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xprof CPU \uD504\uB85C\uD30C\uC77C \uC791\uC131 \uB370\uC774\uD130\uB97C \uCD9C\uB825\uD569\uB2C8\uB2E4.\n\ -Xfuture \uBBF8\uB798 \uAE30\uBCF8\uAC12\uC744 \uC608\uCE21\uD558\uC5EC \uAC00\uC7A5 \uC5C4\uACA9\uD55C \uAC80\uC0AC\uB97C \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xrs Java/VM\uC5D0 \uC758\uD55C OS \uC2E0\uD638 \uC0AC\uC6A9\uC744 \uC904\uC785\uB2C8\uB2E4(\uC124\uBA85\uC11C \uCC38\uC870).\n\ -Xcheck:jni JNI \uD568\uC218\uC5D0 \uB300\uD55C \uCD94\uAC00 \uAC80\uC0AC\uB97C \uC218\uD589\uD569\uB2C8\uB2E4.\n\ -Xshare:off \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130 \uC0AC\uC6A9\uC744 \uC2DC\uB3C4\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n\ -Xshare:auto \uAC00\uB2A5\uD55C \uACBD\uC6B0 \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n\ -Xshare:on \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4. \uADF8\uB807\uC9C0 \uC54A\uC744 \uACBD\uC6B0 \uC2E4\uD328\uD569\uB2C8\uB2E4.\n\ -XshowSettings \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\ -XshowSettings:all\n\ \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\ -XshowSettings:vm \uBAA8\uB4E0 VM \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\ -XshowSettings:properties\n\ \uBAA8\uB4E0 \uC18D\uC131 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\ -XshowSettings:locale\n\ \uBAA8\uB4E0 \uB85C\uCF00\uC77C \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\n-X \uC635\uC158\uC740 \uBE44\uD45C\uC900 \uC635\uC158\uC774\uBBC0\uB85C \uD1B5\uC9C0 \uC5C6\uC774 \uBCC0\uACBD\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n
+java.launcher.X.macosx.usage=\n\uB2E4\uC74C\uC740 Mac OS X\uC5D0 \uD2B9\uC815\uB41C \uC635\uC158\uC785\uB2C8\uB2E4.\n -XstartOnFirstThread\n \uCCAB\uBC88\uC9F8 (AppKit) \uC2A4\uB808\uB4DC\uC5D0 main() \uBA54\uC18C\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4.\n -Xdock:name=<application name>"\n \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uC774\uB984\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n -Xdock:icon=<path to icon file>\n \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC544\uC774\uCF58\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n\n
java.launcher.cls.error1=\uC624\uB958: \uAE30\uBCF8 \uD074\uB798\uC2A4 {0}\uC744(\uB97C) \uCC3E\uAC70\uB098 \uB85C\uB4DC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-java.launcher.cls.error2=\uC624\uB958: {1} \uD074\uB798\uC2A4\uC5D0\uC11C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uAC00 {0}\uC774(\uAC00) \uC544\uB2D9\uB2C8\uB2E4. \uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\n\ public static void main(String[] args)
-java.launcher.cls.error3=\uC624\uB958: \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB294 {0} \uD074\uB798\uC2A4\uC5D0\uC11C void \uC720\uD615\uC758 \uAC12\uC744 \uBC18\uD658\uD574\uC57C \uD569\uB2C8\uB2E4. \n\uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\n\ public static void main(String[] args)
-java.launcher.cls.error4=\uC624\uB958: {0} \uD074\uB798\uC2A4\uC5D0\uC11C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\n\ public static void main(String[] args)
+java.launcher.cls.error2=\uC624\uB958: {1} \uD074\uB798\uC2A4\uC5D0\uC11C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uAC00 {0}\uC774(\uAC00) \uC544\uB2D9\uB2C8\uB2E4. \uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\n public static void main(String[] args)
+java.launcher.cls.error3=\uC624\uB958: \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB294 {0} \uD074\uB798\uC2A4\uC5D0\uC11C void \uC720\uD615\uC758 \uAC12\uC744 \uBC18\uD658\uD574\uC57C \uD569\uB2C8\uB2E4. \n\uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\n public static void main(String[] args)
+java.launcher.cls.error4=\uC624\uB958: {0} \uD074\uB798\uC2A4\uC5D0\uC11C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\r\n public static void main(String[] args)\r\n\uB610\uB294 JavaFX \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uD074\uB798\uC2A4\uB294 {1}\uC744(\uB97C) \uD655\uC7A5\uD574\uC57C \uD569\uB2C8\uB2E4.
+java.launcher.cls.error5=\uC624\uB958: \uC774 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8\uC744 \uC2E4\uD589\uD558\uB294 \uB370 \uD544\uC694\uD55C JavaFX \uB7F0\uD0C0\uC784 \uAD6C\uC131 \uC694\uC18C\uAC00 \uB204\uB77D\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
java.launcher.jar.error1=\uC624\uB958: {0} \uD30C\uC77C\uC744 \uC5F4\uB824\uACE0 \uC2DC\uB3C4\uD558\uB294 \uC911 \uC608\uC0C1\uCE58 \uC54A\uC740 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
java.launcher.jar.error2={0}\uC5D0\uC11C Manifest\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
java.launcher.jar.error3={0}\uC5D0 \uAE30\uBCF8 Manifest \uC18D\uC131\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
+java.launcher.init.error=\uCD08\uAE30\uD654 \uC624\uB958
+java.launcher.javafx.error1=\uC624\uB958: JavaFX launchApplication \uBA54\uC18C\uB4DC\uC5D0 \uC798\uBABB\uB41C \uC11C\uBA85\uC774 \uC788\uC2B5\uB2C8\uB2E4.\\n\uB530\uB77C\uC11C static\uC73C\uB85C \uC120\uC5B8\uD558\uACE0 void \uC720\uD615\uC758 \uAC12\uC744 \uBC18\uD658\uD574\uC57C \uD569\uB2C8\uB2E4.
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
#
# Translators please note do not translate the options themselves
-java.launcher.opt.header = Uso: {0} [-options] class [args...]\n\ (para executar uma classe)\n ou {0} [-options] -jar jarfile [args...]\n\ (para executar um arquivo jar)\nem que as op\u00E7\u00F5es incluem:\n
+java.launcher.opt.header = Uso: {0} [-options] class [args...]\n (para executar uma classe)\n ou {0} [-options] -jar jarfile [args...]\n (para executar um arquivo jar)\nem que as op\u00E7\u00F5es incluem:\n
java.launcher.opt.datamodel =\ -d{0}\t usar um modelo de dados de {0} bits, se estiver dispon\u00EDvel\n
java.launcher.opt.vmselect =\ {0}\t para selecionar a VM "{1}"\n
@@ -34,15 +34,21 @@
java.launcher.ergo.message2 =\ porque a execu\u00E7\u00E3o est\u00E1 sendo feita em uma m\u00E1quina de classe de servidor.\n
# Translators please note do not translate the options themselves
-java.launcher.opt.footer =\ -cp <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n\ -classpath <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n\ Uma lista separada por {0} de diret\u00F3rios, archives JAR\n\ e archives ZIP nos quais ser\u00E3o procurados os arquivos de classe.\n\ -D<nome>=<valor>\n\ define uma propriedade do sistema\n\ -verbose[:classe|gc|jni]\n\ ativa a sa\u00EDda detalhada\n\ -version imprime a vers\u00E3o do produto e sai do programa\n\ -version:<valor>\n\ requer a execu\u00E7\u00E3o da vers\u00E3o especificada\n\ -showversion imprime a vers\u00E3o do produto e continua\n\ -jre-restrict-search | -no-jre-restrict-search\n\ inclui/exclui JREs privados do usu\u00E1rio na pesquisa de vers\u00E3o\n\ -? -help imprime esta mensagem de ajuda\n\ -X imprime a ajuda sobre op\u00E7\u00F5es n\u00E3o padronizadas\n\ -ea[:<nome do pacote>...|:<nome da classe>]\n\ -enableassertions[:<nome do pacote>...|:<nome da classe>]\n\ ativa asser\u00E7\u00F5es com granularidade especificada\n\ -da[:<nome do pacote>...|:<nome da classe>]\n\ -disableassertions[:<nome do pacote>...|:<nome da classe>]\n\ desativa asser\u00E7\u00F5es com granularidade especificada\n\ -esa | -enablesystemassertions\n\ ativa asser\u00E7\u00F5es do sistema\n\ -dsa | -disablesystemassertions\n\ desativa asser\u00E7\u00F5es do sistema\n\ -agentlib:<nome da biblioteca>[=<op\u00E7\u00F5es>]\n\ carrega a biblioteca de agentes nativa <nome da biblioteca>, por exempl: -agentlib:hprof\n\ consulte tamb\u00E9m: -agentlib:jdwp=help e -agentlib:hprof=help\n\ -agentpath:<nome do caminho>[=<op\u00E7\u00F5es>]\n\ carrega a biblioteca de agentes nativa com base no nome do caminho completo\n\ -javaagent:<caminho do arquivo jar>[=<op\u00E7\u00F5es>]\n\ carrega o agente da linguagem de programa\u00E7\u00E3o Java; consulte java.lang.instrument\n\ -splash:<caminho da imagem>\n\ mostra a tela de abertura com a imagem especificada\nConsulte http://java.sun.com/javase/reference para obter mais detalhes.
+java.launcher.opt.footer =\ -cp <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n -classpath <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n Uma lista separada por {0} de diret\u00F3rios, archives JAR\n e archives ZIP nos quais ser\u00E3o procurados os arquivos de classe.\n -D<nome>=<valor>\n define uma propriedade do sistema\n -verbose[:classe|gc|jni]\n ativa a sa\u00EDda detalhada\n -version imprime a vers\u00E3o do produto e sai do programa\n -version:<valor>\n requer a execu\u00E7\u00E3o da vers\u00E3o especificada\n -showversion imprime a vers\u00E3o do produto e continua\n -jre-restrict-search | -no-jre-restrict-search\n inclui/exclui JREs privados do usu\u00E1rio na pesquisa de vers\u00E3o\n -? -help imprime esta mensagem de ajuda\n -X imprime a ajuda sobre op\u00E7\u00F5es n\u00E3o padronizadas\n -ea[:<nome do pacote>...|:<nome da classe>]\n -enableassertions[:<nome do pacote>...|:<nome da classe>]\n ativa asser\u00E7\u00F5es com granularidade especificada\n -da[:<nome do pacote>...|:<nome da classe>]\n -disableassertions[:<nome do pacote>...|:<nome da classe>]\n desativa asser\u00E7\u00F5es com granularidade especificada\n -esa | -enablesystemassertions\n ativa asser\u00E7\u00F5es do sistema\n -dsa | -disablesystemassertions\n desativa asser\u00E7\u00F5es do sistema\n -agentlib:<nome da biblioteca>[=<op\u00E7\u00F5es>]\n carrega a biblioteca de agentes nativa <nome da biblioteca>, por exemplo: -agentlib:hprof\n consulte tamb\u00E9m: -agentlib:jdwp=help e -agentlib:hprof=help\n -agentpath:<nome do caminho>[=<op\u00E7\u00F5es>]\n carrega a biblioteca de agentes nativa com base no nome do caminho completo\n -javaagent:<caminho do arquivo jar>[=<op\u00E7\u00F5es>]\n carrega o agente da linguagem de programa\u00E7\u00E3o Java; consulte java.lang.instrument\n -splash:<caminho da imagem>\n mostra a tela de abertura com a imagem especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para obter mais detalhes.
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\ -Xmixed execu\u00E7\u00E3o no modo misto (default)\n -Xint execu\u00E7\u00E3o somente no modo interpretado\n -Xbootclasspath:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n define o caminho de pesquisa para classes e recursos de inicializa\u00E7\u00E3o\n -Xbootclasspath/a:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n anexa no final do caminho da classe de inicializa\u00E7\u00E3o\n -Xbootclasspath/p:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n anexa no in\u00EDcio do caminho da classe de inicializa\u00E7\u00E3o\n -Xdiag mostra mensagens de diagn\u00F3stico adicionais\n -Xnoclassgc desativa a coleta de lixo da classe\n -Xincgc ativa a coleta de lixo incremental\n -Xloggc:<arquivo> registra o status do GC status em um arquivo com marca\u00E7\u00F5es de data e hor\u00E1rio\n -Xbatch desativa a compila\u00E7\u00E3o em segundo plano\n -Xms<tamanho> define o tamanho inicial do heap Java\n -Xmx<tamanho> define o tamanho m\u00E1ximo do heap Java\n -Xss<tamanho> define o tamanho da pilha de threads java\n -Xprof produz dados de perfil da cpu\n -Xfuture ativa verifica\u00E7\u00F5es de n\u00EDvel m\u00E1ximo de exig\u00EAncia, prevendo o valor default futuro\n -Xrs reduz o uso de sinais do SO pelo(a) Java/VM (consulte a documenta\u00E7\u00E3o)\n -Xcheck:jni executa verifica\u00E7\u00F5es adicionais de fun\u00E7\u00F5es da JNI\n -Xshare:off n\u00E3o tenta usar dados da classe compartilhada\n -Xshare:auto se poss\u00EDvel, usa dados da classe compartilhada (default)\n -Xshare:on requer o uso de dados da classe compartilhada, caso contr\u00E1rio haver\u00E1 falha.\n -XshowSettings mostra todas as defini\u00E7\u00F5es e continua\n -XshowSettings:all\n mostra todas as defini\u00E7\u00F5es e continua\n -XshowSettings:vm mostra todas as defini\u00E7\u00F5es relacionadas \u00E0 vm e continua\n -XshowSettings:properties\n mostra todas as defini\u00E7\u00F5es da propriedade e continua\n -XshowSettings:locale\n mostra todas as defini\u00E7\u00F5es relativas \u00E0s configura\u00E7\u00F5es regionais e continua\n\nAs -X options n\u00E3o s\u00E3o padronizadas e est\u00E3o sujeitas a altera\u00E7\u00F5es sem aviso.\n
# Translators please note do not translate the options themselves
-java.launcher.X.usage=\ -Xmixed execu\u00E7\u00E3o no modo misto (default)\n\ -Xint execu\u00E7\u00E3o somente no modo interpretado\n\ -Xbootclasspath:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n\ define o caminho de pesquisa para classes e recursos de inicializa\u00E7\u00E3o\n\ -Xbootclasspath/a:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n\ anexa no final do caminho da classe de inicializa\u00E7\u00E3o\n\ -Xbootclasspath/p:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n\ anexa no in\u00EDcio do caminho da classe de inicializa\u00E7\u00E3o\n\ -Xdiag mostra mensagens de diagn\u00F3stico adicionais\n\ -Xnoclassgc desativa a coleta de lixo da classe\n\ -Xincgc ativa a coleta de lixo incremental\n\ -Xloggc:<arquivo> registra o status do GC status em um arquivo com marca\u00E7\u00F5es de data e hor\u00E1rio\n\ -Xbatch desativa a compila\u00E7\u00E3o em segundo plano\n\ -Xms<tamanho> define o tamanho inicial do heap Java\n\ -Xmx<tamanho> define o tamanho m\u00E1ximo do heap Java\n\ -Xss<tamanho> define o tamanho da pilha de threads java\n\ -Xprof produz dados de perfil da cpu\n\ -Xfuture ativa verifica\u00E7\u00F5es de n\u00EDvel m\u00E1ximo de exig\u00EAncia, prevendo o valor default futuro\n\ -Xrs reduz o uso de sinais do SO pelo(a) Java/VM (consulte a documenta\u00E7\u00E3o)\n\ -Xcheck:jni executa verifica\u00E7\u00F5es adicionais de fun\u00E7\u00F5es da JNI\n\ -Xshare:off n\u00E3o tenta usar dados da classe compartilhada\n\ -Xshare:auto se poss\u00EDvel, usa dados da classe compartilhada (default)\n\ -Xshare:on requer o uso de dados da classe compartilhada, caso contr\u00E1rio haver\u00E1 falha.\n\ -XshowSettings mostra todas as defini\u00E7\u00F5es e continua\n\ -XshowSettings:all\n\ mostra todas as defini\u00E7\u00F5es e continua\n\ -XshowSettings:vm mostra todas as defini\u00E7\u00F5es relacionadas \u00E0 vm e continua\n\ -XshowSettings:properties\n\ mostra todas as defini\u00E7\u00F5es da propriedade e continua\n\ -XshowSettings:locale\n\ mostra todas as defini\u00E7\u00F5es relativas \u00E0s configura\u00E7\u00F5es regionais e continua\n\nAs -X options n\u00E3o s\u00E3o padronizadas e est\u00E3o sujeitas a altera\u00E7\u00F5es sem aviso.\n
+java.launcher.X.macosx.usage=\nAs op\u00E7\u00F5es a seguir s\u00E3o espec\u00EDficas para o Mac OS X:\n -XstartOnFirstThread\n executa o m\u00E9todo main() no primeiro thread (AppKit)\n -Xdock:name=<nome da aplica\u00E7\u00E3o>"\n substitui o nome da aplica\u00E7\u00E3o default exibido no encaixe\n -Xdock:icon=<caminho para o arquivo do \u00EDcone>\n substitui o \u00EDcone exibido no encaixe\n\n
java.launcher.cls.error1=Erro: N\u00E3o foi poss\u00EDvel localizar nem carregar a classe principal {0}
-java.launcher.cls.error2=Erro: O m\u00E9todo principal n\u00E3o \u00E9 {0} na classe {1}; defina o m\u00E9todo principal como:\n\ public static void main(String[] args)
-java.launcher.cls.error3=Erro: O m\u00E9todo principal deve retornar um valor do tipo void na classe {0}; \ndefina o m\u00E9todo principal como:\n\ public static void main(String[] args)
-java.launcher.cls.error4=Erro: O m\u00E9todo principal n\u00E3o foi encontrado na classe {0}; defina o m\u00E9todo principal como:\n\ public static void main(String[] args)
+java.launcher.cls.error2=Erro: o m\u00E9todo main n\u00E3o \u00E9 {0} na classe {1}; defina o m\u00E9todo main como:\n public static void main(String[] args)
+java.launcher.cls.error3=Erro: o m\u00E9todo main deve retornar um valor do tipo void na classe {0}; \ndefina o m\u00E9todo main como:\n public static void main(String[] args)
+java.launcher.cls.error4=Erro: o m\u00E9todo main n\u00E3o foi encontrado na classe {0}; defina o m\u00E9todo main como:\\n public static void main(String[] args)\\nou uma classe da aplica\u00E7\u00E3o JavaFX deve expandir {1}
+java.launcher.cls.error5=Erro: os componentes de runtime do JavaFX n\u00E3o foram encontrados. Eles s\u00E3o obrigat\u00F3rios para executar esta aplica\u00E7\u00E3o
java.launcher.jar.error1=Erro: ocorreu um erro inesperado ao tentar abrir o arquivo {0}
java.launcher.jar.error2=manifesto n\u00E3o encontrado em {0}
java.launcher.jar.error3=nenhum atributo de manifesto principal em {0}
+java.launcher.init.error=erro de inicializa\u00E7\u00E3o
+java.launcher.javafx.error1=Erro: O m\u00E9todo launchApplication do JavaFX tem a assinatura errada. Ele\\ndeve ser declarado como est\u00E1tico e retornar um valor do tipo void
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_sv.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
#
# Translators please note do not translate the options themselves
-java.launcher.opt.header = Syntax: {0} [-alternativ] class [argument...]\n\ (f\u00F6r att k\u00F6ra en klass)\n eller {0} [-alternativ] -jar jarfile [argument...]\n\ (f\u00F6r att k\u00F6ra en jar-fil)\nd\u00E4r alternativen omfattar:\n
+java.launcher.opt.header = Syntax: {0} [-alternativ] class [argument...]\n (f\u00F6r att k\u00F6ra en klass)\n eller {0} [-alternativ] -jar jarfile [argument...]\n (f\u00F6r att k\u00F6ra en jar-fil)\nd\u00E4r alternativen omfattar:\n
java.launcher.opt.datamodel =\ -d{0}\t anv\u00E4nd en {0}-bitsdatamodell om det finns\n
java.launcher.opt.vmselect =\ {0}\t f\u00F6r att v\u00E4lja "{1}" VM\n
@@ -34,15 +34,21 @@
java.launcher.ergo.message2 =\ eftersom du k\u00F6r en serverklassmaskin.\n
# Translators please note do not translate the options themselves
-java.launcher.opt.footer =\ -cp <klass\u00F6kv\u00E4g f\u00F6r kataloger och zip-/jar-filer>\n\ -classpath <klass\u00F6kv\u00E4g f\u00F6r kataloger och zip-/jar-filer>\n\ En {0}-avgr\u00E4nsad lista med kataloger, JAR-arkiv,\n\ och ZIP-arkiv f\u00F6r s\u00F6kning efter klassfiler.\n\ -D<namn>=<v\u00E4rde>\n\ ange en systemegenskap\n\ -verbose[:class|gc|jni]\n\ aktivera utf\u00F6rliga utdata\n\ -version skriv ut produktversionen och avsluta\n\ -version:<v\u00E4rde>\n\ beg\u00E4r den specifika versionen som ska k\u00F6ras\n\ -showversion skriv ut produktversionen och forts\u00E4tt\n\ -jre-restrict-search | -no-jre-restrict-search\n\ inkludera/exkludera anv\u00E4ndarprivata JRE:er i versions\u00F6kningen\n\ -? -help skriv ut det h\u00E4r hj\u00E4lpmeddelandet\n\ -X skriv ut hj\u00E4lp f\u00F6r icke-standardalternativ\n\ -ea[:<paket>...|:<klass>]\n\ -enableassertions[:<paket>...|:<klass>]\n\ aktivera verifiering med angiven detaljgrad\n\ -da[:<packagename>...|:<klass>]\n\ -disableassertions[:<paket>...|:<klass>]\n\ avaktivera verifiering med angiven detaljgrad\n\ -esa | -enablesystemassertions\n\ aktivera systemverifieringar\n\ -dsa | -disablesystemassertions\n\ avaktivera systemverifieringar\n\ -agentlib:<bibliotek>[=<alternativ>]\n\ ladda ursprungligt agentbibliotek <bibliotek>, e.g. -agentlib:hprof\n\ se \u00E4ven -agentlib:jdwp=help och -agentlib:hprof=help\n\ -agentpath:<s\u00F6kv\u00E4g>[=<alternativ>]\n\ ladda ursprungligt agentbibliotek med helt s\u00F6kv\u00E4gsnamn\n\ -javaagent:<jar-s\u00F6kv\u00E4g>[=<alternativ>]\n\ ladda Java-programspr\u00E5ksagent, se java.lang.instrument\n\ -splash:<bilds\u00F6kv\u00E4g>\n\ visa v\u00E4lkomstsk\u00E4rm med angiven bild\nMer information finns p\u00E5 http://java.sun.com/javase/reference.
+java.launcher.opt.footer =\ -cp <klass\u00F6kv\u00E4g f\u00F6r kataloger och zip-/jar-filer>\n -classpath <klass\u00F6kv\u00E4g f\u00F6r kataloger och zip-/jar-filer>\n En {0}-separerad lista med kataloger, JAR-arkiv,\n och ZIP-arkiv f\u00F6r s\u00F6kning efter klassfiler.\n -D<name>=<value>\n ange en systemegenskap\n -verbose:[class|gc|jni]\n aktivera utf\u00F6rliga utdata\n -version skriv ut produktversionen och avsluta\n -version:<value>\n beg\u00E4r den specifika versionen som ska k\u00F6ras\n -showversion skriv ut produktversionen och forts\u00E4tt\n -jre-restrict-search | -no-jre-restrict-search\n inkludera/exkludera anv\u00E4ndarprivata JRE:er i versions\u00F6kningen\n -? -help skriv ut det h\u00E4r hj\u00E4lpmeddelandet\n -X skriv ut hj\u00E4lp f\u00F6r icke-standardalternativ\n -ea[:<packagename>...|:<classname>]\n -enableassertions[:<packagename>...|:<classname>]\n aktivera verifiering med angiven detaljgrad\n -da[:<packagename>...|:<classname>]\n -disableassertions[:<packagename>...|:<classname>]\n avaktivera verifiering med angiven detaljgrad\n -esa | -enablesystemassertions\n aktivera systemverifieringar\n -dsa | -disablesystemassertions\n avaktivera systemverifieringar\n -agentlib:<libname>[=<options>]\n ladda ursprungligt agentbibliotek <libname>, e.g. -agentlib:hprof\n se \u00E4ven -agentlib:jdwp=help och -agentlib:hprof=help\n -agentpath:<pathname>[=<options>]\n ladda ursprungligt agentbibliotek med helt s\u00F6kv\u00E4gsnamn\n -javaagent:<jarpath>[=<options>]\n ladda Java-programspr\u00E5ksagent, se java.lang.instrument\n -splash:<imagepath>\n visa v\u00E4lkomstsk\u00E4rm med angiven bild\nMer information finns p\u00E5 http://www.oracle.com/technetwork/java/javase/documentation/index.html.
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\ -Xmixed k\u00F6rning i blandat l\u00E4ge (standard)\n -Xint endast k\u00F6rning i tolkat l\u00E4ge\n -Xbootclasspath:<kataloger och zip-/jar-filer avgr\u00E4nsas med {0}>\n ange s\u00F6kv\u00E4g f\u00F6r programladdningsklasser och -resurser\n -Xbootclasspath/a:<kataloger och zip-/jar-filer avgr\u00E4nsas med {0}>\n l\u00E4gg till i slutet av programladdningsklassens s\u00F6kv\u00E4g\n -Xbootclasspath/p:<kataloger och zip-/jar-filer avgr\u00E4nsas med {0}>\n l\u00E4gg till i b\u00F6rjan av programladdningsklassens s\u00F6kv\u00E4g\n -Xdiag visa ytterligare diagnostiska meddelanden\n -Xnoclassgc avaktivera klassens skr\u00E4pinsamling\n -Xincgc aktivera inkrementell skr\u00E4pinsamling\n -Xloggc:<fil> logga GC-status till en fil med tidsst\u00E4mplar\n -Xbatch avaktivera bakgrundskompilering\n -Xms<storlek> ange ursprunglig storlek f\u00F6r Java-heap\n -Xmx<storlek> ange maximal storlek f\u00F6r Java-heap\n -Xss<storlek> ange storlek f\u00F6r java-tr\u00E5dsstack\n -Xprof utdata f\u00F6r processorprofilering\n -Xfuture aktivera str\u00E4ngaste kontroller, f\u00F6rv\u00E4ntad framtida standard\n -Xrs minska OS-signalanv\u00E4ndning av Java/VM (se dokumentation)\n -Xcheck:jni utf\u00F6r ytterligare kontroller f\u00F6r JNI-funktioner\n -Xshare:off anv\u00E4nd inte delade klassdata\n -Xshare:auto anv\u00E4nd delade klassdata om det g\u00E5r (standard)\n -Xshare:on kr\u00E4v att delade klassdata anv\u00E4nds, annars slutf\u00F6r inte.\n -XshowSettings visa alla inst\u00E4llningar och forts\u00E4tt\n -XshowSettings:all\n visa alla inst\u00E4llningar och forts\u00E4tt\n -XshowSettings:vm visa alla vm-relaterade inst\u00E4llningar och forts\u00E4tt\n -XshowSettings:properties\n visa alla egenskapsinst\u00E4llningar och forts\u00E4tt\n -XshowSettings:locale\n visa alla spr\u00E5krelaterade inst\u00E4llningar och forts\u00E4tt\n\n-X-alternativen \u00E4r inte standard och kan \u00E4ndras utan f\u00F6reg\u00E5ende meddelande.\n
# Translators please note do not translate the options themselves
-java.launcher.X.usage=\ -Xmixed k\u00F6rning i blandat l\u00E4ge (standard)\n\ -Xint endast k\u00F6rning i tolkat l\u00E4ge\n\ -Xbootclasspath:<kataloger och zip-/jar-filer avgr\u00E4nsas med {0}>\n\ ange s\u00F6kv\u00E4g f\u00F6r programladdningsklasser och -resurser\n\ -Xbootclasspath/a:<kataloger och zip-/jar-filer avgr\u00E4nsas med {0}>\n\ l\u00E4gg till i slutet av programladdningsklassens s\u00F6kv\u00E4g\n\ -Xbootclasspath/p:<kataloger och zip-/jar-filer avgr\u00E4nsas med {0}>\n\ l\u00E4gg till i b\u00F6rjan av programladdningsklassens s\u00F6kv\u00E4g\n\ -Xdiag visa ytterligare diagnostiska meddelanden\n\ -Xnoclassgc avaktivera klassens skr\u00E4pinsamling\n\ -Xincgc aktivera inkrementell skr\u00E4pinsamling\n\ -Xloggc:<fil> logga GC-status till en fil med tidsst\u00E4mplar\n\ -Xbatch avaktivera bakgrundskompilering\n\ -Xms<storlek> ange ursprunglig storlek f\u00F6r Java-heap\n\ -Xmx<storlek> ange maximal storlek f\u00F6r Java-heap\n\ -Xss<storlek> ange storlek f\u00F6r java-tr\u00E5dsstack\n\ -Xprof utdata f\u00F6r processorprofilering\n\ -Xfuture aktivera str\u00E4ngaste kontroller, f\u00F6rv\u00E4ntad framtida standard\n\ -Xrs minska OS-signalanv\u00E4ndning av Java/VM (se dokumentation)\n\ -Xcheck:jni utf\u00F6r ytterligare kontroller f\u00F6r JNI-funktioner\n\ -Xshare:off anv\u00E4nd inte delade klassdata\n\ -Xshare:auto anv\u00E4nd delade klassdata om det g\u00E5r (standard)\n\ -Xshare:on kr\u00E4v att delade klassdata anv\u00E4nds, annars slutf\u00F6r inte.\n\ -XshowSettings visa alla inst\u00E4llningar och forts\u00E4tt\n\ -XshowSettings:all\n\ visa alla inst\u00E4llningar och forts\u00E4tt\n\ -XshowSettings:vm visa alla vm-relaterade inst\u00E4llningar och forts\u00E4tt\n\ -XshowSettings:properties\n\ visa alla egenskapsinst\u00E4llningar och forts\u00E4tt\n\ -XshowSettings:locale\n\ visa alla spr\u00E5krelaterade inst\u00E4llningar och forts\u00E4tt\n\n-X-alternativen \u00E4r inte standard och kan \u00E4ndras utan f\u00F6reg\u00E5ende meddelande.\n
+java.launcher.X.macosx.usage=\nF\u00F6ljande alternativ \u00E4r specifika f\u00F6r Mac OS X:\n -XstartOnFirstThread\n k\u00F6r huvudmetoden() p\u00E5 den f\u00F6rsta (AppKit) tr\u00E5den\n -Xdock:name=<application name>"\n \u00E5sidosatt standardapplikationsnamn visas i docka\n -Xdock:icon=<path to icon file>\n \u00E5sidosatt standardikon visas i docka\n\n
java.launcher.cls.error1=Fel: Hittar inte eller kan inte ladda huvudklassen {0}
-java.launcher.cls.error2=Fel: Huvudmetoden \u00E4r inte {0} i klassen {1}, definiera huvudmetoden som:\n\ public static void main(String[] args)
-java.launcher.cls.error3=Fel: Huvudmetoden m\u00E5ste returnera ett v\u00E4rde av typen void i klassen {0}, \ndefiniera huvudmetoden som:\n\ public static void main(String[] args)
-java.launcher.cls.error4=Fel: Huvudmetoden finns inte i klassen {0}, definiera huvudmetoden som:\n\ public static void main(String[] args)
+java.launcher.cls.error2=Fel: Huvudmetoden \u00E4r inte {0} i klassen {1}, definiera huvudmetoden som:\n public static void main(String[] args)
+java.launcher.cls.error3=Fel: Huvudmetoden m\u00E5ste returnera ett v\u00E4rde av typen void i klassen {0}, \ndefiniera huvudmetoden som:\n public static void main(String[] args)
+java.launcher.cls.error4=Fel: Huvudmetoden finns inte i klassen {0}, definiera huvudmetoden som:\n public static void main(String[] args)\neller s\u00E5 m\u00E5ste en JavaFX-applikationsklass ut\u00F6ka {1}
+java.launcher.cls.error5=Fel: JavaFX-k\u00F6rningskomponenter saknas, och de kr\u00E4vs f\u00F6r att kunna k\u00F6ra den h\u00E4r applikationen
java.launcher.jar.error1=Fel: Ett ov\u00E4ntat fel intr\u00E4ffade n\u00E4r filen {0} skulle \u00F6ppnas
java.launcher.jar.error2=manifest finns inte i {0}
java.launcher.jar.error3=inget huvudmanifestattribut i {0}
+java.launcher.init.error=initieringsfel
+java.launcher.javafx.error1=Fel: JavaFX launchApplication-metoden har fel signatur, den \nm\u00E5ste ha deklarerats som statisk och returnera ett v\u00E4rde av typen void
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
#
# Translators please note do not translate the options themselves
-java.launcher.opt.header = \u7528\u6CD5: {0} [-options] class [args...]\n\ (\u6267\u884C\u7C7B)\n \u6216 {0} [-options] -jar jarfile [args...]\n\ (\u6267\u884C jar \u6587\u4EF6)\n\u5176\u4E2D\u9009\u9879\u5305\u62EC:\n
+java.launcher.opt.header = \u7528\u6CD5: {0} [-options] class [args...]\n (\u6267\u884C\u7C7B)\n \u6216 {0} [-options] -jar jarfile [args...]\n (\u6267\u884C jar \u6587\u4EF6)\n\u5176\u4E2D\u9009\u9879\u5305\u62EC:\n
java.launcher.opt.datamodel =\ -d{0}\t \u4F7F\u7528 {0} \u4F4D\u6570\u636E\u6A21\u578B (\u5982\u679C\u53EF\u7528)\n
java.launcher.opt.vmselect =\ {0}\t \u9009\u62E9 "{1}" VM\n
@@ -34,15 +34,21 @@
java.launcher.ergo.message2 =\ \u56E0\u4E3A\u60A8\u662F\u5728\u670D\u52A1\u5668\u7C7B\u8BA1\u7B97\u673A\u4E0A\u8FD0\u884C\u3002\n
# Translators please note do not translate the options themselves
-java.launcher.opt.footer =\ -cp <\u76EE\u5F55\u548C zip/jar \u6587\u4EF6\u7684\u7C7B\u641C\u7D22\u8DEF\u5F84>\n\ -classpath <\u76EE\u5F55\u548C zip/jar \u6587\u4EF6\u7684\u7C7B\u641C\u7D22\u8DEF\u5F84>\n\ \u7528 {0} \u5206\u9694\u7684\u76EE\u5F55, JAR \u6863\u6848\n\ \u548C ZIP \u6863\u6848\u5217\u8868, \u7528\u4E8E\u641C\u7D22\u7C7B\u6587\u4EF6\u3002\n\ -D<name>=<value>\n\ \u8BBE\u7F6E\u7CFB\u7EDF\u5C5E\u6027\n\ -verbose[:class|gc|jni]\n\ \u542F\u7528\u8BE6\u7EC6\u8F93\u51FA\n\ -version \u8F93\u51FA\u4EA7\u54C1\u7248\u672C\u5E76\u9000\u51FA\n\ -version:<value>\n\ \u9700\u8981\u6307\u5B9A\u7684\u7248\u672C\u624D\u80FD\u8FD0\u884C\n\ -showversion \u8F93\u51FA\u4EA7\u54C1\u7248\u672C\u5E76\u7EE7\u7EED\n\ -jre-restrict-search | -no-jre-restrict-search\n\ \u5728\u7248\u672C\u641C\u7D22\u4E2D\u5305\u62EC/\u6392\u9664\u7528\u6237\u4E13\u7528 JRE\n\ -? -help \u8F93\u51FA\u6B64\u5E2E\u52A9\u6D88\u606F\n\ -X \u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u5E2E\u52A9\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ \u6309\u6307\u5B9A\u7684\u7C92\u5EA6\u542F\u7528\u65AD\u8A00\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ \u7981\u7528\u5177\u6709\u6307\u5B9A\u7C92\u5EA6\u7684\u65AD\u8A00\n\ -esa | -enablesystemassertions\n\ \u542F\u7528\u7CFB\u7EDF\u65AD\u8A00\n\ -dsa | -disablesystemassertions\n\ \u7981\u7528\u7CFB\u7EDF\u65AD\u8A00\n\ -agentlib:<libname>[=<options>]\n\ \u52A0\u8F7D\u672C\u673A\u4EE3\u7406\u5E93 <libname>, \u4F8B\u5982 -agentlib:hprof\n\ \u53E6\u8BF7\u53C2\u9605 -agentlib:jdwp=help \u548C -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ \u6309\u5B8C\u6574\u8DEF\u5F84\u540D\u52A0\u8F7D\u672C\u673A\u4EE3\u7406\u5E93\n\ -javaagent:<jarpath>[=<options>]\n\ \u52A0\u8F7D Java \u7F16\u7A0B\u8BED\u8A00\u4EE3\u7406, \u8BF7\u53C2\u9605 java.lang.instrument\n\ -splash:<imagepath>\n\ \u4F7F\u7528\u6307\u5B9A\u7684\u56FE\u50CF\u663E\u793A\u542F\u52A8\u5C4F\u5E55\n\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u53C2\u9605 http://java.sun.com/javase/reference\u3002
+java.launcher.opt.footer =\ -cp <\u76EE\u5F55\u548C zip/jar \u6587\u4EF6\u7684\u7C7B\u641C\u7D22\u8DEF\u5F84>\n\\ -classpath <\u76EE\u5F55\u548C zip/jar \u6587\u4EF6\u7684\u7C7B\u641C\u7D22\u8DEF\u5F84>\n\\ \u7528 {0} \u5206\u9694\u7684\u76EE\u5F55, JAR \u6863\u6848\n\\ \u548C ZIP \u6863\u6848\u5217\u8868, \u7528\u4E8E\u641C\u7D22\u7C7B\u6587\u4EF6\u3002\n\\ -D<\u540D\u79F0>=<\u503C>\n\\ \u8BBE\u7F6E\u7CFB\u7EDF\u5C5E\u6027\n\\ -verbose:[class|gc|jni]\n\\ \u542F\u7528\u8BE6\u7EC6\u8F93\u51FA\n\\ -version \u8F93\u51FA\u4EA7\u54C1\u7248\u672C\u5E76\u9000\u51FA\n\\ -version:<\u503C>\n\\ \u9700\u8981\u6307\u5B9A\u7684\u7248\u672C\u624D\u80FD\u8FD0\u884C\n\\ -showversion \u8F93\u51FA\u4EA7\u54C1\u7248\u672C\u5E76\u7EE7\u7EED\n\\ -jre-restrict-search | -no-jre-restrict-search\n\\ \u5728\u7248\u672C\u641C\u7D22\u4E2D\u5305\u62EC/\u6392\u9664\u7528\u6237\u4E13\u7528 JRE\n\\ -? -help \u8F93\u51FA\u6B64\u5E2E\u52A9\u6D88\u606F\n\\ -X \u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u5E2E\u52A9\n\\ -ea[:<packagename>...|:<classname>]\n\\ -enableassertions[:<packagename>...|:<classname>]\n\\ \u6309\u6307\u5B9A\u7684\u7C92\u5EA6\u542F\u7528\u65AD\u8A00\n\\ -da[:<packagename>...|:<classname>]\n\\ -disableassertions[:<packagename>...|:<classname>]\n\\ \u7981\u7528\u5177\u6709\u6307\u5B9A\u7C92\u5EA6\u7684\u65AD\u8A00\n\\ -esa | -enablesystemassertions\n\\ \u542F\u7528\u7CFB\u7EDF\u65AD\u8A00\n\\ -dsa | -disablesystemassertions\n\\ \u7981\u7528\u7CFB\u7EDF\u65AD\u8A00\n\\ -agentlib:<libname>[=<\u9009\u9879>]\n\\ \u52A0\u8F7D\u672C\u673A\u4EE3\u7406\u5E93 <libname>, \u4F8B\u5982 -agentlib:hprof\n\\ \u53E6\u8BF7\u53C2\u9605 -agentlib:jdwp=help \u548C -agentlib:hprof=help\n\\ -agentpath:<pathname>[=<\u9009\u9879>]\n\\ \u6309\u5B8C\u6574\u8DEF\u5F84\u540D\u52A0\u8F7D\u672C\u673A\u4EE3\u7406\u5E93\n\\ -javaagent:<jarpath>[=<\u9009\u9879>]\n\\ \u52A0\u8F7D Java \u7F16\u7A0B\u8BED\u8A00\u4EE3\u7406, \u8BF7\u53C2\u9605 java.lang.instrument\n\\ -splash:<imagepath>\n\\ \u4F7F\u7528\u6307\u5B9A\u7684\u56FE\u50CF\u663E\u793A\u542F\u52A8\u5C4F\u5E55\n\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u53C2\u9605 http://www.oracle.com/technetwork/java/javase/documentation/index.html\u3002
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\ -Xmixed \u6DF7\u5408\u6A21\u5F0F\u6267\u884C (\u9ED8\u8BA4)\n -Xint \u4EC5\u89E3\u91CA\u6A21\u5F0F\u6267\u884C\n -Xbootclasspath:<\u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u548C zip/jar \u6587\u4EF6>\n \u8BBE\u7F6E\u641C\u7D22\u8DEF\u5F84\u4EE5\u5F15\u5BFC\u7C7B\u548C\u8D44\u6E90\n -Xbootclasspath/a:<\u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u548C zip/jar \u6587\u4EF6>\n \u9644\u52A0\u5728\u5F15\u5BFC\u7C7B\u8DEF\u5F84\u672B\u5C3E\n -Xbootclasspath/p:<\u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u548C zip/jar \u6587\u4EF6>\n \u7F6E\u4E8E\u5F15\u5BFC\u7C7B\u8DEF\u5F84\u4E4B\u524D\n -Xdiag \u663E\u793A\u9644\u52A0\u8BCA\u65AD\u6D88\u606F\n -Xnoclassgc \u7981\u7528\u7C7B\u5783\u573E\u6536\u96C6\n -Xincgc \u542F\u7528\u589E\u91CF\u5783\u573E\u6536\u96C6\n -Xloggc:<file> \u5C06 GC \u72B6\u6001\u8BB0\u5F55\u5728\u6587\u4EF6\u4E2D (\u5E26\u65F6\u95F4\u6233)\n -Xbatch \u7981\u7528\u540E\u53F0\u7F16\u8BD1\n -Xms<size> \u8BBE\u7F6E\u521D\u59CB Java \u5806\u5927\u5C0F\n -Xmx<size> \u8BBE\u7F6E\u6700\u5927 Java \u5806\u5927\u5C0F\n -Xss<size> \u8BBE\u7F6E Java \u7EBF\u7A0B\u5806\u6808\u5927\u5C0F\n -Xprof \u8F93\u51FA cpu \u914D\u7F6E\u6587\u4EF6\u6570\u636E\n -Xfuture \u542F\u7528\u6700\u4E25\u683C\u7684\u68C0\u67E5, \u9884\u671F\u5C06\u6765\u7684\u9ED8\u8BA4\u503C\n -Xrs \u51CF\u5C11 Java/VM \u5BF9\u64CD\u4F5C\u7CFB\u7EDF\u4FE1\u53F7\u7684\u4F7F\u7528 (\u8BF7\u53C2\u9605\u6587\u6863)\n -Xcheck:jni \u5BF9 JNI \u51FD\u6570\u6267\u884C\u5176\u4ED6\u68C0\u67E5\n -Xshare:off \u4E0D\u5C1D\u8BD5\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E\n -Xshare:auto \u5728\u53EF\u80FD\u7684\u60C5\u51B5\u4E0B\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E (\u9ED8\u8BA4)\n -Xshare:on \u8981\u6C42\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E, \u5426\u5219\u5C06\u5931\u8D25\u3002\n -XshowSettings \u663E\u793A\u6240\u6709\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n -XshowSettings:all\n \u663E\u793A\u6240\u6709\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n -XshowSettings:vm \u663E\u793A\u6240\u6709\u4E0E vm \u76F8\u5173\u7684\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n -XshowSettings:properties\n \u663E\u793A\u6240\u6709\u5C5E\u6027\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n -XshowSettings:locale\n \u663E\u793A\u6240\u6709\u4E0E\u533A\u57DF\u8BBE\u7F6E\u76F8\u5173\u7684\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n\n-X \u9009\u9879\u662F\u975E\u6807\u51C6\u9009\u9879, \u5982\u6709\u66F4\u6539, \u6055\u4E0D\u53E6\u884C\u901A\u77E5\u3002\n
# Translators please note do not translate the options themselves
-java.launcher.X.usage=\ -Xmixed \u6DF7\u5408\u6A21\u5F0F\u6267\u884C (\u9ED8\u8BA4)\n\ -Xint \u4EC5\u89E3\u91CA\u6A21\u5F0F\u6267\u884C\n\ -Xbootclasspath:<\u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u548C zip/jar \u6587\u4EF6>\n\ \u8BBE\u7F6E\u641C\u7D22\u8DEF\u5F84\u4EE5\u5F15\u5BFC\u7C7B\u548C\u8D44\u6E90\n\ -Xbootclasspath/a:<\u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u548C zip/jar \u6587\u4EF6>\n\ \u9644\u52A0\u5728\u5F15\u5BFC\u7C7B\u8DEF\u5F84\u672B\u5C3E\n\ -Xbootclasspath/p:<\u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u548C zip/jar \u6587\u4EF6>\n\ \u7F6E\u4E8E\u5F15\u5BFC\u7C7B\u8DEF\u5F84\u4E4B\u524D\n\ -Xdiag \u663E\u793A\u9644\u52A0\u8BCA\u65AD\u6D88\u606F\n\ -Xnoclassgc \u7981\u7528\u7C7B\u5783\u573E\u6536\u96C6\n\ -Xincgc \u542F\u7528\u589E\u91CF\u5783\u573E\u6536\u96C6\n\ -Xloggc:<file> \u5C06 GC \u72B6\u6001\u8BB0\u5F55\u5728\u6587\u4EF6\u4E2D (\u5E26\u65F6\u95F4\u6233)\n\ -Xbatch \u7981\u7528\u540E\u53F0\u7F16\u8BD1\n\ -Xms<size> \u8BBE\u7F6E\u521D\u59CB Java \u5806\u5927\u5C0F\n\ -Xmx<size> \u8BBE\u7F6E\u6700\u5927 Java \u5806\u5927\u5C0F\n\ -Xss<size> \u8BBE\u7F6E Java \u7EBF\u7A0B\u5806\u6808\u5927\u5C0F\n\ -Xprof \u8F93\u51FA cpu \u914D\u7F6E\u6587\u4EF6\u6570\u636E\n\ -Xfuture \u542F\u7528\u6700\u4E25\u683C\u7684\u68C0\u67E5, \u9884\u671F\u5C06\u6765\u7684\u9ED8\u8BA4\u503C\n\ -Xrs \u51CF\u5C11 Java/VM \u5BF9\u64CD\u4F5C\u7CFB\u7EDF\u4FE1\u53F7\u7684\u4F7F\u7528 (\u8BF7\u53C2\u9605\u6587\u6863)\n\ -Xcheck:jni \u5BF9 JNI \u51FD\u6570\u6267\u884C\u5176\u4ED6\u68C0\u67E5\n\ -Xshare:off \u4E0D\u5C1D\u8BD5\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E\n\ -Xshare:auto \u5728\u53EF\u80FD\u7684\u60C5\u51B5\u4E0B\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E (\u9ED8\u8BA4)\n\ -Xshare:on \u8981\u6C42\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E, \u5426\u5219\u5C06\u5931\u8D25\u3002\n\ -XshowSettings \u663E\u793A\u6240\u6709\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n\ -XshowSettings:all\n\ \u663E\u793A\u6240\u6709\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n\ -XshowSettings:vm \u663E\u793A\u6240\u6709\u4E0E vm \u76F8\u5173\u7684\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n\ -XshowSettings:properties\n\ \u663E\u793A\u6240\u6709\u5C5E\u6027\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n\ -XshowSettings:locale\n\ \u663E\u793A\u6240\u6709\u4E0E\u533A\u57DF\u8BBE\u7F6E\u76F8\u5173\u7684\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n\n-X \u9009\u9879\u662F\u975E\u6807\u51C6\u9009\u9879, \u5982\u6709\u66F4\u6539, \u6055\u4E0D\u53E6\u884C\u901A\u77E5\u3002\n
+java.launcher.X.macosx.usage=\n\u4EE5\u4E0B\u9009\u9879\u4E3A Mac OS X \u7279\u5B9A\u7684\u9009\u9879:\n -XstartOnFirstThread\n \u5728\u7B2C\u4E00\u4E2A (AppKit) \u7EBF\u7A0B\u4E0A\u8FD0\u884C main() \u65B9\u6CD5\n -Xdock:name=<\u5E94\u7528\u7A0B\u5E8F\u540D\u79F0>"\n \u8986\u76D6\u505C\u9760\u680F\u4E2D\u663E\u793A\u7684\u9ED8\u8BA4\u5E94\u7528\u7A0B\u5E8F\u540D\u79F0\n -Xdock:icon=<\u56FE\u6807\u6587\u4EF6\u7684\u8DEF\u5F84>\n \u8986\u76D6\u505C\u9760\u680F\u4E2D\u663E\u793A\u7684\u9ED8\u8BA4\u56FE\u6807\n\n
java.launcher.cls.error1=\u9519\u8BEF: \u627E\u4E0D\u5230\u6216\u65E0\u6CD5\u52A0\u8F7D\u4E3B\u7C7B {0}
-java.launcher.cls.error2=\u9519\u8BEF: \u4E3B\u65B9\u6CD5\u4E0D\u662F\u7C7B {1} \u4E2D\u7684{0}, \u8BF7\u5C06\u4E3B\u65B9\u6CD5\u5B9A\u4E49\u4E3A:\n\ public static void main(String[] args)
-java.launcher.cls.error3=\u9519\u8BEF: \u4E3B\u65B9\u6CD5\u5FC5\u987B\u8FD4\u56DE\u7C7B {0} \u4E2D\u7684\u7A7A\u7C7B\u578B\u503C, \u8BF7\n\u5C06\u4E3B\u65B9\u6CD5\u5B9A\u4E49\u4E3A:\n\ public static void main(String[] args)
-java.launcher.cls.error4=\u9519\u8BEF: \u5728\u7C7B {0} \u4E2D\u627E\u4E0D\u5230\u4E3B\u65B9\u6CD5, \u8BF7\u5C06\u4E3B\u65B9\u6CD5\u5B9A\u4E49\u4E3A:\n\ public static void main(String[] args)
+java.launcher.cls.error2=\u9519\u8BEF: main \u65B9\u6CD5\u4E0D\u662F\u7C7B {1} \u4E2D\u7684{0}, \u8BF7\u5C06 main \u65B9\u6CD5\u5B9A\u4E49\u4E3A:\n public static void main(String[] args)
+java.launcher.cls.error3=\u9519\u8BEF: main \u65B9\u6CD5\u5FC5\u987B\u8FD4\u56DE\u7C7B {0} \u4E2D\u7684\u7A7A\u7C7B\u578B\u503C, \u8BF7\n\u5C06 main \u65B9\u6CD5\u5B9A\u4E49\u4E3A:\n public static void main(String[] args)
+java.launcher.cls.error4=\u9519\u8BEF: \u5728\u7C7B {0} \u4E2D\u627E\u4E0D\u5230 main \u65B9\u6CD5, \u8BF7\u5C06 main \u65B9\u6CD5\u5B9A\u4E49\u4E3A:\n public static void main(String[] args)\n\u5426\u5219 JavaFX \u5E94\u7528\u7A0B\u5E8F\u7C7B\u5FC5\u987B\u6269\u5C55{1}
+java.launcher.cls.error5=\u9519\u8BEF: \u7F3A\u5C11 JavaFX \u8FD0\u884C\u65F6\u7EC4\u4EF6, \u9700\u8981\u4F7F\u7528\u8BE5\u7EC4\u4EF6\u6765\u8FD0\u884C\u6B64\u5E94\u7528\u7A0B\u5E8F
java.launcher.jar.error1=\u9519\u8BEF: \u5C1D\u8BD5\u6253\u5F00\u6587\u4EF6{0}\u65F6\u51FA\u73B0\u610F\u5916\u9519\u8BEF
java.launcher.jar.error2=\u5728{0}\u4E2D\u627E\u4E0D\u5230\u6E05\u5355
java.launcher.jar.error3={0}\u4E2D\u6CA1\u6709\u4E3B\u6E05\u5355\u5C5E\u6027
+java.launcher.init.error=\u521D\u59CB\u5316\u9519\u8BEF
+java.launcher.javafx.error1=\u9519\u8BEF: JavaFX launchApplication \u65B9\u6CD5\u5177\u6709\u9519\u8BEF\u7684\u7B7E\u540D, \u5FC5\u987B\n\u5C06\u65B9\u6CD5\u58F0\u660E\u4E3A\u9759\u6001\u65B9\u6CD5\u5E76\u8FD4\u56DE\u7A7A\u7C7B\u578B\u7684\u503C
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_zh_TW.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_zh_TW.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
#
# Translators please note do not translate the options themselves
-java.launcher.opt.header = \u7528\u6CD5: {0} [-options] class [args...]\n\ (\u57F7\u884C\u985E\u5225)\n \u6216 {0} [-options] -jar jarfile [args...]\n\ (\u57F7\u884C jar \u6A94\u6848)\n\u9078\u9805\u5305\u62EC:\n
+java.launcher.opt.header = \u7528\u6CD5: {0} [-options] class [args...]\n (\u57F7\u884C\u985E\u5225)\n \u6216 {0} [-options] -jar jarfile [args...]\n (\u57F7\u884C jar \u6A94\u6848)\n\u9078\u9805\u5305\u62EC:\n
java.launcher.opt.datamodel =\ -d{0}\t \u4F7F\u7528 {0} \u4F4D\u5143\u8CC7\u6599\u6A21\u578B (\u5982\u679C\u6709\u7684\u8A71)\n
java.launcher.opt.vmselect =\ {0}\t \u9078\u53D6 "{1}" VM\n
@@ -34,15 +34,21 @@
java.launcher.ergo.message2 =\ \u56E0\u70BA\u60A8\u6B63\u5728\u4F3A\u670D\u5668\u985E\u5225\u6A5F\u5668\u4E0A\u57F7\u884C\u3002\n
# Translators please note do not translate the options themselves
-java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n\ -classpath <class search path of directories and zip/jar files>\n\ \u641C\u5C0B\u985E\u5225\u6A94\u6848\u4E4B\u76EE\u9304\u3001JAR \u5B58\u6A94\n\ \u548C ZIP \u5B58\u6A94\u7684\u4EE5{0}\u5206\u9694\u7684\u6E05\u55AE\u3002\n\ -D<name>=<value>\n\ \u8A2D\u5B9A\u7CFB\u7D71\u5C6C\u6027\n\ -verbose[:class|gc|jni]\n\ \u555F\u7528\u8A73\u7D30\u8CC7\u8A0A\u8F38\u51FA\n\ -version \u5217\u5370\u7522\u54C1\u7248\u672C\u4E26\u7D50\u675F\n\ -version:<value>\n\ \u9700\u8981\u6307\u5B9A\u7684\u7248\u672C\u624D\u80FD\u57F7\u884C\n\ -showversion \u5217\u5370\u7522\u54C1\u7248\u672C\u4E26\u7E7C\u7E8C\n\ -jre-restrict-search | -no-jre-restrict-search\n\ \u5728\u7248\u672C\u641C\u5C0B\u4E2D\u5305\u62EC/\u6392\u9664\u4F7F\u7528\u8005\u5C08\u7528 JRE\n\ -? -help \u5217\u5370\u6B64\u8AAA\u660E\u8A0A\u606F\n\ -X \u5217\u5370\u975E\u6A19\u6E96\u9078\u9805\u7684\u8AAA\u660E\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ \u555F\u7528\u5177\u6709\u6307\u5B9A\u8A73\u7D30\u7A0B\u5EA6\u7684\u5BA3\u544A\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ \u505C\u7528\u5177\u6709\u6307\u5B9A\u8A73\u7D30\u7A0B\u5EA6\u7684\u5BA3\u544A\n\ -esa | -enablesystemassertions\n\ \u555F\u7528\u7CFB\u7D71\u5BA3\u544A\n\ -dsa | -disablesystemassertions\n\ \u505C\u7528\u7CFB\u7D71\u5BA3\u544A\n\ -agentlib:<libname>[=<options>]\n\ \u8F09\u5165\u539F\u751F\u4EE3\u7406\u7A0B\u5F0F\u7A0B\u5F0F\u5EAB <libname>\uFF0C\u4F8B\u5982 -agentlib:hprof\n\ \u53E6\u8ACB\u53C3\u95B1 -agentlib:jdwp=help \u8207 -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ \u4F7F\u7528\u5B8C\u6574\u8DEF\u5F91\u540D\u7A31\u8F09\u5165\u539F\u751F\u4EE3\u7406\u7A0B\u5F0F\u7A0B\u5F0F\u5EAB\n\ -javaagent:<jarpath>[=<options>]\n\ \u8F09\u5165 Java \u7A0B\u5F0F\u8A9E\u8A00\u4EE3\u7406\u7A0B\u5F0F\uFF0C\u8ACB\u53C3\u95B1 java.lang.instrument\n\ -splash:<imagepath>\n\ \u986F\u793A\u6307\u5B9A\u5F71\u50CF\u7684\u8EDF\u9AD4\u8CC7\u8A0A\u756B\u9762\n\u8ACB\u53C3\u95B1 http://java.sun.com/javase/reference\uFF0C\u66B8\u89E3\u8A73\u7D30\u8CC7\u8A0A\u3002
+java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n -classpath <class search path of directories and zip/jar files>\n \u4F7F\u7528 {0} \u5340\u9694\u7684\u76EE\u9304\u3001JAR \u5B58\u6A94\u4EE5\u53CA\n ZIP \u5B58\u6A94\u6E05\u55AE\u4F86\u641C\u5C0B\u985E\u5225\u6A94\u6848\u3002\n -D<name>=<value>\n \u8A2D\u5B9A\u7CFB\u7D71\u5C6C\u6027\n -verbose:[class|gc|jni]\n \u555F\u7528\u8A73\u7D30\u8CC7\u8A0A\u8F38\u51FA\n -version \u5217\u5370\u7522\u54C1\u7248\u672C\u4E26\u7D50\u675F\n -version:<value>\n \u9700\u8981\u6307\u5B9A\u7684\u7248\u672C\u624D\u80FD\u57F7\u884C\n -showversion \u5217\u5370\u7522\u54C1\u7248\u672C\u4E26\u7E7C\u7E8C\n -jre-restrict-search | -no-jre-restrict-search\n \u5728\u7248\u672C\u641C\u5C0B\u4E2D\u5305\u62EC/\u6392\u9664\u4F7F\u7528\u8005\u5C08\u7528 JRE\n -? -help \u5217\u5370\u6B64\u8AAA\u660E\u8A0A\u606F\n -X \u5217\u5370\u975E\u6A19\u6E96\u9078\u9805\u7684\u8AAA\u660E\n -ea[:<packagename>...|:<classname>]\n -enableassertions[:<packagename>...|:<classname>]\n \u555F\u7528\u542B\u6307\u5B9A\u8A73\u7D30\u7A0B\u5EA6\u7684\u5BA3\u544A\n -da[:<packagename>...|:<classname>]\n -disableassertions[:<packagename>...|:<classname>]\n \u505C\u7528\u542B\u6307\u5B9A\u8A73\u7D30\u7A0B\u5EA6\u7684\u5BA3\u544A\n -esa | -enablesystemassertions\n \u555F\u7528\u7CFB\u7D71\u5BA3\u544A\n -dsa | -disablesystemassertions\n \u505C\u7528\u7CFB\u7D71\u5BA3\u544A\n -agentlib:<libname>[=<options>]\n \u8F09\u5165\u539F\u751F\u4EE3\u7406\u7A0B\u5F0F\u7A0B\u5F0F\u5EAB <libname>\uFF0C\u4F8B\u5982 -agentlib:hprof\n \u53E6\u8ACB\u53C3\u95B1 -agentlib:jdwp=help \u8207 -agentlib:hprof=help\n -agentpath:<pathname>[=<options>]\n \u4F7F\u7528\u5B8C\u6574\u8DEF\u5F91\u540D\u7A31\u8F09\u5165\u539F\u751F\u4EE3\u7406\u7A0B\u5F0F\u7A0B\u5F0F\u5EAB\n -javaagent:<jarpath>[=<options>]\n \u8F09\u5165 Java \u7A0B\u5F0F\u8A9E\u8A00\u4EE3\u7406\u7A0B\u5F0F\uFF0C\u8ACB\u53C3\u95B1 java.lang.instrument\n -splash:<imagepath>\n \u986F\u793A\u6307\u5B9A\u5F71\u50CF\u7684\u8EDF\u9AD4\u8CC7\u8A0A\u756B\u9762\n\u8ACB\u53C3\u95B1 http://www.oracle.com/technetwork/java/javase/documentation/index.html \u66B8\u89E3\u8A73\u7D30\u8CC7\u8A0A\u3002
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\ -Xmixed \u6DF7\u5408\u6A21\u5F0F\u57F7\u884C (\u9810\u8A2D)\n -Xint \u50C5\u9650\u89E3\u8B6F\u6A21\u5F0F\u57F7\u884C\n -Xbootclasspath:<\u4EE5 {0} \u5206\u9694\u7684\u76EE\u9304\u548C zip/jar \u6A94\u6848>\n \u8A2D\u5B9A\u555F\u52D5\u5B89\u88DD\u985E\u5225\u548C\u8CC7\u6E90\u7684\u641C\u5C0B\u8DEF\u5F91\n -Xbootclasspath/a:<\u4EE5 {0} \u5206\u9694\u7684\u76EE\u9304\u548C zip/jar \u6A94\u6848>\n \u9644\u52A0\u5728\u555F\u52D5\u5B89\u88DD\u985E\u5225\u8DEF\u5F91\u7684\u7D50\u5C3E\n -Xbootclasspath/p:<\u4EE5 {0} \u5206\u9694\u7684\u76EE\u9304\u548C zip/jar \u6A94\u6848>\n \u9644\u52A0\u5728\u555F\u52D5\u5B89\u88DD\u985E\u5225\u8DEF\u5F91\u7684\u524D\u9762\n -Xdiag \u986F\u793A\u5176\u4ED6\u7684\u8A3A\u65B7\u8A0A\u606F\n -Xnoclassgc \u505C\u7528\u985E\u5225\u8CC7\u6E90\u56DE\u6536\n -Xincgc \u555F\u7528\u6F38\u9032\u8CC7\u6E90\u56DE\u6536\n -Xloggc:<file> \u5229\u7528\u6642\u6233\u5C07 GC \u72C0\u614B\u8A18\u9304\u81F3\u6A94\u6848\u4E2D\n -Xbatch \u505C\u7528\u80CC\u666F\u7DE8\u8B6F\n -Xms<size> \u8A2D\u5B9A\u8D77\u59CB Java \u5806\u96C6\u5927\u5C0F\n -Xmx<size> \u8A2D\u5B9A Java \u5806\u96C6\u5927\u5C0F\u4E0A\u9650\n -Xss<size> \u8A2D\u5B9A Java \u57F7\u884C\u7DD2\u5806\u758A\u5927\u5C0F\n -Xprof \u8F38\u51FA CPU \u5206\u6790\u8CC7\u6599\n -Xfuture \u555F\u7528\u6700\u56B4\u683C\u7684\u6AA2\u67E5\uFF0C\u9810\u5148\u505A\u70BA\u5C07\u4F86\u7684\u9810\u8A2D\n -Xrs \u6E1B\u5C11 Java/VM \u4F7F\u7528\u4F5C\u696D\u7CFB\u7D71\u4FE1\u865F (\u8ACB\u53C3\u95B1\u6587\u4EF6)\n -Xcheck:jni \u57F7\u884C\u5176\u4ED6\u7684 JNI \u51FD\u6578\u6AA2\u67E5\n -Xshare:off \u4E0D\u5617\u8A66\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599\n -Xshare:auto \u5118\u53EF\u80FD\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599 (\u9810\u8A2D)\n -Xshare:on \u9700\u8981\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599\uFF0C\u5426\u5247\u5931\u6557\u3002\n -XshowSettings \u986F\u793A\u6240\u6709\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n -XshowSettings:all\n \u986F\u793A\u6240\u6709\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n -XshowSettings:vm \u986F\u793A\u6240\u6709 VM \u76F8\u95DC\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n -XshowSettings:properties\n \u986F\u793A\u6240\u6709\u5C6C\u6027\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n -XshowSettings:locale\n \u986F\u793A\u6240\u6709\u5730\u5340\u8A2D\u5B9A\u76F8\u95DC\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n\n -X \u9078\u9805\u4E0D\u662F\u6A19\u6E96\u9078\u9805\uFF0C\u82E5\u6709\u8B8A\u66F4\u4E0D\u53E6\u884C\u901A\u77E5\u3002\n
# Translators please note do not translate the options themselves
-java.launcher.X.usage=\ -Xmixed \u6DF7\u5408\u6A21\u5F0F\u57F7\u884C (\u9810\u8A2D)\n\ -Xint \u50C5\u9650\u89E3\u8B6F\u6A21\u5F0F\u57F7\u884C\n\ -Xbootclasspath:<\u4EE5 {0} \u5206\u9694\u7684\u76EE\u9304\u548C zip/jar \u6A94\u6848>\n\ \u8A2D\u5B9A\u555F\u52D5\u5B89\u88DD\u985E\u5225\u548C\u8CC7\u6E90\u7684\u641C\u5C0B\u8DEF\u5F91\n\ -Xbootclasspath/a:<\u4EE5 {0} \u5206\u9694\u7684\u76EE\u9304\u548C zip/jar \u6A94\u6848>\n\ \u9644\u52A0\u5728\u555F\u52D5\u5B89\u88DD\u985E\u5225\u8DEF\u5F91\u7684\u7D50\u5C3E\n\ -Xbootclasspath/p:<\u4EE5 {0} \u5206\u9694\u7684\u76EE\u9304\u548C zip/jar \u6A94\u6848>\n\ \u9644\u52A0\u5728\u555F\u52D5\u5B89\u88DD\u985E\u5225\u8DEF\u5F91\u7684\u524D\u9762\n\ -Xdiag \u986F\u793A\u5176\u4ED6\u7684\u8A3A\u65B7\u8A0A\u606F\n\ -Xnoclassgc \u505C\u7528\u985E\u5225\u8CC7\u6E90\u56DE\u6536\n\ -Xincgc \u555F\u7528\u6F38\u9032\u8CC7\u6E90\u56DE\u6536\n\ -Xloggc:<file> \u5229\u7528\u6642\u6233\u5C07 GC \u72C0\u614B\u8A18\u9304\u81F3\u6A94\u6848\u4E2D\n\ -Xbatch \u505C\u7528\u80CC\u666F\u7DE8\u8B6F\n\ -Xms<size> \u8A2D\u5B9A\u8D77\u59CB Java \u5806\u96C6\u5927\u5C0F\n\ -Xmx<size> \u8A2D\u5B9A Java \u5806\u96C6\u5927\u5C0F\u4E0A\u9650\n\ -Xss<size> \u8A2D\u5B9A Java \u57F7\u884C\u7DD2\u5806\u758A\u5927\u5C0F\n\ -Xprof \u8F38\u51FA CPU \u5206\u6790\u8CC7\u6599\n\ -Xfuture \u555F\u7528\u6700\u56B4\u683C\u7684\u6AA2\u67E5\uFF0C\u9810\u5148\u505A\u70BA\u5C07\u4F86\u7684\u9810\u8A2D\n\ -Xrs \u6E1B\u5C11 Java/VM \u4F7F\u7528\u4F5C\u696D\u7CFB\u7D71\u4FE1\u865F (\u8ACB\u53C3\u95B1\u6587\u4EF6)\n\ -Xcheck:jni \u57F7\u884C\u5176\u4ED6\u7684 JNI \u51FD\u6578\u6AA2\u67E5\n\ -Xshare:off \u4E0D\u5617\u8A66\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599\n\ -Xshare:auto \u5118\u53EF\u80FD\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599 (\u9810\u8A2D)\n\ -Xshare:on \u9700\u8981\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599\uFF0C\u5426\u5247\u5931\u6557\u3002\n\ -XshowSettings \u986F\u793A\u6240\u6709\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n\ -XshowSettings:all\n\ \u986F\u793A\u6240\u6709\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n\ -XshowSettings:vm \u986F\u793A\u6240\u6709 VM \u76F8\u95DC\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n\ -XshowSettings:properties\n\ \u986F\u793A\u6240\u6709\u5C6C\u6027\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n\ -XshowSettings:locale\n\ \u986F\u793A\u6240\u6709\u5730\u5340\u8A2D\u5B9A\u76F8\u95DC\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n\n -X \u9078\u9805\u4E0D\u662F\u6A19\u6E96\u9078\u9805\uFF0C\u82E5\u6709\u8B8A\u66F4\u4E0D\u53E6\u884C\u901A\u77E5\u3002\n
+java.launcher.X.macosx.usage=\n\u4E0B\u5217\u662F Mac OS X \u7279\u5B9A\u9078\u9805:\n -XstartOnFirstThread\n \u5728\u7B2C\u4E00\u500B (AppKit) \u57F7\u884C\u7DD2\u57F7\u884C main() \u65B9\u6CD5\n -Xdock:name=<application name>"\n \u8986\u5BEB\u7D50\u5408\u8AAA\u660E\u756B\u9762\u4E2D\u986F\u793A\u7684\u9810\u8A2D\u61C9\u7528\u7A0B\u5F0F\u540D\u7A31\n -Xdock:icon=<path to icon file>\n \u8986\u5BEB\u7D50\u5408\u8AAA\u660E\u756B\u9762\u4E2D\u986F\u793A\u7684\u9810\u8A2D\u5716\u793A\n\n
java.launcher.cls.error1=\u932F\u8AA4: \u627E\u4E0D\u5230\u6216\u7121\u6CD5\u8F09\u5165\u4E3B\u8981\u985E\u5225 {0}
-java.launcher.cls.error2=\u932F\u8AA4: \u4E3B\u8981\u65B9\u6CD5\u4E0D\u662F\u985E\u5225 {1} \u4E2D\u7684 {0}\uFF0C\u8ACB\u5B9A\u7FA9\u4E3B\u8981\u65B9\u6CD5\u70BA:\n\ public static void main(String[] args)
-java.launcher.cls.error3=\u932F\u8AA4: \u4E3B\u8981\u65B9\u6CD5\u5FC5\u9808\u50B3\u56DE\u985E\u5225 {0} \u4E2D void \u985E\u578B\u7684\u503C\uFF0C \n\u8ACB\u5B9A\u7FA9\u4E3B\u8981\u65B9\u6CD5\u70BA:\n\ public static void main(String[] args)
-java.launcher.cls.error4=\u932F\u8AA4: \u5728\u985E\u5225 {0} \u4E2D\u627E\u4E0D\u5230\u4E3B\u8981\u65B9\u6CD5\uFF0C\u8ACB\u5B9A\u7FA9\u4E3B\u8981\u65B9\u6CD5\u70BA:\n\ public static void main(String[] args)
+java.launcher.cls.error2=\u932F\u8AA4: \u4E3B\u8981\u65B9\u6CD5\u4E0D\u662F\u985E\u5225 {1} \u4E2D\u7684 {0}\uFF0C\u8ACB\u5B9A\u7FA9\u4E3B\u8981\u65B9\u6CD5\u70BA:\n public static void main(String[] args)
+java.launcher.cls.error3=\u932F\u8AA4: \u4E3B\u8981\u65B9\u6CD5\u5FC5\u9808\u50B3\u56DE\u985E\u5225 {0} \u4E2D void \u985E\u578B\u7684\u503C\uFF0C \n\u8ACB\u5B9A\u7FA9\u4E3B\u8981\u65B9\u6CD5\u70BA:\n public static void main(String[] args)
+java.launcher.cls.error4=\u932F\u8AA4: \u5728\u985E\u5225 {0} \u4E2D\u627E\u4E0D\u5230\u4E3B\u8981\u65B9\u6CD5\uFF0C\u8ACB\u5B9A\u7FA9\u4E3B\u8981\u65B9\u6CD5\u70BA:\n public static void main(String[] args)\n\u6216\u8005 JavaFX \u61C9\u7528\u7A0B\u5F0F\u985E\u5225\u5FC5\u9808\u64F4\u5145 {1}
+java.launcher.cls.error5=\u932F\u8AA4: \u907A\u6F0F\u57F7\u884C\u6B64\u61C9\u7528\u7A0B\u5F0F\u6240\u9700\u7684 JavaFX \u7A0B\u5F0F\u5BE6\u969B\u57F7\u884C\u5143\u4EF6
java.launcher.jar.error1=\u932F\u8AA4: \u5617\u8A66\u958B\u555F\u6A94\u6848 {0} \u6642\u767C\u751F\u672A\u9810\u671F\u7684\u932F\u8AA4
java.launcher.jar.error2=\u5728 {0} \u4E2D\u627E\u4E0D\u5230\u8CC7\u8A0A\u6E05\u55AE
java.launcher.jar.error3={0} \u4E2D\u6C92\u6709\u4E3B\u8981\u8CC7\u8A0A\u6E05\u55AE\u5C6C\u6027
+java.launcher.init.error=\u521D\u59CB\u5316\u932F\u8AA4
+java.launcher.javafx.error1=\u932F\u8AA4: JavaFX launchApplication \u65B9\u6CD5\u7684\u7C3D\u7AE0\u932F\u8AA4\uFF0C\u5B83\n\u5FC5\u9808\u5BA3\u544A\u70BA\u975C\u614B\u4E26\u50B3\u56DE void \u985E\u578B\u7684\u503C
--- a/jdk/src/share/classes/sun/management/AgentConfigurationError.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/management/AgentConfigurationError.java Wed May 01 11:34:06 2013 -0700
@@ -128,19 +128,13 @@
public AgentConfigurationError(String error, String... params) {
super();
this.error = error;
- this.params = new String[params.length];
- for (int i = 0; i < params.length; i++) {
- this.params[i] = params[i];
- }
+ this.params = params.clone();
}
public AgentConfigurationError(String error, Throwable cause, String... params) {
super(cause);
this.error = error;
- this.params = new String[params.length];
- for (int i = 0; i < params.length; i++) {
- this.params[i] = params[i];
- }
+ this.params = params.clone();
}
public String getError() {
@@ -148,7 +142,7 @@
}
public String[] getParams() {
- return params;
+ return params.clone();
}
private static final long serialVersionUID = 1211605593516195475L;
--- a/jdk/src/share/classes/sun/management/resources/agent_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/management/resources/agent_de.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -40,11 +40,12 @@
agent.err.agentclass.notfound = Management Agent-Klasse nicht gefunden
agent.err.agentclass.failed = Management Agent-Klasse nicht erfolgreich
-agent.err.premain.notfound = premain(String) ist in Agentklasse nicht vorhanden
+agent.err.premain.notfound = premain(String) ist in Agent-Klasse nicht vorhanden
agent.err.agentclass.access.denied = Zugriff auf premain(String) wurde abgelehnt
agent.err.invalid.agentclass = Ung\u00FCltiger Eigenschaftswert f\u00FCr com.sun.management.agent.class
-
+agent.err.invalid.state = Ung\u00FCltiger Agent-Zustand
agent.err.invalid.jmxremote.port = Ung\u00FCltige Nummer f\u00FCr com.sun.management.jmxremote.port
+agent.err.invalid.jmxremote.rmi.port = Ung\u00FCltige Nummer f\u00FCr com.sun.management.jmxremote.rmi.port
agent.err.file.not.set = Datei nicht angegeben
agent.err.file.not.readable = Datei nicht lesbar
@@ -52,13 +53,13 @@
agent.err.file.not.found = Datei wurde nicht gefunden
agent.err.file.access.not.restricted = Lesezugriff auf Datei muss eingeschr\u00E4nkt werden
-agent.err.password.file.notset = Es wurde keine Kennwortdatei angegeben, obwohl com.sun.management.jmxremote.authenticate auf \"true\" gesetzt ist
+agent.err.password.file.notset = Es wurde keine Kennwortdatei angegeben, obwohl com.sun.management.jmxremote.authenticate auf "true" gesetzt ist
agent.err.password.file.not.readable = Kennwortdatei nicht lesbar
agent.err.password.file.read.failed = Kennwortdatei konnte nicht gelesen werden
agent.err.password.file.notfound = Kennwortdatei nicht gefunden
agent.err.password.file.access.notrestricted = Lesezugriff auf Kennwortdatei muss eingeschr\u00E4nkt werden
-agent.err.access.file.notset = Es wurde keine Zugriffsdatei angegeben, obwohl com.sun.management.jmxremote.authenticate auf \"true\" gesetzt ist
+agent.err.access.file.notset = Es wurde keine Zugriffsdatei angegeben, obwohl com.sun.management.jmxremote.authenticate auf "true" gesetzt ist
agent.err.access.file.not.readable = Zugriffsdatei kann nicht gelesen werden
agent.err.access.file.read.failed = Zugriffsdatei konnte nicht gelesen werden
agent.err.access.file.notfound = Zugriffsdatei nicht gefunden
@@ -69,7 +70,7 @@
agent.err.invalid.snmp.port = Ung\u00FCltige Nummer f\u00FCr com.sun.management.snmp.port
agent.err.invalid.snmp.trap.port = Ung\u00FCltige Nummer f\u00FCr com.sun.management.snmp.trap
agent.err.unknown.snmp.interface = Unbekannte SNMP-Schnittstelle
-agent.err.acl.file.notset = Es wurde keine SNMP-ACL-Datei angegeben, obwohl com.sun.management.snmp.acl auf \"true\" gesetzt ist
+agent.err.acl.file.notset = Es wurde keine SNMP-ACL-Datei angegeben, obwohl com.sun.management.snmp.acl auf "true" gesetzt ist
agent.err.acl.file.notfound = SNMP-ACL-Datei konnte nicht gefunden werden
agent.err.acl.file.not.readable = SNMP-ACL-Datei kann nicht gelesen werden
agent.err.acl.file.read.failed = SNMP-ACL-Datei konnte nicht gelesen werden
@@ -78,11 +79,11 @@
agent.err.snmp.adaptor.start.failed = Fehler beim Starten des SNMP-Adaptors mit Adresse
agent.err.snmp.mib.init.failed = Initialisierung von SNMP-MIB nicht erfolgreich mit Fehler
-jmxremote.ConnectorBootstrap.initialize = JMX-Connector-Server starten:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = Keine Authentifizierung
-jmxremote.ConnectorBootstrap.initialize.ready = JMX-Connector bereit unter: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = Lesezugriff auf Kennwortdatei muss eingeschr\u00E4nkt werden: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = Lesezugriff auf Datei muss eingeschr\u00E4nkt werden: {0}
+jmxremote.ConnectorBootstrap.starting = JMX-Connector-Server starten:
+jmxremote.ConnectorBootstrap.noAuthentication = Keine Authentifizierung
+jmxremote.ConnectorBootstrap.ready = JMX-Connector bereit unter: {0}
+jmxremote.ConnectorBootstrap.password.readonly = Lesezugriff auf Kennwortdatei muss eingeschr\u00E4nkt werden: {0}
+jmxremote.ConnectorBootstrap.file.readonly = Lesezugriff auf Datei muss eingeschr\u00E4nkt werden: {0}
jmxremote.AdaptorBootstrap.getTargetList.processing = ACL wird verarbeitet
jmxremote.AdaptorBootstrap.getTargetList.adding = Ziel hinzuf\u00FCgen: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/management/resources/agent_es.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -43,8 +43,9 @@
agent.err.premain.notfound = premain(String) no existe en la clase del agente
agent.err.agentclass.access.denied = Acceso denegado a premain(String)
agent.err.invalid.agentclass = Valor de propiedad com.sun.management.agent.class no v\u00E1lido
-
+agent.err.invalid.state = Estado del agente no v\u00E1lido
agent.err.invalid.jmxremote.port = N\u00FAmero com.sun.management.jmxremote.port no v\u00E1lido
+agent.err.invalid.jmxremote.rmi.port = N\u00FAmero com.sun.management.jmxremote.rmi.port no v\u00E1lido
agent.err.file.not.set = Archivo no especificado
agent.err.file.not.readable = Archivo ilegible
@@ -78,11 +79,11 @@
agent.err.snmp.adaptor.start.failed = Fallo al iniciar el adaptador de SNMP con la direcci\u00F3n
agent.err.snmp.mib.init.failed = Fallo al inicializar el MIB de SNMP con error
-jmxremote.ConnectorBootstrap.initialize = Iniciando servidor de conector JMX:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = Sin autenticaci\u00F3n
-jmxremote.ConnectorBootstrap.initialize.ready = Conector JMX listo en: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = Se debe restringir el acceso de lectura al archivo de contrase\u00F1as: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = El acceso de lectura al archivo debe ser restringido: {0}
+jmxremote.ConnectorBootstrap.starting = Iniciando servidor de conector JMX:
+jmxremote.ConnectorBootstrap.noAuthentication = Sin autenticaci\u00F3n
+jmxremote.ConnectorBootstrap.ready = Conector JMX listo en: {0}
+jmxremote.ConnectorBootstrap.password.readonly = Se debe restringir el acceso de lectura al archivo de contrase\u00F1as: {0}
+jmxremote.ConnectorBootstrap.file.readonly = El acceso de lectura al archivo debe ser restringido: {0}
jmxremote.AdaptorBootstrap.getTargetList.processing = Procesando ACL
jmxremote.AdaptorBootstrap.getTargetList.adding = Agregando destino: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_fr.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/management/resources/agent_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -43,8 +43,9 @@
agent.err.premain.notfound = premain(String) n'existe pas dans la classe d'agents
agent.err.agentclass.access.denied = Acc\u00E8s \u00E0 premain(String) refus\u00E9
agent.err.invalid.agentclass = Valeur de propri\u00E9t\u00E9 com.sun.management.agent.class incorrecte
-
+agent.err.invalid.state = Etat de l'agent non valide
agent.err.invalid.jmxremote.port = Num\u00E9ro com.sun.management.jmxremote.port incorrect
+agent.err.invalid.jmxremote.rmi.port = Num\u00E9ro com.sun.management.jmxremote.rmi.port non valide
agent.err.file.not.set = Fichier non sp\u00E9cifi\u00E9
agent.err.file.not.readable = Fichier illisible
@@ -78,11 +79,11 @@
agent.err.snmp.adaptor.start.failed = Impossible de d\u00E9marrer l'adaptateur SNMP avec l'adresse
agent.err.snmp.mib.init.failed = Impossible d'initialiser SNMP MIB avec l'erreur
-jmxremote.ConnectorBootstrap.initialize = D\u00E9marrage du serveur du connecteur JMX :
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = Pas d'authentification
-jmxremote.ConnectorBootstrap.initialize.ready = Connecteur JMX pr\u00EAt \u00E0 : {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = L''acc\u00E8s en lecture au fichier de mots de passe doit \u00EAtre limit\u00E9 : {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = L''acc\u00E8s en lecture au fichier doit \u00EAtre limit\u00E9 : {0}
+jmxremote.ConnectorBootstrap.starting = D\u00E9marrage du serveur du connecteur JMX :
+jmxremote.ConnectorBootstrap.noAuthentication = Pas d'authentification
+jmxremote.ConnectorBootstrap.ready = Connecteur JMX pr\u00EAt \u00E0 : {0}
+jmxremote.ConnectorBootstrap.password.readonly = L''acc\u00E8s en lecture au fichier de mots de passe doit \u00EAtre limit\u00E9 : {0}
+jmxremote.ConnectorBootstrap.file.readonly = L''acc\u00E8s en lecture au fichier doit \u00EAtre limit\u00E9 : {0}
jmxremote.AdaptorBootstrap.getTargetList.processing = Traitement de la liste de contr\u00F4le d'acc\u00E8s (ACL)
jmxremote.AdaptorBootstrap.getTargetList.adding = Ajout de la cible : {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_it.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/management/resources/agent_it.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -43,8 +43,9 @@
agent.err.premain.notfound = premain(String) non esiste nella classe agente
agent.err.agentclass.access.denied = Accesso negato a premain(String)
agent.err.invalid.agentclass = Valore propriet\u00E0 com.sun.management.agent.class non valido
-
+agent.err.invalid.state = Stato agente non valido
agent.err.invalid.jmxremote.port = Numero com.sun.management.jmxremote.port non valido
+agent.err.invalid.jmxremote.rmi.port = Numero com.sun.management.jmxremote.rmi.port non valido
agent.err.file.not.set = File non specificato
agent.err.file.not.readable = File non leggibile
@@ -78,11 +79,11 @@
agent.err.snmp.adaptor.start.failed = Impossibile avviare l'adattatore SNMP con indirizzo
agent.err.snmp.mib.init.failed = Impossibile inizializzare MIB SNMP con errore
-jmxremote.ConnectorBootstrap.initialize = Avvio del server connettore JMX:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = Nessuna autenticazione
-jmxremote.ConnectorBootstrap.initialize.ready = Connettore JMX pronto in: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = Limitare l''accesso in lettura al password file: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = Limitare l''accesso in lettura al file: {0}
+jmxremote.ConnectorBootstrap.starting = Avvio del server connettore JMX:
+jmxremote.ConnectorBootstrap.noAuthentication = Nessuna autenticazione
+jmxremote.ConnectorBootstrap.ready = Connettore JMX pronto in: {0}
+jmxremote.ConnectorBootstrap.password.readonly = Limitare l''accesso in lettura al password file: {0}
+jmxremote.ConnectorBootstrap.file.readonly = Limitare l''accesso in lettura al file: {0}
jmxremote.AdaptorBootstrap.getTargetList.processing = Elaborazione ACL
jmxremote.AdaptorBootstrap.getTargetList.adding = Aggiunta destinazione: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/management/resources/agent_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -43,8 +43,9 @@
agent.err.premain.notfound = premain(String)\u304C\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30AF\u30E9\u30B9\u306B\u5B58\u5728\u3057\u307E\u305B\u3093
agent.err.agentclass.access.denied = premain(String)\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F
agent.err.invalid.agentclass = com.sun.management.agent.class\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5024\u304C\u7121\u52B9\u3067\u3059
-
+agent.err.invalid.state = \u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u306E\u72B6\u614B\u304C\u7121\u52B9\u3067\u3059
agent.err.invalid.jmxremote.port = com.sun.management.jmxremote.port\u306E\u756A\u53F7\u304C\u7121\u52B9\u3067\u3059
+agent.err.invalid.jmxremote.rmi.port = com.sun.management.jmxremote.rmi.port\u306E\u756A\u53F7\u304C\u7121\u52B9\u3067\u3059
agent.err.file.not.set = \u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
agent.err.file.not.readable = \u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u53D6\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
@@ -78,11 +79,11 @@
agent.err.snmp.adaptor.start.failed = \u3053\u306E\u30A2\u30C9\u30EC\u30B9\u3067SNMP\u30A2\u30C0\u30D7\u30BF\u3092\u958B\u59CB\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
agent.err.snmp.mib.init.failed = \u30A8\u30E9\u30FC\u3067SNMP MIB\u3092\u521D\u671F\u5316\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-jmxremote.ConnectorBootstrap.initialize = JMX\u30B3\u30CD\u30AF\u30BF\u30FB\u30B5\u30FC\u30D0\u30FC\u3092\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = \u8A8D\u8A3C\u306A\u3057
-jmxremote.ConnectorBootstrap.initialize.ready = JMX\u30B3\u30CD\u30AF\u30BF\u306E\u6E96\u5099\u304C\u3067\u304D\u307E\u3057\u305F: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = \u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
+jmxremote.ConnectorBootstrap.starting = JMX\u30B3\u30CD\u30AF\u30BF\u30FB\u30B5\u30FC\u30D0\u30FC\u3092\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059:
+jmxremote.ConnectorBootstrap.noAuthentication = \u8A8D\u8A3C\u306A\u3057
+jmxremote.ConnectorBootstrap.ready = JMX\u30B3\u30CD\u30AF\u30BF\u306E\u6E96\u5099\u304C\u3067\u304D\u307E\u3057\u305F: {0}
+jmxremote.ConnectorBootstrap.password.readonly = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
+jmxremote.ConnectorBootstrap.file.readonly = \u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
jmxremote.AdaptorBootstrap.getTargetList.processing = ACL\u3092\u51E6\u7406\u3057\u3066\u3044\u307E\u3059
jmxremote.AdaptorBootstrap.getTargetList.adding = \u30BF\u30FC\u30B2\u30C3\u30C8\u3092\u8FFD\u52A0\u3057\u3066\u3044\u307E\u3059: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_ko.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/management/resources/agent_ko.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -43,8 +43,9 @@
agent.err.premain.notfound = \uC5D0\uC774\uC804\uD2B8 \uD074\uB798\uC2A4\uC5D0 premain(\uBB38\uC790\uC5F4)\uC774 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
agent.err.agentclass.access.denied = premain(\uBB38\uC790\uC5F4)\uC5D0 \uB300\uD55C \uC561\uC138\uC2A4\uAC00 \uAC70\uBD80\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
agent.err.invalid.agentclass = com.sun.management.agent.class \uC18D\uC131 \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
-
+agent.err.invalid.state = \uBD80\uC801\uD569\uD55C \uC5D0\uC774\uC804\uD2B8 \uC0C1\uD0DC
agent.err.invalid.jmxremote.port = com.sun.management.jmxremote.port \uBC88\uD638\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+agent.err.invalid.jmxremote.rmi.port = \uBD80\uC801\uD569\uD55C com.sun.management.jmxremote.rmi.port \uBC88\uD638
agent.err.file.not.set = \uD30C\uC77C\uC774 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.
agent.err.file.not.readable = \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
@@ -78,11 +79,11 @@
agent.err.snmp.adaptor.start.failed = \uC8FC\uC18C\uAC00 \uC788\uB294 SNMP \uC5B4\uB311\uD130 \uC2DC\uC791\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
agent.err.snmp.mib.init.failed = \uC624\uB958\uB85C \uC778\uD574 SNMP MIB \uCD08\uAE30\uD654\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
-jmxremote.ConnectorBootstrap.initialize = JMX \uCEE4\uB125\uD130 \uC11C\uBC84\uB97C \uC2DC\uC791\uD558\uB294 \uC911:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = \uC778\uC99D \uC5C6\uC74C
-jmxremote.ConnectorBootstrap.initialize.ready = {0}\uC5D0\uC11C JMX \uCEE4\uB125\uD130\uAC00 \uC900\uBE44\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
-jmxremote.ConnectorBootstrap.initialize.password.readonly = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD568: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD568: {0}
+jmxremote.ConnectorBootstrap.starting = JMX \uCEE4\uB125\uD130 \uC11C\uBC84\uB97C \uC2DC\uC791\uD558\uB294 \uC911:
+jmxremote.ConnectorBootstrap.noAuthentication = \uC778\uC99D \uC5C6\uC74C
+jmxremote.ConnectorBootstrap.ready = {0}\uC5D0\uC11C JMX \uCEE4\uB125\uD130\uAC00 \uC900\uBE44\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+jmxremote.ConnectorBootstrap.password.readonly = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD568: {0}
+jmxremote.ConnectorBootstrap.file.readonly = \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD568: {0}
jmxremote.AdaptorBootstrap.getTargetList.processing = ACL\uC744 \uCC98\uB9AC\uD558\uB294 \uC911
jmxremote.AdaptorBootstrap.getTargetList.adding = \uB300\uC0C1\uC744 \uCD94\uAC00\uD558\uB294 \uC911: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/management/resources/agent_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -43,8 +43,9 @@
agent.err.premain.notfound = premain(String) n\u00E3o existe na classe do agente
agent.err.agentclass.access.denied = Acesso negado a premain(String)
agent.err.invalid.agentclass = Valor inv\u00E1lido da propriedade com.sun.management.agent.class
-
+agent.err.invalid.state = Estado de agente inv\u00E1lido
agent.err.invalid.jmxremote.port = N\u00FAmero inv\u00E1lido de com.sun.management.jmxremote.port
+agent.err.invalid.jmxremote.rmi.port = N\u00FAmero inv\u00E1lido do com.sun.management.jmxremote.rmi.port
agent.err.file.not.set = Arquivo n\u00E3o especificado
agent.err.file.not.readable = Arquivo ileg\u00EDvel
@@ -78,11 +79,11 @@
agent.err.snmp.adaptor.start.failed = Falha ao iniciar o adaptador SNMP com endere\u00E7o
agent.err.snmp.mib.init.failed = Falha ao inicializar o MIB SNMP com erro
-jmxremote.ConnectorBootstrap.initialize = Iniciando o Servidor do Conector JMX:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = Sem autentica\u00E7\u00E3o
-jmxremote.ConnectorBootstrap.initialize.ready = Conector JMX pronto em: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = O acesso de leitura do arquivo de senha deve ser limitado: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = O acesso de leitura do arquivo deve ser limitado: {0}
+jmxremote.ConnectorBootstrap.starting = Iniciando o Servidor do Conector JMX:
+jmxremote.ConnectorBootstrap.noAuthentication = Sem autentica\u00E7\u00E3o
+jmxremote.ConnectorBootstrap.ready = Conector JMX pronto em: {0}
+jmxremote.ConnectorBootstrap.password.readonly = O acesso de leitura do arquivo de senha deve ser limitado: {0}
+jmxremote.ConnectorBootstrap.file.readonly = O acesso de leitura do arquivo deve ser limitado: {0}
jmxremote.AdaptorBootstrap.getTargetList.processing = Processando ACL
jmxremote.AdaptorBootstrap.getTargetList.adding = Adicionando destino: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_sv.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/management/resources/agent_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -43,8 +43,9 @@
agent.err.premain.notfound = premain(String) finns inte i agentklassen
agent.err.agentclass.access.denied = \u00C5tkomst till premain(String) nekad
agent.err.invalid.agentclass = Ogiltigt egenskapsv\u00E4rde f\u00F6r com.sun.management.agent.class
-
+agent.err.invalid.state = Ogiltig agentstatus
agent.err.invalid.jmxremote.port = Ogiltigt com.sun.management.jmxremote.port-nummer
+agent.err.invalid.jmxremote.rmi.port = Ogiltigt com.sun.management.jmxremote.rmi.port-nummer
agent.err.file.not.set = Filen \u00E4r inte angiven
agent.err.file.not.readable = Filen \u00E4r inte l\u00E4sbar
@@ -78,11 +79,11 @@
agent.err.snmp.adaptor.start.failed = Kunde inte starta SNMP-adaptern med adressen
agent.err.snmp.mib.init.failed = Kunde inte initiera SNMP MIB. Returnerade felet
-jmxremote.ConnectorBootstrap.initialize = Startar server f\u00F6r JMX-anslutning:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = Ingen autentisering
-jmxremote.ConnectorBootstrap.initialize.ready = JMX-anslutning redo p\u00E5: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = L\u00E4sbeh\u00F6righeten f\u00F6r l\u00F6senordsfilen m\u00E5ste begr\u00E4nsas: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = Fill\u00E4snings\u00E5tkomst m\u00E5ste begr\u00E4nsas {0}
+jmxremote.ConnectorBootstrap.starting = Startar server f\u00F6r JMX-anslutning:
+jmxremote.ConnectorBootstrap.noAuthentication = Ingen autentisering
+jmxremote.ConnectorBootstrap.ready = JMX-anslutning redo p\u00E5: {0}
+jmxremote.ConnectorBootstrap.password.readonly = L\u00E4sbeh\u00F6righeten f\u00F6r l\u00F6senordsfilen m\u00E5ste begr\u00E4nsas: {0}
+jmxremote.ConnectorBootstrap.file.readonly = Fill\u00E4snings\u00E5tkomst m\u00E5ste begr\u00E4nsas {0}
jmxremote.AdaptorBootstrap.getTargetList.processing = ACL bearbetas
jmxremote.AdaptorBootstrap.getTargetList.adding = M\u00E5l l\u00E4ggs till: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/management/resources/agent_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -43,8 +43,9 @@
agent.err.premain.notfound = \u4EE3\u7406\u7C7B\u4E2D\u4E0D\u5B58\u5728 premain(String)
agent.err.agentclass.access.denied = \u62D2\u7EDD\u8BBF\u95EE premain(String)
agent.err.invalid.agentclass = com.sun.management.agent.class \u5C5E\u6027\u503C\u65E0\u6548
-
+agent.err.invalid.state = \u4EE3\u7406\u72B6\u6001\u65E0\u6548
agent.err.invalid.jmxremote.port = com.sun.management.jmxremote.port \u7F16\u53F7\u65E0\u6548
+agent.err.invalid.jmxremote.rmi.port = com.sun.management.jmxremote.rmi.port \u7F16\u53F7\u65E0\u6548
agent.err.file.not.set = \u672A\u6307\u5B9A\u6587\u4EF6
agent.err.file.not.readable = \u6587\u4EF6\u4E0D\u53EF\u8BFB\u53D6
@@ -78,11 +79,11 @@
agent.err.snmp.adaptor.start.failed = \u65E0\u6CD5\u542F\u52A8\u5E26\u6709\u5730\u5740\u7684 SNMP \u9002\u914D\u5668
agent.err.snmp.mib.init.failed = \u65E0\u6CD5\u521D\u59CB\u5316\u5E26\u6709\u9519\u8BEF\u7684 SNMP MIB
-jmxremote.ConnectorBootstrap.initialize = \u6B63\u5728\u542F\u52A8 JMX \u8FDE\u63A5\u5668\u670D\u52A1\u5668:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = \u65E0\u9A8C\u8BC1
-jmxremote.ConnectorBootstrap.initialize.ready = \u4F4D\u4E8E{0}\u7684 JMX \u8FDE\u63A5\u5668\u5DF2\u5C31\u7EEA
-jmxremote.ConnectorBootstrap.initialize.password.readonly = \u5FC5\u987B\u9650\u5236\u53E3\u4EE4\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = \u5FC5\u987B\u9650\u5236\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650: {0}
+jmxremote.ConnectorBootstrap.starting = \u6B63\u5728\u542F\u52A8 JMX \u8FDE\u63A5\u5668\u670D\u52A1\u5668:
+jmxremote.ConnectorBootstrap.noAuthentication = \u65E0\u9A8C\u8BC1
+jmxremote.ConnectorBootstrap.ready = \u4F4D\u4E8E{0}\u7684 JMX \u8FDE\u63A5\u5668\u5DF2\u5C31\u7EEA
+jmxremote.ConnectorBootstrap.password.readonly = \u5FC5\u987B\u9650\u5236\u53E3\u4EE4\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650: {0}
+jmxremote.ConnectorBootstrap.file.readonly = \u5FC5\u987B\u9650\u5236\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650: {0}
jmxremote.AdaptorBootstrap.getTargetList.processing = \u6B63\u5728\u5904\u7406 ACL
jmxremote.AdaptorBootstrap.getTargetList.adding = \u6B63\u5728\u6DFB\u52A0\u76EE\u6807: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_zh_TW.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/management/resources/agent_zh_TW.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -43,8 +43,9 @@
agent.err.premain.notfound = \u4EE3\u7406\u7A0B\u5F0F\u985E\u5225\u4E2D\u4E0D\u5B58\u5728 premain(String)
agent.err.agentclass.access.denied = \u5B58\u53D6 premain(String) \u906D\u5230\u62D2\u7D55
agent.err.invalid.agentclass = com.sun.management.agent.class \u5C6C\u6027\u503C\u7121\u6548
-
+agent.err.invalid.state = \u7121\u6548\u7684\u4EE3\u7406\u7A0B\u5F0F\u72C0\u614B
agent.err.invalid.jmxremote.port = com.sun.management.jmxremote.port \u865F\u78BC\u7121\u6548
+agent.err.invalid.jmxremote.rmi.port = com.sun.management.jmxremote.rmi.port \u865F\u78BC\u7121\u6548
agent.err.file.not.set = \u672A\u6307\u5B9A\u6A94\u6848
agent.err.file.not.readable = \u6A94\u6848\u7121\u6CD5\u8B80\u53D6
@@ -78,11 +79,11 @@
agent.err.snmp.adaptor.start.failed = \u7121\u6CD5\u4F7F\u7528\u4F4D\u5740\u555F\u52D5 SNMP \u914D\u63A5\u5361
agent.err.snmp.mib.init.failed = \u7121\u6CD5\u521D\u59CB\u5316 SNMP MIB\uFF0C\u51FA\u73FE\u932F\u8AA4
-jmxremote.ConnectorBootstrap.initialize = \u6B63\u5728\u555F\u52D5 JMX \u9023\u63A5\u5668\u4F3A\u670D\u5668:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = \u7121\u8A8D\u8B49
-jmxremote.ConnectorBootstrap.initialize.ready = JMX \u9023\u63A5\u5668\u5C31\u7DD2\uFF0C\u4F4D\u65BC: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = \u5FC5\u9808\u9650\u5236\u5BC6\u78BC\u6A94\u6848\u8B80\u53D6\u5B58\u53D6: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = \u5FC5\u9808\u9650\u5236\u6A94\u6848\u8B80\u53D6\u5B58\u53D6\u6B0A: {0}
+jmxremote.ConnectorBootstrap.starting = \u6B63\u5728\u555F\u52D5 JMX \u9023\u63A5\u5668\u4F3A\u670D\u5668:
+jmxremote.ConnectorBootstrap.noAuthentication = \u7121\u8A8D\u8B49
+jmxremote.ConnectorBootstrap.ready = JMX \u9023\u63A5\u5668\u5C31\u7DD2\uFF0C\u4F4D\u65BC: {0}
+jmxremote.ConnectorBootstrap.password.readonly = \u5FC5\u9808\u9650\u5236\u5BC6\u78BC\u6A94\u6848\u8B80\u53D6\u5B58\u53D6: {0}
+jmxremote.ConnectorBootstrap.file.readonly = \u5FC5\u9808\u9650\u5236\u6A94\u6848\u8B80\u53D6\u5B58\u53D6\u6B0A: {0}
jmxremote.AdaptorBootstrap.getTargetList.processing = \u6B63\u5728\u8655\u7406 ACL
jmxremote.AdaptorBootstrap.getTargetList.adding = \u6B63\u5728\u65B0\u589E\u76EE\u6A19: {0}
--- a/jdk/src/share/classes/sun/misc/PerfCounter.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/PerfCounter.java Wed May 01 11:34:06 2013 -0700
@@ -62,7 +62,7 @@
private PerfCounter(String name, int type) {
this.name = name;
- ByteBuffer bb = perf.createLong(name, U_None, type, 0L);
+ ByteBuffer bb = perf.createLong(name, type, U_None, 0L);
bb.order(ByteOrder.nativeOrder());
this.lb = bb.asLongBuffer();
}
--- a/jdk/src/share/classes/sun/misc/resources/Messages_de.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_de.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_es.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_es.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_fr.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_fr.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_it.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_it.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_ja.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_ja.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_ko.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_ko.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_pt_BR.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_pt_BR.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_sv.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_sv.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_zh_CN.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_zh_CN.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_zh_TW.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_zh_TW.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/net/www/protocol/http/DigestAuthentication.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/DigestAuthentication.java Wed May 01 11:34:06 2013 -0700
@@ -364,17 +364,18 @@
+ ncfield
+ ", uri=\"" + uri
+ "\", response=\"" + response
- + "\", algorithm=\"" + algorithm;
+ + "\", algorithm=" + algorithm;
if (opaque != null) {
- value = value + "\", opaque=\"" + opaque;
+ value = value + ", opaque=\"" + opaque;
+ value = value + "\"";
}
if (cnonce != null) {
- value = value + "\", cnonce=\"" + cnonce;
+ value = value + ", cnonce=\"" + cnonce;
+ value = value + "\"";
}
if (qop) {
- value = value + "\", qop=\"auth";
+ value = value + ", qop=auth";
}
- value = value + "\"";
return value;
}
--- a/jdk/src/share/classes/sun/print/resources/serviceui_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_de.properties Wed May 01 11:34:06 2013 -0700
@@ -16,9 +16,9 @@
button.print=Drucken
button.properties=E&igenschaften...
#
-checkbox.collate=So&rtieren
+checkbox.collate=&Sortieren
checkbox.jobsheets=&Bannerseite
-checkbox.printtofile=A&usgabe in Datei
+checkbox.printtofile=Ausgabe in &Datei
#
dialog.printtitle=Drucken
dialog.pstitle=Seite einrichten
@@ -35,42 +35,42 @@
label.psname=&Name:
label.pstype=Typ:
label.rangeto=Bis
-label.size=Gr\u00F6\u00DF&e:
-label.source=Q&uelle:
+label.size=G&r\u00F6\u00DFe:
+label.source=&Quelle:
label.status=Status:
-label.username=Ben&utzername:
+label.username=&Benutzername:
label.millimetres=(mm)
label.inches=(Zoll)
label.topmargin=&oben
-label.bottommargin=u&nten
+label.bottommargin=&unten
label.leftmargin=&links
label.rightmargin=&rechts
#
radiobutton.color=&Farbe
radiobutton.draftq=Ent&wurf
-radiobutton.duplex=Du&plex
+radiobutton.duplex=&Duplex
radiobutton.highq=&Hoch
radiobutton.landscape=&Querformat
radiobutton.monochrome=&Monochrom
radiobutton.normalq=&Normal
radiobutton.oneside=&Einseitig
-radiobutton.portrait=&Hochformat
+radiobutton.portrait=Hochfor&mat
radiobutton.rangeall=A&lle
radiobutton.rangepages=S&eiten
-radiobutton.revlandscape=U&mgekehrtes Querformat
-radiobutton.revportrait=Umge&kehrtes Hochformat
+radiobutton.revlandscape=Umgekehrtes Q&uerformat
+radiobutton.revportrait=Umgekehrtes &Hochformat
radiobutton.tumble=&Kalenderdruck
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
tab.appearance=&Darstellung
tab.general=&Allgemein
-tab.pagesetup=&Seite einrichten
+tab.pagesetup=Seite &einrichten
#
error.pagerange=Ung\u00FCltiger Seitenbereich. Geben Sie die Werte erneut ein (Beispiel: 1-3,5,7-10)
error.destination=Ung\u00FCltiger Dateiname. Wiederholen Sie den Vorgang
#
# The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound
# character is replaced with 'n')
#
iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
Cassette=Kassette
Form-Source=Formularquelle
#
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by
# PrinterIsAcceptingJobs.toString()
#
accepting-jobs=Jobs annehmen
not-accepting-jobs=Jobs nicht annehmen
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_es.properties Wed May 01 11:34:06 2013 -0700
@@ -17,7 +17,7 @@
button.properties=P&ropiedades...
#
checkbox.collate=Inter&calar
-checkbox.jobsheets=P\u00E1gina d&e R\u00F3tulo
+checkbox.jobsheets=P\u00E1gina de R\u00F3tu&lo
checkbox.printtofile=I&mprimir en Archivo
#
dialog.printtitle=Imprimir
@@ -29,19 +29,19 @@
dialog.writeerror=No se puede escribir en el archivo:
#
label.info=Informaci\u00F3n:
-label.jobname=Nombre del &Trabajo:
-label.numcopies=N\u00FAmer&o de Copias:
-label.priority=Pr&ioridad:
+label.jobname=&Nombre del Trabajo:
+label.numcopies=N\u00FAmero de C&opias:
+label.priority=Prior&idad:
label.psname=&Nombre:
label.pstype=Tipo:
label.rangeto=A
-label.size=&Tama\u00F1o:
-label.source=Origen:
+label.size=Tama&\u00F1o:
+label.source=Ori&gen:
label.status=Estado:
-label.username=U&suario:
+label.username=&Usuario:
label.millimetres=(mm)
label.inches=(pulg.)
-label.topmargin=superior
+label.topmargin=&superior
label.bottommargin=in&ferior
label.leftmargin=iz&quierdo
label.rightmargin=d&erecho
@@ -49,16 +49,16 @@
radiobutton.color=&Color
radiobutton.draftq=Bo&rrador
radiobutton.duplex=&D\u00FAplex
-radiobutton.highq=A<a
+radiobutton.highq=&Alta
radiobutton.landscape=Hori&zontal
radiobutton.monochrome=&Monocromo
radiobutton.normalq=&Normal
-radiobutton.oneside=&Una Cara
+radiobutton.oneside=Una Ca&ra
radiobutton.portrait=&Vertical
radiobutton.rangeall=&Todo
radiobutton.rangepages=P\u00E1&ginas
radiobutton.revlandscape=&Horizontal Inverso
-radiobutton.revportrait=Ve&rtical Inverso
+radiobutton.revportrait=Vertical Inver&so
radiobutton.tumble=Cam&bio de Cara
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
@@ -70,7 +70,7 @@
error.destination=Nombre de archivo no v\u00E1lido; int\u00E9ntelo de nuevo
#
# The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound
# character is replaced with 'n')
#
iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
Cassette=Casete
Form-Source=Origen de Formulario
#
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by
# PrinterIsAcceptingJobs.toString()
#
accepting-jobs=Aceptando trabajos
not-accepting-jobs=No aceptando trabajos
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -30,7 +30,7 @@
#
label.info=Infos :
label.jobname=Nom du &travail :
-label.numcopies=N&ombre de copies :
+label.numcopies=Nombre de c&opies :
label.priority=P&riorit\u00E9 :
label.psname=&Nom :
label.pstype=Type :
@@ -38,7 +38,7 @@
label.size=Tai&lle :
label.source=Sour&ce :
label.status=Statut :
-label.username=N&om utilisateur :
+label.username=Nom &utilisateur :
label.millimetres=(mm)
label.inches=(po)
label.topmargin=&haut
@@ -46,11 +46,11 @@
label.leftmargin=&gauche
label.rightmargin=&droite
#
-radiobutton.color=&Couleur
+radiobutton.color=Coule&ur
radiobutton.draftq=Broui&llon
radiobutton.duplex=&Duplex
radiobutton.highq=Ma&x.
-radiobutton.landscape=Pa&ysage
+radiobutton.landscape=Pay&sage
radiobutton.monochrome=&Monochrome
radiobutton.normalq=&Normal
radiobutton.oneside=&Un c\u00F4t\u00E9
@@ -58,7 +58,7 @@
radiobutton.rangeall=&Tout
radiobutton.rangepages=Pag&es
radiobutton.revlandscape=Paysage i&nvers\u00E9
-radiobutton.revportrait=Portra&it invers\u00E9
+radiobutton.revportrait=Portrait &invers\u00E9
radiobutton.tumble=&T\u00EAte-b\u00EAche
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
@@ -70,7 +70,7 @@
error.destination=Nom de fichier non valide ; recommencez
#
# The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound
# character is replaced with 'n')
#
iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
Cassette=Cassette
Form-Source=Source du formulaire
#
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by
# PrinterIsAcceptingJobs.toString()
#
accepting-jobs=Acceptation des t\u00E2ches
not-accepting-jobs=Refus des t\u00E2ches
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_it.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_it.properties Wed May 01 11:34:06 2013 -0700
@@ -17,7 +17,7 @@
button.properties=P&ropriet\u00E0...
#
checkbox.collate=Fascico&la
-checkbox.jobsheets=&Pagina banner
+checkbox.jobsheets=Pagina &banner
checkbox.printtofile=Stampa su &file
#
dialog.printtitle=Stampa
@@ -30,8 +30,8 @@
#
label.info=Informazioni:
label.jobname=Nome &job:
-label.numcopies=Numer&o di copie:
-label.priority=Pr&iorit\u00E0:
+label.numcopies=Numero di c&opie:
+label.priority=P&riorit\u00E0:
label.psname=&Nome:
label.pstype=Tipo:
label.rangeto=A
@@ -51,7 +51,7 @@
radiobutton.duplex=F&ronte retro
radiobutton.highq=A<a
radiobutton.landscape=Orizzonta&le
-radiobutton.monochrome=&Monocromatico
+radiobutton.monochrome=Monocrom&atico
radiobutton.normalq=&Normale
radiobutton.oneside=Un lat&o
radiobutton.portrait=&Verticale
@@ -70,7 +70,7 @@
error.destination=Nome file non valido; riprovare
#
# The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound
# character is replaced with 'n')
#
iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
Cassette=Cassetta
Form-Source=Origine modulo
#
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by
# PrinterIsAcceptingJobs.toString()
#
accepting-jobs=Accettazione job
not-accepting-jobs=Rifiuto job
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -70,7 +70,7 @@
error.destination=\u7121\u52B9\u306A\u30D5\u30A1\u30A4\u30EB\u540D\u3002\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
#
# The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound
# character is replaced with 'n')
#
iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
Cassette=\u30AB\u30BB\u30C3\u30C8
Form-Source=\u30D5\u30A9\u30FC\u30E0\u30FB\u30BD\u30FC\u30B9
#
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by
# PrinterIsAcceptingJobs.toString()
#
accepting-jobs=\u30B8\u30E7\u30D6\u3092\u53D7\u3051\u4ED8\u3051\u3066\u3044\u307E\u3059
not-accepting-jobs=\u30B8\u30E7\u30D6\u3092\u53D7\u3051\u4ED8\u3051\u307E\u305B\u3093
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_ko.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_ko.properties Wed May 01 11:34:06 2013 -0700
@@ -70,7 +70,7 @@
error.destination=\uBD80\uC801\uD569\uD55C \uD30C\uC77C \uC774\uB984: \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC2ED\uC2DC\uC624.
#
# The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound
# character is replaced with 'n')
#
iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
Cassette=\uCE74\uC138\uD2B8
Form-Source=\uC591\uC2DD \uC18C\uC2A4
#
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by
# PrinterIsAcceptingJobs.toString()
#
accepting-jobs=\uC791\uC5C5 \uC2B9\uC778
not-accepting-jobs=\uC791\uC5C5 \uC2B9\uC778 \uC548\uD568
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -14,9 +14,9 @@
button.cancel=Cancelar
button.ok=OK
button.print=Imprimir
-button.properties=Proprie&dades...
+button.properties=P&ropriedades...
#
-checkbox.collate=Ag&rupar
+checkbox.collate=&Agrupar
checkbox.jobsheets=P\u00E1gina com &Banner
checkbox.printtofile=&Imprimir em Arquivo
#
@@ -31,7 +31,7 @@
label.info=Informa\u00E7\u00F5es:
label.jobname=Nome do &Job:
label.numcopies=N\u00FAmer&o de c\u00F3pias:
-label.priority=&Prioridade:
+label.priority=P&rioridade:
label.psname=&Nome:
label.pstype=Tipo:
label.rangeto=At\u00E9
@@ -44,33 +44,33 @@
label.topmargin=&superior
label.bottommargin=&inferior
label.leftmargin=es&querda:
-label.rightmargin=&direita
+label.rightmargin=di&reita
#
radiobutton.color=C&or
radiobutton.draftq=&Rascunho
radiobutton.duplex=&Duplex
-radiobutton.highq=Al&ta
+radiobutton.highq=&Alta
radiobutton.landscape=&Paisagem
radiobutton.monochrome=&Monocrom\u00E1tico
radiobutton.normalq=&Normal
-radiobutton.oneside=Um &Lado
+radiobutton.oneside=Um Lad&o
radiobutton.portrait=&Retrato
radiobutton.rangeall=T&udo
radiobutton.rangepages=&P\u00E1ginas
radiobutton.revlandscape=Paisagem I&nvertida
-radiobutton.revportrait=R&etrato Invertido
+radiobutton.revportrait=Retrato &Invertido
radiobutton.tumble=&Virar
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
tab.appearance=&Apar\u00EAncia
tab.general=&Geral
-tab.pagesetup=&Configura\u00E7\u00E3o de P\u00E1gina
+tab.pagesetup=Configura\u00E7\u00E3o de &P\u00E1gina
#
error.pagerange=Faixa de p\u00E1ginas inv\u00E1lida; insira novamente os valores (por exemplo, 1-3,5,7-10)
error.destination=Nome de arquivo inv\u00E1lido; tente novamente
#
# The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound
# character is replaced with 'n')
#
iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
Cassette=Cassete
Form-Source=Origem do Formul\u00E1rio
#
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by
# PrinterIsAcceptingJobs.toString()
#
accepting-jobs=Aceitando jobs
not-accepting-jobs=N\u00E3o aceitando jobs
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_sv.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -14,11 +14,11 @@
button.cancel=Avbryt
button.ok=OK
button.print=Skriv ut
-button.properties=Egenskape&r...
+button.properties=&Egenskaper...
#
-checkbox.collate=Sor&tera
-checkbox.jobsheets=F\u00F6&rs\u00E4ttsblad
-checkbox.printtofile=S&kriv ut till fil
+checkbox.collate=&Sortera
+checkbox.jobsheets=&F\u00F6rs\u00E4ttsblad
+checkbox.printtofile=Skriv ut till &fil
#
dialog.printtitle=Skriv ut
dialog.pstitle=Utskriftsformat
@@ -35,42 +35,42 @@
label.psname=&Namn:
label.pstype=Typ:
label.rangeto=Till
-label.size=St&orlek:
-label.source=&K\u00E4lla:
+label.size=Stor&lek:
+label.source=K\u00E4l&la:
label.status=Status:
label.username=A&nv\u00E4ndarnamn:
label.millimetres=(mm)
label.inches=(tum)
-label.topmargin=\u00F6ve&rkant
+label.topmargin=&\u00F6verkant
label.bottommargin=&nederkant
-label.leftmargin=&v\u00E4nster
+label.leftmargin=v&\u00E4nster
label.rightmargin=&h\u00F6ger
#
-radiobutton.color=F\u00E4r&g
-radiobutton.draftq=Ut&kast
+radiobutton.color=&F\u00E4rg
+radiobutton.draftq=Utka&st
radiobutton.duplex=&Dubbelsidig
radiobutton.highq=&H\u00F6g
radiobutton.landscape=&Liggande
radiobutton.monochrome=&Monokrom
-radiobutton.normalq=N&ormal
+radiobutton.normalq=&Normal
radiobutton.oneside=&Ensidig
-radiobutton.portrait=St\u00E5en&de
+radiobutton.portrait=&St\u00E5ende
radiobutton.rangeall=A&lla
-radiobutton.rangepages=Si&dor
+radiobutton.rangepages=Sid&or
radiobutton.revlandscape=Omv\u00E4nt li&ggande
-radiobutton.revportrait=O&mv\u00E4nt st\u00E5ende
+radiobutton.revportrait=Omv\u00E4nt st\u00E5en&de
radiobutton.tumble=&V\u00E4nd
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
tab.appearance=&Format
tab.general=&Allm\u00E4nt
-tab.pagesetup=Ut&skriftsformat
+tab.pagesetup=Utskrifts&format
#
error.pagerange=Ogiltigt sidintervall. Skriv in v\u00E4rdena igen (t ex 1-3,5,7-10)
error.destination=Ogiltigt filnamn. F\u00F6rs\u00F6k igen.
#
# The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound
# character is replaced with 'n')
#
iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
Cassette=Kassett
Form-Source=Formul\u00E4rk\u00E4lla
#
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by
# PrinterIsAcceptingJobs.toString()
#
accepting-jobs=Accepterar jobb
not-accepting-jobs=Accepterar inte jobb
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -28,16 +28,16 @@
dialog.noprintermsg=\u627E\u4E0D\u5230\u6253\u5370\u670D\u52A1\u3002
dialog.writeerror=\u65E0\u6CD5\u5199\u5165\u6587\u4EF6:
#
-label.info=\u4FE1\u606F:
+label.info=\u4FE1\u606F:
label.jobname=\u4F5C\u4E1A\u540D(&J):
label.numcopies=\u6253\u5370\u4EFD\u6570(&O):
label.priority=\u4F18\u5148\u7EA7(&R):
label.psname=\u540D\u79F0(&N):
-label.pstype=\u7C7B\u578B:
+label.pstype=\u7C7B\u578B:
label.rangeto=\u81F3
label.size=\u5927\u5C0F(&Z):
label.source=\u6765\u6E90(&C):
-label.status=\u72B6\u6001:
+label.status=\u72B6\u6001:
label.username=\u7528\u6237\u540D(&U):
label.millimetres=(\u6BEB\u7C73)
label.inches=(\u82F1\u5BF8)
@@ -70,7 +70,7 @@
error.destination=\u65E0\u6548\u7684\u6587\u4EF6\u540D; \u8BF7\u91CD\u8BD5
#
# The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound
# character is replaced with 'n')
#
iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
Cassette=\u7EB8\u76D2
Form-Source=\u8868\u683C\u6765\u6E90
#
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by
# PrinterIsAcceptingJobs.toString()
#
accepting-jobs=\u63A5\u53D7\u4F5C\u4E1A
not-accepting-jobs=\u4E0D\u63A5\u53D7\u4F5C\u4E1A
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_zh_TW.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_zh_TW.properties Wed May 01 11:34:06 2013 -0700
@@ -28,16 +28,16 @@
dialog.noprintermsg=\u627E\u4E0D\u5230\u5217\u5370\u670D\u52D9\u3002
dialog.writeerror=\u7121\u6CD5\u5BEB\u5165\u81F3\u6A94\u6848:
#
-label.info=\u8CC7\u8A0A:
+label.info=\u8CC7\u8A0A:
label.jobname=\u5DE5\u4F5C\u540D\u7A31(&J):
-label.numcopies=\u5217\u5370\u4EFD\u6578(&O):
+label.numcopies=\u5217\u5370\u4EFD\u6578(&O):
label.priority=\u512A\u5148\u6B0A(&R):
label.psname=\u540D\u7A31(&N):
-label.pstype=\u985E\u578B:
+label.pstype=\u985E\u578B:
label.rangeto=\u81F3
label.size=\u5927\u5C0F(&Z):
-label.source=\u4F86\u6E90(&C):
-label.status=\u72C0\u614B:
+label.source=\u4F86\u6E90(&C):
+label.status=\u72C0\u614B:
label.username=\u4F7F\u7528\u8005\u540D\u7A31(&U):
label.millimetres=(mm)
label.inches=(in)
@@ -70,7 +70,7 @@
error.destination=\u7121\u6548\u7684\u6A94\u540D; \u8ACB\u518D\u8A66\u4E00\u6B21
#
# The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound
# character is replaced with 'n')
#
iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
Cassette=\u5361\u5F0F\u78C1\u5E36\u6A5F
Form-Source=\u8868\u683C\u4F86\u6E90
#
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by
# PrinterIsAcceptingJobs.toString()
#
accepting-jobs=\u63A5\u53D7\u7684\u5DE5\u4F5C
not-accepting-jobs=\u4E0D\u63A5\u53D7\u7684\u5DE5\u4F5C
-
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_de.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_es.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_fr.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_it.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_it.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -24,5 +24,5 @@
# questions.
#
-rmiregistry.usage=Utilizzo: {0} <opzioni> <porta>\n\ndove <opzioni> include:\n -J<flag fase di esecuzione> Passa l''argomento all''interprete java
+rmiregistry.usage=Uso: {0} <opzioni> <porta>\n\ndove <opzioni> include:\n -J<flag fase di esecuzione> Passa l''argomento all''interprete java
rmiregistry.port.badnumber=l''argomento della porta, {0}, non \u00E8 un numero.
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_ko.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_ko.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_sv.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_zh_TW.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_zh_TW.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/rmic/resources/rmic_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/rmic/resources/rmic_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/rmic/resources/rmic_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/rmic/resources/rmic_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_de.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_es.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_fr.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_it.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_it.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@
# "rmid", "-port", "-log", "-stop", "-C" and "-J" should not be translated,
# because they are syntax
-rmid.usage=Utilizzo: {0} <opzioni>\n\ndove <opzioni> include:\n -port <porta> Specifica la porta usata da rmid\n -log <directory> Specifica la directory in cui rmid scrive il log\n -stop Arresta l''invocazione corrente di rmid (per la porta specificata)\n -C<flag fase di esecuzione> Passa l''argomento a ciascun processo figlio (gruppo di attivazione)\n -J<flag fase di esecuzione> Passa l''argomento all''interprete java\n
+rmid.usage=Uso: {0} <opzioni>\n\ndove <opzioni> include:\n -port <porta> Specifica la porta usata da rmid\n -log <directory> Specifica la directory in cui rmid scrive il log\n -stop Arresta l''invocazione corrente di rmid (per la porta specificata)\n -C<flag fase di esecuzione> Passa l''argomento a ciascun processo figlio (gruppo di attivazione)\n -J<flag fase di esecuzione> Passa l''argomento all''interprete java\n
# This means "The currently running activation daemon has been shut down,
# and is about to exit".
rmid.daemon.shutdown=daemon di attivazione terminato
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_ko.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_ko.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_sv.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_zh_TW.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_zh_TW.properties Wed May 01 11:34:06 2013 -0700
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/security/pkcs/PKCS7.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs/PKCS7.java Wed May 01 11:34:06 2013 -0700
@@ -784,6 +784,9 @@
* @param signatureAlgorithm the name of the signature algorithm
* @param tsaURI the URI of the Timestamping Authority; or null if no
* timestamp is requested
+ * @param tSAPolicyID the TSAPolicyID of the Timestamping Authority as a
+ * numerical object identifier; or null if we leave the TSA server
+ * to choose one. This argument is only used when tsaURI is provided
* @return the bytes of the encoded PKCS #7 signed data message
* @throws NoSuchAlgorithmException The exception is thrown if the signature
* algorithm is unrecognised.
@@ -798,7 +801,8 @@
X509Certificate[] signerChain,
byte[] content,
String signatureAlgorithm,
- URI tsaURI)
+ URI tsaURI,
+ String tSAPolicyID)
throws CertificateException, IOException, NoSuchAlgorithmException
{
@@ -807,7 +811,7 @@
if (tsaURI != null) {
// Timestamp the signature
HttpTimestamper tsa = new HttpTimestamper(tsaURI);
- byte[] tsToken = generateTimestampToken(tsa, signature);
+ byte[] tsToken = generateTimestampToken(tsa, tSAPolicyID, signature);
// Insert the timestamp token into the PKCS #7 signer info element
// (as an unsigned attribute)
@@ -851,14 +855,20 @@
* set to true.
*
* @param tsa the timestamping authority to use
+ * @param tSAPolicyID the TSAPolicyID of the Timestamping Authority as a
+ * numerical object identifier; or null if we leave the TSA server
+ * to choose one
* @param toBeTimestamped the token that is to be timestamped
* @return the encoded timestamp token
* @throws IOException The exception is thrown if an error occurs while
- * communicating with the TSA.
+ * communicating with the TSA, or a non-null
+ * TSAPolicyID is specified in the request but it
+ * does not match the one in the reply
* @throws CertificateException The exception is thrown if the TSA's
* certificate is not permitted for timestamping.
*/
private static byte[] generateTimestampToken(Timestamper tsa,
+ String tSAPolicyID,
byte[] toBeTimestamped)
throws IOException, CertificateException
{
@@ -868,7 +878,7 @@
try {
// SHA-1 is always used.
messageDigest = MessageDigest.getInstance("SHA-1");
- tsQuery = new TSRequest(toBeTimestamped, messageDigest);
+ tsQuery = new TSRequest(tSAPolicyID, toBeTimestamped, messageDigest);
} catch (NoSuchAlgorithmException e) {
// ignore
}
@@ -889,6 +899,12 @@
tsReply.getStatusCodeAsText() + " " +
tsReply.getFailureCodeAsText());
}
+
+ if (tSAPolicyID != null &&
+ !tSAPolicyID.equals(tsReply.getTimestampToken().getPolicyID())) {
+ throw new IOException("TSAPolicyID changed in "
+ + "timestamp token");
+ }
PKCS7 tsToken = tsReply.getToken();
TimestampToken tst = tsReply.getTimestampToken();
--- a/jdk/src/share/classes/sun/security/ssl/KerberosClientKeyExchange.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/KerberosClientKeyExchange.java Wed May 01 11:34:06 2013 -0700
@@ -86,10 +86,10 @@
public KerberosClientKeyExchange(ProtocolVersion protocolVersion,
ProtocolVersion clientVersion, SecureRandom rand,
- HandshakeInStream input, SecretKey[] serverKeys) throws IOException {
+ HandshakeInStream input, AccessControlContext acc, Object serverKeys) throws IOException {
if (impl != null) {
- init(protocolVersion, clientVersion, rand, input, serverKeys);
+ init(protocolVersion, clientVersion, rand, input, acc, serverKeys);
} else {
throw new IllegalStateException("Kerberos is unavailable");
}
@@ -126,10 +126,10 @@
public void init(ProtocolVersion protocolVersion,
ProtocolVersion clientVersion, SecureRandom rand,
- HandshakeInStream input, SecretKey[] serverKeys) throws IOException {
+ HandshakeInStream input, AccessControlContext acc, Object ServiceCreds) throws IOException {
if (impl != null) {
- impl.init(protocolVersion, clientVersion, rand, input, serverKeys);
+ impl.init(protocolVersion, clientVersion, rand, input, acc, ServiceCreds);
}
}
--- a/jdk/src/share/classes/sun/security/ssl/Krb5Helper.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/Krb5Helper.java Wed May 01 11:34:06 2013 -0700
@@ -94,18 +94,18 @@
/**
* Returns the KerberosKeys for the default server-side principal.
*/
- public static SecretKey[] getServerKeys(AccessControlContext acc)
+ public static Object getServiceCreds(AccessControlContext acc)
throws LoginException {
ensureAvailable();
- return proxy.getServerKeys(acc);
+ return proxy.getServiceCreds(acc);
}
/**
* Returns the server-side principal name associated with the KerberosKey.
*/
- public static String getServerPrincipalName(SecretKey kerberosKey) {
+ public static String getServerPrincipalName(Object serviceCreds) {
ensureAvailable();
- return proxy.getServerPrincipalName(kerberosKey);
+ return proxy.getServerPrincipalName(serviceCreds);
}
/**
@@ -124,4 +124,12 @@
ensureAvailable();
return proxy.getServicePermission(principalName, action);
}
+
+ /**
+ * Determines if the Subject might contain creds for princ.
+ */
+ public static boolean isRelated(Subject subject, Principal princ) {
+ ensureAvailable();
+ return proxy.isRelated(subject, princ);
+ }
}
--- a/jdk/src/share/classes/sun/security/ssl/Krb5Proxy.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/Krb5Proxy.java Wed May 01 11:34:06 2013 -0700
@@ -50,14 +50,14 @@
/**
- * Returns the KerberosKeys for the default server-side principal.
+ * Returns the Kerberos ServiceCreds for the default server-side principal.
*/
- SecretKey[] getServerKeys(AccessControlContext acc) throws LoginException;
+ Object getServiceCreds(AccessControlContext acc) throws LoginException;
/**
* Returns the server-side principal name associated with the KerberosKey.
*/
- String getServerPrincipalName(SecretKey kerberosKey);
+ String getServerPrincipalName(Object serviceCreds);
/**
* Returns the hostname embedded in the principal name.
@@ -68,4 +68,9 @@
* Returns a ServicePermission for the principal name and action.
*/
Permission getServicePermission(String principalName, String action);
+
+ /**
+ * Determines if the Subject might contain creds for princ.
+ */
+ boolean isRelated(Subject subject, Principal princ);
}
--- a/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java Wed May 01 11:34:06 2013 -0700
@@ -62,7 +62,7 @@
private X509Certificate[] certs;
private PrivateKey privateKey;
- private SecretKey[] kerberosKeys;
+ private Object serviceCreds;
// flag to check for clientCertificateVerify message
private boolean needClientVerify = false;
@@ -200,7 +200,8 @@
clientRequestedVersion,
sslContext.getSecureRandom(),
input,
- kerberosKeys));
+ this.getAccSE(),
+ serviceCreds));
break;
case K_DHE_RSA:
case K_DHE_DSS:
@@ -543,18 +544,15 @@
if (subject != null) {
// Eliminate dependency on KerberosPrincipal
- Set<Principal> principals =
- subject.getPrincipals(Principal.class);
- if (!principals.contains(localPrincipal)) {
+ if (Krb5Helper.isRelated(subject, localPrincipal)) {
+ if (debug != null && Debug.isOn("session"))
+ System.out.println("Subject can" +
+ " provide creds for princ");
+ } else {
resumingSession = false;
- if (debug != null && Debug.isOn("session")) {
- System.out.println("Subject identity" +
- " is not the same");
- }
- } else {
if (debug != null && Debug.isOn("session"))
- System.out.println("Subject identity" +
- " is same");
+ System.out.println("Subject cannot" +
+ " provide creds for princ");
}
} else {
resumingSession = false;
@@ -1316,49 +1314,51 @@
* @return true if successful, false if not available or invalid
*/
private boolean setupKerberosKeys() {
- if (kerberosKeys != null) {
+ if (serviceCreds != null) {
return true;
}
try {
final AccessControlContext acc = getAccSE();
- kerberosKeys = AccessController.doPrivileged(
+ serviceCreds = AccessController.doPrivileged(
// Eliminate dependency on KerberosKey
- new PrivilegedExceptionAction<SecretKey[]>() {
+ new PrivilegedExceptionAction<Object>() {
@Override
- public SecretKey[] run() throws Exception {
+ public Object run() throws Exception {
// get kerberos key for the default principal
- return Krb5Helper.getServerKeys(acc);
+ return Krb5Helper.getServiceCreds(acc);
}});
// check permission to access and use the secret key of the
// Kerberized "host" service
- if (kerberosKeys != null && kerberosKeys.length > 0) {
+ if (serviceCreds != null) {
if (debug != null && Debug.isOn("handshake")) {
- for (SecretKey k: kerberosKeys) {
- System.out.println("Using Kerberos key: " +
- k);
+ System.out.println("Using Kerberos creds");
+ }
+ String serverPrincipal =
+ Krb5Helper.getServerPrincipalName(serviceCreds);
+ if (serverPrincipal != null) {
+ // When service is bound, we check ASAP. Otherwise,
+ // will check after client request is received
+ // in in Kerberos ClientKeyExchange
+ SecurityManager sm = System.getSecurityManager();
+ try {
+ if (sm != null) {
+ // Eliminate dependency on ServicePermission
+ sm.checkPermission(Krb5Helper.getServicePermission(
+ serverPrincipal, "accept"), acc);
+ }
+ } catch (SecurityException se) {
+ serviceCreds = null;
+ // Do not destroy keys. Will affect Subject
+ if (debug != null && Debug.isOn("handshake")) {
+ System.out.println("Permission to access Kerberos"
+ + " secret key denied");
+ }
+ return false;
}
}
-
- String serverPrincipal =
- Krb5Helper.getServerPrincipalName(kerberosKeys[0]);
- SecurityManager sm = System.getSecurityManager();
- try {
- if (sm != null) {
- // Eliminate dependency on ServicePermission
- sm.checkPermission(Krb5Helper.getServicePermission(
- serverPrincipal, "accept"), acc);
- }
- } catch (SecurityException se) {
- kerberosKeys = null;
- // %%% destroy keys? or will that affect Subject?
- if (debug != null && Debug.isOn("handshake"))
- System.out.println("Permission to access Kerberos"
- + " secret key denied");
- return false;
- }
}
- return (kerberosKeys != null && kerberosKeys.length > 0);
+ return serviceCreds != null;
} catch (PrivilegedActionException e) {
// Likely exception here is LoginExceptin
if (debug != null && Debug.isOn("handshake")) {
--- a/jdk/src/share/classes/sun/security/ssl/krb5/KerberosClientKeyExchangeImpl.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/krb5/KerberosClientKeyExchangeImpl.java Wed May 01 11:34:06 2013 -0700
@@ -33,8 +33,8 @@
import java.security.PrivilegedActionException;
import java.security.SecureRandom;
import java.net.InetAddress;
+import java.security.PrivilegedAction;
-import javax.crypto.SecretKey;
import javax.security.auth.kerberos.KerberosTicket;
import javax.security.auth.kerberos.KerberosKey;
import javax.security.auth.kerberos.KerberosPrincipal;
@@ -44,18 +44,19 @@
import sun.security.krb5.EncryptionKey;
import sun.security.krb5.EncryptedData;
import sun.security.krb5.PrincipalName;
-import sun.security.krb5.Realm;
import sun.security.krb5.internal.Ticket;
import sun.security.krb5.internal.EncTicketPart;
import sun.security.krb5.internal.crypto.KeyUsage;
import sun.security.jgss.krb5.Krb5Util;
+import sun.security.jgss.krb5.ServiceCreds;
import sun.security.krb5.KrbException;
import sun.security.krb5.internal.Krb5;
import sun.security.ssl.Debug;
import sun.security.ssl.HandshakeInStream;
import sun.security.ssl.HandshakeOutStream;
+import sun.security.ssl.Krb5Helper;
import sun.security.ssl.ProtocolVersion;
/**
@@ -138,16 +139,15 @@
* @param rand random number generator used for generating random
* premaster secret if ticket and/or premaster verification fails
* @param input inputstream from which to get ASN.1-encoded KerberosWrapper
- * @param serverKey server's master secret key
+ * @param acc the AccessControlContext of the handshaker
+ * @param serviceCreds server's creds
*/
@Override
public void init(ProtocolVersion protocolVersion,
ProtocolVersion clientVersion,
- SecureRandom rand, HandshakeInStream input, SecretKey[] secretKeys)
+ SecureRandom rand, HandshakeInStream input, AccessControlContext acc, Object serviceCreds)
throws IOException {
- KerberosKey[] serverKeys = (KerberosKey[])secretKeys;
-
// Read ticket
encodedTicket = input.getBytes16();
@@ -163,9 +163,42 @@
EncryptedData encPart = t.encPart;
PrincipalName ticketSname = t.sname;
- Realm ticketRealm = t.sname.getRealm();
+
+ final ServiceCreds creds = (ServiceCreds)serviceCreds;
+ final KerberosPrincipal princ =
+ new KerberosPrincipal(ticketSname.toString());
- String serverPrincipal = serverKeys[0].getPrincipal().getName();
+ // For bound service, permission already checked at setup
+ if (creds.getName() == null) {
+ SecurityManager sm = System.getSecurityManager();
+ try {
+ if (sm != null) {
+ // Eliminate dependency on ServicePermission
+ sm.checkPermission(Krb5Helper.getServicePermission(
+ ticketSname.toString(), "accept"), acc);
+ }
+ } catch (SecurityException se) {
+ serviceCreds = null;
+ // Do not destroy keys. Will affect Subject
+ if (debug != null && Debug.isOn("handshake")) {
+ System.out.println("Permission to access Kerberos"
+ + " secret key denied");
+ }
+ throw new IOException("Kerberos service not allowedy");
+ }
+ }
+ KerberosKey[] serverKeys = AccessController.doPrivileged(
+ new PrivilegedAction<KerberosKey[]>() {
+ @Override
+ public KerberosKey[] run() {
+ return creds.getKKeys(princ);
+ }
+ });
+ if (serverKeys.length == 0) {
+ throw new IOException("Found no key for " + princ +
+ (creds.getName() == null ? "" :
+ (", this keytab is for " + creds.getName() + " only")));
+ }
/*
* permission to access and use the secret key of the Kerberized
@@ -174,17 +207,6 @@
* before promising the client
*/
- // Check that ticket Sname matches serverPrincipal
- String ticketPrinc = ticketSname.toString();
- if (!ticketPrinc.equals(serverPrincipal)) {
- if (debug != null && Debug.isOn("handshake"))
- System.out.println("Service principal in Ticket does not"
- + " match associated principal in KerberosKey");
- throw new IOException("Server principal is " +
- serverPrincipal + " but ticket is for " +
- ticketPrinc);
- }
-
// See if we have the right key to decrypt the ticket to get
// the session key.
int encPartKeyType = encPart.getEType();
@@ -198,9 +220,8 @@
}
if (dkey == null) {
// %%% Should print string repr of etype
- throw new IOException(
- "Cannot find key of appropriate type to decrypt ticket - need etype " +
- encPartKeyType);
+ throw new IOException("Cannot find key of appropriate type" +
+ " to decrypt ticket - need etype " + encPartKeyType);
}
EncryptionKey secretKey = new EncryptionKey(
@@ -222,7 +243,7 @@
sessionKey = encTicketPart.key;
if (debug != null && Debug.isOn("handshake")) {
- System.out.println("server principal: " + serverPrincipal);
+ System.out.println("server principal: " + ticketSname);
System.out.println("cname: " + encTicketPart.cname.toString());
}
} catch (IOException e) {
@@ -382,12 +403,22 @@
KerberosKey[] keys) throws KrbException {
int ktype;
boolean etypeFound = false;
+
+ // When no matched kvno is found, returns tke key of the same
+ // etype with the highest kvno
+ int kvno_found = 0;
+ KerberosKey key_found = null;
+
for (int i = 0; i < keys.length; i++) {
ktype = keys[i].getKeyType();
if (etype == ktype) {
+ int kv = keys[i].getVersionNumber();
etypeFound = true;
- if (versionMatches(version, keys[i].getVersionNumber())) {
+ if (versionMatches(version, kv)) {
return keys[i];
+ } else if (kv > kvno_found) {
+ key_found = keys[i];
+ kvno_found = kv;
}
}
}
@@ -399,18 +430,25 @@
ktype = keys[i].getKeyType();
if (ktype == EncryptedData.ETYPE_DES_CBC_CRC ||
ktype == EncryptedData.ETYPE_DES_CBC_MD5) {
+ int kv = keys[i].getVersionNumber();
etypeFound = true;
- if (versionMatches(version, keys[i].getVersionNumber())) {
+ if (versionMatches(version, kv)) {
return new KerberosKey(keys[i].getPrincipal(),
keys[i].getEncoded(),
etype,
- keys[i].getVersionNumber());
+ kv);
+ } else if (kv > kvno_found) {
+ key_found = new KerberosKey(keys[i].getPrincipal(),
+ keys[i].getEncoded(),
+ etype,
+ kv);
+ kvno_found = kv;
}
}
}
}
if (etypeFound) {
- throw new KrbException(Krb5.KRB_AP_ERR_BADKEYVER);
+ return key_found;
}
return null;
}
--- a/jdk/src/share/classes/sun/security/ssl/krb5/Krb5ProxyImpl.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/krb5/Krb5ProxyImpl.java Wed May 01 11:34:06 2013 -0700
@@ -28,9 +28,11 @@
import java.security.AccessControlContext;
import java.security.Permission;
import java.security.Principal;
+import java.util.Set;
import javax.crypto.SecretKey;
import javax.security.auth.Subject;
import javax.security.auth.kerberos.KerberosKey;
+import javax.security.auth.kerberos.KeyTab;
import javax.security.auth.kerberos.ServicePermission;
import javax.security.auth.login.LoginException;
@@ -61,17 +63,16 @@
}
@Override
- public SecretKey[] getServerKeys(AccessControlContext acc)
+ public Object getServiceCreds(AccessControlContext acc)
throws LoginException {
ServiceCreds serviceCreds =
Krb5Util.getServiceCreds(GSSCaller.CALLER_SSL_SERVER, null, acc);
- return serviceCreds != null ? serviceCreds.getKKeys() :
- new KerberosKey[0];
+ return serviceCreds;
}
@Override
- public String getServerPrincipalName(SecretKey kerberosKey) {
- return ((KerberosKey)kerberosKey).getPrincipal().getName();
+ public String getServerPrincipalName(Object serviceCreds) {
+ return ((ServiceCreds)serviceCreds).getName();
}
@Override
@@ -100,4 +101,21 @@
String action) {
return new ServicePermission(principalName, action);
}
+
+ @Override
+ public boolean isRelated(Subject subject, Principal princ) {
+ if (princ == null) return false;
+ Set<Principal> principals =
+ subject.getPrincipals(Principal.class);
+ if (principals.contains(princ)) {
+ // bound to this principal
+ return true;
+ }
+ for (KeyTab pc: subject.getPrivateCredentials(KeyTab.class)) {
+ if (!pc.isBound()) {
+ return true;
+ }
+ }
+ return false;
+ }
}
--- a/jdk/src/share/classes/sun/security/timestamp/TSRequest.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/timestamp/TSRequest.java Wed May 01 11:34:06 2013 -0700
@@ -88,9 +88,10 @@
* @param messageDigest The MessageDigest of the hash algorithm to use.
* @throws NoSuchAlgorithmException if the hash algorithm is not supported
*/
- public TSRequest(byte[] toBeTimeStamped, MessageDigest messageDigest)
+ public TSRequest(String tSAPolicyID, byte[] toBeTimeStamped, MessageDigest messageDigest)
throws NoSuchAlgorithmException {
+ this.policyId = tSAPolicyID;
this.hashAlgorithmId = AlgorithmId.get(messageDigest.getAlgorithm());
this.hashValue = messageDigest.digest(toBeTimeStamped);
}
--- a/jdk/src/share/classes/sun/security/timestamp/TimestampToken.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/timestamp/TimestampToken.java Wed May 01 11:34:06 2013 -0700
@@ -115,6 +115,10 @@
return nonce;
}
+ public String getPolicyID() {
+ return policy.toString();
+ }
+
/*
* Parses the timestamp token info.
*
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java Wed May 01 11:34:06 2013 -0700
@@ -141,6 +141,7 @@
String tsaUrl; // location of the Timestamping Authority
String tsaAlias; // alias for the Timestamping Authority's certificate
String altCertChain; // file to read alternative cert chain from
+ String tSAPolicyID;
boolean verify = false; // verify the jar
String verbose = null; // verbose output when signing/verifying
boolean showcerts = false; // show certs when verifying
@@ -331,6 +332,9 @@
} else if (collator.compare(flags, "-certchain") ==0) {
if (++n == args.length) usageNoArg();
altCertChain = args[n];
+ } else if (collator.compare(flags, "-tsapolicyid") ==0) {
+ if (++n == args.length) usageNoArg();
+ tSAPolicyID = args[n];
} else if (collator.compare(flags, "-debug") ==0) {
debug = true;
} else if (collator.compare(flags, "-keypass") ==0) {
@@ -531,6 +535,9 @@
(".tsacert.alias.public.key.certificate.for.Timestamping.Authority"));
System.out.println();
System.out.println(rb.getString
+ (".tsapolicyid.tsapolicyid.for.Timestamping.Authority"));
+ System.out.println();
+ System.out.println(rb.getString
(".altsigner.class.class.name.of.an.alternative.signing.mechanism"));
System.out.println();
System.out.println(rb.getString
@@ -1232,7 +1239,7 @@
try {
block =
sf.generateBlock(privateKey, sigalg, certChain,
- externalSF, tsaUrl, tsaCert, signingMechanism, args,
+ externalSF, tsaUrl, tsaCert, tSAPolicyID, signingMechanism, args,
zipFile);
} catch (SocketTimeoutException e) {
// Provide a helpful message when TSA is beyond a firewall
@@ -2206,13 +2213,14 @@
X509Certificate[] certChain,
boolean externalSF, String tsaUrl,
X509Certificate tsaCert,
+ String tSAPolicyID,
ContentSigner signingMechanism,
String[] args, ZipFile zipFile)
throws NoSuchAlgorithmException, InvalidKeyException, IOException,
SignatureException, CertificateException
{
return new Block(this, privateKey, sigalg, certChain, externalSF,
- tsaUrl, tsaCert, signingMechanism, args, zipFile);
+ tsaUrl, tsaCert, tSAPolicyID, signingMechanism, args, zipFile);
}
@@ -2226,7 +2234,7 @@
*/
Block(SignatureFile sfg, PrivateKey privateKey, String sigalg,
X509Certificate[] certChain, boolean externalSF, String tsaUrl,
- X509Certificate tsaCert, ContentSigner signingMechanism,
+ X509Certificate tsaCert, String tSAPolicyID, ContentSigner signingMechanism,
String[] args, ZipFile zipFile)
throws NoSuchAlgorithmException, InvalidKeyException, IOException,
SignatureException, CertificateException {
@@ -2309,7 +2317,7 @@
// Assemble parameters for the signing mechanism
ContentSignerParameters params =
- new JarSignerParameters(args, tsaUri, tsaCert, signature,
+ new JarSignerParameters(args, tsaUri, tsaCert, tSAPolicyID, signature,
signatureAlgorithm, certChain, content, zipFile);
// Generate the signature block
@@ -2353,11 +2361,13 @@
private X509Certificate[] signerCertificateChain;
private byte[] content;
private ZipFile source;
+ private String tSAPolicyID;
/**
* Create a new object.
*/
JarSignerParameters(String[] args, URI tsa, X509Certificate tsaCertificate,
+ String tSAPolicyID,
byte[] signature, String signatureAlgorithm,
X509Certificate[] signerCertificateChain, byte[] content,
ZipFile source) {
@@ -2369,6 +2379,7 @@
this.args = args;
this.tsa = tsa;
this.tsaCertificate = tsaCertificate;
+ this.tSAPolicyID = tSAPolicyID;
this.signature = signature;
this.signatureAlgorithm = signatureAlgorithm;
this.signerCertificateChain = signerCertificateChain;
@@ -2403,6 +2414,10 @@
return tsaCertificate;
}
+ public String getTSAPolicyID() {
+ return tSAPolicyID;
+ }
+
/**
* Retrieves the signature.
*
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/Resources.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Resources.java Wed May 01 11:34:06 2013 -0700
@@ -86,6 +86,8 @@
"[-tsa <url>] location of the Timestamping Authority"},
{".tsacert.alias.public.key.certificate.for.Timestamping.Authority",
"[-tsacert <alias>] public key certificate for Timestamping Authority"},
+ {".tsapolicyid.tsapolicyid.for.Timestamping.Authority",
+ "[-tsapolicyid <oid>] TSAPolicyID for Timestamping Authority"},
{".altsigner.class.class.name.of.an.alternative.signing.mechanism",
"[-altsigner <class>] class name of an alternative signing mechanism"},
{".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism",
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_ja.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_ja.java Wed May 01 11:34:06 2013 -0700
@@ -73,7 +73,7 @@
{".digestalg.algorithm.name.of.digest.algorithm",
"[-digestalg <algorithm>] \u30C0\u30A4\u30B8\u30A7\u30B9\u30C8\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"},
{".sigalg.algorithm.name.of.signature.algorithm",
- "[-sigalg <algorithm>] \u7F72\u540D\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"},
+ "[-sigalg <algorithm>] \u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"},
{".verify.verify.a.signed.JAR.file",
"[-verify] \u7F72\u540D\u4ED8\u304DJAR\u30D5\u30A1\u30A4\u30EB\u306E\u691C\u8A3C"},
{".verbose.suboptions.verbose.output.when.signing.verifying.",
@@ -91,7 +91,7 @@
{".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism",
"[-altsignerpath <pathlist>]\u4EE3\u66FF\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u306E\u4F4D\u7F6E"},
{".internalsf.include.the.SF.file.inside.the.signature.block",
- "[-internalsf] \u7F72\u540D\u30D6\u30ED\u30C3\u30AF\u306B.SF\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B"},
+ "[-internalsf] \u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30D6\u30ED\u30C3\u30AF\u306B.SF\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B"},
{".sectionsonly.don.t.compute.hash.of.entire.manifest",
"[-sectionsonly] \u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5168\u4F53\u306E\u30CF\u30C3\u30B7\u30E5\u306F\u8A08\u7B97\u3057\u306A\u3044"},
{".protected.keystore.has.protected.authentication.path",
@@ -119,7 +119,7 @@
{"i", "i"},
{".and.d.more.", "(\u4ED6\u306B\u3082%d\u500B)"},
{".s.signature.was.verified.",
- " s=\u7F72\u540D\u304C\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F "},
+ " s=\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F "},
{".m.entry.is.listed.in.manifest",
" m=\u30A8\u30F3\u30C8\u30EA\u304C\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5185\u306B\u30EA\u30B9\u30C8\u3055\u308C\u307E\u3059"},
{".k.at.least.one.certificate.was.found.in.keystore",
@@ -129,14 +129,14 @@
{".X.not.signed.by.specified.alias.es.",
" X =\u6307\u5B9A\u3057\u305F\u5225\u540D\u3067\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
{"no.manifest.", "\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002"},
- {".Signature.related.entries.","(\u7F72\u540D\u95A2\u9023\u30A8\u30F3\u30C8\u30EA)"},
+ {".Signature.related.entries.","(\u30B7\u30B0\u30CD\u30C1\u30E3\u95A2\u9023\u30A8\u30F3\u30C8\u30EA)"},
{".Unsigned.entries.", "(\u672A\u7F72\u540D\u306E\u30A8\u30F3\u30C8\u30EA)"},
{"jar.is.unsigned.signatures.missing.or.not.parsable.",
- "jar\u306F\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002(\u7F72\u540D\u304C\u898B\u3064\u304B\u3089\u306A\u3044\u304B\u3001\u69CB\u6587\u89E3\u6790\u3067\u304D\u307E\u305B\u3093)"},
+ "jar\u306F\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002(\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u898B\u3064\u304B\u3089\u306A\u3044\u304B\u3001\u69CB\u6587\u89E3\u6790\u3067\u304D\u307E\u305B\u3093)"},
{"jar.verified.", "jar\u304C\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F\u3002"},
{"jarsigner.", "jarsigner: "},
{"signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or.",
- "\u7F72\u540D\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u306B\u4F7F\u7528\u3067\u304D\u308B\u6587\u5B57\u306F\u3001A-Z\u30010-9\u3001_\u3001- \u306E\u307F\u3067\u3059\u3002"},
+ "\u30B7\u30B0\u30CD\u30C1\u30E3\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u306B\u4F7F\u7528\u3067\u304D\u308B\u6587\u5B57\u306F\u3001A-Z\u30010-9\u3001_\u3001- \u306E\u307F\u3067\u3059\u3002"},
{"unable.to.open.jar.file.", "\u6B21\u306Ejar\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304F\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093: "},
{"unable.to.create.", "\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093: "},
{".adding.", " \u8FFD\u52A0\u4E2D: "},
@@ -177,7 +177,7 @@
{"certificate.will.expire.on", "\u8A3C\u660E\u66F8\u306F{0}\u306B\u5931\u52B9\u3057\u307E\u3059"},
{".CertPath.not.validated.", "[CertPath\u304C\u691C\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093: "},
{"requesting.a.signature.timestamp",
- "\u7F72\u540D\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u306E\u30EA\u30AF\u30A8\u30B9\u30C8"},
+ "\u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u306E\u30EA\u30AF\u30A8\u30B9\u30C8"},
{"TSA.location.", "TSA\u306E\u5834\u6240: "},
{"TSA.certificate.", "TSA\u8A3C\u660E\u66F8: "},
{"no.response.from.the.Timestamping.Authority.",
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java Wed May 01 11:34:06 2013 -0700
@@ -53,9 +53,9 @@
{"If.keystore.is.not.password.protected.then.storepass.and.keypass.must.not.be.specified",
"\u5982\u679C\u5BC6\u94A5\u5E93\u672A\u53D7\u53E3\u4EE4\u4FDD\u62A4, \u5219\u4E0D\u80FD\u6307\u5B9A -storepass \u548C -keypass"},
{"Usage.jarsigner.options.jar.file.alias",
- "\u7528\u6CD5: jarsigner [\u9009\u9879] jar\u6587\u4EF6 \u522B\u540D"},
+ "\u7528\u6CD5: jarsigner [\u9009\u9879] jar \u6587\u4EF6\u522B\u540D"},
{".jarsigner.verify.options.jar.file.alias.",
- " jarsigner -verify [\u9009\u9879] jar\u6587\u4EF6 [\u522B\u540D...]"},
+ " jarsigner -verify [options] jar-file [alias...]"},
{".keystore.url.keystore.location",
"[-keystore <url>] \u5BC6\u94A5\u5E93\u4F4D\u7F6E"},
{".storepass.password.password.for.keystore.integrity",
@@ -65,7 +65,7 @@
{".keypass.password.password.for.private.key.if.different.",
"[-keypass <\u53E3\u4EE4>] \u79C1\u6709\u5BC6\u94A5\u7684\u53E3\u4EE4 (\u5982\u679C\u4E0D\u540C)"},
{".certchain.file.name.of.alternative.certchain.file",
- "[-certchain <\u6587\u4EF6>] \u66FF\u4EE3\u8BC1\u4E66\u94FE\u6587\u4EF6\u7684\u540D\u79F0"},
+ "[-certchain <file>] \u66FF\u4EE3 certchain \u6587\u4EF6\u7684\u540D\u79F0"},
{".sigfile.file.name.of.SF.DSA.file",
"[-sigfile <\u6587\u4EF6>] .SF/.DSA \u6587\u4EF6\u7684\u540D\u79F0"},
{".signedjar.file.name.of.signed.JAR.file",
@@ -77,7 +77,7 @@
{".verify.verify.a.signed.JAR.file",
"[-verify] \u9A8C\u8BC1\u5DF2\u7B7E\u540D\u7684 JAR \u6587\u4EF6"},
{".verbose.suboptions.verbose.output.when.signing.verifying.",
- "[-verbose[:\u5B50\u9009\u9879]] \u7B7E\u540D/\u9A8C\u8BC1\u65F6\u8F93\u51FA\u8BE6\u7EC6\u4FE1\u606F\u3002"},
+ "[-verbose[:suboptions]] \u7B7E\u540D/\u9A8C\u8BC1\u65F6\u8F93\u51FA\u8BE6\u7EC6\u4FE1\u606F\u3002"},
{".suboptions.can.be.all.grouped.or.summary",
" \u5B50\u9009\u9879\u53EF\u4EE5\u662F all, grouped \u6216 summary"},
{".certs.display.certificates.when.verbose.and.verifying",
@@ -106,7 +106,7 @@
"[-strict] \u5C06\u8B66\u544A\u89C6\u4E3A\u9519\u8BEF"},
{"Option.lacks.argument", "\u9009\u9879\u7F3A\u5C11\u53C2\u6570"},
{"Please.type.jarsigner.help.for.usage", "\u8BF7\u952E\u5165 jarsigner -help \u4EE5\u4E86\u89E3\u7528\u6CD5"},
- {"Please.specify.jarfile.name", "\u8BF7\u6307\u5B9A jar \u6587\u4EF6\u7684\u540D\u79F0"},
+ {"Please.specify.jarfile.name", "\u8BF7\u6307\u5B9A jarfile \u540D\u79F0"},
{"Please.specify.alias.name", "\u8BF7\u6307\u5B9A\u522B\u540D"},
{"Only.one.alias.can.be.specified", "\u53EA\u80FD\u6307\u5B9A\u4E00\u4E2A\u522B\u540D"},
{"This.jar.contains.signed.entries.which.is.not.signed.by.the.specified.alias.es.",
@@ -153,11 +153,11 @@
{"unable.to.instantiate.keystore.class.",
"\u65E0\u6CD5\u5B9E\u4F8B\u5316\u5BC6\u94A5\u5E93\u7C7B: "},
{"Certificate.chain.not.found.for.alias.alias.must.reference.a.valid.KeyStore.key.entry.containing.a.private.key.and",
- "\u627E\u4E0D\u5230{0}\u7684\u8BC1\u4E66\u94FE\u3002{1}\u5FC5\u987B\u5F15\u7528\u5305\u542B\u79C1\u6709\u5BC6\u94A5\u548C\u76F8\u5E94\u7684\u516C\u5171\u5BC6\u94A5\u8BC1\u4E66\u94FE\u7684\u6709\u6548 KeyStore \u5BC6\u94A5\u6761\u76EE\u3002"},
+ "\u627E\u4E0D\u5230{0}\u7684\u8BC1\u4E66\u94FE\u3002{1}\u5FC5\u987B\u5F15\u7528\u5305\u542B\u79C1\u6709\u5BC6\u94A5\u548C\u76F8\u5E94\u7684\u516C\u5171\u5BC6\u94A5\u8BC1\u4E66\u94FE\u7684\u6709\u6548\u5BC6\u94A5\u5E93\u5BC6\u94A5\u6761\u76EE\u3002"},
{"File.specified.by.certchain.does.not.exist",
"\u7531 -certchain \u6307\u5B9A\u7684\u6587\u4EF6\u4E0D\u5B58\u5728"},
{"Cannot.restore.certchain.from.file.specified",
- "\u65E0\u6CD5\u4ECE\u6307\u5B9A\u7684\u6587\u4EF6\u8FD8\u539F\u8BC1\u4E66\u94FE"},
+ "\u65E0\u6CD5\u4ECE\u6307\u5B9A\u7684\u6587\u4EF6\u8FD8\u539F certchain"},
{"Certificate.chain.not.found.in.the.file.specified.",
"\u5728\u6307\u5B9A\u7684\u6587\u4EF6\u4E2D\u627E\u4E0D\u5230\u8BC1\u4E66\u94FE\u3002"},
{"found.non.X.509.certificate.in.signer.s.chain",
@@ -184,7 +184,7 @@
"\u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u6CA1\u6709\u54CD\u5E94\u3002\u5982\u679C\u8981\u4ECE\u9632\u706B\u5899\u540E\u9762\u8FDE\u63A5, \u5219\u53EF\u80FD\u9700\u8981\u6307\u5B9A HTTP \u6216 HTTPS \u4EE3\u7406\u3002\u8BF7\u4E3A jarsigner \u63D0\u4F9B\u4EE5\u4E0B\u9009\u9879: "},
{"or", "\u6216"},
{"Certificate.not.found.for.alias.alias.must.reference.a.valid.KeyStore.entry.containing.an.X.509.public.key.certificate.for.the",
- "\u627E\u4E0D\u5230{0}\u7684\u8BC1\u4E66\u3002{1}\u5FC5\u987B\u5F15\u7528\u5305\u542B\u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684 X.509 \u516C\u5171\u5BC6\u94A5\u8BC1\u4E66\u7684\u6709\u6548 KeyStore \u6761\u76EE\u3002"},
+ "\u627E\u4E0D\u5230{0}\u7684\u8BC1\u4E66\u3002{1}\u5FC5\u987B\u5F15\u7528\u5305\u542B\u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684 X.509 \u516C\u5171\u5BC6\u94A5\u8BC1\u4E66\u7684\u6709\u6548\u5BC6\u94A5\u5E93\u6761\u76EE\u3002"},
{"using.an.alternative.signing.mechanism",
"\u6B63\u5728\u4F7F\u7528\u66FF\u4EE3\u7684\u7B7E\u540D\u673A\u5236"},
{"entry.was.signed.on", "\u6761\u76EE\u7684\u7B7E\u540D\u65E5\u671F\u4E3A {0}"},
@@ -229,7 +229,6 @@
{"Cannot.find.environment.variable.",
"\u627E\u4E0D\u5230\u73AF\u5883\u53D8\u91CF: "},
{"Cannot.find.file.", "\u627E\u4E0D\u5230\u6587\u4EF6: "},
- {"Command.option.flag.needs.an.argument.", "\u547D\u4EE4\u9009\u9879{0}\u9700\u8981\u4E00\u4E2A\u53C2\u6570\u3002"},
};
/**
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java Wed May 01 11:34:06 2013 -0700
@@ -133,7 +133,8 @@
}
}
return PKCS7.generateSignedData(signature, signerChain, content,
- params.getSignatureAlgorithm(), tsaURI);
+ params.getSignatureAlgorithm(), tsaURI,
+ params.getTSAPolicyID());
}
/**
--- a/jdk/src/share/classes/sun/security/util/AuthResources_pt_BR.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/util/AuthResources_pt_BR.java Wed May 01 11:34:06 2013 -0700
@@ -99,7 +99,7 @@
/*** EVERYTHING BELOW IS DEPRECATED ***/
// com.sun.security.auth.PolicyFile
- {".error.parsing.", ": erro de parse "},
+ {".error.parsing.", ": erro de parsing "},
{"COLON", ": "},
{".error.adding.Permission.", ": erro ao adicionar a Permiss\u00E3o "},
{"SPACE", " "},
--- a/jdk/src/share/classes/sun/security/util/AuthResources_zh_TW.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/util/AuthResources_zh_TW.java Wed May 01 11:34:06 2013 -0700
@@ -94,7 +94,7 @@
{"Kerberos.username.defUsername.",
"Kerberos \u4F7F\u7528\u8005\u540D\u7A31 [{0}]: "},
{"Kerberos.password.for.username.",
- "Kerberos \u5BC6\u78BC [{0}]: "},
+ "Kerberos \u5BC6\u78BC {0}: "},
/*** EVERYTHING BELOW IS DEPRECATED ***/
--- a/jdk/src/share/classes/sun/security/util/Resources_es.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/util/Resources_es.java Wed May 01 11:34:06 2013 -0700
@@ -146,7 +146,7 @@
// sun.security.pkcs11.SunPKCS11
{"PKCS11.Token.providerName.Password.",
- "Contrase\u00F1a del Elemento PKCS11 [{0}]: "},
+ "Contrase\u00F1a del Token PKCS11 [{0}]: "},
/* --- DEPRECATED --- */
// javax.security.auth.Policy
--- a/jdk/src/share/classes/sun/security/util/Resources_pt_BR.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/security/util/Resources_pt_BR.java Wed May 01 11:34:06 2013 -0700
@@ -105,7 +105,7 @@
// sun.security.provider.PolicyFile
{"java.security.policy.error.parsing.policy.message",
- "java.security.policy: erro durante o parse de {0}:\n\t{1}"},
+ "java.security.policy: erro durante o parsing de {0}:\n\t{1}"},
{"java.security.policy.error.adding.Permission.perm.message",
"java.security.policy: erro ao adicionar a permiss\u00E3o, {0}:\n\t{1}"},
{"java.security.policy.error.adding.Entry.message",
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_de.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_de.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -39,9 +39,9 @@
out.adding={0} wird hinzugef\u00FCgt
out.deflated=({0} % verkleinert)
out.stored=(0 % gespeichert)
-out.create=\ \ erstellt: {0}
+out.create=\ erstellt: {0}
out.extracted=extrahiert: {0}
out.inflated=\ \\vergr\u00F6\u00DFert: {0}
out.size=(ein = {0}) (aus = {1})
-usage=Verwendung: jar-Dateien {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] ...\nOptionen:\n\ \ -c Neues Archiv erstellen\n\ \ -t Inhaltsverzeichnis f\u00FCr Archiv auflisten\n\ \ -x Genannte (oder alle) Dateien aus Archiv extrahieren\n\ \ -u Vorhandenes Archiv aktualisieren\n\ \ -v Verbose-Ausgabe f\u00FCr Standardausgabe generieren\n\ \ -f Namen der Archivdatei angeben\n\ \ -m Manifest-Informationen von angegebener Manifest-Datei einschlie\u00DFen\n\ \ -e Anwendungs-Einstiegspunkt f\u00FCr die \n\ \ in einer ausf\u00FChrbaren JAR-Datei geb\u00FCndelte Standalone-Anwendung angeben\n\ \ -0 Nur speichern (keine ZIP-Komprimierung)\n\ \ -M Keine Manifest-Datei f\u00FCr die Eintr\u00E4ge erstellen\n\ \ -i Indexinformationen f\u00FCr angegebenen JAR-Dateien erstellen\n\ \ -C zum angegebenen Verzeichnis wechseln und folgende Datei einschlie\u00DFen\nFalls eine Datei ein Verzeichnis ist, wird dieses rekursiv verarbeitet.\nDer Name der Manifest-Datei, der Name der Archivdatei und der Name des Einstiegspunkts werden\nin derselben Reihenfolge wie die Kennzeichen "m", "f" und "e" angegeben.\n\nBeispiel 1: Archivieren Sie zwei Klassendateien in ein Archiv mit Namen "classes.jar": \n\ \ jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Verwenden Sie die vorhandenen Manifest-Datei "mymanifest", und archivieren Sie\n\ \ alle Dateien im Verzeichnis foo/ in "classes.jar": \n\ \ jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Verwendung: jar-Dateien {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] ...\nOptionen:\n -c Neues Archiv erstellen\n -t Inhaltsverzeichnis f\u00FCr Archiv auflisten\n -x Genannte (oder alle) Dateien aus Archiv extrahieren\n -u Vorhandenes Archiv aktualisieren\n -v Verbose-Ausgabe f\u00FCr Standardausgabe generieren\n -f Namen der Archivdatei angeben\n -m Manifest-Informationen von angegebener Manifest-Datei einschlie\u00DFen\n -e Anwendungs-Einstiegspunkt f\u00FCr die \n in einer ausf\u00FChrbaren JAR-Datei geb\u00FCndelte Standalone-Anwendung angeben\n -0 Nur speichern (keine ZIP-Komprimierung)\n -M Keine Manifest-Datei f\u00FCr die Eintr\u00E4ge erstellen\n -i Indexinformationen f\u00FCr angegebenen JAR-Dateien erstellen\n -C zum angegebenen Verzeichnis wechseln und folgende Datei einschlie\u00DFen\nFalls eine Datei ein Verzeichnis ist, wird dieses rekursiv verarbeitet.\nDer Name der Manifest-Datei, der Name der Archivdatei und der Name des Einstiegspunkts werden\nin derselben Reihenfolge wie die Kennzeichen "m", "f" und "e" angegeben.\n\nBeispiel 1: Archivieren Sie zwei Klassendateien in ein Archiv mit Namen "classes.jar": \n jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Verwenden Sie die vorhandenen Manifest-Datei "mymanifest", und archivieren Sie\n alle Dateien im Verzeichnis foo/ in "classes.jar": \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_es.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_es.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -39,9 +39,9 @@
out.adding=agregando: {0}
out.deflated=(desinflado {0}%)
out.stored=(almacenado 0%)
-out.create=\ \ creado: {0}
+out.create=\ creado: {0}
out.extracted=extra\u00EDdo: {0}
out.inflated=\ \\inflado: {0}
out.size=(entrada = {0}) (salida = {1})
-usage=Sintaxis: jar {ctxui}[vfm0Me] [archive-jar] [archive-manifiesto] [punto-entrada] [-C dir] archivos...\nOpciones:\n\ \ -c crear nuevo archivo\n\ \ -t crear la tabla de contenido del archivo\n\ \ -x extraer el archive mencionado (o todos) del archivo\n\ \ -u actualizar archive existente\n\ \ -v generar salida detallada de los datos de salida est\u00E1ndar\n\ \ -f especificar nombre de archive de almacenamiento\n\ \ -m incluir informaci\u00F3n de manifiesto del archive de manifiesto especificado\n\ \ -e especificar punto de entrada de la aplicaci\u00F3n para la aplicaci\u00F3n aut\u00F3noma \n\ \ que se incluye dentro de un archive jar ejecutable\n\ \ -0 s\u00F3lo almacenar; no utilizar compresi\u00F3n ZIP\n\ \ -M no crear un archive de manifiesto para las entradas\n\ \ -i generar informaci\u00F3n de \u00EDndice para los archives jar especificados\n\ \ -C cambiar al directorio especificado e incluir el archivo siguiente\nSi alg\u00FAn archivo es un directorio, se procesar\u00E1 de forma recurrente.\nEl nombre del archivo de manifiesto, el nombre del archivo de almacenamiento y el nombre del punto de entrada se\nespecifican en el mismo orden que los indicadores 'm', 'f' y 'e'.\n\nEjemplo 1: para archivar archivos de dos clases en un archivo llamado classes.jar: \n\ \ jar cvf classes.jar Foo.class Bar.class \nEjemplo 2: utilice un archivo de manifiesto existente 'mymanifest' y archive todos los\n\ \ archivos del directorio foo/ en 'classes.jar': \n\ \ jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Sintaxis: jar {ctxui}[vfm0Me] [archive-jar] [archive-manifiesto] [punto-entrada] [-C dir] archivos...\nOpciones:\n -c crear nuevo archivo\n -t crear la tabla de contenido del archivo\n -x extraer el archive mencionado (o todos) del archivo\n -u actualizar archive existente\n -v generar salida detallada de los datos de salida est\u00E1ndar\n -f especificar nombre de archive de almacenamiento\n -m incluir informaci\u00F3n de manifiesto del archive de manifiesto especificado\n -e especificar punto de entrada de la aplicaci\u00F3n para la aplicaci\u00F3n aut\u00F3noma \n que se incluye dentro de un archive jar ejecutable\n -0 s\u00F3lo almacenar; no utilizar compresi\u00F3n ZIP\n -M no crear un archive de manifiesto para las entradas\n -i generar informaci\u00F3n de \u00EDndice para los archives jar especificados\n -C cambiar al directorio especificado e incluir el archivo siguiente\nSi alg\u00FAn archivo es un directorio, se procesar\u00E1 de forma recurrente.\nEl nombre del archivo de manifiesto, el nombre del archivo de almacenamiento y el nombre del punto de entrada se\nespecifican en el mismo orden que los indicadores 'm', 'f' y 'e'.\n\nEjemplo 1: para archivar archivos de dos clases en un archivo llamado classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nEjemplo 2: utilice un archivo de manifiesto existente 'mymanifest' y archive todos los\n archivos del directorio foo/ en 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_fr.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_fr.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -39,9 +39,9 @@
out.adding=ajout : {0}
out.deflated=(compression : {0} %)
out.stored=(stockage : 0 %)
-out.create=\ \ cr\u00E9\u00E9 : {0}
+out.create=\ cr\u00E9\u00E9 : {0}
out.extracted=extrait : {0}
out.inflated=\ \\d\u00E9compress\u00E9 : {0}
out.size=(entr\u00E9e = {0}) (sortie = {1})
-usage=Syntaxe : jar {ctxui}[vfm0Me] [fichier-jar] [fichier-manifeste] [point-entr\u00E9e] [-C r\u00E9p] fichiers...\nOptions :\n\ \ -c cr\u00E9e une archive\n\ \ -t affiche la table des mati\u00E8res de l'archive\n\ \ -x extrait les fichiers nomm\u00E9s (ou tous les fichiers) de l'archive\n\ \ -u met \u00E0 jour l'archive existante\n\ \ -v g\u00E9n\u00E8re une version d\u00E9taill\u00E9e d'une sortie standard\n\ \ -f sp\u00E9cifie le nom du fichier archive\n\ \ -m inclut les informations de manifeste \u00E0 partir du fichier de manifeste sp\u00E9cifi\u00E9\n\ \ -e sp\u00E9cifie le point d'entr\u00E9e d'une application en mode autonome \n\ \ int\u00E9gr\u00E9e \u00E0 un fichier JAR ex\u00E9cutable\n\ \ -0 stockage uniquement, pas de compression ZIP\n\ \ -M ne cr\u00E9e pas de fichier manifeste pour les entr\u00E9es\n\ \ -i g\u00E9n\u00E8re les informations d'index des fichiers JAR sp\u00E9cifi\u00E9s\n\ \ -C passe au r\u00E9pertoire sp\u00E9cifi\u00E9 et inclut le fichier suivant\nSi l'un des fichiers est un r\u00E9pertoire, celui-ci est trait\u00E9 r\u00E9cursivement.\nLes noms du fichier manifeste, du fichier archive et du point d'entr\u00E9e sont\nsp\u00E9cifi\u00E9s dans le m\u00EAme ordre que celui des indicateurs m, f et e.\n\nExemple 1 : pour archiver deux fichiers de classe dans une archive intitul\u00E9e classes.jar : \n\ \ jar cvf classes.jar Foo.class Bar.class \nExemple 2 : pour utiliser un fichier manifeste existant 'monmanifeste', puis archiver tous les\n\ \ fichiers du r\u00E9pertoire foo/ dans 'classes.jar' : \n\ \ jar cvfm classes.jar monmanifeste -C foo/ .\n
+usage=Syntaxe : jar {ctxui}[vfm0Me] [fichier-jar] [fichier-manifeste] [point-entr\u00E9e] [-C r\u00E9p] fichiers...\nOptions :\n -c cr\u00E9e une archive\n -t affiche la table des mati\u00E8res de l'archive\n -x extrait les fichiers nomm\u00E9s (ou tous les fichiers) de l'archive\n -u met \u00E0 jour l'archive existante\n -v g\u00E9n\u00E8re une version d\u00E9taill\u00E9e d'une sortie standard\n -f sp\u00E9cifie le nom du fichier archive\n -m inclut les informations de manifeste \u00E0 partir du fichier de manifeste sp\u00E9cifi\u00E9\n -e sp\u00E9cifie le point d'entr\u00E9e d'une application en mode autonome \n int\u00E9gr\u00E9e \u00E0 un fichier JAR ex\u00E9cutable\n -0 stockage uniquement, pas de compression ZIP\n -M ne cr\u00E9e pas de fichier manifeste pour les entr\u00E9es\n -i g\u00E9n\u00E8re les informations d'index des fichiers JAR sp\u00E9cifi\u00E9s\n -C passe au r\u00E9pertoire sp\u00E9cifi\u00E9 et inclut le fichier suivant\nSi l'un des fichiers est un r\u00E9pertoire, celui-ci est trait\u00E9 r\u00E9cursivement.\nLes noms du fichier manifeste, du fichier archive et du point d'entr\u00E9e sont\nsp\u00E9cifi\u00E9s dans le m\u00EAme ordre que celui des indicateurs m, f et e.\n\nExemple 1 : pour archiver deux fichiers de classe dans une archive intitul\u00E9e classes.jar : \n jar cvf classes.jar Foo.class Bar.class \nExemple 2 : pour utiliser un fichier manifeste existant 'monmanifeste', puis archiver tous les\n fichiers du r\u00E9pertoire foo/ dans 'classes.jar' : \n jar cvfm classes.jar monmanifeste -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_it.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_it.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -39,9 +39,9 @@
out.adding=aggiunta in corso di: {0}
out.deflated=(compresso {0}%)
out.stored=(memorizzato 0%)
-out.create=\ \ \ \ \ creato: {0}
+out.create=\ creato: {0}
out.extracted=estratto: {0}
out.inflated=\ \\decompresso: {0}
out.size=(in = {0}) (out = {1})
-usage=Utilizzo: jar {ctxui}[vfm0Me] [file-jar] [file-manifest] [punto di ingresso] [-C dir] file ...\nOpzioni:\n\ \ -c crea un nuovo archivio\n\ \ -t visualizza l'indice dell'archivio\n\ \ -x estrae i file con nome (o tutti i file) dall'archivio\n\ \ -u aggiorna l'archivio esistente\n\ \ -v genera output commentato dall'output standard\n\ \ -f specifica il nome file dell'archivio\n\ \ -m include informazioni manifest dal file manifest specificato\n\ \ -e specifica il punto di ingresso per l'applicazione stand-alone \n\ \ inclusa nel file jar eseguibile\n\ \ -0 solo memorizzazione; senza compressione ZIP\n\ \ -M consente di non creare un file manifest per le voci\n\ \ -i genera informazioni sull'indice per i file jar specificati\n\ \ -C imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n\ \ jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n\ \ file della directory foo/ in 'classes.jar': \n\ \ jar cvfm classes.jar mymanifest -C foo/.\n
+usage=Uso: jar {ctxui}[vfm0Me] [file-jar] [file-manifest] [punto di ingresso] [-C dir] file ...\nOpzioni:\n -c crea un nuovo archivio\n -t visualizza l'indice dell'archivio\n -x estrae i file con nome (o tutti i file) dall'archivio\n -u aggiorna l'archivio esistente\n -v genera output commentato dall'output standard\n -f specifica il nome file dell'archivio\n -m include informazioni manifest dal file manifest specificato\n -e specifica il punto di ingresso per l'applicazione stand-alone \n inclusa nel file jar eseguibile\n -0 solo memorizzazione; senza compressione ZIP\n -M consente di non creare un file manifest per le voci\n -i genera informazioni sull'indice per i file jar specificati\n -C imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n file della directory foo/ in 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/.\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -39,9 +39,9 @@
out.adding={0}\u3092\u8FFD\u52A0\u4E2D\u3067\u3059
out.deflated=({0}%\u53CE\u7E2E\u3055\u308C\u307E\u3057\u305F)
out.stored=(0%\u683C\u7D0D\u3055\u308C\u307E\u3057\u305F)
-out.create=\ \ {0}\u304C\u4F5C\u6210\u3055\u308C\u307E\u3057\u305F
+out.create=\ {0}\u304C\u4F5C\u6210\u3055\u308C\u307E\u3057\u305F
out.extracted={0}\u304C\u62BD\u51FA\u3055\u308C\u307E\u3057\u305F
out.inflated=\ \\{0}\u304C\u5C55\u958B\u3055\u308C\u307E\u3057\u305F
out.size=(\u5165={0})(\u51FA={1})
-usage=\u4F7F\u7528\u65B9\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n\\ -c \u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B\n\\ -t \u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u5185\u5BB9\u3092\u4E00\u89A7\u8868\u793A\u3059\u308B\n\\ -x \u6307\u5B9A\u306E(\u307E\u305F\u306F\u3059\u3079\u3066\u306E)\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u62BD\u51FA\u3059\u308B\n\\ -u \u65E2\u5B58\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u66F4\u65B0\u3059\u308B\n\\ -v \u6A19\u6E96\u51FA\u529B\u306B\u8A73\u7D30\u306A\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n\\ -f \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3059\u308B\n\\ -m \u6307\u5B9A\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u60C5\u5831\u3092\u53D6\u308A\u8FBC\u3080\n\\ -e \u5B9F\u884C\u53EF\u80FDjar\u30D5\u30A1\u30A4\u30EB\u306B\u30D0\u30F3\u30C9\u30EB\u3055\u308C\u305F\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\n\\ \u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u3092\u6307\u5B9A\u3059\u308B\n\\ -0 \u683C\u7D0D\u306E\u307F\u3002ZIP\u5727\u7E2E\u3092\u4F7F\u7528\u3057\u306A\u3044\n\\ -M \u30A8\u30F3\u30C8\u30EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u306A\u3044\n\\ -i \u6307\u5B9A\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306E\u7D22\u5F15\u60C5\u5831\u3092\u751F\u6210\u3059\u308B\n\\ -C \u6307\u5B9A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u5909\u66F4\u3057\u3001\u4EE5\u4E0B\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u308A\u8FBC\u3080\n\u30D5\u30A1\u30A4\u30EB\u304C\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u5834\u5408\u306F\u518D\u5E30\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\n\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u304A\u3088\u3073\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u540D\u306F\u3001\n\u30D5\u30E9\u30B0'm'\u3001'f'\u3001'e'\u306E\u6307\u5B9A\u3068\u540C\u3058\u9806\u756A\u3067\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\n\u4F8B1: 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6classes.jar\u306B\u4FDD\u5B58\u3059\u308B:\n\\ jar cvf classes.jar Foo.class Bar.class\n\u4F8B2: \u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB'mymanifest'\u3092\u4F7F\u7528\u3057\u3001foo/\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\n\\ \u5168\u30D5\u30A1\u30A4\u30EB\u3092'classes.jar'\u306B\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B:\n\\ jar cvfm classes.jar mymanifest -C foo/ \n
+usage=\u4F7F\u7528\u65B9\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n -c \u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B\n -t \u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u5185\u5BB9\u3092\u4E00\u89A7\u8868\u793A\u3059\u308B\n -x \u6307\u5B9A\u306E(\u307E\u305F\u306F\u3059\u3079\u3066\u306E)\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u62BD\u51FA\u3059\u308B\n -u \u65E2\u5B58\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u66F4\u65B0\u3059\u308B\n -v \u6A19\u6E96\u51FA\u529B\u306B\u8A73\u7D30\u306A\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n -f \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3059\u308B\n -m \u6307\u5B9A\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u60C5\u5831\u3092\u53D6\u308A\u8FBC\u3080\n -e \u5B9F\u884C\u53EF\u80FDjar\u30D5\u30A1\u30A4\u30EB\u306B\u30D0\u30F3\u30C9\u30EB\u3055\u308C\u305F\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\n \u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u3092\u6307\u5B9A\u3059\u308B\n -0 \u683C\u7D0D\u306E\u307F\u3002ZIP\u5727\u7E2E\u3092\u4F7F\u7528\u3057\u306A\u3044\n -M \u30A8\u30F3\u30C8\u30EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u306A\u3044\n -i \u6307\u5B9A\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306E\u7D22\u5F15\u60C5\u5831\u3092\u751F\u6210\u3059\u308B\n -C \u6307\u5B9A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u5909\u66F4\u3057\u3001\u4EE5\u4E0B\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u308A\u8FBC\u3080\n\u30D5\u30A1\u30A4\u30EB\u304C\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u5834\u5408\u306F\u518D\u5E30\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\n\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u304A\u3088\u3073\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u540D\u306F\u3001\n\u30D5\u30E9\u30B0'm'\u3001'f'\u3001'e'\u306E\u6307\u5B9A\u3068\u540C\u3058\u9806\u756A\u3067\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\n\u4F8B1: 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6classes.jar\u306B\u4FDD\u5B58\u3059\u308B:\n jar cvf classes.jar Foo.class Bar.class\n\u4F8B2: \u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB'mymanifest'\u3092\u4F7F\u7528\u3057\u3001foo/\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\n \u5168\u30D5\u30A1\u30A4\u30EB\u3092'classes.jar'\u306B\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B:\n jar cvfm classes.jar mymanifest -C foo/ \n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_ko.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_ko.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -39,9 +39,9 @@
out.adding=\uCD94\uAC00\uD558\uB294 \uC911: {0}
out.deflated=({0}%\uB97C \uAC10\uC18C\uD568)
out.stored=(0%\uB97C \uC800\uC7A5\uD568)
-out.create=\ \ \uC0DD\uC131\uB428: {0}
+out.create=\ \uC0DD\uC131\uB428: {0}
out.extracted=\uCD94\uCD9C\uB428: {0}
out.inflated=\ \\\uC99D\uAC00\uB428: {0}
out.size=(\uC785\uB825 = {0}) (\uCD9C\uB825 = {1})
-usage=\uC0AC\uC6A9\uBC95: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\uC635\uC158:\n\ \ -c \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ -t \uC544\uCE74\uC774\uBE0C\uC5D0 \uB300\uD55C \uBAA9\uCC28\uB97C \uB098\uC5F4\uD569\uB2C8\uB2E4.\n\ \ -x \uBA85\uBA85\uB41C(\uB610\uB294 \uBAA8\uB4E0) \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uC5D0\uC11C \uCD94\uCD9C\uD569\uB2C8\uB2E4.\n\ \ -u \uAE30\uC874 \uC544\uCE74\uC774\uBE0C\uB97C \uAC31\uC2E0\uD569\uB2C8\uB2E4.\n\ \ -v \uD45C\uC900 \uCD9C\uB825\uC5D0 \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ -f \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ -m \uC9C0\uC815\uB41C Manifest \uD30C\uC77C\uC758 Manifest \uC815\uBCF4\uB97C \uD3EC\uD568\uD569\uB2C8\uB2E4.\n\ \ -e jar \uC2E4\uD589 \uD30C\uC77C\uC5D0 \uBC88\uB4E4\uB85C \uC81C\uACF5\uB41C \uB3C5\uB9BD\uD615 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8\uC758 \n\ \ \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uC2DC\uC791 \uC9C0\uC810\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ -0 \uC800\uC7A5 \uC804\uC6A9: ZIP \uC555\uCD95\uC744 \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n\ \ -M \uD56D\uBAA9\uC5D0 \uB300\uD574 Manifest \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n\ \ -i \uC9C0\uC815\uB41C jar \uD30C\uC77C\uC5D0 \uB300\uD55C \uC778\uB371\uC2A4 \uC815\uBCF4\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ -C \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uB85C \uBCC0\uACBD\uD558\uACE0 \uB2E4\uC74C \uD30C\uC77C\uC744 \uD3EC\uD568\uD569\uB2C8\uB2E4.\n\uD2B9\uC815 \uD30C\uC77C\uC774 \uB514\uB809\uD1A0\uB9AC\uC77C \uACBD\uC6B0 \uC21C\uD658\uC801\uC73C\uB85C \uCC98\uB9AC\uB429\uB2C8\uB2E4.\nManifest \uD30C\uC77C \uC774\uB984, \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984 \uBC0F \uC2DC\uC791 \uC9C0\uC810 \uC774\uB984\uC740\n'm', 'f' \uBC0F 'e' \uD50C\uB798\uADF8\uC640 \uB3D9\uC77C\uD55C \uC21C\uC11C\uB85C \uC9C0\uC815\uB429\uB2C8\uB2E4.\n\n\uC608 1: classes.jar\uB77C\uB294 \uC544\uCE74\uC774\uBE0C\uC5D0 \uB450 \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n\ \ jar cvf classes.jar Foo.class Bar.class \n\uC608 2: \uAE30\uC874 Manifest \uD30C\uC77C 'mymanifest'\uB97C \uC0AC\uC6A9\uD558\uC5EC\n\ \ foo/ \uB514\uB809\uD1A0\uB9AC\uC758 \uBAA8\uB4E0 \uD30C\uC77C\uC744 'classes.jar'\uB85C \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n\ \ jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=\uC0AC\uC6A9\uBC95: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\uC635\uC158:\n -c \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n -t \uC544\uCE74\uC774\uBE0C\uC5D0 \uB300\uD55C \uBAA9\uCC28\uB97C \uB098\uC5F4\uD569\uB2C8\uB2E4.\n -x \uBA85\uBA85\uB41C(\uB610\uB294 \uBAA8\uB4E0) \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uC5D0\uC11C \uCD94\uCD9C\uD569\uB2C8\uB2E4.\n -u \uAE30\uC874 \uC544\uCE74\uC774\uBE0C\uB97C \uAC31\uC2E0\uD569\uB2C8\uB2E4.\n -v \uD45C\uC900 \uCD9C\uB825\uC5D0 \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n -f \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n -m \uC9C0\uC815\uB41C Manifest \uD30C\uC77C\uC758 Manifest \uC815\uBCF4\uB97C \uD3EC\uD568\uD569\uB2C8\uB2E4.\n -e jar \uC2E4\uD589 \uD30C\uC77C\uC5D0 \uBC88\uB4E4\uB85C \uC81C\uACF5\uB41C \uB3C5\uB9BD\uD615 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8\uC758 \n \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uC2DC\uC791 \uC9C0\uC810\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n -0 \uC800\uC7A5 \uC804\uC6A9: ZIP \uC555\uCD95\uC744 \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n -M \uD56D\uBAA9\uC5D0 \uB300\uD574 Manifest \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n -i \uC9C0\uC815\uB41C jar \uD30C\uC77C\uC5D0 \uB300\uD55C \uC778\uB371\uC2A4 \uC815\uBCF4\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n -C \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uB85C \uBCC0\uACBD\uD558\uACE0 \uB2E4\uC74C \uD30C\uC77C\uC744 \uD3EC\uD568\uD569\uB2C8\uB2E4.\n\uD2B9\uC815 \uD30C\uC77C\uC774 \uB514\uB809\uD1A0\uB9AC\uC77C \uACBD\uC6B0 \uC21C\uD658\uC801\uC73C\uB85C \uCC98\uB9AC\uB429\uB2C8\uB2E4.\nManifest \uD30C\uC77C \uC774\uB984, \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984 \uBC0F \uC2DC\uC791 \uC9C0\uC810 \uC774\uB984\uC740\n'm', 'f' \uBC0F 'e' \uD50C\uB798\uADF8\uC640 \uB3D9\uC77C\uD55C \uC21C\uC11C\uB85C \uC9C0\uC815\uB429\uB2C8\uB2E4.\n\n\uC608 1: classes.jar\uB77C\uB294 \uC544\uCE74\uC774\uBE0C\uC5D0 \uB450 \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n jar cvf classes.jar Foo.class Bar.class \n\uC608 2: \uAE30\uC874 Manifest \uD30C\uC77C 'mymanifest'\uB97C \uC0AC\uC6A9\uD558\uC5EC\n foo/ \uB514\uB809\uD1A0\uB9AC\uC758 \uBAA8\uB4E0 \uD30C\uC77C\uC744 'classes.jar'\uB85C \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_pt_BR.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_pt_BR.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -39,9 +39,9 @@
out.adding=adicionando: {0}
out.deflated=(vazio {0}%)
out.stored=(armazenado 0%)
-out.create=\ \ criado: {0}
+out.create=\ criado: {0}
out.extracted=extra\u00EDdo: {0}
out.inflated=\ \\cheio: {0}
out.size=(dentro = {0}) (fora= {1})
-usage=Uso: arquivos jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] ...\nOp\u00E7\u00F5es:\n\ \ -c cria novo arquivo compactado\n\ \ -t lista o sum\u00E1rio do arquivo compactado\n\ \ -x extrai arquivos com o nome (ou todos) do arquivo compactado\n\ \ -u atualizar o arquivo compactado existente\n\ \ -v gera sa\u00EDda detalhada na sa\u00EDda padr\u00E3o\n\ \ -f especifica o nome do arquivo do arquivo compactado\n\ \ -m inclui as informa\u00E7\u00F5es do manifesto do arquivo de manifesto especificado\n\ \ -e especifica o ponto de entrada da aplica\u00E7\u00E3o para aplica\u00E7\u00E3o independente \n\ \ empacotando em um arquivo jar execut\u00E1vel\n\ \ -0 armazena somente; n\u00E3o usa compacta\u00E7\u00E3o ZIP\n\ \ -M n\u00E3o cria um arquivo de manifesto para as entradas\n\ \ -i gera informa\u00E7\u00F5es de \u00EDndice para os arquivos especificados\n\ \ -C altera para o diret\u00F3rio e inclui o arquivo seguinte\nSe nenhum arquivo for um diret\u00F3rio, ent\u00E3o ser\u00E1 processado repetidamente.\nO nome do arquivo de manifesto, o nome do arquivo compactado e o nome do ponto de entrada s\u00E3o\nespecificados na mesma ordem dos flags 'm', 'f' e 'e'.\n\nExemplo 1: para arquivar dois arquivos de classe em um arquivo compactado com o nome classes.jar: \n\ \ jar cvf classes.jar Foo.class Bar.class \nExemplo 2: use um arquivo de manifesto existente 'mymanifest' e arquive todos os\n\ \ arquivos no diret\u00F3rio foo/ na 'classes.jar': \n\ \ jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Uso: arquivos jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] ...\nOp\u00E7\u00F5es:\n -c cria novo arquivo compactado\n -t lista o sum\u00E1rio do arquivo compactado\n -x extrai arquivos com o nome (ou todos) do arquivo compactado\n -u atualizar o arquivo compactado existente\n -v gera sa\u00EDda detalhada na sa\u00EDda padr\u00E3o\n -f especifica o nome do arquivo do arquivo compactado\n -m inclui as informa\u00E7\u00F5es do manifesto do arquivo de manifesto especificado\n -e especifica o ponto de entrada da aplica\u00E7\u00E3o para aplica\u00E7\u00E3o independente \n empacotando em um arquivo jar execut\u00E1vel\n -0 armazena somente; n\u00E3o usa compacta\u00E7\u00E3o ZIP\n -M n\u00E3o cria um arquivo de manifesto para as entradas\n -i gera informa\u00E7\u00F5es de \u00EDndice para os arquivos especificados\n -C altera para o diret\u00F3rio e inclui o arquivo seguinte\nSe nenhum arquivo for um diret\u00F3rio, ent\u00E3o ser\u00E1 processado repetidamente.\nO nome do arquivo de manifesto, o nome do arquivo compactado e o nome do ponto de entrada s\u00E3o\nespecificados na mesma ordem dos flags 'm', 'f' e 'e'.\n\nExemplo 1: para arquivar dois arquivos de classe em um arquivo compactado com o nome classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nExemplo 2: use um arquivo de manifesto existente 'mymanifest' e arquive todos os\n arquivos no diret\u00F3rio foo/ na 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_sv.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_sv.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -39,9 +39,9 @@
out.adding=l\u00E4gger till: {0}
out.deflated=({0}% packat)
out.stored=(0% lagrat)
-out.create=\ \ skapad: {0}
+out.create=\ skapad: {0}
out.extracted=extraherat: {0}
-out.inflated=\\uppackat: {0}
+out.inflated=\ uppackat: {0}
out.size=(in = {0}) (ut = {1})
-usage=Syntax: jar-filer {ctxui}[vfm0Me] [jar-fil] [manifestfil] [startpunkt] [-C-katalog] ...\nAlternativ:\n\ \ -c skapa nytt arkiv\n\ \ -t lista inneh\u00E5llsf\u00F6rteckning f\u00F6r arkiv\n\ \ -x extrahera namngivna (eller alla) filer fr\u00E5n arkiv\n\ \ -u uppdatera befintligt arkiv\n\ \ -v generera utf\u00F6rliga utdata vid standardutmatning\n\ \ -f ange arkivfilens namn\n\ \ -m inkludera manifestinformation fr\u00E5n angivet manifest\n\ \ -e ange programstartpunkt f\u00F6r frist\u00E5ende applikation \n\ \ som medf\u00F6ljer i en jar-programfil\n\ \ -0 endast lagra (ingen zip-komprimering)\n\ \ -M skapa inte n\u00E5gon manifestfil f\u00F6r posterna\n\ \ -i generera indexinformation f\u00F6r de angivna jar-filerna\n\ \ -C \u00E4ndra till den angivna katalogen och inkludera f\u00F6ljande fil\nOm en fil \u00E4r en katalog bearbetas den rekursivt.\nNamnen p\u00E5 manifestfilen, arkivfilen och startpunkten anges i samma\nordning som m-, f- och e-flaggorna.\n\nExempel 1: S\u00E5 h\u00E4r arkiverar du tv\u00E5 klassfiler i ett arkiv med namnet classes.jar: \n\ \ jar cvf classes.jar Foo.class Bar.class \nExempel 2: Anv\u00E4nd en befintlig manifestfil (mymanifest) och arkivera alla\n\ \ filer fr\u00E5n katalogen foo/ i classes.jar: \n\ \ jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Syntax: jar-filer {ctxui}[vfm0Me] [jar-fil] [manifestfil] [startpunkt] [-C-katalog] ...\nAlternativ:\n -c skapa nytt arkiv\n -t lista inneh\u00E5llsf\u00F6rteckning f\u00F6r arkiv\n -x extrahera namngivna (eller alla) filer fr\u00E5n arkiv\n -u uppdatera befintligt arkiv\n -v generera utf\u00F6rliga utdata vid standardutmatning\n -f ange arkivfilens namn\n -m inkludera manifestinformation fr\u00E5n angivet manifest\n -e ange programstartpunkt f\u00F6r frist\u00E5ende applikation \n som medf\u00F6ljer i en jar-programfil\n -0 endast lagra (ingen zip-komprimering)\n -M skapa inte n\u00E5gon manifestfil f\u00F6r posterna\n -i generera indexinformation f\u00F6r de angivna jar-filerna\n -C \u00E4ndra till den angivna katalogen och inkludera f\u00F6ljande fil\nOm en fil \u00E4r en katalog bearbetas den rekursivt.\nNamnen p\u00E5 manifestfilen, arkivfilen och startpunkten anges i samma\nordning som m-, f- och e-flaggorna.\n\nExempel 1: S\u00E5 h\u00E4r arkiverar du tv\u00E5 klassfiler i ett arkiv med namnet classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nExempel 2: Anv\u00E4nd en befintlig manifestfil (mymanifest) och arkivera alla\n filer fr\u00E5n katalogen foo/ i classes.jar: \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -39,9 +39,9 @@
out.adding=\u6B63\u5728\u6DFB\u52A0: {0}
out.deflated=(\u538B\u7F29\u4E86 {0}%)
out.stored=(\u5B58\u50A8\u4E86 0%)
-out.create=\ \ \u5DF2\u521B\u5EFA: {0}
+out.create=\ \u5DF2\u521B\u5EFA: {0}
out.extracted=\u5DF2\u63D0\u53D6: {0}
-out.inflated=\ \ \u5DF2\u89E3\u538B: {0}
+out.inflated=\ \u5DF2\u89E3\u538B: {0}
out.size=(\u8F93\u5165 = {0}) (\u8F93\u51FA = {1})
-usage=\u7528\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u9009\u9879\u5305\u62EC: \n\ \ -c \u521B\u5EFA\u65B0\u7684\u5F52\u6863\u6587\u4EF6\n\ \ -t \u5217\u51FA\u5F52\u6863\u76EE\u5F55\n\ \ -x \u4ECE\u6863\u6848\u4E2D\u63D0\u53D6\u6307\u5B9A\u7684 (\u6216\u6240\u6709) \u6587\u4EF6\n\ \ -u \u66F4\u65B0\u73B0\u6709\u7684\u5F52\u6863\u6587\u4EF6\n\ \ -v \u5728\u6807\u51C6\u8F93\u51FA\u4E2D\u751F\u6210\u8BE6\u7EC6\u8F93\u51FA\n\ \ -f \u6307\u5B9A\u5F52\u6863\u6587\u4EF6\u540D\n\ \ -m \u5305\u542B\u6307\u5B9A\u6E05\u5355\u6587\u4EF6\u4E2D\u7684\u6E05\u5355\u4FE1\u606F\n\ \ -e \u4E3A\u6346\u7ED1\u5230\u53EF\u6267\u884C jar \u6587\u4EF6\u7684\u72EC\u7ACB\u5E94\u7528\u7A0B\u5E8F\n\ \ \u6307\u5B9A\u5E94\u7528\u7A0B\u5E8F\u5165\u53E3\u70B9\n\ \ -0 \u4EC5\u5B58\u50A8; \u4E0D\u4F7F\u7528\u60C5\u51B5\u4EFB\u4F55 ZIP \u538B\u7F29\n\ \ -M \u4E0D\u521B\u5EFA\u6761\u76EE\u7684\u6E05\u5355\u6587\u4EF6\n\ \ -i \u4E3A\u6307\u5B9A\u7684 jar \u6587\u4EF6\u751F\u6210\u7D22\u5F15\u4FE1\u606F\n\ \ -C \u66F4\u6539\u4E3A\u6307\u5B9A\u7684\u76EE\u5F55\u5E76\u5305\u542B\u5176\u4E2D\u7684\u6587\u4EF6\n\u5982\u679C\u6709\u4EFB\u4F55\u76EE\u5F55\u6587\u4EF6, \u5219\u5BF9\u5176\u8FDB\u884C\u9012\u5F52\u5904\u7406\u3002\n\u6E05\u5355\u6587\u4EF6\u540D, \u5F52\u6863\u6587\u4EF6\u540D\u548C\u5165\u53E3\u70B9\u540D\u79F0\u7684\u6307\u5B9A\u987A\u5E8F\n\u4E0E 'm', 'f' \u548C 'e' \u6807\u8BB0\u7684\u6307\u5B9A\u987A\u5E8F\u76F8\u540C\u3002\n\n\u793A\u4F8B 1: \u5C06\u4E24\u4E2A\u7C7B\u6587\u4EF6\u5F52\u6863\u5230\u4E00\u4E2A\u540D\u4E3A classes.jar \u7684\u5F52\u6863\u6587\u4EF6\u4E2D: \n\ \ jar cvf classes.jar Foo.class Bar.class \n\u793A\u4F8B 2: \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u6587\u4EF6 'mymanifest' \u5E76\n\ \ \u5C06 foo/ \u76EE\u5F55\u4E2D\u7684\u6240\u6709\u6587\u4EF6\u5F52\u6863\u5230 'classes.jar' \u4E2D: \n\ \ jar cvfm classes.jar mymanifest -C foo/\u3002\n
+usage=\u7528\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u9009\u9879\u5305\u62EC: \n -c \u521B\u5EFA\u65B0\u7684\u5F52\u6863\u6587\u4EF6\n -t \u5217\u51FA\u5F52\u6863\u76EE\u5F55\n -x \u4ECE\u6863\u6848\u4E2D\u63D0\u53D6\u6307\u5B9A\u7684 (\u6216\u6240\u6709) \u6587\u4EF6\n -u \u66F4\u65B0\u73B0\u6709\u7684\u5F52\u6863\u6587\u4EF6\n -v \u5728\u6807\u51C6\u8F93\u51FA\u4E2D\u751F\u6210\u8BE6\u7EC6\u8F93\u51FA\n -f \u6307\u5B9A\u5F52\u6863\u6587\u4EF6\u540D\n -m \u5305\u542B\u6307\u5B9A\u6E05\u5355\u6587\u4EF6\u4E2D\u7684\u6E05\u5355\u4FE1\u606F\n -e \u4E3A\u6346\u7ED1\u5230\u53EF\u6267\u884C jar \u6587\u4EF6\u7684\u72EC\u7ACB\u5E94\u7528\u7A0B\u5E8F\n \u6307\u5B9A\u5E94\u7528\u7A0B\u5E8F\u5165\u53E3\u70B9\n -0 \u4EC5\u5B58\u50A8; \u4E0D\u4F7F\u7528\u60C5\u51B5\u4EFB\u4F55 ZIP \u538B\u7F29\n -M \u4E0D\u521B\u5EFA\u6761\u76EE\u7684\u6E05\u5355\u6587\u4EF6\n -i \u4E3A\u6307\u5B9A\u7684 jar \u6587\u4EF6\u751F\u6210\u7D22\u5F15\u4FE1\u606F\n -C \u66F4\u6539\u4E3A\u6307\u5B9A\u7684\u76EE\u5F55\u5E76\u5305\u542B\u5176\u4E2D\u7684\u6587\u4EF6\n\u5982\u679C\u6709\u4EFB\u4F55\u76EE\u5F55\u6587\u4EF6, \u5219\u5BF9\u5176\u8FDB\u884C\u9012\u5F52\u5904\u7406\u3002\n\u6E05\u5355\u6587\u4EF6\u540D, \u5F52\u6863\u6587\u4EF6\u540D\u548C\u5165\u53E3\u70B9\u540D\u79F0\u7684\u6307\u5B9A\u987A\u5E8F\n\u4E0E 'm', 'f' \u548C 'e' \u6807\u8BB0\u7684\u6307\u5B9A\u987A\u5E8F\u76F8\u540C\u3002\n\n\u793A\u4F8B 1: \u5C06\u4E24\u4E2A\u7C7B\u6587\u4EF6\u5F52\u6863\u5230\u4E00\u4E2A\u540D\u4E3A classes.jar \u7684\u5F52\u6863\u6587\u4EF6\u4E2D: \n jar cvf classes.jar Foo.class Bar.class \n\u793A\u4F8B 2: \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u6587\u4EF6 'mymanifest' \u5E76\n \u5C06 foo/ \u76EE\u5F55\u4E2D\u7684\u6240\u6709\u6587\u4EF6\u5F52\u6863\u5230 'classes.jar' \u4E2D: \n jar cvfm classes.jar mymanifest -C foo/\u3002\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_TW.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_TW.properties Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -39,9 +39,9 @@
out.adding=\u65B0\u589E: {0}
out.deflated=(\u58D3\u7E2E {0}%)
out.stored=(\u5132\u5B58 0%)
-out.create=\ \ \u5EFA\u7ACB: {0}
+out.create=\ \u5EFA\u7ACB: {0}
out.extracted=\u64F7\u53D6: {0}
out.inflated=\ \\\u64F4\u5C55: {0}
out.size=\ (\u8B80={0})(\u5BEB={1})
-usage=\u7528\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] \u6A94\u6848 ...\n\u9078\u9805:\n\ \ -c \u5EFA\u7ACB\u65B0\u7684\u6B78\u6A94\n\ \ -t \u5217\u51FA\u6B78\u6A94\u7684\u76EE\u9304\n\ \ -x \u5F9E\u6B78\u6A94\u4E2D\u64F7\u53D6\u5DF2\u547D\u540D\u7684 (\u6216\u6240\u6709) \u6A94\u6848\n\ \ -u \u66F4\u65B0\u73FE\u6709\u6B78\u6A94\n\ \ -v \u5728\u6A19\u6E96\u8F38\u51FA\u4E2D\u7522\u751F\u8A73\u7D30\u8F38\u51FA\n\ \ -f \u6307\u5B9A\u6B78\u6A94\u6A94\u6848\u540D\u7A31\n\ \ -m \u5305\u542B\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u4E2D\u7684\u8CC7\u8A0A\u6E05\u55AE\u8CC7\u8A0A\n\ \ -e \u70BA\u7368\u7ACB\u61C9\u7528\u7A0B\u5F0F\u6307\u5B9A\u61C9\u7528\u7A0B\u5F0F\u9032\u5165\u9EDE\n\ \ \u5DF2\u96A8\u9644\u65BC\u53EF\u57F7\u884C jar \u6A94\u6848\u4E2D\n\ \ -0 \u50C5\u5132\u5B58; \u4E0D\u4F7F\u7528 ZIP \u58D3\u7E2E\u65B9\u5F0F\n\ \ -M \u4E0D\u70BA\u9805\u76EE\u5EFA\u7ACB\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\n\ \ -i \u70BA\u6307\u5B9A\u7684 jar \u6A94\u6848\u7522\u751F\u7D22\u5F15\u8CC7\u8A0A\n\ \ -C \u8B8A\u66F4\u81F3\u6307\u5B9A\u76EE\u9304\u4E26\u5305\u542B\u5F8C\u9762\u6240\u5217\u7684\u6A94\u6848\n\u5982\u679C\u6709\u4EFB\u4F55\u6A94\u6848\u662F\u76EE\u9304\uFF0C\u5247\u6703\u5C0D\u5176\u9032\u884C\u905E\u8FF4\u8655\u7406\u3002\n\u6E05\u55AE\u6A94\u6848\u540D\u7A31\u3001\u6B78\u6A94\u6A94\u6848\u540D\u7A31\u548C\u9032\u5165\u9EDE\u540D\u7A31\n\u7684\u6307\u5B9A\u9806\u5E8F\u8207\u6307\u5B9A 'm' \u65D7\u6A19\u3001'f' \u65D7\u6A19\u548C 'e' \u65D7\u6A19\u7684\u9806\u5E8F\u76F8\u540C\u3002\n\n\u7BC4\u4F8B 1: \u5C07\u5169\u500B\u985E\u5225\u6A94\u6848\u6B78\u6A94\u81F3\u540D\u70BA classes.jar \u7684\u6B78\u6A94\u4E2D: \n\ \ jar cvf classes.jar Foo.class Bar.class\n\u7BC4\u4F8B 2: \u4F7F\u7528\u73FE\u6709\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848 'mymanifest' \u4E26\u5C07\n\ \ foo/ \u76EE\u9304\u4E2D\u7684\u6240\u6709\u6A94\u6848\u6B78\u6A94\u81F3 'classes.jar' \u4E2D: \n\ \ jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=\u7528\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] \u6A94\u6848 ...\n\u9078\u9805:\n -c \u5EFA\u7ACB\u65B0\u7684\u6B78\u6A94\n -t \u5217\u51FA\u6B78\u6A94\u7684\u76EE\u9304\n -x \u5F9E\u6B78\u6A94\u4E2D\u64F7\u53D6\u5DF2\u547D\u540D\u7684 (\u6216\u6240\u6709) \u6A94\u6848\n -u \u66F4\u65B0\u73FE\u6709\u6B78\u6A94\n -v \u5728\u6A19\u6E96\u8F38\u51FA\u4E2D\u7522\u751F\u8A73\u7D30\u8F38\u51FA\n -f \u6307\u5B9A\u6B78\u6A94\u6A94\u6848\u540D\u7A31\n -m \u5305\u542B\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u4E2D\u7684\u8CC7\u8A0A\u6E05\u55AE\u8CC7\u8A0A\n -e \u70BA\u7368\u7ACB\u61C9\u7528\u7A0B\u5F0F\u6307\u5B9A\u61C9\u7528\u7A0B\u5F0F\u9032\u5165\u9EDE\n \u5DF2\u96A8\u9644\u65BC\u53EF\u57F7\u884C jar \u6A94\u6848\u4E2D\n -0 \u50C5\u5132\u5B58; \u4E0D\u4F7F\u7528 ZIP \u58D3\u7E2E\u65B9\u5F0F\n -M \u4E0D\u70BA\u9805\u76EE\u5EFA\u7ACB\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\n -i \u70BA\u6307\u5B9A\u7684 jar \u6A94\u6848\u7522\u751F\u7D22\u5F15\u8CC7\u8A0A\n -C \u8B8A\u66F4\u81F3\u6307\u5B9A\u76EE\u9304\u4E26\u5305\u542B\u5F8C\u9762\u6240\u5217\u7684\u6A94\u6848\n\u5982\u679C\u6709\u4EFB\u4F55\u6A94\u6848\u662F\u76EE\u9304\uFF0C\u5247\u6703\u5C0D\u5176\u9032\u884C\u905E\u8FF4\u8655\u7406\u3002\n\u6E05\u55AE\u6A94\u6848\u540D\u7A31\u3001\u6B78\u6A94\u6A94\u6848\u540D\u7A31\u548C\u9032\u5165\u9EDE\u540D\u7A31\n\u7684\u6307\u5B9A\u9806\u5E8F\u8207\u6307\u5B9A 'm' \u65D7\u6A19\u3001'f' \u65D7\u6A19\u548C 'e' \u65D7\u6A19\u7684\u9806\u5E8F\u76F8\u540C\u3002\n\n\u7BC4\u4F8B 1: \u5C07\u5169\u500B\u985E\u5225\u6A94\u6848\u6B78\u6A94\u81F3\u540D\u70BA classes.jar \u7684\u6B78\u6A94\u4E2D: \n jar cvf classes.jar Foo.class Bar.class\n\u7BC4\u4F8B 2: \u4F7F\u7528\u73FE\u6709\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848 'mymanifest' \u4E26\u5C07\n foo/ \u76EE\u9304\u4E2D\u7684\u6240\u6709\u6A94\u6848\u6B78\u6A94\u81F3 'classes.jar' \u4E2D: \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jconsole/resources/messages_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jconsole/resources/messages_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -1,15 +1,15 @@
-ONE_DAY=\ 1\u65e5
+ONE_DAY=\ 1\u65E5
ONE_HOUR=\ 1\u6642\u9593
ONE_MIN=\ 1\u5206
-ONE_MONTH=\ 1\u304b\u6708
-ONE_YEAR=\ 1\u5e74
+ONE_MONTH=\ 1\u304B\u6708
+ONE_YEAR=\ 1\u5E74
TWO_HOURS=\ 2\u6642\u9593
THREE_HOURS=\ 3\u6642\u9593
-THREE_MONTHS=\ 3\u304b\u6708
+THREE_MONTHS=\ 3\u304B\u6708
FIVE_MIN=\ 5\u5206
SIX_HOURS=\ 6\u6642\u9593
-SIX_MONTHS=\ 6\u304b\u6708
-SEVEN_DAYS=\ 7\u65e5
+SIX_MONTHS=\ 6\u304B\u6708
+SEVEN_DAYS=\ 7\u65E5
TEN_MIN=10\u5206
TWELVE_HOURS=12\u6642\u9593
THIRTY_MIN=30\u5206
@@ -19,255 +19,255 @@
ACTION_CAPITALIZED=ACTION
ACTION_INFO_CAPITALIZED=ACTION_INFO
ALL=\u3059\u3079\u3066
-ARCHITECTURE=\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3
-ATTRIBUTE=\u5c5e\u6027
-ATTRIBUTE_VALUE=\u5c5e\u6027\u5024
-ATTRIBUTE_VALUES=\u5c5e\u6027\u5024
-ATTRIBUTES=\u5c5e\u6027
-BLANK=\u30d6\u30e9\u30f3\u30af
-BLOCKED_COUNT_WAITED_COUNT=\u30d6\u30ed\u30c3\u30af\u6e08\u5408\u8a08: {0} \u5f85\u6a5f\u6e08\u5408\u8a08: {1}\n
-BOOT_CLASS_PATH=\u30d6\u30fc\u30c8\u30fb\u30af\u30e9\u30b9\u30d1\u30b9
-BORDERED_COMPONENT_MORE_OR_LESS_BUTTON_TOOLTIP=\u8868\u793a\u3059\u308b\u60c5\u5831\u91cf\u3092\u5897\u6e1b\u3059\u308b\u30c8\u30b0\u30eb
-CPU_USAGE=CPU\u4f7f\u7528\u7387
-CPU_USAGE_FORMAT=CPU\u4f7f\u7528\u7387: {0}%
-CANCEL=\u53d6\u6d88
-CASCADE=\u91cd\u306d\u3066\u8868\u793a(&C)
-CHART_COLON=\u30c1\u30e3\u30fc\u30c8(&C):
-CLASS_PATH=\u30af\u30e9\u30b9\u30d1\u30b9
+ARCHITECTURE=\u30A2\u30FC\u30AD\u30C6\u30AF\u30C1\u30E3
+ATTRIBUTE=\u5C5E\u6027
+ATTRIBUTE_VALUE=\u5C5E\u6027\u5024
+ATTRIBUTE_VALUES=\u5C5E\u6027\u5024
+ATTRIBUTES=\u5C5E\u6027
+BLANK=\u30D6\u30E9\u30F3\u30AF
+BLOCKED_COUNT_WAITED_COUNT=\u30D6\u30ED\u30C3\u30AF\u6E08\u5408\u8A08: {0} \u5F85\u6A5F\u6E08\u5408\u8A08: {1}\n
+BOOT_CLASS_PATH=\u30D6\u30FC\u30C8\u30FB\u30AF\u30E9\u30B9\u30D1\u30B9
+BORDERED_COMPONENT_MORE_OR_LESS_BUTTON_TOOLTIP=\u8868\u793A\u3059\u308B\u60C5\u5831\u91CF\u3092\u5897\u6E1B\u3059\u308B\u30C8\u30B0\u30EB
+CPU_USAGE=CPU\u4F7F\u7528\u7387
+CPU_USAGE_FORMAT=CPU\u4F7F\u7528\u7387: {0}%
+CANCEL=\u53D6\u6D88
+CASCADE=\u91CD\u306D\u3066\u8868\u793A(&C)
+CHART_COLON=\u30C1\u30E3\u30FC\u30C8(&C):
+CLASS_PATH=\u30AF\u30E9\u30B9\u30D1\u30B9
CLASS_NAME=ClassName
-CLASS_TAB_INFO_LABEL_FORMAT=<html>\u30ed\u30fc\u30c9\u6e08: {0} \u672a\u30ed\u30fc\u30c9: {1} \u5408\u8a08: {2}</html>
-CLASS_TAB_LOADED_CLASSES_PLOTTER_ACCESSIBLE_NAME=\u30ed\u30fc\u30c9\u6e08\u30af\u30e9\u30b9\u306e\u30c1\u30e3\u30fc\u30c8\u3002
-CLASSES=\u30af\u30e9\u30b9
-CLOSE=\u9589\u3058\u308b
-COLUMN_NAME=\u540d\u524d
+CLASS_TAB_INFO_LABEL_FORMAT=<html>\u30ED\u30FC\u30C9\u6E08: {0} \u672A\u30ED\u30FC\u30C9: {1} \u5408\u8A08: {2}</html>
+CLASS_TAB_LOADED_CLASSES_PLOTTER_ACCESSIBLE_NAME=\u30ED\u30FC\u30C9\u6E08\u30AF\u30E9\u30B9\u306E\u30C1\u30E3\u30FC\u30C8\u3002
+CLASSES=\u30AF\u30E9\u30B9
+CLOSE=\u9589\u3058\u308B
+COLUMN_NAME=\u540D\u524D
COLUMN_PID=PID
-COMMITTED_MEMORY=\u30b3\u30df\u30c3\u30c8\u6e08\u30e1\u30e2\u30ea\u30fc
-COMMITTED_VIRTUAL_MEMORY=\u30b3\u30df\u30c3\u30c8\u6e08\u4eee\u60f3\u30e1\u30e2\u30ea\u30fc
-COMMITTED=\u30b3\u30df\u30c3\u30c8\u6e08
-CONNECT=\u63a5\u7d9a(&C)
-CONNECT_DIALOG_CONNECT_BUTTON_TOOLTIP=Java\u4eee\u60f3\u30de\u30b7\u30f3\u306b\u63a5\u7d9a
-CONNECT_DIALOG_ACCESSIBLE_DESCRIPTION=\u30ed\u30fc\u30ab\u30eb\u307e\u305f\u306f\u30ea\u30e2\u30fc\u30c8\u306eJava\u4eee\u60f3\u30de\u30b7\u30f3\u3078\u306e\u65b0\u898f\u63a5\u7d9a\u3092\u884c\u3046\u30c0\u30a4\u30a2\u30ed\u30b0
-CONNECT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u30de\u30b9\u30c8\u30d8\u30c3\u30c9\u56f3\u5f62
-CONNECT_DIALOG_MASTHEAD_TITLE=\u65b0\u898f\u63a5\u7d9a
-CONNECT_DIALOG_STATUS_BAR_ACCESSIBLE_NAME=\u30b9\u30c6\u30fc\u30bf\u30b9\u30fb\u30d0\u30fc
-CONNECT_DIALOG_TITLE=JConsole: \u65b0\u898f\u63a5\u7d9a
-CONNECTED_PUNCTUATION_CLICK_TO_DISCONNECT_=\u63a5\u7d9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u5207\u65ad\u3057\u307e\u3059\u3002
-CONNECTION_FAILED=\u63a5\u7d9a\u306b\u5931\u6557\u3057\u307e\u3057\u305f
-CONNECTION=\u63a5\u7d9a(&C)
-CONNECTION_NAME=\u63a5\u7d9a\u540d
-CONNECTION_NAME__DISCONNECTED_={0} (\u5207\u65ad\u6e08)
-CONSTRUCTOR=\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf
-CURRENT_CLASSES_LOADED=\u30ed\u30fc\u30c9\u6e08\u306e\u73fe\u5728\u306e\u30af\u30e9\u30b9
-CURRENT_HEAP_SIZE=\u73fe\u5728\u306e\u30d2\u30fc\u30d7\u30fb\u30b5\u30a4\u30ba
-CURRENT_VALUE=\u73fe\u5728\u5024: {0}
-CREATE=\u4f5c\u6210
-DAEMON_THREADS=\u30c7\u30fc\u30e2\u30f3\u30fb\u30b9\u30ec\u30c3\u30c9
-DISCONNECTED_PUNCTUATION_CLICK_TO_CONNECT_=\u5207\u65ad\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u63a5\u7d9a\u3057\u307e\u3059\u3002
-DOUBLE_CLICK_TO_EXPAND_FORWARD_SLASH_COLLAPSE=\u5c55\u958b\u307e\u305f\u306f\u7e2e\u5c0f\u3059\u308b\u306b\u306f\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044
-DOUBLE_CLICK_TO_VISUALIZE=\u8996\u899a\u5316\u3059\u308b\u306b\u306f\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044
-DESCRIPTION=\u8aac\u660e
-DESCRIPTOR=\u8a18\u8ff0\u5b50
-DETAILS=\u8a73\u7d30
-DETECT_DEADLOCK=\u30c7\u30c3\u30c9\u30ed\u30c3\u30af\u306e\u691c\u51fa(&D)
-DETECT_DEADLOCK_TOOLTIP=\u30c7\u30c3\u30c9\u30ed\u30c3\u30af\u6e08\u30b9\u30ec\u30c3\u30c9\u306e\u691c\u51fa
-DIMENSION_IS_NOT_SUPPORTED_COLON=\u6b21\u5143\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093:
-DISCARD_CHART=\u30c1\u30e3\u30fc\u30c8\u306e\u7834\u68c4
-DURATION_DAYS_HOURS_MINUTES={0,choice,1#{0,number,integer}\u65e5|1.0<{0,number,integer}\u65e5}{1,choice,0<{1,number,integer}\u6642\u9593|1#{1,number,integer}\u6642\u9593|1<{1,number,integer}\u6642\u9593}{2,choice,0<{2,number,integer}\u5206|1#{2,number,integer}\u5206|1.0<{2,number,integer}\u5206}
+COMMITTED_MEMORY=\u30B3\u30DF\u30C3\u30C8\u6E08\u30E1\u30E2\u30EA\u30FC
+COMMITTED_VIRTUAL_MEMORY=\u30B3\u30DF\u30C3\u30C8\u6E08\u4EEE\u60F3\u30E1\u30E2\u30EA\u30FC
+COMMITTED=\u30B3\u30DF\u30C3\u30C8\u6E08
+CONNECT=\u63A5\u7D9A(&C)
+CONNECT_DIALOG_CONNECT_BUTTON_TOOLTIP=Java\u4EEE\u60F3\u30DE\u30B7\u30F3\u306B\u63A5\u7D9A
+CONNECT_DIALOG_ACCESSIBLE_DESCRIPTION=\u30ED\u30FC\u30AB\u30EB\u307E\u305F\u306F\u30EA\u30E2\u30FC\u30C8\u306EJava\u4EEE\u60F3\u30DE\u30B7\u30F3\u3078\u306E\u65B0\u898F\u63A5\u7D9A\u3092\u884C\u3046\u30C0\u30A4\u30A2\u30ED\u30B0
+CONNECT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u30DE\u30B9\u30C8\u30D8\u30C3\u30C9\u56F3\u5F62
+CONNECT_DIALOG_MASTHEAD_TITLE=\u65B0\u898F\u63A5\u7D9A
+CONNECT_DIALOG_STATUS_BAR_ACCESSIBLE_NAME=\u30B9\u30C6\u30FC\u30BF\u30B9\u30FB\u30D0\u30FC
+CONNECT_DIALOG_TITLE=JConsole: \u65B0\u898F\u63A5\u7D9A
+CONNECTED_PUNCTUATION_CLICK_TO_DISCONNECT_=\u63A5\u7D9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u5207\u65AD\u3057\u307E\u3059\u3002
+CONNECTION_FAILED=\u63A5\u7D9A\u306B\u5931\u6557\u3057\u307E\u3057\u305F
+CONNECTION=\u63A5\u7D9A(&C)
+CONNECTION_NAME=\u63A5\u7D9A\u540D
+CONNECTION_NAME__DISCONNECTED_={0} (\u5207\u65AD\u6E08)
+CONSTRUCTOR=\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF
+CURRENT_CLASSES_LOADED=\u30ED\u30FC\u30C9\u6E08\u306E\u73FE\u5728\u306E\u30AF\u30E9\u30B9
+CURRENT_HEAP_SIZE=\u73FE\u5728\u306E\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA
+CURRENT_VALUE=\u73FE\u5728\u5024: {0}
+CREATE=\u4F5C\u6210
+DAEMON_THREADS=\u30C7\u30FC\u30E2\u30F3\u30FB\u30B9\u30EC\u30C3\u30C9
+DISCONNECTED_PUNCTUATION_CLICK_TO_CONNECT_=\u5207\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u63A5\u7D9A\u3057\u307E\u3059\u3002
+DOUBLE_CLICK_TO_EXPAND_FORWARD_SLASH_COLLAPSE=\u5C55\u958B\u307E\u305F\u306F\u7E2E\u5C0F\u3059\u308B\u306B\u306F\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044
+DOUBLE_CLICK_TO_VISUALIZE=\u8996\u899A\u5316\u3059\u308B\u306B\u306F\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044
+DESCRIPTION=\u8AAC\u660E
+DESCRIPTOR=\u8A18\u8FF0\u5B50
+DETAILS=\u8A73\u7D30
+DETECT_DEADLOCK=\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF\u306E\u691C\u51FA(&D)
+DETECT_DEADLOCK_TOOLTIP=\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF\u6E08\u30B9\u30EC\u30C3\u30C9\u306E\u691C\u51FA
+DIMENSION_IS_NOT_SUPPORTED_COLON=\u6B21\u5143\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093:
+DISCARD_CHART=\u30C1\u30E3\u30FC\u30C8\u306E\u7834\u68C4
+DURATION_DAYS_HOURS_MINUTES={0,choice,1#{0,number,integer}\u65E5|1.0<{0,number,integer}\u65E5}{1,choice,0<{1,number,integer}\u6642\u9593|1#{1,number,integer}\u6642\u9593|1<{1,number,integer}\u6642\u9593}{2,choice,0<{2,number,integer}\u5206|1#{2,number,integer}\u5206|1.0<{2,number,integer}\u5206}
DURATION_HOURS_MINUTES={0,choice,1#{0,number,integer}\u6642\u9593|1<{0,number,integer}\u6642\u9593}{1,choice,0<{1,number,integer}\u5206|1#{1,number,integer}\u5206|1.0<{1,number,integer}\u5206}
DURATION_MINUTES={0,choice,1#{0,number,integer}\u5206|1.0<{0,number,integer}\u5206}
-DURATION_SECONDS={0}\u79d2
-EMPTY_ARRAY=\u7a7a\u306e\u914d\u5217
-ERROR=\u30a8\u30e9\u30fc
-ERROR_COLON_MBEANS_ALREADY_EXIST=\u30a8\u30e9\u30fc: MBeans\u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059
-ERROR_COLON_MBEANS_DO_NOT_EXIST=\u30a8\u30e9\u30fc: MBeans\u306f\u5b58\u5728\u3057\u307e\u305b\u3093
-EVENT=\u30a4\u30d9\u30f3\u30c8
-EXIT=\u7d42\u4e86(&X)
-FAIL_TO_LOAD_PLUGIN=\u8b66\u544a: \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30ed\u30fc\u30c9\u306b\u5931\u6557\u3057\u307e\u3057\u305f: {0}
-FILE_CHOOSER_FILE_EXISTS_CANCEL_OPTION=\u53d6\u6d88
-FILE_CHOOSER_FILE_EXISTS_MESSAGE=<html><center>\u30d5\u30a1\u30a4\u30eb\u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u3066\u3044\u307e\u3059:<br>{0}<br>\u7f6e\u63db\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b\u3002
-FILE_CHOOSER_FILE_EXISTS_OK_OPTION=\u7f6e\u63db
-FILE_CHOOSER_FILE_EXISTS_TITLE=\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3057\u3066\u3044\u307e\u3059
-FILE_CHOOSER_SAVED_FILE=<html>\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u3057\u307e\u3057\u305f:<br>{0}<br>({1}\u30d0\u30a4\u30c8)
-FILE_CHOOSER_SAVE_FAILED_MESSAGE=<html><center>\u30d5\u30a1\u30a4\u30eb\u3078\u306e\u4fdd\u5b58\u306b\u5931\u6557\u3057\u307e\u3057\u305f:<br>{0}<br>{1}
-FILE_CHOOSER_SAVE_FAILED_TITLE=\u4fdd\u5b58\u306b\u5931\u6557\u3057\u307e\u3057\u305f
-FREE_PHYSICAL_MEMORY=\u7a7a\u304d\u7269\u7406\u30e1\u30e2\u30ea\u30fc
-FREE_SWAP_SPACE=\u7a7a\u304d\u30b9\u30ef\u30c3\u30d7\u30fb\u30b9\u30da\u30fc\u30b9
-GARBAGE_COLLECTOR=\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30bf
-GC_INFO=\u540d\u524d= ''{0}''\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3= {1,choice,-1#\u3042\u308a\u307e\u305b\u3093|0#{1,number,integer}\u500b}\u3001\u5408\u8a08\u6d88\u8cbb\u6642\u9593= {2}
+DURATION_SECONDS={0}\u79D2
+EMPTY_ARRAY=\u7A7A\u306E\u914D\u5217
+ERROR=\u30A8\u30E9\u30FC
+ERROR_COLON_MBEANS_ALREADY_EXIST=\u30A8\u30E9\u30FC: MBeans\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u307E\u3059
+ERROR_COLON_MBEANS_DO_NOT_EXIST=\u30A8\u30E9\u30FC: MBeans\u306F\u5B58\u5728\u3057\u307E\u305B\u3093
+EVENT=\u30A4\u30D9\u30F3\u30C8
+EXIT=\u7D42\u4E86(&X)
+FAIL_TO_LOAD_PLUGIN=\u8B66\u544A: \u30D7\u30E9\u30B0\u30A4\u30F3\u306E\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F: {0}
+FILE_CHOOSER_FILE_EXISTS_CANCEL_OPTION=\u53D6\u6D88
+FILE_CHOOSER_FILE_EXISTS_MESSAGE=<html><center>\u30D5\u30A1\u30A4\u30EB\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059:<br>{0}<br>\u7F6E\u63DB\u3057\u3066\u3082\u3088\u308D\u3057\u3044\u3067\u3059\u304B\u3002
+FILE_CHOOSER_FILE_EXISTS_OK_OPTION=\u7F6E\u63DB
+FILE_CHOOSER_FILE_EXISTS_TITLE=\u30D5\u30A1\u30A4\u30EB\u304C\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
+FILE_CHOOSER_SAVED_FILE=<html>\u30D5\u30A1\u30A4\u30EB\u306B\u4FDD\u5B58\u3057\u307E\u3057\u305F:<br>{0}<br>({1}\u30D0\u30A4\u30C8)
+FILE_CHOOSER_SAVE_FAILED_MESSAGE=<html><center>\u30D5\u30A1\u30A4\u30EB\u3078\u306E\u4FDD\u5B58\u306B\u5931\u6557\u3057\u307E\u3057\u305F:<br>{0}<br>{1}
+FILE_CHOOSER_SAVE_FAILED_TITLE=\u4FDD\u5B58\u306B\u5931\u6557\u3057\u307E\u3057\u305F
+FREE_PHYSICAL_MEMORY=\u7A7A\u304D\u7269\u7406\u30E1\u30E2\u30EA\u30FC
+FREE_SWAP_SPACE=\u7A7A\u304D\u30B9\u30EF\u30C3\u30D7\u30FB\u30B9\u30DA\u30FC\u30B9
+GARBAGE_COLLECTOR=\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30BF
+GC_INFO=\u540D\u524D= ''{0}''\u3001\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3= {1,choice,-1#\u3042\u308A\u307E\u305B\u3093|0#{1,number,integer}\u500B}\u3001\u5408\u8A08\u6D88\u8CBB\u6642\u9593= {2}
GC_TIME=GC\u6642\u9593
-GC_TIME_DETAILS={1}\u3067{0} ({2}\u500b\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3)
-HEAP_MEMORY_USAGE=\u30d2\u30fc\u30d7\u30fb\u30e1\u30e2\u30ea\u30fc\u4f7f\u7528\u7387
-HEAP=\u30d2\u30fc\u30d7
-HELP_ABOUT_DIALOG_ACCESSIBLE_DESCRIPTION=JConsole\u3068JDK\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3064\u3044\u3066\u306e\u60c5\u5831\u3092\u542b\u3080\u30c0\u30a4\u30a2\u30ed\u30b0
-HELP_ABOUT_DIALOG_JCONSOLE_VERSION=JConsole\u30d0\u30fc\u30b8\u30e7\u30f3:<br>{0}
-HELP_ABOUT_DIALOG_JAVA_VERSION=Java VM\u30d0\u30fc\u30b8\u30e7\u30f3:<br>{0}
-HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u30de\u30b9\u30c8\u30d8\u30c3\u30c9\u56f3\u5f62
-HELP_ABOUT_DIALOG_MASTHEAD_TITLE=JConsole\u306b\u3064\u3044\u3066
-HELP_ABOUT_DIALOG_TITLE=JConsole: \u8a73\u7d30
-HELP_ABOUT_DIALOG_USER_GUIDE_LINK=JConsole\u30e6\u30fc\u30b6\u30fc\u30fb\u30ac\u30a4\u30c9(&U):<br>{0}
+GC_TIME_DETAILS={1}\u3067{0} ({2}\u500B\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3)
+HEAP_MEMORY_USAGE=\u30D2\u30FC\u30D7\u30FB\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387
+HEAP=\u30D2\u30FC\u30D7
+HELP_ABOUT_DIALOG_ACCESSIBLE_DESCRIPTION=JConsole\u3068JDK\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u306B\u3064\u3044\u3066\u306E\u60C5\u5831\u3092\u542B\u3080\u30C0\u30A4\u30A2\u30ED\u30B0
+HELP_ABOUT_DIALOG_JCONSOLE_VERSION=JConsole\u30D0\u30FC\u30B8\u30E7\u30F3:<br>{0}
+HELP_ABOUT_DIALOG_JAVA_VERSION=Java VM\u30D0\u30FC\u30B8\u30E7\u30F3:<br>{0}
+HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u30DE\u30B9\u30C8\u30D8\u30C3\u30C9\u56F3\u5F62
+HELP_ABOUT_DIALOG_MASTHEAD_TITLE=JConsole\u306B\u3064\u3044\u3066
+HELP_ABOUT_DIALOG_TITLE=JConsole: \u8A73\u7D30
+HELP_ABOUT_DIALOG_USER_GUIDE_LINK=JConsole\u30E6\u30FC\u30B6\u30FC\u30FB\u30AC\u30A4\u30C9(&U):<br>{0}
HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL=http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html
-HELP_MENU_ABOUT_TITLE=JConsole\u306b\u3064\u3044\u3066(&A)
-HELP_MENU_USER_GUIDE_TITLE=\u30aa\u30f3\u30e9\u30a4\u30f3\u30fb\u30e6\u30fc\u30b6\u30fc\u30fb\u30ac\u30a4\u30c9(&U)
-HELP_MENU_TITLE=\u30d8\u30eb\u30d7(&H)
+HELP_MENU_ABOUT_TITLE=JConsole\u306B\u3064\u3044\u3066(&A)
+HELP_MENU_USER_GUIDE_TITLE=\u30AA\u30F3\u30E9\u30A4\u30F3\u30FB\u30E6\u30FC\u30B6\u30FC\u30FB\u30AC\u30A4\u30C9(&U)
+HELP_MENU_TITLE=\u30D8\u30EB\u30D7(&H)
HOTSPOT_MBEANS_ELLIPSIS=Hotspot MBeans(&H)...
-HOTSPOT_MBEANS_DIALOG_ACCESSIBLE_DESCRIPTION=Hotspot MBeans\u306e\u7ba1\u7406\u7528\u30c0\u30a4\u30a2\u30ed\u30b0
-IMPACT=\u5f71\u97ff
-INFO=\u60c5\u5831
-INFO_CAPITALIZED=\u60c5\u5831
-INVALID_PLUGIN_PATH=\u8b66\u544a: \u7121\u52b9\u306a\u30d7\u30e9\u30b0\u30a4\u30f3\u30fb\u30d1\u30b9: {0}
-INVALID_URL=\u7121\u52b9\u306aURL: {0}
-IS=\u6b21\u306b\u4e00\u81f4\u3059\u308b
+HOTSPOT_MBEANS_DIALOG_ACCESSIBLE_DESCRIPTION=Hotspot MBeans\u306E\u7BA1\u7406\u7528\u30C0\u30A4\u30A2\u30ED\u30B0
+IMPACT=\u5F71\u97FF
+INFO=\u60C5\u5831
+INFO_CAPITALIZED=INFO
+INVALID_PLUGIN_PATH=\u8B66\u544A: \u7121\u52B9\u306A\u30D7\u30E9\u30B0\u30A4\u30F3\u30FB\u30D1\u30B9: {0}
+INVALID_URL=\u7121\u52B9\u306AURL: {0}
+IS=\u6B21\u306B\u4E00\u81F4\u3059\u308B
JAVA_MONITORING___MANAGEMENT_CONSOLE=Java Monitoring && Management Console
JCONSOLE_COLON_=JConsole: {0}
-JCONSOLE_VERSION=JConsole\u30d0\u30fc\u30b8\u30e7\u30f3"{0}"
+JCONSOLE_VERSION=JConsole\u30D0\u30FC\u30B8\u30E7\u30F3"{0}"
JCONSOLE_ACCESSIBLE_DESCRIPTION=Java Monitoring && Management Console
-JIT_COMPILER=JIT\u30b3\u30f3\u30d1\u30a4\u30e9
-LIBRARY_PATH=\u30e9\u30a4\u30d6\u30e9\u30ea\u30fb\u30d1\u30b9
-LIVE_THREADS=\u5b9f\u884c\u4e2d\u306e\u30b9\u30ec\u30c3\u30c9
-LOADED=\u30ed\u30fc\u30c9\u6e08
-LOCAL_PROCESS_COLON=\u30ed\u30fc\u30ab\u30eb\u30fb\u30d7\u30ed\u30bb\u30b9(&L):
+JIT_COMPILER=JIT\u30B3\u30F3\u30D1\u30A4\u30E9
+LIBRARY_PATH=\u30E9\u30A4\u30D6\u30E9\u30EA\u30FB\u30D1\u30B9
+LIVE_THREADS=\u5B9F\u884C\u4E2D\u306E\u30B9\u30EC\u30C3\u30C9
+LOADED=\u30ED\u30FC\u30C9\u6E08
+LOCAL_PROCESS_COLON=\u30ED\u30FC\u30AB\u30EB\u30FB\u30D7\u30ED\u30BB\u30B9(&L):
MASTHEAD_FONT=Dialog-PLAIN-25
-MANAGEMENT_NOT_ENABLED=<b>\u6ce8\u610f</b>: \u7ba1\u7406\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306f\u3053\u306e\u30d7\u30ed\u30bb\u30b9\u3067\u306f\u6709\u52b9\u5316\u3055\u308c\u307e\u305b\u3093\u3002
-MANAGEMENT_WILL_BE_ENABLED=<b>\u6ce8\u610f</b>: \u7ba1\u7406\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306f\u3053\u306e\u30d7\u30ed\u30bb\u30b9\u3067\u6709\u52b9\u5316\u3055\u308c\u307e\u3059\u3002
+MANAGEMENT_NOT_ENABLED=<b>\u6CE8\u610F</b>: \u7BA1\u7406\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u306F\u3053\u306E\u30D7\u30ED\u30BB\u30B9\u3067\u306F\u6709\u52B9\u5316\u3055\u308C\u307E\u305B\u3093\u3002
+MANAGEMENT_WILL_BE_ENABLED=<b>\u6CE8\u610F</b>: \u7BA1\u7406\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u306F\u3053\u306E\u30D7\u30ED\u30BB\u30B9\u3067\u6709\u52B9\u5316\u3055\u308C\u307E\u3059\u3002
MBEAN_ATTRIBUTE_INFO=MBeanAttributeInfo
MBEAN_INFO=MBeanInfo
MBEAN_NOTIFICATION_INFO=MBeanNotificationInfo
MBEAN_OPERATION_INFO=MBeanOperationInfo
MBEANS=MBeans
-MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON=\u30af\u30ea\u30a2(&C)
-MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP=\u901a\u77e5\u306e\u30af\u30ea\u30a2
-MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE=\u30b3\u30f3\u30dd\u30b8\u30c3\u30c8\u30fb\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3{0}/{1}
-MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE=\u30b3\u30f3\u30dd\u30b8\u30c3\u30c8\u30fb\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3
-MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON=\u30ea\u30d5\u30ec\u30c3\u30b7\u30e5(&R)
-MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP=\u5c5e\u6027\u306e\u30ea\u30d5\u30ec\u30c3\u30b7\u30e5
-MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON=\u30b5\u30d6\u30b9\u30af\u30e9\u30a4\u30d6(&S)
-MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u901a\u77e5\u30ea\u30b9\u30cb\u30f3\u30b0\u306e\u958b\u59cb
-MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE=\u30bf\u30d6\u30fb\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3{0}/{1}
-MBEANS_TAB_TABULAR_NAVIGATION_SINGLE=\u30bf\u30d6\u30fb\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3
-MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON=\u30b5\u30d6\u30b9\u30af\u30e9\u30a4\u30d6\u89e3\u9664(&U)
-MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u901a\u77e5\u30ea\u30b9\u30cb\u30f3\u30b0\u306e\u505c\u6b62
-MANAGE_HOTSPOT_MBEANS_IN_COLON_=Hotspot MBeans\u306e\u7ba1\u7406:
+MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON=\u30AF\u30EA\u30A2(&C)
+MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP=\u901A\u77E5\u306E\u30AF\u30EA\u30A2
+MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE=\u30B3\u30F3\u30DD\u30B8\u30C3\u30C8\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3{0}/{1}
+MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE=\u30B3\u30F3\u30DD\u30B8\u30C3\u30C8\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3
+MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON=\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5(&R)
+MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP=\u5C5E\u6027\u306E\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5
+MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON=\u30B5\u30D6\u30B9\u30AF\u30E9\u30A4\u30D6(&S)
+MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u901A\u77E5\u30EA\u30B9\u30CB\u30F3\u30B0\u306E\u958B\u59CB
+MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE=\u30BF\u30D6\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3{0}/{1}
+MBEANS_TAB_TABULAR_NAVIGATION_SINGLE=\u30BF\u30D6\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3
+MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON=\u30B5\u30D6\u30B9\u30AF\u30E9\u30A4\u30D6\u89E3\u9664(&U)
+MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u901A\u77E5\u30EA\u30B9\u30CB\u30F3\u30B0\u306E\u505C\u6B62
+MANAGE_HOTSPOT_MBEANS_IN_COLON_=Hotspot MBeans\u306E\u7BA1\u7406:
MAX=\u6700\u5927
-MAXIMUM_HEAP_SIZE=\u6700\u5927\u30d2\u30fc\u30d7\u30fb\u30b5\u30a4\u30ba
-MEMORY=\u30e1\u30e2\u30ea\u30fc
-MEMORY_POOL_LABEL=\u30e1\u30e2\u30ea\u30fc\u30fb\u30d7\u30fc\u30eb"{0}"
-MEMORY_TAB_HEAP_PLOTTER_ACCESSIBLE_NAME=\u30d2\u30fc\u30d7\u7528\u306e\u30e1\u30e2\u30ea\u30fc\u4f7f\u7528\u7387\u30c1\u30e3\u30fc\u30c8\u3002
-MEMORY_TAB_INFO_LABEL_FORMAT=<html>\u4f7f\u7528\u6e08: {0} \u30b3\u30df\u30c3\u30c8\u6e08: {1} \u6700\u5927: {2}</html>
-MEMORY_TAB_NON_HEAP_PLOTTER_ACCESSIBLE_NAME=\u975e\u30d2\u30fc\u30d7\u7528\u306e\u30e1\u30e2\u30ea\u30fc\u4f7f\u7528\u7387\u30c1\u30e3\u30fc\u30c8\u3002
-MEMORY_TAB_POOL_CHART_ABOVE_THRESHOLD={0}\u306e\u3057\u304d\u3044\u5024\u3088\u308a\u4e0a\u3067\u3059\u3002\n
-MEMORY_TAB_POOL_CHART_ACCESSIBLE_NAME=\u30e1\u30e2\u30ea\u30fc\u30fb\u30d7\u30fc\u30eb\u4f7f\u7528\u7387\u30c1\u30e3\u30fc\u30c8\u3002
-MEMORY_TAB_POOL_CHART_BELOW_THRESHOLD={0}\u306e\u3057\u304d\u3044\u5024\u3088\u308a\u4e0b\u3067\u3059\u3002\n
-MEMORY_TAB_POOL_PLOTTER_ACCESSIBLE_NAME={0}\u306e\u30e1\u30e2\u30ea\u30fc\u4f7f\u7528\u7387\u30c1\u30e3\u30fc\u30c8\u3002
-MESSAGE=\u30e1\u30c3\u30bb\u30fc\u30b8
-METHOD_SUCCESSFULLY_INVOKED=\u30e1\u30bd\u30c3\u30c9\u304c\u6b63\u5e38\u306b\u8d77\u52d5\u3055\u308c\u307e\u3057\u305f
-MINIMIZE_ALL=\u3059\u3079\u3066\u6700\u5c0f\u5316(&M)
-MONITOR_LOCKED=\ \ \ - \u30ed\u30c3\u30af\u6e08{0}\n
-NAME=\u540d\u524d
-NAME_AND_BUILD={0} (\u30d3\u30eb\u30c9{1})
-NAME_STATE=\u540d\u524d: {0}\n\u72b6\u614b: {1}\n
-NAME_STATE_LOCK_NAME=\u540d\u524d: {0}\n\u72b6\u614b: {2}\u306e{1}\n
-NAME_STATE_LOCK_NAME_LOCK_OWNER=\u540d\u524d: {0}\n\u72b6\u614b: {2}\u306e{1}\u3001\u6240\u6709\u8005: {3}\n
-NEW_CONNECTION_ELLIPSIS=\u65b0\u898f\u63a5\u7d9a(&N)...
-NO_DEADLOCK_DETECTED=\u30c7\u30c3\u30c9\u30ed\u30c3\u30af\u304c\u691c\u51fa\u3055\u308c\u307e\u305b\u3093\u3067\u3057\u305f
-NON_HEAP_MEMORY_USAGE=\u975e\u30d2\u30fc\u30d7\u30fb\u30e1\u30e2\u30ea\u30fc\u4f7f\u7528\u7387
-NON_HEAP=\u975e\u30d2\u30fc\u30d7
-NOTIFICATION=\u901a\u77e5
-NOTIFICATION_BUFFER=\u901a\u77e5\u30d0\u30c3\u30d5\u30a1
-NOTIFICATIONS=\u901a\u77e5
+MAXIMUM_HEAP_SIZE=\u6700\u5927\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA
+MEMORY=\u30E1\u30E2\u30EA\u30FC
+MEMORY_POOL_LABEL=\u30E1\u30E2\u30EA\u30FC\u30FB\u30D7\u30FC\u30EB"{0}"
+MEMORY_TAB_HEAP_PLOTTER_ACCESSIBLE_NAME=\u30D2\u30FC\u30D7\u7528\u306E\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387\u30C1\u30E3\u30FC\u30C8\u3002
+MEMORY_TAB_INFO_LABEL_FORMAT=<html>\u4F7F\u7528\u6E08: {0} \u30B3\u30DF\u30C3\u30C8\u6E08: {1} \u6700\u5927: {2}</html>
+MEMORY_TAB_NON_HEAP_PLOTTER_ACCESSIBLE_NAME=\u975E\u30D2\u30FC\u30D7\u7528\u306E\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387\u30C1\u30E3\u30FC\u30C8\u3002
+MEMORY_TAB_POOL_CHART_ABOVE_THRESHOLD={0}\u306E\u3057\u304D\u3044\u5024\u3088\u308A\u4E0A\u3067\u3059\u3002\n
+MEMORY_TAB_POOL_CHART_ACCESSIBLE_NAME=\u30E1\u30E2\u30EA\u30FC\u30FB\u30D7\u30FC\u30EB\u4F7F\u7528\u7387\u30C1\u30E3\u30FC\u30C8\u3002
+MEMORY_TAB_POOL_CHART_BELOW_THRESHOLD={0}\u306E\u3057\u304D\u3044\u5024\u3088\u308A\u4E0B\u3067\u3059\u3002\n
+MEMORY_TAB_POOL_PLOTTER_ACCESSIBLE_NAME={0}\u306E\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387\u30C1\u30E3\u30FC\u30C8\u3002
+MESSAGE=\u30E1\u30C3\u30BB\u30FC\u30B8
+METHOD_SUCCESSFULLY_INVOKED=\u30E1\u30BD\u30C3\u30C9\u304C\u6B63\u5E38\u306B\u8D77\u52D5\u3055\u308C\u307E\u3057\u305F
+MINIMIZE_ALL=\u3059\u3079\u3066\u6700\u5C0F\u5316(&M)
+MONITOR_LOCKED=\ - \u30ED\u30C3\u30AF\u6E08{0}\n
+NAME=\u540D\u524D
+NAME_AND_BUILD={0} (\u30D3\u30EB\u30C9{1})
+NAME_STATE=\u540D\u524D: {0}\n\u72B6\u614B: {1}\n
+NAME_STATE_LOCK_NAME=\u540D\u524D: {0}\n\u72B6\u614B: {2}\u306E{1}\n
+NAME_STATE_LOCK_NAME_LOCK_OWNER=\u540D\u524D: {0}\n\u72B6\u614B: {2}\u306E{1}\u3001\u6240\u6709\u8005: {3}\n
+NEW_CONNECTION_ELLIPSIS=\u65B0\u898F\u63A5\u7D9A(&N)...
+NO_DEADLOCK_DETECTED=\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF\u304C\u691C\u51FA\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F
+NON_HEAP_MEMORY_USAGE=\u975E\u30D2\u30FC\u30D7\u30FB\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387
+NON_HEAP=\u975E\u30D2\u30FC\u30D7
+NOTIFICATION=\u901A\u77E5
+NOTIFICATION_BUFFER=\u901A\u77E5\u30D0\u30C3\u30D5\u30A1
+NOTIFICATIONS=\u901A\u77E5
NOTIF_TYPES=NotifTypes
-NUMBER_OF_THREADS=\u30b9\u30ec\u30c3\u30c9\u6570
-NUMBER_OF_LOADED_CLASSES=\u30ed\u30fc\u30c9\u6e08\u30af\u30e9\u30b9\u6570
-NUMBER_OF_PROCESSORS=\u30d7\u30ed\u30bb\u30c3\u30b5\u6570
+NUMBER_OF_THREADS=\u30B9\u30EC\u30C3\u30C9\u6570
+NUMBER_OF_LOADED_CLASSES=\u30ED\u30FC\u30C9\u6E08\u30AF\u30E9\u30B9\u6570
+NUMBER_OF_PROCESSORS=\u30D7\u30ED\u30BB\u30C3\u30B5\u6570
OBJECT_NAME=ObjectName
-OPERATING_SYSTEM=\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30fb\u30b7\u30b9\u30c6\u30e0
-OPERATION=\u64cd\u4f5c
-OPERATION_INVOCATION=\u64cd\u4f5c\u306e\u547c\u51fa\u3057
-OPERATION_RETURN_VALUE=\u64cd\u4f5c\u306e\u623b\u308a\u5024
-OPERATIONS=\u64cd\u4f5c
+OPERATING_SYSTEM=\u30AA\u30DA\u30EC\u30FC\u30C6\u30A3\u30F3\u30B0\u30FB\u30B7\u30B9\u30C6\u30E0
+OPERATION=\u64CD\u4F5C
+OPERATION_INVOCATION=\u64CD\u4F5C\u306E\u547C\u51FA\u3057
+OPERATION_RETURN_VALUE=\u64CD\u4F5C\u306E\u623B\u308A\u5024
+OPERATIONS=\u64CD\u4F5C
OVERVIEW=\u6982\u8981
-OVERVIEW_PANEL_PLOTTER_ACCESSIBLE_NAME={0}\u306e\u30c1\u30e3\u30fc\u30c8\u3002
-PARAMETER=\u30d1\u30e9\u30e1\u30fc\u30bf
-PASSWORD_ACCESSIBLE_NAME=\u30d1\u30b9\u30ef\u30fc\u30c9
-PASSWORD_COLON_=\u30d1\u30b9\u30ef\u30fc\u30c9(P):
-PEAK=\u30d4\u30fc\u30af
-PERFORM_GC=GC\u306e\u5b9f\u884c(G)
-PERFORM_GC_TOOLTIP=\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u30ea\u30af\u30a8\u30b9\u30c8
-PLOTTER_ACCESSIBLE_NAME=\u30c1\u30e3\u30fc\u30c8
+OVERVIEW_PANEL_PLOTTER_ACCESSIBLE_NAME={0}\u306E\u30C1\u30E3\u30FC\u30C8\u3002
+PARAMETER=\u30D1\u30E9\u30E1\u30FC\u30BF
+PASSWORD_ACCESSIBLE_NAME=\u30D1\u30B9\u30EF\u30FC\u30C9
+PASSWORD_COLON_=\u30D1\u30B9\u30EF\u30FC\u30C9(&P):
+PEAK=\u30D4\u30FC\u30AF
+PERFORM_GC=GC\u306E\u5B9F\u884C(&G)
+PERFORM_GC_TOOLTIP=\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306E\u30EA\u30AF\u30A8\u30B9\u30C8
+PLOTTER_ACCESSIBLE_NAME=\u30C1\u30E3\u30FC\u30C8
PLOTTER_ACCESSIBLE_NAME_KEY_AND_VALUE={0}={1}\n
-PLOTTER_ACCESSIBLE_NAME_NO_DATA=\u30c7\u30fc\u30bf\u304c\u30d7\u30ed\u30c3\u30c8\u3055\u308c\u307e\u305b\u3093\u3002
-PLOTTER_SAVE_AS_MENU_ITEM=\u540d\u524d\u3092\u4ed8\u3051\u3066\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58(&A)...
-PLOTTER_TIME_RANGE_MENU=\u6642\u9593\u7bc4\u56f2(&T)
-PROBLEM_ADDING_LISTENER=\u30ea\u30b9\u30ca\u30fc\u8ffd\u52a0\u4e2d\u306e\u554f\u984c
-PROBLEM_DISPLAYING_MBEAN=MBean\u8868\u793a\u4e2d\u306e\u554f\u984c
-PROBLEM_INVOKING=\u547c\u51fa\u3057\u4e2d\u306e\u554f\u984c
-PROBLEM_REMOVING_LISTENER=\u30ea\u30b9\u30ca\u30fc\u524a\u9664\u4e2d\u306e\u554f\u984c
-PROBLEM_SETTING_ATTRIBUTE=\u5c5e\u6027\u8a2d\u5b9a\u4e2d\u306e\u554f\u984c
-PROCESS_CPU_TIME=\u30d7\u30ed\u30bb\u30b9CPU\u6642\u9593
-READABLE=\u8aad\u53d6\u308a\u53ef\u80fd
-RECONNECT=\u518d\u63a5\u7d9a
-REMOTE_PROCESS_COLON=\u30ea\u30e2\u30fc\u30c8\u30fb\u30d7\u30ed\u30bb\u30b9(&R):
-REMOTE_PROCESS_TEXT_FIELD_ACCESSIBLE_NAME=\u30ea\u30e2\u30fc\u30c8\u30fb\u30d7\u30ed\u30bb\u30b9
-RESTORE_ALL=\u3059\u3079\u3066\u5fa9\u5143(&R)
+PLOTTER_ACCESSIBLE_NAME_NO_DATA=\u30C7\u30FC\u30BF\u304C\u30D7\u30ED\u30C3\u30C8\u3055\u308C\u307E\u305B\u3093\u3002
+PLOTTER_SAVE_AS_MENU_ITEM=\u540D\u524D\u3092\u4ED8\u3051\u3066\u30C7\u30FC\u30BF\u3092\u4FDD\u5B58(&A)...
+PLOTTER_TIME_RANGE_MENU=\u6642\u9593\u7BC4\u56F2(&T)
+PROBLEM_ADDING_LISTENER=\u30EA\u30B9\u30CA\u30FC\u8FFD\u52A0\u4E2D\u306E\u554F\u984C
+PROBLEM_DISPLAYING_MBEAN=MBean\u8868\u793A\u4E2D\u306E\u554F\u984C
+PROBLEM_INVOKING=\u547C\u51FA\u3057\u4E2D\u306E\u554F\u984C
+PROBLEM_REMOVING_LISTENER=\u30EA\u30B9\u30CA\u30FC\u524A\u9664\u4E2D\u306E\u554F\u984C
+PROBLEM_SETTING_ATTRIBUTE=\u5C5E\u6027\u8A2D\u5B9A\u4E2D\u306E\u554F\u984C
+PROCESS_CPU_TIME=\u30D7\u30ED\u30BB\u30B9CPU\u6642\u9593
+READABLE=\u8AAD\u53D6\u308A\u53EF\u80FD
+RECONNECT=\u518D\u63A5\u7D9A
+REMOTE_PROCESS_COLON=\u30EA\u30E2\u30FC\u30C8\u30FB\u30D7\u30ED\u30BB\u30B9(&R):
+REMOTE_PROCESS_TEXT_FIELD_ACCESSIBLE_NAME=\u30EA\u30E2\u30FC\u30C8\u30FB\u30D7\u30ED\u30BB\u30B9
+RESTORE_ALL=\u3059\u3079\u3066\u5FA9\u5143(&R)
RETURN_TYPE=ReturnType
SEQ_NUM=SeqNum
-SIZE_BYTES={0,number,integer}\u30d0\u30a4\u30c8
+SIZE_BYTES={0,number,integer}\u30D0\u30A4\u30C8
SIZE_GB={0} Gb
SIZE_KB={0} Kb
SIZE_MB={0} Mb
-SOURCE=\u30bd\u30fc\u30b9
-STACK_TRACE=\n\u30b9\u30bf\u30c3\u30af\u30fb\u30c8\u30ec\u30fc\u30b9: \n
+SOURCE=\u30BD\u30FC\u30B9
+STACK_TRACE=\n\u30B9\u30BF\u30C3\u30AF\u30FB\u30C8\u30EC\u30FC\u30B9: \n
SUMMARY_TAB_HEADER_DATE_TIME_FORMAT=FULL,FULL
-SUMMARY_TAB_PENDING_FINALIZATION_LABEL=\u30d5\u30a1\u30a4\u30ca\u30e9\u30a4\u30ba\u306e\u30da\u30f3\u30c7\u30a3\u30f3\u30b0
-SUMMARY_TAB_PENDING_FINALIZATION_VALUE={0}\u500b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8
-SUMMARY_TAB_TAB_NAME=VM\u30b5\u30de\u30ea\u30fc
-SUMMARY_TAB_VM_VERSION={0}\u30d0\u30fc\u30b8\u30e7\u30f3{1}
-THREADS=\u30b9\u30ec\u30c3\u30c9
-THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME=\u30b9\u30ec\u30c3\u30c9\u60c5\u5831
-THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME=\u30b9\u30ec\u30c3\u30c9\u6570\u306e\u30c1\u30e3\u30fc\u30c8\u3002
-THRESHOLD=\u3057\u304d\u3044\u5024
-TILE=\u4e26\u3079\u3066\u8868\u793a(&T)
-TIME_RANGE_COLON=\u6642\u9593\u7bc4\u56f2(&T):
+SUMMARY_TAB_PENDING_FINALIZATION_LABEL=\u30D5\u30A1\u30A4\u30CA\u30E9\u30A4\u30BA\u306E\u30DA\u30F3\u30C7\u30A3\u30F3\u30B0
+SUMMARY_TAB_PENDING_FINALIZATION_VALUE={0}\u500B\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8
+SUMMARY_TAB_TAB_NAME=VM\u30B5\u30DE\u30EA\u30FC
+SUMMARY_TAB_VM_VERSION={0}\u30D0\u30FC\u30B8\u30E7\u30F3{1}
+THREADS=\u30B9\u30EC\u30C3\u30C9
+THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME=\u30B9\u30EC\u30C3\u30C9\u60C5\u5831
+THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME=\u30B9\u30EC\u30C3\u30C9\u6570\u306E\u30C1\u30E3\u30FC\u30C8\u3002
+THRESHOLD=\u3057\u304D\u3044\u5024
+TILE=\u4E26\u3079\u3066\u8868\u793A(&T)
+TIME_RANGE_COLON=\u6642\u9593\u7BC4\u56F2(&T):
TIME=\u6642\u9593
TIME_STAMP=TimeStamp
-TOTAL_LOADED=\u30ed\u30fc\u30c9\u6e08\u5408\u8a08
-TOTAL_CLASSES_LOADED=\u30ed\u30fc\u30c9\u6e08\u30af\u30e9\u30b9\u5408\u8a08
-TOTAL_CLASSES_UNLOADED=\u30a2\u30f3\u30ed\u30fc\u30c9\u6e08\u30af\u30e9\u30b9\u5408\u8a08
-TOTAL_COMPILE_TIME=\u5408\u8a08\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u9593
-TOTAL_PHYSICAL_MEMORY=\u5408\u8a08\u7269\u7406\u30e1\u30e2\u30ea\u30fc
-TOTAL_THREADS_STARTED=\u958b\u59cb\u6e08\u5408\u8a08\u30b9\u30ec\u30c3\u30c9
-TOTAL_SWAP_SPACE=\u5408\u8a08\u30b9\u30ef\u30c3\u30d7\u30fb\u30b9\u30da\u30fc\u30b9
-TYPE=\u578b
-UNAVAILABLE=\u5229\u7528\u4e0d\u53ef
+TOTAL_LOADED=\u30ED\u30FC\u30C9\u6E08\u5408\u8A08
+TOTAL_CLASSES_LOADED=\u30ED\u30FC\u30C9\u6E08\u30AF\u30E9\u30B9\u5408\u8A08
+TOTAL_CLASSES_UNLOADED=\u30A2\u30F3\u30ED\u30FC\u30C9\u6E08\u30AF\u30E9\u30B9\u5408\u8A08
+TOTAL_COMPILE_TIME=\u5408\u8A08\u30B3\u30F3\u30D1\u30A4\u30EB\u6642\u9593
+TOTAL_PHYSICAL_MEMORY=\u5408\u8A08\u7269\u7406\u30E1\u30E2\u30EA\u30FC
+TOTAL_THREADS_STARTED=\u958B\u59CB\u6E08\u5408\u8A08\u30B9\u30EC\u30C3\u30C9
+TOTAL_SWAP_SPACE=\u5408\u8A08\u30B9\u30EF\u30C3\u30D7\u30FB\u30B9\u30DA\u30FC\u30B9
+TYPE=\u30BF\u30A4\u30D7
+UNAVAILABLE=\u5229\u7528\u4E0D\u53EF
UNKNOWN_CAPITALIZED=UNKNOWN
-UNKNOWN_HOST=\u4e0d\u660e\u306a\u30db\u30b9\u30c8: {0}
-UNREGISTER=\u767b\u9332\u89e3\u9664
-UPTIME=\u7a3c\u50cd\u6642\u9593
-USAGE_THRESHOLD=\u4f7f\u7528\u3057\u304d\u3044\u5024
-REMOTE_TF_USAGE=<b>\u4f7f\u7528\u65b9\u6cd5</b>: <hostname>:<port>\u307e\u305f\u306fservice:jmx:<protocol>:<sap>
-USED=\u4f7f\u7528\u6e08
-USERNAME_COLON_=\u30e6\u30fc\u30b6\u30fc\u540d(&U):
-USERNAME_ACCESSIBLE_NAME=\u30e6\u30fc\u30b6\u30fc\u540d
+UNKNOWN_HOST=\u4E0D\u660E\u306A\u30DB\u30B9\u30C8: {0}
+UNREGISTER=\u767B\u9332\u89E3\u9664
+UPTIME=\u7A3C\u50CD\u6642\u9593
+USAGE_THRESHOLD=\u4F7F\u7528\u3057\u304D\u3044\u5024
+REMOTE_TF_USAGE=<b>\u4F7F\u7528\u65B9\u6CD5</b>: <hostname>:<port>\u307E\u305F\u306Fservice:jmx:<protocol>:<sap>
+USED=\u4F7F\u7528\u6E08
+USERNAME_COLON_=\u30E6\u30FC\u30B6\u30FC\u540D(&U):
+USERNAME_ACCESSIBLE_NAME=\u30E6\u30FC\u30B6\u30FC\u540D
USER_DATA=UserData
-VIRTUAL_MACHINE=\u4eee\u60f3\u30de\u30b7\u30f3
-VM_ARGUMENTS=VM\u5f15\u6570
-VMINTERNAL_FRAME_ACCESSIBLE_DESCRIPTION=Java\u4eee\u60f3\u30de\u30b7\u30f3\u306e\u30e2\u30cb\u30bf\u30fc\u7528\u306e\u5185\u90e8\u30d5\u30ec\u30fc\u30e0
+VIRTUAL_MACHINE=\u4EEE\u60F3\u30DE\u30B7\u30F3
+VM_ARGUMENTS=VM\u5F15\u6570
+VMINTERNAL_FRAME_ACCESSIBLE_DESCRIPTION=Java\u4EEE\u60F3\u30DE\u30B7\u30F3\u306E\u30E2\u30CB\u30BF\u30FC\u7528\u306E\u5185\u90E8\u30D5\u30EC\u30FC\u30E0
VALUE=\u5024
-VENDOR=\u30d9\u30f3\u30c0\u30fc
-VERBOSE_OUTPUT=\u8a73\u7d30\u51fa\u529b
-VERBOSE_OUTPUT_TOOLTIP=\u30af\u30e9\u30b9\u8aad\u8fbc\u307f\u30b7\u30b9\u30c6\u30e0\u3067\u8a73\u7d30\u51fa\u529b\u3092\u6709\u52b9\u306b\u3059\u308b
-VIEW=\u8868\u793a
-WINDOW=\u30a6\u30a3\u30f3\u30c9\u30a6(&W)
-WINDOWS=\u30a6\u30a3\u30f3\u30c9\u30a6
-WRITABLE=\u66f8\u8fbc\u307f\u53ef\u80fd
-CONNECTION_FAILED1=\u63a5\u7d9a\u306b\u5931\u6557\u3057\u307e\u3057\u305f: \u518d\u8a66\u884c\u3057\u307e\u3059\u304b\u3002
-CONNECTION_FAILED2={0}\u3078\u306e\u63a5\u7d9a\u304c\u6210\u529f\u3057\u307e\u305b\u3093\u3067\u3057\u305f\u3002<br>\u3082\u3046\u4e00\u5ea6\u8a66\u3057\u307e\u3059\u304b\u3002
-CONNECTION_LOST1=\u63a5\u7d9a\u304c\u5931\u308f\u308c\u307e\u3057\u305f: \u518d\u63a5\u7d9a\u3057\u307e\u3059\u304b\u3002
-CONNECTING_TO1={0}\u306b\u63a5\u7d9a\u4e2d
-CONNECTING_TO2={0}\u306b\u73fe\u5728\u63a5\u7d9a\u4e2d\u3067\u3059\u3002<br>\u3053\u308c\u306b\u306f\u6570\u5206\u304b\u304b\u308a\u307e\u3059\u3002
-DEADLOCK_TAB=\u30c7\u30c3\u30c9\u30ed\u30c3\u30af
-DEADLOCK_TAB_N=\u30c7\u30c3\u30c9\u30ed\u30c3\u30af{0}
-EXPAND=\u5c55\u958b
+VENDOR=\u30D9\u30F3\u30C0\u30FC
+VERBOSE_OUTPUT=\u8A73\u7D30\u51FA\u529B
+VERBOSE_OUTPUT_TOOLTIP=\u30AF\u30E9\u30B9\u8AAD\u8FBC\u307F\u30B7\u30B9\u30C6\u30E0\u3067\u8A73\u7D30\u51FA\u529B\u3092\u6709\u52B9\u306B\u3059\u308B
+VIEW=\u8868\u793A
+WINDOW=\u30A6\u30A3\u30F3\u30C9\u30A6(&W)
+WINDOWS=\u30A6\u30A3\u30F3\u30C9\u30A6
+WRITABLE=\u66F8\u8FBC\u307F\u53EF\u80FD
+CONNECTION_FAILED1=\u63A5\u7D9A\u306B\u5931\u6557\u3057\u307E\u3057\u305F: \u518D\u8A66\u884C\u3057\u307E\u3059\u304B\u3002
+CONNECTION_FAILED2={0}\u3078\u306E\u63A5\u7D9A\u304C\u6210\u529F\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002<br>\u3082\u3046\u4E00\u5EA6\u8A66\u3057\u307E\u3059\u304B\u3002
+CONNECTION_LOST1=\u63A5\u7D9A\u304C\u5931\u308F\u308C\u307E\u3057\u305F: \u518D\u63A5\u7D9A\u3057\u307E\u3059\u304B\u3002
+CONNECTING_TO1={0}\u306B\u63A5\u7D9A\u4E2D
+CONNECTING_TO2={0}\u306B\u73FE\u5728\u63A5\u7D9A\u4E2D\u3067\u3059\u3002<br>\u3053\u308C\u306B\u306F\u6570\u5206\u304B\u304B\u308A\u307E\u3059\u3002
+DEADLOCK_TAB=\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF
+DEADLOCK_TAB_N=\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF{0}
+EXPAND=\u5C55\u958B
KBYTES={0} KB
-PLOT=\u30d7\u30ed\u30c3\u30c8
-VISUALIZE=\u8996\u899a\u5316
-ZZ_USAGE_TEXT=\u4f7f\u7528\u65b9\u6cd5: {0} [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]\n\n -interval \u66f4\u65b0\u9593\u9694\u3092n\u79d2\u306b\u8a2d\u5b9a\u3059\u308b(\u30c7\u30d5\u30a9\u30eb\u30c8\u306f4\u79d2)\n -notile \u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u6700\u521d\u306b\u4e26\u3079\u3066\u8868\u793a\u3057\u306a\u3044(2\u3064\u4ee5\u4e0a\u306e\u63a5\u7d9a\u306b\u3064\u3044\u3066)\n -pluginpath JConsole\u304c\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u53c2\u7167\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3059\u308b\u30d1\u30b9\u3092\u6307\u5b9a\u3059\u308b\n -version \u30d7\u30ed\u30b0\u30e9\u30e0\u30fb\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5370\u5237\u3059\u308b\n\n connection = pid || host:port || JMX URL (service:jmx:<protocol>://...)\n pid \u30bf\u30fc\u30b2\u30c3\u30c8\u30fb\u30d7\u30ed\u30bb\u30b9\u306e\u30d7\u30ed\u30bb\u30b9ID\n host \u30ea\u30e2\u30fc\u30c8\u30fb\u30db\u30b9\u30c8\u540d\u307e\u305f\u306fIP\u30a2\u30c9\u30ec\u30b9\n port \u30ea\u30e2\u30fc\u30c8\u63a5\u7d9a\u7528\u306e\u30dd\u30fc\u30c8\u756a\u53f7\n\n -J JConsole\u304c\u5b9f\u884c\u4e2d\u306eJava\u4eee\u60f3\u30de\u30b7\u30f3\u3078\u306e\n \u5165\u529b\u5f15\u6570\u3092\u6307\u5b9a\u3059\u308b
+PLOT=\u30D7\u30ED\u30C3\u30C8
+VISUALIZE=\u8996\u899A\u5316
+ZZ_USAGE_TEXT=\u4F7F\u7528\u65B9\u6CD5: {0} [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]\n\n -interval \u66F4\u65B0\u9593\u9694\u3092n\u79D2\u306B\u8A2D\u5B9A\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8\u306F4\u79D2)\n -notile \u30A6\u30A3\u30F3\u30C9\u30A6\u3092\u6700\u521D\u306B\u4E26\u3079\u3066\u8868\u793A\u3057\u306A\u3044(2\u3064\u4EE5\u4E0A\u306E\u63A5\u7D9A\u306B\u3064\u3044\u3066)\n -pluginpath JConsole\u304C\u30D7\u30E9\u30B0\u30A4\u30F3\u3092\u53C2\u7167\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3059\u308B\u30D1\u30B9\u3092\u6307\u5B9A\u3059\u308B\n -version \u30D7\u30ED\u30B0\u30E9\u30E0\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u5370\u5237\u3059\u308B\n\n connection = pid || host:port || JMX URL (service:jmx:<protocol>://...)\n pid \u30BF\u30FC\u30B2\u30C3\u30C8\u30FB\u30D7\u30ED\u30BB\u30B9\u306E\u30D7\u30ED\u30BB\u30B9ID\n host \u30EA\u30E2\u30FC\u30C8\u30FB\u30DB\u30B9\u30C8\u540D\u307E\u305F\u306FIP\u30A2\u30C9\u30EC\u30B9\n port \u30EA\u30E2\u30FC\u30C8\u63A5\u7D9A\u7528\u306E\u30DD\u30FC\u30C8\u756A\u53F7\n\n -J JConsole\u304C\u5B9F\u884C\u4E2D\u306EJava\u4EEE\u60F3\u30DE\u30B7\u30F3\u3078\u306E\n \u5165\u529B\u5F15\u6570\u3092\u6307\u5B9A\u3059\u308B
--- a/jdk/src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -1,273 +1,273 @@
ONE_DAY=\ 1 \u5929
-ONE_HOUR=\ 1 \u5c0f\u65f6
-ONE_MIN=\ 1 \u5206\u949f
-ONE_MONTH=\ 1 \u4e2a\u6708
-ONE_YEAR=\ 1 \u5e74
-TWO_HOURS=\ 2 \u5c0f\u65f6
-THREE_HOURS=\ 3 \u5c0f\u65f6
-THREE_MONTHS=\ 3 \u4e2a\u6708
-FIVE_MIN=\ 5 \u5206\u949f
-SIX_HOURS=\ 6 \u5c0f\u65f6
-SIX_MONTHS=\ 6 \u4e2a\u6708
+ONE_HOUR=\ 1 \u5C0F\u65F6
+ONE_MIN=\ 1 \u5206\u949F
+ONE_MONTH=\ 1 \u4E2A\u6708
+ONE_YEAR=\ 1 \u5E74
+TWO_HOURS=\ 2 \u5C0F\u65F6
+THREE_HOURS=\ 3 \u5C0F\u65F6
+THREE_MONTHS=\ 3 \u4E2A\u6708
+FIVE_MIN=\ 5 \u5206\u949F
+SIX_HOURS=\ 6 \u5C0F\u65F6
+SIX_MONTHS=\ 6 \u4E2A\u6708
SEVEN_DAYS=\ 7 \u5929
-TEN_MIN=10 \u5206\u949f
-TWELVE_HOURS=12 \u5c0f\u65f6
-THIRTY_MIN=30 \u5206\u949f
+TEN_MIN=10 \u5206\u949F
+TWELVE_HOURS=12 \u5C0F\u65F6
+THIRTY_MIN=30 \u5206\u949F
LESS_THAN=<
A_LOT_LESS_THAN=<<
GREATER_THAN=>
ACTION_CAPITALIZED=ACTION
ACTION_INFO_CAPITALIZED=ACTION_INFO
-ALL=\u5168\u90e8
-ARCHITECTURE=\u4f53\u7cfb\u7ed3\u6784
-ATTRIBUTE=\u5c5e\u6027
-ATTRIBUTE_VALUE=\u5c5e\u6027\u503c
-ATTRIBUTE_VALUES=\u5c5e\u6027\u503c
-ATTRIBUTES=\u5c5e\u6027
-BLANK=\u7a7a\u767d
-BLOCKED_COUNT_WAITED_COUNT=\u603b\u963b\u6b62\u6570: {0}, \u603b\u7b49\u5f85\u6570: {1}\n
-BOOT_CLASS_PATH=\u5f15\u5bfc\u7c7b\u8def\u5f84
-BORDERED_COMPONENT_MORE_OR_LESS_BUTTON_TOOLTIP=\u5207\u6362\u4ee5\u663e\u793a\u66f4\u591a\u6216\u66f4\u5c11\u4fe1\u606f
+ALL=\u5168\u90E8
+ARCHITECTURE=\u4F53\u7CFB\u7ED3\u6784
+ATTRIBUTE=\u5C5E\u6027
+ATTRIBUTE_VALUE=\u5C5E\u6027\u503C
+ATTRIBUTE_VALUES=\u5C5E\u6027\u503C
+ATTRIBUTES=\u5C5E\u6027
+BLANK=\u7A7A\u767D
+BLOCKED_COUNT_WAITED_COUNT=\u603B\u963B\u6B62\u6570: {0}, \u603B\u7B49\u5F85\u6570: {1}\n
+BOOT_CLASS_PATH=\u5F15\u5BFC\u7C7B\u8DEF\u5F84
+BORDERED_COMPONENT_MORE_OR_LESS_BUTTON_TOOLTIP=\u5207\u6362\u4EE5\u663E\u793A\u66F4\u591A\u6216\u66F4\u5C11\u4FE1\u606F
CPU_USAGE=CPU \u5360\u7528\u7387
CPU_USAGE_FORMAT=CPU \u5360\u7528\u7387: {0}%
-CANCEL=\u53d6\u6d88
-CASCADE=\u5c42\u53e0(&C)
-CHART_COLON=\u56fe\u8868(&C):
-CLASS_PATH=\u7c7b\u8def\u5f84
+CANCEL=\u53D6\u6D88
+CASCADE=\u5C42\u53E0(&C)
+CHART_COLON=\u56FE\u8868(&C):
+CLASS_PATH=\u7C7B\u8DEF\u5F84
CLASS_NAME=ClassName
-CLASS_TAB_INFO_LABEL_FORMAT=<html>\u5df2\u52a0\u8f7d: {0} \u5df2\u5378\u8f7d: {1} \u603b\u8ba1: {2}</html>
-CLASS_TAB_LOADED_CLASSES_PLOTTER_ACCESSIBLE_NAME=\u5df2\u52a0\u8f7d\u7c7b\u7684\u56fe\u8868\u3002
-CLASSES=\u7c7b
-CLOSE=\u5173\u95ed
-COLUMN_NAME=\u540d\u79f0
+CLASS_TAB_INFO_LABEL_FORMAT=<html>\u5DF2\u52A0\u8F7D: {0} \u5DF2\u5378\u8F7D: {1} \u603B\u8BA1: {2}</html>
+CLASS_TAB_LOADED_CLASSES_PLOTTER_ACCESSIBLE_NAME=\u5DF2\u52A0\u8F7D\u7C7B\u7684\u56FE\u8868\u3002
+CLASSES=\u7C7B
+CLOSE=\u5173\u95ED
+COLUMN_NAME=\u540D\u79F0
COLUMN_PID=PID
-COMMITTED_MEMORY=\u63d0\u4ea4\u7684\u5185\u5b58
-COMMITTED_VIRTUAL_MEMORY=\u63d0\u4ea4\u7684\u865a\u62df\u5185\u5b58
-COMMITTED=\u5df2\u63d0\u4ea4
-CONNECT=\u8fde\u63a5(&C)
-CONNECT_DIALOG_CONNECT_BUTTON_TOOLTIP=\u8fde\u63a5\u5230 Java \u865a\u62df\u673a
-CONNECT_DIALOG_ACCESSIBLE_DESCRIPTION=\u7528\u4e8e\u4e0e\u672c\u5730\u6216\u8fdc\u7a0b Java \u865a\u62df\u673a\u5efa\u7acb\u65b0\u8fde\u63a5\u7684\u5bf9\u8bdd\u6846
-CONNECT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u62a5\u5934\u56fe
-CONNECT_DIALOG_MASTHEAD_TITLE=\u65b0\u5efa\u8fde\u63a5
-CONNECT_DIALOG_STATUS_BAR_ACCESSIBLE_NAME=\u72b6\u6001\u680f
-CONNECT_DIALOG_TITLE=JConsole: \u65b0\u5efa\u8fde\u63a5
-CONNECTED_PUNCTUATION_CLICK_TO_DISCONNECT_=\u5df2\u8fde\u63a5\u3002\u5355\u51fb\u53ef\u65ad\u5f00\u8fde\u63a5\u3002
-CONNECTION_FAILED=\u8fde\u63a5\u5931\u8d25
-CONNECTION=\u8fde\u63a5(&C)
-CONNECTION_NAME=\u8fde\u63a5\u540d\u79f0
-CONNECTION_NAME__DISCONNECTED_={0} (\u5df2\u65ad\u5f00\u8fde\u63a5)
+COMMITTED_MEMORY=\u63D0\u4EA4\u7684\u5185\u5B58
+COMMITTED_VIRTUAL_MEMORY=\u63D0\u4EA4\u7684\u865A\u62DF\u5185\u5B58
+COMMITTED=\u5DF2\u63D0\u4EA4
+CONNECT=\u8FDE\u63A5(&C)
+CONNECT_DIALOG_CONNECT_BUTTON_TOOLTIP=\u8FDE\u63A5\u5230 Java \u865A\u62DF\u673A
+CONNECT_DIALOG_ACCESSIBLE_DESCRIPTION=\u7528\u4E8E\u4E0E\u672C\u5730\u6216\u8FDC\u7A0B Java \u865A\u62DF\u673A\u5EFA\u7ACB\u65B0\u8FDE\u63A5\u7684\u5BF9\u8BDD\u6846
+CONNECT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u62A5\u5934\u56FE
+CONNECT_DIALOG_MASTHEAD_TITLE=\u65B0\u5EFA\u8FDE\u63A5
+CONNECT_DIALOG_STATUS_BAR_ACCESSIBLE_NAME=\u72B6\u6001\u680F
+CONNECT_DIALOG_TITLE=JConsole: \u65B0\u5EFA\u8FDE\u63A5
+CONNECTED_PUNCTUATION_CLICK_TO_DISCONNECT_=\u5DF2\u8FDE\u63A5\u3002\u5355\u51FB\u53EF\u65AD\u5F00\u8FDE\u63A5\u3002
+CONNECTION_FAILED=\u8FDE\u63A5\u5931\u8D25
+CONNECTION=\u8FDE\u63A5(&C)
+CONNECTION_NAME=\u8FDE\u63A5\u540D\u79F0
+CONNECTION_NAME__DISCONNECTED_={0} (\u5DF2\u65AD\u5F00\u8FDE\u63A5)
CONSTRUCTOR=\u6784\u9020\u5668
-CURRENT_CLASSES_LOADED=\u5df2\u52a0\u88c5\u5f53\u524d\u7c7b
-CURRENT_HEAP_SIZE=\u5f53\u524d\u5806\u5927\u5c0f
-CURRENT_VALUE=\u5f53\u524d\u503c: {0}
-CREATE=\u521b\u5efa
-DAEMON_THREADS=\u5b88\u62a4\u7a0b\u5e8f\u7ebf\u7a0b
-DISCONNECTED_PUNCTUATION_CLICK_TO_CONNECT_=\u5df2\u65ad\u5f00\u8fde\u63a5\u3002\u5355\u51fb\u53ef\u8fde\u63a5\u3002
-DOUBLE_CLICK_TO_EXPAND_FORWARD_SLASH_COLLAPSE=\u53cc\u51fb\u4ee5\u5c55\u5f00/\u9690\u85cf
-DOUBLE_CLICK_TO_VISUALIZE=\u53cc\u51fb\u4ee5\u4f7f\u5176\u53ef\u89c1
-DESCRIPTION=\u8bf4\u660e
-DESCRIPTOR=\u63cf\u8ff0\u7b26
-DETAILS=\u8be6\u7ec6\u8d44\u6599
-DETECT_DEADLOCK=\u68c0\u6d4b\u6b7b\u9501(&D)
-DETECT_DEADLOCK_TOOLTIP=\u68c0\u6d4b\u5904\u4e8e\u6b7b\u9501\u72b6\u6001\u7684\u7ebf\u7a0b
-DIMENSION_IS_NOT_SUPPORTED_COLON=\u4e0d\u652f\u6301\u7ef4:
-DISCARD_CHART=\u653e\u5f03\u56fe\u8868
-DURATION_DAYS_HOURS_MINUTES={0,choice,1#{0,number,integer} \u5929 |1.0<{0,number,integer} \u5929 }{1,choice,0<{1,number,integer} \u5c0f\u65f6 |1#{1,number,integer} \u5c0f\u65f6 |1<{1,number,integer} \u5c0f\u65f6 }{2,choice,0<{2,number,integer} \u5206\u949f|1#{2,number,integer} \u5206\u949f|1.0<{2,number,integer} \u5206\u949f}
-DURATION_HOURS_MINUTES={0,choice,1#{0,number,integer} \u5c0f\u65f6 |1<{0,number,integer} \u5c0f\u65f6 }{1,choice,0<{1,number,integer} \u5206\u949f|1#{1,number,integer} \u5206\u949f|1.0<{1,number,integer} \u5206\u949f}
-DURATION_MINUTES={0,choice,1#{0,number,integer} \u5206\u949f|1.0<{0,number,integer} \u5206\u949f}
-DURATION_SECONDS={0} \u79d2
-EMPTY_ARRAY=\u7a7a\u6570\u7ec4
-ERROR=\u9519\u8bef
-ERROR_COLON_MBEANS_ALREADY_EXIST=\u9519\u8bef: MBean \u5df2\u5b58\u5728
-ERROR_COLON_MBEANS_DO_NOT_EXIST=\u9519\u8bef: MBean \u4e0d\u5b58\u5728
-EVENT=\u4e8b\u4ef6
-EXIT=\u9000\u51fa(&X)
-FAIL_TO_LOAD_PLUGIN=\u8b66\u544a: \u65e0\u6cd5\u52a0\u8f7d\u63d2\u4ef6: {0}
-FILE_CHOOSER_FILE_EXISTS_CANCEL_OPTION=\u53d6\u6d88
-FILE_CHOOSER_FILE_EXISTS_MESSAGE=<html><center>\u6587\u4ef6\u5df2\u5b58\u5728:<br>{0}<br>\u662f\u5426\u8981\u66ff\u6362?
-FILE_CHOOSER_FILE_EXISTS_OK_OPTION=\u66ff\u6362
-FILE_CHOOSER_FILE_EXISTS_TITLE=\u6587\u4ef6\u5df2\u5b58\u5728
-FILE_CHOOSER_SAVED_FILE=<html>\u5df2\u4fdd\u5b58\u5230\u6587\u4ef6:<br>{0}<br>({1} \u5b57\u8282)
-FILE_CHOOSER_SAVE_FAILED_MESSAGE=<html><center>\u672a\u80fd\u4fdd\u5b58\u5230\u6587\u4ef6:<br>{0}<br>{1}
-FILE_CHOOSER_SAVE_FAILED_TITLE=\u4fdd\u5b58\u5931\u8d25
-FREE_PHYSICAL_MEMORY=\u7a7a\u95f2\u7269\u7406\u5185\u5b58
-FREE_SWAP_SPACE=\u7a7a\u95f2\u4ea4\u6362\u7a7a\u95f4
-GARBAGE_COLLECTOR=\u5783\u573e\u6536\u96c6\u5668
-GC_INFO=\u540d\u79f0 = ''{0}'', \u6536\u96c6 = {1,choice,-1#Unavailable|0#{1,number,integer}}, \u603b\u82b1\u8d39\u65f6\u95f4 = {2}
-GC_TIME=GC \u65f6\u95f4
-GC_TIME_DETAILS={1}\u4e0a\u7684{0} ({2}\u6536\u96c6)
-HEAP_MEMORY_USAGE=\u5806\u5185\u5b58\u4f7f\u7528\u91cf
+CURRENT_CLASSES_LOADED=\u5DF2\u52A0\u88C5\u5F53\u524D\u7C7B
+CURRENT_HEAP_SIZE=\u5F53\u524D\u5806\u5927\u5C0F
+CURRENT_VALUE=\u5F53\u524D\u503C: {0}
+CREATE=\u521B\u5EFA
+DAEMON_THREADS=\u5B88\u62A4\u7A0B\u5E8F\u7EBF\u7A0B
+DISCONNECTED_PUNCTUATION_CLICK_TO_CONNECT_=\u5DF2\u65AD\u5F00\u8FDE\u63A5\u3002\u5355\u51FB\u53EF\u8FDE\u63A5\u3002
+DOUBLE_CLICK_TO_EXPAND_FORWARD_SLASH_COLLAPSE=\u53CC\u51FB\u4EE5\u5C55\u5F00/\u9690\u85CF
+DOUBLE_CLICK_TO_VISUALIZE=\u53CC\u51FB\u4EE5\u4F7F\u5176\u53EF\u89C1
+DESCRIPTION=\u8BF4\u660E
+DESCRIPTOR=\u63CF\u8FF0\u7B26
+DETAILS=\u8BE6\u7EC6\u4FE1\u606F
+DETECT_DEADLOCK=\u68C0\u6D4B\u6B7B\u9501(&D)
+DETECT_DEADLOCK_TOOLTIP=\u68C0\u6D4B\u5904\u4E8E\u6B7B\u9501\u72B6\u6001\u7684\u7EBF\u7A0B
+DIMENSION_IS_NOT_SUPPORTED_COLON=\u4E0D\u652F\u6301\u7EF4:
+DISCARD_CHART=\u653E\u5F03\u56FE\u8868
+DURATION_DAYS_HOURS_MINUTES={0,choice,1#{0,number,integer} \u5929 |1.0<{0,number,integer} \u5929 }{1,choice,0<{1,number,integer} \u5C0F\u65F6 |1#{1,number,integer} \u5C0F\u65F6 |1<{1,number,integer} \u5C0F\u65F6 }{2,choice,0<{2,number,integer} \u5206\u949F|1#{2,number,integer} \u5206\u949F|1.0<{2,number,integer} \u5206\u949F}
+DURATION_HOURS_MINUTES={0,choice,1#{0,number,integer} \u5C0F\u65F6 |1<{0,number,integer} \u5C0F\u65F6 }{1,choice,0<{1,number,integer} \u5206\u949F|1#{1,number,integer} \u5206\u949F|1.0<{1,number,integer} \u5206\u949F}
+DURATION_MINUTES={0,choice,1#{0,number,integer} \u5206\u949F|1.0<{0,number,integer} \u5206\u949F}
+DURATION_SECONDS={0} \u79D2
+EMPTY_ARRAY=\u7A7A\u6570\u7EC4
+ERROR=\u9519\u8BEF
+ERROR_COLON_MBEANS_ALREADY_EXIST=\u9519\u8BEF: MBean \u5DF2\u5B58\u5728
+ERROR_COLON_MBEANS_DO_NOT_EXIST=\u9519\u8BEF: MBean \u4E0D\u5B58\u5728
+EVENT=\u4E8B\u4EF6
+EXIT=\u9000\u51FA(&X)
+FAIL_TO_LOAD_PLUGIN=\u8B66\u544A: \u65E0\u6CD5\u52A0\u8F7D\u63D2\u4EF6: {0}
+FILE_CHOOSER_FILE_EXISTS_CANCEL_OPTION=\u53D6\u6D88
+FILE_CHOOSER_FILE_EXISTS_MESSAGE=<html><center>\u6587\u4EF6\u5DF2\u5B58\u5728:<br>{0}<br>\u662F\u5426\u8981\u66FF\u6362?
+FILE_CHOOSER_FILE_EXISTS_OK_OPTION=\u66FF\u6362
+FILE_CHOOSER_FILE_EXISTS_TITLE=\u6587\u4EF6\u5DF2\u5B58\u5728
+FILE_CHOOSER_SAVED_FILE=<html>\u5DF2\u4FDD\u5B58\u5230\u6587\u4EF6:<br>{0}<br>({1} \u5B57\u8282)
+FILE_CHOOSER_SAVE_FAILED_MESSAGE=<html><center>\u672A\u80FD\u4FDD\u5B58\u5230\u6587\u4EF6:<br>{0}<br>{1}
+FILE_CHOOSER_SAVE_FAILED_TITLE=\u4FDD\u5B58\u5931\u8D25
+FREE_PHYSICAL_MEMORY=\u7A7A\u95F2\u7269\u7406\u5185\u5B58
+FREE_SWAP_SPACE=\u7A7A\u95F2\u4EA4\u6362\u7A7A\u95F4
+GARBAGE_COLLECTOR=\u5783\u573E\u6536\u96C6\u5668
+GC_INFO=\u540D\u79F0 = ''{0}'', \u6536\u96C6 = {1,choice,-1#Unavailable|0#{1,number,integer}}, \u603B\u82B1\u8D39\u65F6\u95F4 = {2}
+GC_TIME=GC \u65F6\u95F4
+GC_TIME_DETAILS={1}\u4E0A\u7684{0} ({2}\u6536\u96C6)
+HEAP_MEMORY_USAGE=\u5806\u5185\u5B58\u4F7F\u7528\u91CF
HEAP=\u5806
-HELP_ABOUT_DIALOG_ACCESSIBLE_DESCRIPTION=\u5305\u542b\u6709\u5173 JConsole \u548c JDK \u7248\u672c\u4fe1\u606f\u7684\u5bf9\u8bdd\u6846
-HELP_ABOUT_DIALOG_JCONSOLE_VERSION=JConsole \u7248\u672c:<br>{0}
-HELP_ABOUT_DIALOG_JAVA_VERSION=Java VM \u7248\u672c:<br>{0}
-HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u62a5\u5934\u56fe
-HELP_ABOUT_DIALOG_MASTHEAD_TITLE=\u5173\u4e8e JConsole
-HELP_ABOUT_DIALOG_TITLE=JConsole: \u5173\u4e8e
+HELP_ABOUT_DIALOG_ACCESSIBLE_DESCRIPTION=\u5305\u542B\u6709\u5173 JConsole \u548C JDK \u7248\u672C\u4FE1\u606F\u7684\u5BF9\u8BDD\u6846
+HELP_ABOUT_DIALOG_JCONSOLE_VERSION=JConsole \u7248\u672C:<br>{0}
+HELP_ABOUT_DIALOG_JAVA_VERSION=Java VM \u7248\u672C:<br>{0}
+HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u62A5\u5934\u56FE
+HELP_ABOUT_DIALOG_MASTHEAD_TITLE=\u5173\u4E8E JConsole
+HELP_ABOUT_DIALOG_TITLE=JConsole: \u5173\u4E8E
HELP_ABOUT_DIALOG_USER_GUIDE_LINK=JConsole \u7528\u6237\u6307\u5357(&U):<br>{0}
HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL=http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html
-HELP_MENU_ABOUT_TITLE=\u5173\u4e8e JConsole(&A)
-HELP_MENU_USER_GUIDE_TITLE=\u8054\u673a\u7528\u6237\u6307\u5357(&U)
-HELP_MENU_TITLE=\u5e2e\u52a9(&H)
+HELP_MENU_ABOUT_TITLE=\u5173\u4E8E JConsole(&A)
+HELP_MENU_USER_GUIDE_TITLE=\u8054\u673A\u7528\u6237\u6307\u5357(&U)
+HELP_MENU_TITLE=\u5E2E\u52A9(&H)
HOTSPOT_MBEANS_ELLIPSIS=HotSpot MBean(&H)...
-HOTSPOT_MBEANS_DIALOG_ACCESSIBLE_DESCRIPTION=\u7528\u4e8e\u7ba1\u7406 HotSpot MBean \u7684\u5bf9\u8bdd\u6846
-IMPACT=\u5f71\u54cd
-INFO=\u4fe1\u606f
-INFO_CAPITALIZED=INFO
-INVALID_PLUGIN_PATH=\u8b66\u544a: \u63d2\u4ef6\u8def\u5f84\u65e0\u6548: {0}
-INVALID_URL=URL \u65e0\u6548: {0}
-IS=\u662f
-JAVA_MONITORING___MANAGEMENT_CONSOLE=Java \u76d1\u89c6\u548c\u7ba1\u7406\u63a7\u5236\u53f0
+HOTSPOT_MBEANS_DIALOG_ACCESSIBLE_DESCRIPTION=\u7528\u4E8E\u7BA1\u7406 HotSpot MBean \u7684\u5BF9\u8BDD\u6846
+IMPACT=\u5F71\u54CD
+INFO=\u4FE1\u606F
+INFO_CAPITALIZED=\u4FE1\u606F
+INVALID_PLUGIN_PATH=\u8B66\u544A: \u63D2\u4EF6\u8DEF\u5F84\u65E0\u6548: {0}
+INVALID_URL=URL \u65E0\u6548: {0}
+IS=\u662F
+JAVA_MONITORING___MANAGEMENT_CONSOLE=Java \u76D1\u89C6\u548C\u7BA1\u7406\u63A7\u5236\u53F0
JCONSOLE_COLON_=JConsole: {0}
-JCONSOLE_VERSION=JConsole \u7248\u672c "{0}"
-JCONSOLE_ACCESSIBLE_DESCRIPTION=Java \u76d1\u89c6\u548c\u7ba1\u7406\u63a7\u5236\u53f0
-JIT_COMPILER=JIT \u7f16\u8bd1\u5668
-LIBRARY_PATH=\u5e93\u8def\u5f84
-LIVE_THREADS=\u6d3b\u52a8\u7ebf\u7a0b
-LOADED=\u5df2\u52a0\u8f7d
-LOCAL_PROCESS_COLON=\u672c\u5730\u8fdb\u7a0b(&L):
+JCONSOLE_VERSION=JConsole \u7248\u672C "{0}"
+JCONSOLE_ACCESSIBLE_DESCRIPTION=Java \u76D1\u89C6\u548C\u7BA1\u7406\u63A7\u5236\u53F0
+JIT_COMPILER=JIT \u7F16\u8BD1\u5668
+LIBRARY_PATH=\u5E93\u8DEF\u5F84
+LIVE_THREADS=\u6D3B\u52A8\u7EBF\u7A0B
+LOADED=\u5DF2\u52A0\u8F7D
+LOCAL_PROCESS_COLON=\u672C\u5730\u8FDB\u7A0B(&L):
MASTHEAD_FONT=Dialog-PLAIN-25
-MANAGEMENT_NOT_ENABLED=<b>\u6ce8</b>: \u672a\u5bf9\u6b64\u8fdb\u7a0b\u542f\u7528\u7ba1\u7406\u4ee3\u7406\u3002
-MANAGEMENT_WILL_BE_ENABLED=<b>\u6ce8</b>: \u5c06\u5bf9\u6b64\u8fdb\u7a0b\u542f\u7528\u7ba1\u7406\u4ee3\u7406\u3002
+MANAGEMENT_NOT_ENABLED=<b>\u6CE8</b>: \u672A\u5BF9\u6B64\u8FDB\u7A0B\u542F\u7528\u7BA1\u7406\u4EE3\u7406\u3002
+MANAGEMENT_WILL_BE_ENABLED=<b>\u6CE8</b>: \u5C06\u5BF9\u6B64\u8FDB\u7A0B\u542F\u7528\u7BA1\u7406\u4EE3\u7406\u3002
MBEAN_ATTRIBUTE_INFO=MBeanAttributeInfo
MBEAN_INFO=MBeanInfo
MBEAN_NOTIFICATION_INFO=MBeanNotificationInfo
MBEAN_OPERATION_INFO=MBeanOperationInfo
MBEANS=MBean
-MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON=\u6e05\u9664(&C)
-MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP=\u6e05\u9664\u901a\u77e5
-MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE=\u7ec4\u5408\u5bfc\u822a{0}/{1}
-MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE=\u7ec4\u5408\u5bfc\u822a
-MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON=\u5237\u65b0(&R)
-MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP=\u5237\u65b0\u5c5e\u6027
-MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON=\u8ba2\u9605(&S)
-MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u5f00\u59cb\u76d1\u542c\u901a\u77e5
-MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE=\u8868\u683c\u5f0f\u5bfc\u822a{0}/{1}
-MBEANS_TAB_TABULAR_NAVIGATION_SINGLE=\u8868\u683c\u5f0f\u5bfc\u822a
-MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON=\u53d6\u6d88\u8ba2\u9605(&U)
-MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u505c\u6b62\u76d1\u542c\u901a\u77e5
-MANAGE_HOTSPOT_MBEANS_IN_COLON_=\u7ba1\u7406\u4ee5\u4e0b\u4f4d\u7f6e\u7684 HotSpot MBean:
-MAX=\u6700\u5927\u503c
-MAXIMUM_HEAP_SIZE=\u6700\u5927\u5806\u5927\u5c0f
-MEMORY=\u5185\u5b58
-MEMORY_POOL_LABEL=\u5185\u5b58\u6c60 "{0}"
-MEMORY_TAB_HEAP_PLOTTER_ACCESSIBLE_NAME=\u5806\u7684\u5185\u5b58\u4f7f\u7528\u91cf\u56fe\u8868\u3002
-MEMORY_TAB_INFO_LABEL_FORMAT=<html>\u5df2\u7528: {0} \u5df2\u63d0\u4ea4: {1} \u6700\u5927: {2}</html>
-MEMORY_TAB_NON_HEAP_PLOTTER_ACCESSIBLE_NAME=\u975e\u5806\u7684\u5185\u5b58\u4f7f\u7528\u91cf\u56fe\u8868\u3002
-MEMORY_TAB_POOL_CHART_ABOVE_THRESHOLD=\u5927\u4e8e{0}\u7684\u9608\u503c\u3002\n
-MEMORY_TAB_POOL_CHART_ACCESSIBLE_NAME=\u5185\u5b58\u6c60\u4f7f\u7528\u91cf\u56fe\u8868\u3002
-MEMORY_TAB_POOL_CHART_BELOW_THRESHOLD=\u4f4e\u4e8e{0}\u7684\u9608\u503c\u3002\n
-MEMORY_TAB_POOL_PLOTTER_ACCESSIBLE_NAME={0}\u7684\u5185\u5b58\u4f7f\u7528\u91cf\u56fe\u8868\u3002
-MESSAGE=\u6d88\u606f
-METHOD_SUCCESSFULLY_INVOKED=\u5df2\u6210\u529f\u8c03\u7528\u65b9\u6cd5
-MINIMIZE_ALL=\u5168\u90e8\u6700\u5c0f\u5316(&M)
-MONITOR_LOCKED=\ \ \ - \u5df2\u9501\u5b9a{0}\n
-NAME=\u540d\u79f0
-NAME_AND_BUILD={0} (\u5de5\u4f5c\u7248\u672c {1})
-NAME_STATE=\u540d\u79f0: {0}\n\u72b6\u6001: {1}\n
-NAME_STATE_LOCK_NAME=\u540d\u79f0: {0}\n\u72b6\u6001: {2}\u4e0a\u7684{1}\n
-NAME_STATE_LOCK_NAME_LOCK_OWNER=\u540d\u79f0: {0}\n\u72b6\u6001: {2}\u4e0a\u7684{1}, \u62e5\u6709\u8005: {3}\n
-NEW_CONNECTION_ELLIPSIS=\u65b0\u5efa\u8fde\u63a5(&N)...
-NO_DEADLOCK_DETECTED=\u672a\u68c0\u6d4b\u5230\u6b7b\u9501
-NON_HEAP_MEMORY_USAGE=\u975e\u5806\u5185\u5b58\u4f7f\u7528\u91cf
-NON_HEAP=\u975e\u5806
-NOTIFICATION=\u901a\u77e5
-NOTIFICATION_BUFFER=\u901a\u77e5\u7f13\u51b2\u533a
-NOTIFICATIONS=\u901a\u77e5
+MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON=\u6E05\u9664(&C)
+MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP=\u6E05\u9664\u901A\u77E5
+MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE=\u7EC4\u5408\u5BFC\u822A{0}/{1}
+MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE=\u7EC4\u5408\u5BFC\u822A
+MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON=\u5237\u65B0(&R)
+MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP=\u5237\u65B0\u5C5E\u6027
+MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON=\u8BA2\u9605(&S)
+MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u5F00\u59CB\u76D1\u542C\u901A\u77E5
+MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE=\u8868\u683C\u5F0F\u5BFC\u822A{0}/{1}
+MBEANS_TAB_TABULAR_NAVIGATION_SINGLE=\u8868\u683C\u5F0F\u5BFC\u822A
+MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON=\u53D6\u6D88\u8BA2\u9605(&U)
+MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u505C\u6B62\u76D1\u542C\u901A\u77E5
+MANAGE_HOTSPOT_MBEANS_IN_COLON_=\u7BA1\u7406\u4EE5\u4E0B\u4F4D\u7F6E\u7684 HotSpot MBean:
+MAX=\u6700\u5927\u503C
+MAXIMUM_HEAP_SIZE=\u6700\u5927\u5806\u5927\u5C0F
+MEMORY=\u5185\u5B58
+MEMORY_POOL_LABEL=\u5185\u5B58\u6C60 "{0}"
+MEMORY_TAB_HEAP_PLOTTER_ACCESSIBLE_NAME=\u5806\u7684\u5185\u5B58\u4F7F\u7528\u91CF\u56FE\u8868\u3002
+MEMORY_TAB_INFO_LABEL_FORMAT=<html>\u5DF2\u7528: {0} \u5DF2\u63D0\u4EA4: {1} \u6700\u5927: {2}</html>
+MEMORY_TAB_NON_HEAP_PLOTTER_ACCESSIBLE_NAME=\u975E\u5806\u7684\u5185\u5B58\u4F7F\u7528\u91CF\u56FE\u8868\u3002
+MEMORY_TAB_POOL_CHART_ABOVE_THRESHOLD=\u5927\u4E8E{0}\u7684\u9608\u503C\u3002\n
+MEMORY_TAB_POOL_CHART_ACCESSIBLE_NAME=\u5185\u5B58\u6C60\u4F7F\u7528\u91CF\u56FE\u8868\u3002
+MEMORY_TAB_POOL_CHART_BELOW_THRESHOLD=\u4F4E\u4E8E{0}\u7684\u9608\u503C\u3002\n
+MEMORY_TAB_POOL_PLOTTER_ACCESSIBLE_NAME={0}\u7684\u5185\u5B58\u4F7F\u7528\u91CF\u56FE\u8868\u3002
+MESSAGE=\u6D88\u606F
+METHOD_SUCCESSFULLY_INVOKED=\u5DF2\u6210\u529F\u8C03\u7528\u65B9\u6CD5
+MINIMIZE_ALL=\u5168\u90E8\u6700\u5C0F\u5316(&M)
+MONITOR_LOCKED=\ - \u5DF2\u9501\u5B9A {0}\n
+NAME=\u540D\u79F0
+NAME_AND_BUILD={0} (\u5DE5\u4F5C\u7248\u672C {1})
+NAME_STATE=\u540D\u79F0: {0}\n\u72B6\u6001: {1}\n
+NAME_STATE_LOCK_NAME=\u540D\u79F0: {0}\n\u72B6\u6001: {2}\u4E0A\u7684{1}\n
+NAME_STATE_LOCK_NAME_LOCK_OWNER=\u540D\u79F0: {0}\n\u72B6\u6001: {2}\u4E0A\u7684{1}, \u62E5\u6709\u8005: {3}\n
+NEW_CONNECTION_ELLIPSIS=\u65B0\u5EFA\u8FDE\u63A5(&N)...
+NO_DEADLOCK_DETECTED=\u672A\u68C0\u6D4B\u5230\u6B7B\u9501
+NON_HEAP_MEMORY_USAGE=\u975E\u5806\u5185\u5B58\u4F7F\u7528\u91CF
+NON_HEAP=\u975E\u5806
+NOTIFICATION=\u901A\u77E5
+NOTIFICATION_BUFFER=\u901A\u77E5\u7F13\u51B2\u533A
+NOTIFICATIONS=\u901A\u77E5
NOTIF_TYPES=NotifTypes
-NUMBER_OF_THREADS=\u7ebf\u7a0b\u6570
-NUMBER_OF_LOADED_CLASSES=\u5df2\u52a0\u8f7d\u7c7b\u6570
-NUMBER_OF_PROCESSORS=\u5904\u7406\u7a0b\u5e8f\u6570
+NUMBER_OF_THREADS=\u7EBF\u7A0B\u6570
+NUMBER_OF_LOADED_CLASSES=\u5DF2\u52A0\u8F7D\u7C7B\u6570
+NUMBER_OF_PROCESSORS=\u5904\u7406\u7A0B\u5E8F\u6570
OBJECT_NAME=ObjectName
-OPERATING_SYSTEM=\u64cd\u4f5c\u7cfb\u7edf
-OPERATION=\u64cd\u4f5c
-OPERATION_INVOCATION=\u64cd\u4f5c\u8c03\u7528
-OPERATION_RETURN_VALUE=\u64cd\u4f5c\u8fd4\u56de\u503c
-OPERATIONS=\u64cd\u4f5c
-OVERVIEW=\u6982\u89c8
-OVERVIEW_PANEL_PLOTTER_ACCESSIBLE_NAME={0}\u7684\u56fe\u8868\u3002
-PARAMETER=\u53c2\u6570
-PASSWORD_ACCESSIBLE_NAME=\u53e3\u4ee4
-PASSWORD_COLON_=\u53e3\u4ee4(&P):
-PEAK=\u5cf0\u503c
-PERFORM_GC=\u6267\u884c &GC
-PERFORM_GC_TOOLTIP=\u8bf7\u6c42\u5783\u573e\u6536\u96c6
-PLOTTER_ACCESSIBLE_NAME=\u56fe\u8868
+OPERATING_SYSTEM=\u64CD\u4F5C\u7CFB\u7EDF
+OPERATION=\u64CD\u4F5C
+OPERATION_INVOCATION=\u64CD\u4F5C\u8C03\u7528
+OPERATION_RETURN_VALUE=\u64CD\u4F5C\u8FD4\u56DE\u503C
+OPERATIONS=\u64CD\u4F5C
+OVERVIEW=\u6982\u89C8
+OVERVIEW_PANEL_PLOTTER_ACCESSIBLE_NAME={0}\u7684\u56FE\u8868\u3002
+PARAMETER=\u53C2\u6570
+PASSWORD_ACCESSIBLE_NAME=\u53E3\u4EE4
+PASSWORD_COLON_=\u53E3\u4EE4(&P):
+PEAK=\u5CF0\u503C
+PERFORM_GC=\u6267\u884C GC(&G)
+PERFORM_GC_TOOLTIP=\u8BF7\u6C42\u5783\u573E\u6536\u96C6
+PLOTTER_ACCESSIBLE_NAME=\u56FE\u8868
PLOTTER_ACCESSIBLE_NAME_KEY_AND_VALUE={0}={1}\n
-PLOTTER_ACCESSIBLE_NAME_NO_DATA=\u672a\u7ed8\u5236\u6570\u636e\u3002
-PLOTTER_SAVE_AS_MENU_ITEM=\u5c06\u6570\u636e\u53e6\u5b58\u4e3a(&A)...
-PLOTTER_TIME_RANGE_MENU=\u65f6\u95f4\u8303\u56f4(&T)
-PROBLEM_ADDING_LISTENER=\u6dfb\u52a0\u76d1\u542c\u7a0b\u5e8f\u65f6\u51fa\u73b0\u95ee\u9898
-PROBLEM_DISPLAYING_MBEAN=\u663e\u793a MBean \u65f6\u51fa\u73b0\u95ee\u9898
-PROBLEM_INVOKING=\u8c03\u7528\u65f6\u51fa\u73b0\u95ee\u9898
-PROBLEM_REMOVING_LISTENER=\u5220\u9664\u76d1\u542c\u7a0b\u5e8f\u65f6\u51fa\u73b0\u95ee\u9898
-PROBLEM_SETTING_ATTRIBUTE=\u8bbe\u7f6e\u5c5e\u6027\u65f6\u51fa\u73b0\u95ee\u9898
-PROCESS_CPU_TIME=\u8fdb\u7a0b CPU \u65f6\u95f4
-READABLE=\u53ef\u8bfb
-RECONNECT=\u91cd\u65b0\u8fde\u63a5
-REMOTE_PROCESS_COLON=\u8fdc\u7a0b\u8fdb\u7a0b(&R):
-REMOTE_PROCESS_TEXT_FIELD_ACCESSIBLE_NAME=\u8fdc\u7a0b\u8fdb\u7a0b
-RESTORE_ALL=\u5168\u90e8\u8fd8\u539f(&R)
+PLOTTER_ACCESSIBLE_NAME_NO_DATA=\u672A\u7ED8\u5236\u6570\u636E\u3002
+PLOTTER_SAVE_AS_MENU_ITEM=\u5C06\u6570\u636E\u53E6\u5B58\u4E3A(&A)...
+PLOTTER_TIME_RANGE_MENU=\u65F6\u95F4\u8303\u56F4(&T)
+PROBLEM_ADDING_LISTENER=\u6DFB\u52A0\u76D1\u542C\u7A0B\u5E8F\u65F6\u51FA\u73B0\u95EE\u9898
+PROBLEM_DISPLAYING_MBEAN=\u663E\u793A MBean \u65F6\u51FA\u73B0\u95EE\u9898
+PROBLEM_INVOKING=\u8C03\u7528\u65F6\u51FA\u73B0\u95EE\u9898
+PROBLEM_REMOVING_LISTENER=\u5220\u9664\u76D1\u542C\u7A0B\u5E8F\u65F6\u51FA\u73B0\u95EE\u9898
+PROBLEM_SETTING_ATTRIBUTE=\u8BBE\u7F6E\u5C5E\u6027\u65F6\u51FA\u73B0\u95EE\u9898
+PROCESS_CPU_TIME=\u8FDB\u7A0B CPU \u65F6\u95F4
+READABLE=\u53EF\u8BFB
+RECONNECT=\u91CD\u65B0\u8FDE\u63A5
+REMOTE_PROCESS_COLON=\u8FDC\u7A0B\u8FDB\u7A0B(&R):
+REMOTE_PROCESS_TEXT_FIELD_ACCESSIBLE_NAME=\u8FDC\u7A0B\u8FDB\u7A0B
+RESTORE_ALL=\u5168\u90E8\u8FD8\u539F(&R)
RETURN_TYPE=ReturnType
SEQ_NUM=SeqNum
-SIZE_BYTES={0,number,integer} \u5b57\u8282
-SIZE_GB={0} GB
-SIZE_KB={0} KB
-SIZE_MB={0} MB
-SOURCE=\u6e90
-STACK_TRACE=\n\u5806\u6808\u8ddf\u8e2a: \n
+SIZE_BYTES={0,number,integer} \u5B57\u8282
+SIZE_GB={0} Gb
+SIZE_KB={0} Kb
+SIZE_MB={0} Mb
+SOURCE=\u6E90
+STACK_TRACE=\n\u5806\u6808\u8DDF\u8E2A: \n
SUMMARY_TAB_HEADER_DATE_TIME_FORMAT=FULL,FULL
-SUMMARY_TAB_PENDING_FINALIZATION_LABEL=\u6682\u6302\u6700\u7ec8\u5904\u7406
-SUMMARY_TAB_PENDING_FINALIZATION_VALUE={0}\u5bf9\u8c61
+SUMMARY_TAB_PENDING_FINALIZATION_LABEL=\u6682\u6302\u6700\u7EC8\u5904\u7406
+SUMMARY_TAB_PENDING_FINALIZATION_VALUE={0}\u5BF9\u8C61
SUMMARY_TAB_TAB_NAME=VM \u6982\u8981
-SUMMARY_TAB_VM_VERSION={0}\u7248\u672c {1}
-THREADS=\u7ebf\u7a0b
-THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME=\u7ebf\u7a0b\u4fe1\u606f
-THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME=\u8868\u793a\u7ebf\u7a0b\u6570\u7684\u56fe\u8868\u3002
-THRESHOLD=\u9608\u503c
-TILE=\u5e73\u94fa(&T)
-TIME_RANGE_COLON=\u65f6\u95f4\u8303\u56f4(&T):
-TIME=\u65f6\u95f4
+SUMMARY_TAB_VM_VERSION={0}\u7248\u672C {1}
+THREADS=\u7EBF\u7A0B
+THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME=\u7EBF\u7A0B\u4FE1\u606F
+THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME=\u8868\u793A\u7EBF\u7A0B\u6570\u7684\u56FE\u8868\u3002
+THRESHOLD=\u9608\u503C
+TILE=\u5E73\u94FA(&T)
+TIME_RANGE_COLON=\u65F6\u95F4\u8303\u56F4(&T):
+TIME=\u65F6\u95F4
TIME_STAMP=TimeStamp
-TOTAL_LOADED=\u52a0\u8f7d\u603b\u6570
-TOTAL_CLASSES_LOADED=\u5df2\u52a0\u8f7d\u7c7b\u603b\u6570
-TOTAL_CLASSES_UNLOADED=\u5df2\u5378\u8f7d\u7c7b\u603b\u6570
-TOTAL_COMPILE_TIME=\u603b\u7f16\u8bd1\u65f6\u95f4
-TOTAL_PHYSICAL_MEMORY=\u603b\u7269\u7406\u5185\u5b58
-TOTAL_THREADS_STARTED=\u542f\u52a8\u7684\u7ebf\u7a0b\u603b\u6570
-TOTAL_SWAP_SPACE=\u603b\u4ea4\u6362\u7a7a\u95f4
-TYPE=\u7c7b\u578b
-UNAVAILABLE=\u4e0d\u53ef\u7528
+TOTAL_LOADED=\u52A0\u8F7D\u603B\u6570
+TOTAL_CLASSES_LOADED=\u5DF2\u52A0\u8F7D\u7C7B\u603B\u6570
+TOTAL_CLASSES_UNLOADED=\u5DF2\u5378\u8F7D\u7C7B\u603B\u6570
+TOTAL_COMPILE_TIME=\u603B\u7F16\u8BD1\u65F6\u95F4
+TOTAL_PHYSICAL_MEMORY=\u603B\u7269\u7406\u5185\u5B58
+TOTAL_THREADS_STARTED=\u542F\u52A8\u7684\u7EBF\u7A0B\u603B\u6570
+TOTAL_SWAP_SPACE=\u603B\u4EA4\u6362\u7A7A\u95F4
+TYPE=\u7C7B\u578B
+UNAVAILABLE=\u4E0D\u53EF\u7528
UNKNOWN_CAPITALIZED=UNKNOWN
-UNKNOWN_HOST=\u672a\u77e5\u4e3b\u673a: {0}
-UNREGISTER=\u6ce8\u9500
-UPTIME=\u8fd0\u884c\u65f6\u95f4
-USAGE_THRESHOLD=\u7528\u6cd5\u9608\u503c
-REMOTE_TF_USAGE=<b>\u7528\u6cd5</b>: <hostname>:<port> \u6216 service:jmx:<protocol>:<sap>
-USED=\u5df2\u7528
-USERNAME_COLON_=\u7528\u6237\u540d(&U):
-USERNAME_ACCESSIBLE_NAME=\u7528\u6237\u540d
+UNKNOWN_HOST=\u672A\u77E5\u4E3B\u673A: {0}
+UNREGISTER=\u6CE8\u9500
+UPTIME=\u8FD0\u884C\u65F6\u95F4
+USAGE_THRESHOLD=\u7528\u6CD5\u9608\u503C
+REMOTE_TF_USAGE=<b>\u7528\u6CD5</b>: <hostname>:<port> \u6216 service:jmx:<protocol>:<sap>
+USED=\u5DF2\u7528
+USERNAME_COLON_=\u7528\u6237\u540D(&U):
+USERNAME_ACCESSIBLE_NAME=\u7528\u6237\u540D
USER_DATA=UserData
-VIRTUAL_MACHINE=\u865a\u62df\u673a
-VM_ARGUMENTS=VM \u53c2\u6570
-VMINTERNAL_FRAME_ACCESSIBLE_DESCRIPTION=\u7528\u4e8e\u76d1\u89c6 Java \u865a\u62df\u673a\u7684\u5185\u90e8\u6846\u67b6
-VALUE=\u503c
-VENDOR=\u5382\u5546
-VERBOSE_OUTPUT=\u8be6\u7ec6\u8f93\u51fa
-VERBOSE_OUTPUT_TOOLTIP=\u4e3a\u7c7b\u52a0\u8f7d\u7cfb\u7edf\u542f\u7528\u8be6\u7ec6\u8f93\u51fa
-VIEW=\u89c6\u56fe
-WINDOW=\u7a97\u53e3(&W)
-WINDOWS=Windows
-WRITABLE=\u53ef\u5199
-CONNECTION_FAILED1=\u8fde\u63a5\u5931\u8d25: \u662f\u5426\u91cd\u8bd5?
-CONNECTION_FAILED2=\u672a\u6210\u529f\u8fde\u63a5\u5230{0}\u3002<br>\u662f\u5426\u8981\u91cd\u8bd5?
-CONNECTION_LOST1=\u8fde\u63a5\u4e22\u5931: \u662f\u5426\u91cd\u65b0\u8fde\u63a5?
-CONNECTING_TO1=\u6b63\u5728\u8fde\u63a5\u5230{0}
-CONNECTING_TO2=\u60a8\u5f53\u524d\u6b63\u5728\u8fde\u63a5\u5230{0}\u3002<br>\u8fd9\u5c06\u9700\u8981\u51e0\u5206\u949f\u7684\u65f6\u95f4\u3002
-DEADLOCK_TAB=\u6b7b\u9501
-DEADLOCK_TAB_N=\u6b7b\u9501{0}
-EXPAND=\u5c55\u5f00
+VIRTUAL_MACHINE=\u865A\u62DF\u673A
+VM_ARGUMENTS=VM \u53C2\u6570
+VMINTERNAL_FRAME_ACCESSIBLE_DESCRIPTION=\u7528\u4E8E\u76D1\u89C6 Java \u865A\u62DF\u673A\u7684\u5185\u90E8\u6846\u67B6
+VALUE=\u503C
+VENDOR=\u4F9B\u5E94\u5546
+VERBOSE_OUTPUT=\u8BE6\u7EC6\u8F93\u51FA
+VERBOSE_OUTPUT_TOOLTIP=\u4E3A\u7C7B\u52A0\u8F7D\u7CFB\u7EDF\u542F\u7528\u8BE6\u7EC6\u8F93\u51FA
+VIEW=\u89C6\u56FE
+WINDOW=\u7A97\u53E3(&W)
+WINDOWS=\u7A97\u53E3
+WRITABLE=\u53EF\u5199\u5165
+CONNECTION_FAILED1=\u8FDE\u63A5\u5931\u8D25: \u662F\u5426\u91CD\u8BD5?
+CONNECTION_FAILED2=\u672A\u6210\u529F\u8FDE\u63A5\u5230{0}\u3002<br>\u662F\u5426\u8981\u91CD\u8BD5?
+CONNECTION_LOST1=\u8FDE\u63A5\u4E22\u5931: \u662F\u5426\u91CD\u65B0\u8FDE\u63A5?
+CONNECTING_TO1=\u6B63\u5728\u8FDE\u63A5\u5230{0}
+CONNECTING_TO2=\u60A8\u5F53\u524D\u6B63\u5728\u8FDE\u63A5\u5230{0}\u3002<br>\u8FD9\u5C06\u9700\u8981\u51E0\u5206\u949F\u7684\u65F6\u95F4\u3002
+DEADLOCK_TAB=\u6B7B\u9501
+DEADLOCK_TAB_N=\u6B7B\u9501{0}
+EXPAND=\u5C55\u5F00
KBYTES={0} KB
-PLOT=\u7ed8\u56fe
-VISUALIZE=\u53ef\u89c6\u5316
-ZZ_USAGE_TEXT=\u7528\u6cd5: {0} [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]\n\n -interval \u5c06\u66f4\u65b0\u95f4\u9694\u8bbe\u7f6e\u4e3a n \u79d2 (\u9ed8\u8ba4\u503c\u4e3a 4 \u79d2)\n -notile \u521d\u59cb\u4e0d\u5e73\u94fa\u7a97\u53e3 (\u5bf9\u4e8e\u4e24\u4e2a\u6216\u591a\u4e2a\u8fde\u63a5)\n -pluginpath \u6307\u5b9a jconsole \u7528\u4e8e\u67e5\u627e\u63d2\u4ef6\u7684\u8def\u5f84\n -version \u8f93\u51fa\u7a0b\u5e8f\u7248\u672c\n\n connection = pid || host:port || JMX URL (service:jmx:<\u534f\u8bae>://...)\n pid \u76ee\u6807\u8fdb\u7a0b\u7684\u8fdb\u7a0b ID\n host \u8fdc\u7a0b\u4e3b\u673a\u540d\u6216 IP \u5730\u5740\n port \u8fdc\u7a0b\u8fde\u63a5\u7684\u7aef\u53e3\u53f7\n\n -J \u6307\u5b9a\u8fd0\u884c jconsole \u7684 Java \u865a\u62df\u673a\n \u7684\u8f93\u5165\u53c2\u6570
+PLOT=\u7ED8\u56FE
+VISUALIZE=\u53EF\u89C6\u5316
+ZZ_USAGE_TEXT=\u7528\u6CD5: {0} [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]\n\n -interval \u5C06\u66F4\u65B0\u95F4\u9694\u8BBE\u7F6E\u4E3A n \u79D2 (\u9ED8\u8BA4\u503C\u4E3A 4 \u79D2)\n -notile \u521D\u59CB\u4E0D\u5E73\u94FA\u7A97\u53E3 (\u5BF9\u4E8E\u4E24\u4E2A\u6216\u591A\u4E2A\u8FDE\u63A5)\n -pluginpath \u6307\u5B9A jconsole \u7528\u4E8E\u67E5\u627E\u63D2\u4EF6\u7684\u8DEF\u5F84\n -version \u8F93\u51FA\u7A0B\u5E8F\u7248\u672C\n\n connection = pid || host:port || JMX URL (service:jmx:<\u534F\u8BAE>://...)\n pid \u76EE\u6807\u8FDB\u7A0B\u7684\u8FDB\u7A0B ID\n host \u8FDC\u7A0B\u4E3B\u673A\u540D\u6216 IP \u5730\u5740\n port \u8FDC\u7A0B\u8FDE\u63A5\u7684\u7AEF\u53E3\u53F7\n\n -J \u6307\u5B9A\u8FD0\u884C jconsole \u7684 Java \u865A\u62DF\u673A\n \u7684\u8F93\u5165\u53C2\u6570
--- a/jdk/src/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_ja.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_ja.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_zh_CN.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_zh_CN.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/demo/jfc/Notepad/resources/Notepad_ja.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/demo/jfc/Notepad/resources/Notepad_ja.properties Wed May 01 11:34:06 2013 -0700
@@ -3,13 +3,6 @@
Title=\u30E1\u30E2\u5E33
ElementTreeFrameTitle=\u8981\u7D20
-ViewportBackingStore=false
-
-# menubar definition
-#
-# Each of the strings that follow form a key to be
-# used to the actual menu definition.
-menubar=file edit debug
# file Menu definition
#
@@ -20,7 +13,7 @@
# new -> Notepad.newAction
# save -> Notepad.saveAction
# exit -> Notepad.exitAction
-file=new open save - exit
+
fileLabel=\u30D5\u30A1\u30A4\u30EB
openLabel=\u958B\u304F
openImage=resources/open.gif
@@ -36,29 +29,23 @@
# cut -> JTextComponent.cutAction
# copy -> JTextComponent.copyAction
# paste -> JTextComponent.pasteAction
-edit=cut copy paste - undo redo
+
editLabel=\u7DE8\u96C6
cutLabel=\u5207\u53D6\u308A
-cutAction=cut-to-clipboard
cutImage=resources/cut.gif
copyLabel=\u30B3\u30D4\u30FC
-copyAction=copy-to-clipboard
copyImage=resources/copy.gif
pasteLabel=\u8CBC\u4ED8\u3051
-pasteAction=paste-from-clipboard
pasteImage=resources/paste.gif
undoLabel=\u5143\u306B\u623B\u3059
-undoAction=Undo
-redoLabel=\u518D\u5B9F\u884C
-redoAction=Redo
+redoLabel=\u3084\u308A\u76F4\u3057
#
# debug Menu definition
#
-debug=dump showElementTree
+
debugLabel=\u30C7\u30D0\u30C3\u30B0
dumpLabel=\u30E2\u30C7\u30EB\u3092System.err\u306B\u30C0\u30F3\u30D7
-dumpAction=dump-model
showElementTreeLabel=\u8981\u7D20\u306E\u8868\u793A
# toolbar definition
@@ -67,7 +54,7 @@
# used as the basis of the tool definition. Actions
# are of course sharable, and in this case are shared
# with the menu items.
-toolbar=new open save - cut copy paste
+
newTooltip=\u30D5\u30A1\u30A4\u30EB\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B
openTooltip=\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304F
saveTooltip=\u30D5\u30A1\u30A4\u30EB\u306B\u4FDD\u5B58
--- a/jdk/src/share/demo/jfc/Notepad/resources/Notepad_zh_CN.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/share/demo/jfc/Notepad/resources/Notepad_zh_CN.properties Wed May 01 11:34:06 2013 -0700
@@ -3,13 +3,6 @@
Title=\u8BB0\u4E8B\u672C
ElementTreeFrameTitle=\u5143\u7D20
-ViewportBackingStore=false
-
-# menubar definition
-#
-# Each of the strings that follow form a key to be
-# used to the actual menu definition.
-menubar=file edit debug
# file Menu definition
#
@@ -20,7 +13,7 @@
# new -> Notepad.newAction
# save -> Notepad.saveAction
# exit -> Notepad.exitAction
-file=new open save - exit
+
fileLabel=\u6587\u4EF6
openLabel=\u6253\u5F00
openImage=resources/open.gif
@@ -36,29 +29,23 @@
# cut -> JTextComponent.cutAction
# copy -> JTextComponent.copyAction
# paste -> JTextComponent.pasteAction
-edit=cut copy paste - undo redo
+
editLabel=\u7F16\u8F91
cutLabel=\u526A\u5207
-cutAction=cut-to-clipboard
cutImage=resources/cut.gif
copyLabel=\u590D\u5236
-copyAction=copy-to-clipboard
copyImage=resources/copy.gif
pasteLabel=\u7C98\u8D34
-pasteAction=paste-from-clipboard
pasteImage=resources/paste.gif
undoLabel=\u64A4\u6D88
-undoAction=Undo
redoLabel=\u91CD\u505A
-redoAction=Redo
#
# debug Menu definition
#
-debug=dump showElementTree
+
debugLabel=\u8C03\u8BD5
dumpLabel=\u5C06\u6A21\u578B\u8F6C\u50A8\u5230 System.err
-dumpAction=dump-model
showElementTreeLabel=\u663E\u793A\u5143\u7D20
# toolbar definition
@@ -67,7 +54,7 @@
# used as the basis of the tool definition. Actions
# are of course sharable, and in this case are shared
# with the menu items.
-toolbar=new open save - cut copy paste
+
newTooltip=\u521B\u5EFA\u65B0\u6587\u4EF6
openTooltip=\u6253\u5F00\u6587\u4EF6
saveTooltip=\u4FDD\u5B58\u6587\u4EF6
--- a/jdk/src/solaris/bin/amd64/jvm.cfg Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/bin/amd64/jvm.cfg Wed May 01 11:34:06 2013 -0700
@@ -1,4 +1,4 @@
-# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,3 @@
#
-server KNOWN
-client IGNORE
--hotspot ERROR
--classic WARN
--native ERROR
--green ERROR
--- a/jdk/src/solaris/bin/arm/jvm.cfg Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/bin/arm/jvm.cfg Wed May 01 11:34:06 2013 -0700
@@ -1,4 +1,4 @@
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,4 @@
#
-client KNOWN
-server KNOWN
--hotspot ERROR
--classic WARN
--native ERROR
--green ERROR
-minimal KNOWN
--- a/jdk/src/solaris/bin/i586/jvm.cfg Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/bin/i586/jvm.cfg Wed May 01 11:34:06 2013 -0700
@@ -1,4 +1,4 @@
-# Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,4 @@
#
-client IF_SERVER_CLASS -server
-server KNOWN
--hotspot ALIASED_TO -client
--classic WARN
--native ERROR
--green ERROR
-minimal KNOWN
--- a/jdk/src/solaris/bin/ia64/jvm.cfg Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/bin/ia64/jvm.cfg Wed May 01 11:34:06 2013 -0700
@@ -1,7 +1,7 @@
#
#
#
-# Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -36,8 +36,4 @@
# and may not be available in a future release.
#
-server KNOWN
--hotspot ERROR
--classic WARN
-client IGNORE
--native ERROR
--green ERROR
--- a/jdk/src/solaris/bin/ppc/jvm.cfg Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/bin/ppc/jvm.cfg Wed May 01 11:34:06 2013 -0700
@@ -1,4 +1,4 @@
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,4 @@
#
-client KNOWN
-server KNOWN
--hotspot ERROR
--classic WARN
--native ERROR
--green ERROR
-minimal KNOWN
--- a/jdk/src/solaris/bin/sparc/jvm.cfg Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/bin/sparc/jvm.cfg Wed May 01 11:34:06 2013 -0700
@@ -1,4 +1,4 @@
-# Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,4 @@
#
-client IF_SERVER_CLASS -server
-server KNOWN
--hotspot ALIASED_TO -client
--classic WARN
--native ERROR
--green ERROR
-minimal KNOWN
--- a/jdk/src/solaris/bin/sparcv9/jvm.cfg Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/bin/sparcv9/jvm.cfg Wed May 01 11:34:06 2013 -0700
@@ -1,4 +1,4 @@
-# Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -31,8 +31,4 @@
# and may not be available in a future release.
#
-server KNOWN
--hotspot ERROR
--classic WARN
-client IGNORE
--native ERROR
--green ERROR
--- a/jdk/src/solaris/bin/zero/jvm.cfg Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/bin/zero/jvm.cfg Wed May 01 11:34:06 2013 -0700
@@ -1,4 +1,4 @@
-# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,3 @@
#
-server KNOWN
-client IGNORE
--hotspot ERROR
--classic WARN
--native ERROR
--green ERROR
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java Wed May 01 11:34:06 2013 -0700
@@ -84,7 +84,7 @@
}
continue;
}
- if (option == LinkOption.NOFOLLOW_LINKS && supportsNoFollowLinks()) {
+ if (option == LinkOption.NOFOLLOW_LINKS && O_NOFOLLOW != 0) {
flags.noFollowLinks = true;
continue;
}
@@ -218,7 +218,7 @@
// follow links by default
boolean followLinks = true;
if (!flags.createNew && (flags.noFollowLinks || flags.deleteOnClose)) {
- if (flags.deleteOnClose && !supportsNoFollowLinks()) {
+ if (flags.deleteOnClose && O_NOFOLLOW == 0) {
try {
if (UnixFileAttributes.get(path, false).isSymbolicLink())
throw new UnixException("DELETE_ON_CLOSE specified and file is a symbolic link");
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixCopyFile.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixCopyFile.java Wed May 01 11:34:06 2013 -0700
@@ -189,7 +189,7 @@
// copy time stamps last
if (flags.copyBasicAttributes) {
try {
- if (dfd >= 0) {
+ if (dfd >= 0 && futimesSupported()) {
futimes(dfd,
attrs.lastAccessTime().to(TimeUnit.MICROSECONDS),
attrs.lastModifiedTime().to(TimeUnit.MICROSECONDS));
@@ -269,9 +269,15 @@
// copy time attributes
if (flags.copyBasicAttributes) {
try {
- futimes(fo,
- attrs.lastAccessTime().to(TimeUnit.MICROSECONDS),
- attrs.lastModifiedTime().to(TimeUnit.MICROSECONDS));
+ if (futimesSupported()) {
+ futimes(fo,
+ attrs.lastAccessTime().to(TimeUnit.MICROSECONDS),
+ attrs.lastModifiedTime().to(TimeUnit.MICROSECONDS));
+ } else {
+ utimes(target,
+ attrs.lastAccessTime().to(TimeUnit.MICROSECONDS),
+ attrs.lastModifiedTime().to(TimeUnit.MICROSECONDS));
+ }
} catch (UnixException x) {
if (flags.failIfUnableToCopyBasic)
x.rethrowAsIOException(target);
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributeViews.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributeViews.java Wed May 01 11:34:06 2013 -0700
@@ -73,6 +73,8 @@
int fd = file.openForAttributeAccess(followLinks);
try {
+ // assert followLinks || !UnixFileAttributes.get(fd).isSymbolicLink();
+
// if not changing both attributes then need existing attributes
if (lastModifiedTime == null || lastAccessTime == null) {
try {
@@ -92,9 +94,13 @@
boolean retry = false;
try {
- futimes(fd, accessValue, modValue);
+ if (futimesSupported()) {
+ futimes(fd, accessValue, modValue);
+ } else {
+ utimes(file, accessValue, modValue);
+ }
} catch (UnixException x) {
- // if futimes fails with EINVAL and one/both of the times is
+ // if futimes/utimes fails with EINVAL and one/both of the times is
// negative then we adjust the value to the epoch and retry.
if (x.errno() == UnixConstants.EINVAL &&
(modValue < 0L || accessValue < 0L)) {
@@ -107,7 +113,11 @@
if (modValue < 0L) modValue = 0L;
if (accessValue < 0L) accessValue= 0L;
try {
- futimes(fd, accessValue, modValue);
+ if (futimesSupported()) {
+ futimes(fd, accessValue, modValue);
+ } else {
+ utimes(file, accessValue, modValue);
+ }
} catch (UnixException x) {
x.rethrowAsIOException(file);
}
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributes.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributes.java Wed May 01 11:34:06 2013 -0700
@@ -51,6 +51,7 @@
private long st_mtime_nsec;
private long st_ctime_sec;
private long st_ctime_nsec;
+ private long st_birthtime_sec;
// created lazily
private volatile UserPrincipal owner;
@@ -139,7 +140,12 @@
@Override
public FileTime creationTime() {
- return lastModifiedTime();
+ if (UnixNativeDispatcher.birthtimeSupported()) {
+ return FileTime.from(st_birthtime_sec, TimeUnit.SECONDS);
+ } else {
+ // return last modified when birth time not supported
+ return lastModifiedTime();
+ }
}
@Override
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java Wed May 01 11:34:06 2013 -0700
@@ -394,9 +394,9 @@
if (filter == null)
throw new NullPointerException();
- // can't return SecureDirectoryStream on kernels that don't support
- // openat, etc.
- if (!supportsAtSysCalls() || !supportsNoFollowLinks()) {
+ // can't return SecureDirectoryStream on kernels that don't support openat
+ // or O_NOFOLLOW
+ if (!openatSupported() || O_NOFOLLOW == 0) {
try {
long ptr = opendir(dir);
return new UnixDirectoryStream(dir, ptr, filter);
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixNativeDispatcher.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixNativeDispatcher.java Wed May 01 11:34:06 2013 -0700
@@ -537,30 +537,42 @@
*/
static native byte[] strerror(int errnum);
- // indicates if openat, unlinkat, etc. is supported
- private static final boolean hasAtSysCalls;
- static boolean supportsAtSysCalls() {
- return hasAtSysCalls;
+ /**
+ * Capabilities
+ */
+ private static final int SUPPORTS_OPENAT = 1 << 1; // syscalls
+ private static final int SUPPORTS_FUTIMES = 1 << 2;
+ private static final int SUPPORTS_BIRTHTIME = 1 << 16; // other features
+ private static final int capabilities;
+
+ /**
+ * Supports openat and other *at calls.
+ */
+ static boolean openatSupported() {
+ return (capabilities & SUPPORTS_OPENAT) != 0;
}
- static boolean supportsNoFollowLinks() {
- return UnixConstants.O_NOFOLLOW != 0;
+ /**
+ * Supports futimes or futimesat
+ */
+ static boolean futimesSupported() {
+ return (capabilities & SUPPORTS_FUTIMES) != 0;
}
- // initialize syscalls and fieldIDs
- private static native int init();
+ /**
+ * Supports file birth (creation) time attribute
+ */
+ static boolean birthtimeSupported() {
+ return (capabilities & SUPPORTS_BIRTHTIME) != 0;
+ }
- // flags returned by init to indicate capabilities
- private static final int HAS_AT_SYSCALLS = 0x1;
-
+ private static native int init();
static {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("nio");
return null;
}});
- int flags = init();
-
- hasAtSysCalls = (flags & HAS_AT_SYSCALLS) > 0;
+ capabilities = init();
}
}
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java Wed May 01 11:34:06 2013 -0700
@@ -769,7 +769,7 @@
int openForAttributeAccess(boolean followLinks) throws IOException {
int flags = O_RDONLY;
if (!followLinks) {
- if (!supportsNoFollowLinks())
+ if (O_NOFOLLOW == 0)
throw new IOException("NOFOLLOW_LINKS is not supported on this platform");
flags |= O_NOFOLLOW;
}
--- a/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c Wed May 01 11:34:06 2013 -0700
@@ -372,7 +372,7 @@
size_t fds_size;
kres = pid_for_task(mach_task_self(), &my_pid);
- if (res != KERN_SUCCESS) {
+ if (kres != KERN_SUCCESS) {
throw_internal_error(env, "pid_for_task failed");
return -1;
}
--- a/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c Wed May 01 11:34:06 2013 -0700
@@ -97,6 +97,10 @@
static jfieldID attrs_st_ctime_sec;
static jfieldID attrs_st_ctime_nsec;
+#ifdef _DARWIN_FEATURE_64_BIT_INODE
+static jfieldID attrs_st_birthtime_sec;
+#endif
+
static jfieldID attrs_f_frsize;
static jfieldID attrs_f_blocks;
static jfieldID attrs_f_bfree;
@@ -171,7 +175,7 @@
JNIEXPORT jint JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_init(JNIEnv* env, jclass this)
{
- jint flags = 0;
+ jint capabilities = 0;
jclass clazz;
clazz = (*env)->FindClass(env, "sun/nio/fs/UnixFileAttributes");
@@ -193,6 +197,10 @@
attrs_st_ctime_sec = (*env)->GetFieldID(env, clazz, "st_ctime_sec", "J");
attrs_st_ctime_nsec = (*env)->GetFieldID(env, clazz, "st_ctime_nsec", "J");
+#ifdef _DARWIN_FEATURE_64_BIT_INODE
+ attrs_st_birthtime_sec = (*env)->GetFieldID(env, clazz, "st_birthtime_sec", "J");
+#endif
+
clazz = (*env)->FindClass(env, "sun/nio/fs/UnixFileStoreAttributes");
if (clazz == NULL) {
return 0;
@@ -233,14 +241,31 @@
my_fstatat64_func = (fstatat64_func*)&fstatat64_wrapper;
#endif
+ /* supports futimes or futimesat */
+
+#ifdef _ALLBSD_SOURCE
+ capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_FUTIMES;
+#else
+ if (my_futimesat_func != NULL)
+ capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_FUTIMES;
+#endif
+
+ /* supports openat, etc. */
+
if (my_openat64_func != NULL && my_fstatat64_func != NULL &&
my_unlinkat_func != NULL && my_renameat_func != NULL &&
my_futimesat_func != NULL && my_fdopendir_func != NULL)
{
- flags |= sun_nio_fs_UnixNativeDispatcher_HAS_AT_SYSCALLS;
+ capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_OPENAT;
}
- return flags;
+ /* supports file birthtime */
+
+#ifdef _DARWIN_FEATURE_64_BIT_INODE
+ capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_BIRTHTIME;
+#endif
+
+ return capabilities;
}
JNIEXPORT jbyteArray JNICALL
@@ -405,6 +430,10 @@
(*env)->SetLongField(env, attrs, attrs_st_mtime_sec, (jlong)buf->st_mtime);
(*env)->SetLongField(env, attrs, attrs_st_ctime_sec, (jlong)buf->st_ctime);
+#ifdef _DARWIN_FEATURE_64_BIT_INODE
+ (*env)->SetLongField(env, attrs, attrs_st_birthtime_sec, (jlong)buf->st_birthtime);
+#endif
+
#if (_POSIX_C_SOURCE >= 200809L) || defined(__solaris__)
(*env)->SetLongField(env, attrs, attrs_st_atime_nsec, (jlong)buf->st_atim.tv_nsec);
(*env)->SetLongField(env, attrs, attrs_st_mtime_nsec, (jlong)buf->st_mtim.tv_nsec);
--- a/jdk/src/windows/bin/amd64/jvm.cfg Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/windows/bin/amd64/jvm.cfg Wed May 01 11:34:06 2013 -0700
@@ -1,7 +1,7 @@
#
#
#
-# Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,3 @@
#
-server KNOWN
-client IGNORE
--hotspot ALIASED_TO -server
--classic WARN
--native ERROR
--green ERROR
--- a/jdk/src/windows/bin/i586/jvm.cfg Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/windows/bin/i586/jvm.cfg Wed May 01 11:34:06 2013 -0700
@@ -1,4 +1,4 @@
-# Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,3 @@
#
-client KNOWN
-server KNOWN
--hotspot ALIASED_TO -client
--classic WARN
--native ERROR
--green ERROR
--- a/jdk/src/windows/bin/ia64/jvm.cfg Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/windows/bin/ia64/jvm.cfg Wed May 01 11:34:06 2013 -0700
@@ -1,7 +1,7 @@
#
#
#
-# Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,3 @@
#
-server KNOWN
-client IGNORE
--hotspot ALIASED_TO -server
--classic WARN
--native ERROR
--green ERROR
--- a/jdk/src/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,6 +37,7 @@
import java.text.spi.NumberFormatProvider;
import java.util.Calendar;
import java.util.Collections;
+import java.util.Currency;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
@@ -48,6 +49,8 @@
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.spi.CalendarDataProvider;
import java.util.spi.CalendarNameProvider;
+import java.util.spi.CurrencyNameProvider;
+import java.util.spi.LocaleNameProvider;
import sun.util.spi.CalendarProvider;
/**
@@ -72,6 +75,14 @@
private static final int CD_FIRSTDAYOFWEEK = 0;
private static final int CD_MINIMALDAYSINFIRSTWEEK = 1;
+ // Currency/Locale display name types
+ private static final int DN_CURRENCY_NAME = 0;
+ private static final int DN_CURRENCY_SYMBOL = 1;
+ private static final int DN_LOCALE_LANGUAGE = 2;
+ private static final int DN_LOCALE_SCRIPT = 3;
+ private static final int DN_LOCALE_REGION = 4;
+ private static final int DN_LOCALE_VARIANT = 5;
+
// Native Calendar ID to LDML calendar type map
private static final String[] calIDToLDML = {
"",
@@ -96,15 +107,25 @@
private static ConcurrentMap<Locale, SoftReference<DecimalFormatSymbols>> decimalFormatSymbolsCache = new ConcurrentHashMap<>();
private static final Set<Locale> supportedLocaleSet;
+ private static final String nativeDisplayLanguage;
static {
Set<Locale> tmpSet = new HashSet<>();
if (initialize()) {
// Assuming the default locales do not include any extensions, so
// no stripping is needed here.
- Locale l = Locale.forLanguageTag(getDefaultLocale(CAT_FORMAT).replace('_', '-'));
- tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l));
- l = Locale.forLanguageTag(getDefaultLocale(CAT_DISPLAY).replace('_', '-'));
- tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l));
+ Control c = Control.getNoFallbackControl(Control.FORMAT_DEFAULT);
+ String displayLocale = getDefaultLocale(CAT_DISPLAY);
+ Locale l = Locale.forLanguageTag(displayLocale.replace('_', '-'));
+ tmpSet.addAll(c.getCandidateLocales("", l));
+ nativeDisplayLanguage = l.getLanguage();
+
+ String formatLocale = getDefaultLocale(CAT_FORMAT);
+ if (!formatLocale.equals(displayLocale)) {
+ l = Locale.forLanguageTag(formatLocale.replace('_', '-'));
+ tmpSet.addAll(c.getCandidateLocales("", l));
+ }
+ } else {
+ nativeDisplayLanguage = "";
}
supportedLocaleSet = Collections.unmodifiableSet(tmpSet);
}
@@ -392,6 +413,96 @@
};
}
+ public static CurrencyNameProvider getCurrencyNameProvider() {
+ return new CurrencyNameProvider() {
+ @Override
+ public Locale[] getAvailableLocales() {
+ return supportedLocale;
+ }
+
+ @Override
+ public boolean isSupportedLocale(Locale locale) {
+ // Ignore the extensions for now
+ return supportedLocaleSet.contains(locale.stripExtensions()) &&
+ locale.getLanguage().equals(nativeDisplayLanguage);
+ }
+
+ @Override
+ public String getSymbol(String currencyCode, Locale locale) {
+ // Retrieves the currency symbol by calling
+ // GetLocaleInfoEx(LOCALE_SCURRENCY).
+ // It only works with the "locale"'s currency in its native
+ // language.
+ try {
+ if (Currency.getInstance(locale).getCurrencyCode()
+ .equals(currencyCode)) {
+ return getDisplayString(locale.toLanguageTag(),
+ DN_CURRENCY_SYMBOL, currencyCode);
+ }
+ } catch (IllegalArgumentException iae) {}
+ return null;
+ }
+
+ @Override
+ public String getDisplayName(String currencyCode, Locale locale) {
+ // Retrieves the display name by calling
+ // GetLocaleInfoEx(LOCALE_SNATIVECURRNAME).
+ // It only works with the "locale"'s currency in its native
+ // language.
+ try {
+ if (Currency.getInstance(locale).getCurrencyCode()
+ .equals(currencyCode)) {
+ return getDisplayString(locale.toLanguageTag(),
+ DN_CURRENCY_NAME, currencyCode);
+ }
+ } catch (IllegalArgumentException iae) {}
+ return null;
+ }
+ };
+ }
+
+ public static LocaleNameProvider getLocaleNameProvider() {
+ return new LocaleNameProvider() {
+ @Override
+ public Locale[] getAvailableLocales() {
+ return supportedLocale;
+ }
+
+ @Override
+ public boolean isSupportedLocale(Locale locale) {
+ return supportedLocaleSet.contains(locale.stripExtensions()) &&
+ locale.getLanguage().equals(nativeDisplayLanguage);
+ }
+
+ @Override
+ public String getDisplayLanguage(String languageCode, Locale locale) {
+ // Retrieves the display language name by calling
+ // GetLocaleInfoEx(LOCALE_SLOCALIZEDLANGUAGENAME).
+ return getDisplayString(locale.toLanguageTag(),
+ DN_LOCALE_LANGUAGE, languageCode);
+ }
+
+ @Override
+ public String getDisplayCountry(String countryCode, Locale locale) {
+ // Retrieves the display country name by calling
+ // GetLocaleInfoEx(LOCALE_SLOCALIZEDCOUNTRYNAME).
+ return getDisplayString(locale.toLanguageTag(),
+ DN_LOCALE_REGION, nativeDisplayLanguage+"-"+countryCode);
+ }
+
+ @Override
+ public String getDisplayScript(String scriptCode, Locale locale) {
+ return null;
+ }
+
+ @Override
+ public String getDisplayVariant(String variantCode, Locale locale) {
+ return null;
+ }
+ };
+ }
+
+
private static String convertDateTimePattern(String winPattern) {
String ret = winPattern.replaceAll("dddd", "EEEE");
ret = ret.replaceAll("ddd", "EEE");
@@ -413,12 +524,21 @@
}
private static boolean isSupportedCalendarLocale(Locale locale) {
- Locale base = locale.stripExtensions();
+ Locale base = locale;
+
+ if (base.hasExtensions() || base.getVariant() != "") {
+ // strip off extensions and variant.
+ base = new Locale.Builder()
+ .setLocale(locale)
+ .clearExtensions()
+ .build();
+ }
+
if (!supportedLocaleSet.contains(base)) {
return false;
}
- int calid = getCalendarID(locale.toLanguageTag());
+ int calid = getCalendarID(base.toLanguageTag());
if (calid <= 0 || calid >= calIDToLDML.length) {
return false;
}
@@ -546,4 +666,7 @@
// For CalendarDataProvider
private static native int getCalendarDataValue(String langTag, int type);
+
+ // For Locale/CurrencyNameProvider
+ private static native String getDisplayString(String langTag, int key, String value);
}
--- a/jdk/src/windows/native/java/net/NetworkInterface.c Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/windows/native/java/net/NetworkInterface.c Wed May 01 11:34:06 2013 -0700
@@ -123,32 +123,44 @@
*/
size = sizeof(MIB_IFTABLE);
tableP = (MIB_IFTABLE *)malloc(size);
+ if(tableP == NULL)
+ return NULL;
+
count = GetIfTable(tableP, &size, TRUE);
if (count == ERROR_INSUFFICIENT_BUFFER || count == ERROR_BUFFER_OVERFLOW) {
- tableP = (MIB_IFTABLE *)realloc(tableP, size);
+ MIB_IFTABLE* newTableP = (MIB_IFTABLE *)realloc(tableP, size);
+ if (newTableP == NULL) {
+ free(tableP);
+ return NULL;
+ }
+ tableP = newTableP;
+
count = GetIfTable(tableP, &size, TRUE);
}
if (count != NO_ERROR) {
- if (tableP != NULL)
- free(tableP);
+ free(tableP);
return NULL;
}
- if (tableP != NULL) {
- ifrowP = tableP->table;
- for (i=0; i<tableP->dwNumEntries; i++) {
- /*
- * Warning the real index is obtained by GetFriendlyIfIndex()
- */
+ {
+ ifrowP = tableP->table;
+ for (i=0; i<tableP->dwNumEntries; i++) {
+ /*
+ * Warning: the real index is obtained by GetFriendlyIfIndex()
+ */
ifindex = GetFriendlyIfIndex(ifrowP->dwIndex);
if (ifindex == index) {
/*
* Create a copy of the entry so that we can free the table.
*/
- ret = (MIB_IFROW *) malloc(sizeof(MIB_IFROW));
- memcpy(ret, ifrowP, sizeof(MIB_IFROW));
- break;
+ ret = (MIB_IFROW *) malloc(sizeof(MIB_IFROW));
+ if (ret == NULL) {
+ free(tableP);
+ return NULL;
+ }
+ memcpy(ret, ifrowP, sizeof(MIB_IFROW));
+ break;
}
/* onto the next interface */
@@ -184,15 +196,25 @@
*/
size = sizeof(MIB_IFTABLE);
tableP = (MIB_IFTABLE *)malloc(size);
+ if (tableP == NULL) {
+ JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
+ return -1;
+ }
+
ret = GetIfTable(tableP, &size, TRUE);
if (ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_BUFFER_OVERFLOW) {
- tableP = (MIB_IFTABLE *)realloc(tableP, size);
+ MIB_IFTABLE * newTableP = (MIB_IFTABLE *)realloc(tableP, size);
+ if (newTableP == NULL) {
+ free(tableP);
+ JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
+ return -1;
+ }
+ tableP = newTableP;
ret = GetIfTable(tableP, &size, TRUE);
}
if (ret != NO_ERROR) {
- if (tableP != NULL)
- free(tableP);
+ free(tableP);
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetIfTable function failed");
@@ -370,10 +392,21 @@
*/
size = sizeof(MIB_IPADDRTABLE);
tableP = (MIB_IPADDRTABLE *)malloc(size);
+ if (tableP == NULL) {
+ JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
+ return -1;
+ }
ret = GetIpAddrTable(tableP, &size, FALSE);
if (ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_BUFFER_OVERFLOW) {
- tableP = (MIB_IPADDRTABLE *)realloc(tableP, size);
+ MIB_IPADDRTABLE * newTableP = (MIB_IPADDRTABLE *)realloc(tableP, size);
+ if (newTableP == NULL) {
+ free(tableP);
+ JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
+ return -1;
+ }
+ tableP = newTableP;
+
ret = GetIpAddrTable(tableP, &size, FALSE);
}
if (ret != NO_ERROR) {
--- a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c Wed May 01 11:34:06 2013 -0700
@@ -74,7 +74,7 @@
/*
* return an array of IP_ADAPTER_ADDRESSES containing one element
- * for each apdapter on the system. Returned in *adapters.
+ * for each adapter on the system. Returned in *adapters.
* Buffer is malloc'd and must be freed (unless error returned)
*/
static int getAdapters (JNIEnv *env, IP_ADAPTER_ADDRESSES **adapters) {
@@ -82,22 +82,32 @@
IP_ADAPTER_ADDRESSES *adapterInfo;
ULONG len;
adapterInfo = (IP_ADAPTER_ADDRESSES *)malloc (bufsize);
- if (adapterInfo == 0) {
+
+ if (adapterInfo == NULL) {
+ JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
return -1;
}
+
len = bufsize;
flags = GAA_FLAG_SKIP_DNS_SERVER;
flags |= GAA_FLAG_SKIP_MULTICAST;
flags |= GAA_FLAG_INCLUDE_PREFIX;
ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
+
if (ret == ERROR_BUFFER_OVERFLOW) {
- adapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
- if (adapterInfo == 0) {
+ IP_ADAPTER_ADDRESSES * newAdapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
+ if (newAdapterInfo == NULL) {
+ free(adapterInfo);
+ JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
return -1;
}
+
+ adapterInfo = newAdapterInfo;
+
bufsize = len;
ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
}
+
if (ret != ERROR_SUCCESS) {
free (adapterInfo);
JNU_ThrowByName(env, "java/lang/Error",
@@ -110,7 +120,7 @@
/*
* return an array of IP_ADAPTER_ADDRESSES containing one element
- * for each apdapter on the system. Returned in *adapters.
+ * for each adapter on the system. Returned in *adapters.
* Buffer is malloc'd and must be freed (unless error returned)
*/
IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) {
@@ -118,8 +128,8 @@
IP_ADAPTER_ADDRESSES *adapterInfo, *ptr, *ret;
ULONG len;
adapterInfo = (IP_ADAPTER_ADDRESSES *)malloc (bufsize);
- if (adapterInfo == 0) {
- JNU_ThrowByName(env, "java/lang/OutOfMemoryError", 0);
+ if (adapterInfo == NULL) {
+ JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
return NULL;
}
len = bufsize;
@@ -128,14 +138,19 @@
flags |= GAA_FLAG_INCLUDE_PREFIX;
val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
if (val == ERROR_BUFFER_OVERFLOW) {
- adapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
- if (adapterInfo == 0) {
- JNU_ThrowByName(env, "java/lang/OutOfMemoryError", 0);
+ IP_ADAPTER_ADDRESSES * newAdapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
+ if (newAdapterInfo == NULL) {
+ free(adapterInfo);
+ JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
return NULL;
}
+
+ adapterInfo = newAdapterInfo;
+
bufsize = len;
val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
}
+
if (val != ERROR_SUCCESS) {
free (adapterInfo);
JNU_ThrowByName(env, "java/lang/Error",
@@ -148,7 +163,15 @@
// IPv4 interface
if (ptr->Ipv6IfIndex == index) {
ret = (IP_ADAPTER_ADDRESSES *) malloc(sizeof(IP_ADAPTER_ADDRESSES));
+ if (ret == NULL) {
+ free(adapterInfo);
+ JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
+ return NULL;
+ }
+
+ //copy the memory and break out of the while loop.
memcpy(ret, ptr, sizeof(IP_ADAPTER_ADDRESSES));
+ break;
}
ptr=ptr->Next;
}
@@ -163,12 +186,12 @@
int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP)
{
DWORD ret;
- IP_ADAPTER_ADDRESSES *ptr, *adapters=0;
+ IP_ADAPTER_ADDRESSES *ptr, *adapters=NULL;
ULONG len=ipinflen, count=0;
- netif *nif=0, *dup_nif, *last=0, *loopif=0, *curr;
+ netif *nif=NULL, *dup_nif, *last=NULL, *loopif=NULL, *curr;
int tun=0, net=0;
- *netifPP = 0;
+ *netifPP = NULL;
/*
* Get the IPv4 interfaces. This information is the same
@@ -183,7 +206,7 @@
}
/* locate the loopback (and the last) interface */
- for (nif=*netifPP, last=nif; nif!=0; nif=nif->next) {
+ for (nif=*netifPP, last=nif; nif!=NULL; nif=nif->next) {
if (nif->ifType == MIB_IF_TYPE_LOOPBACK) {
loopif = nif;
}
@@ -235,7 +258,7 @@
int index = ptr->IfIndex;
if (index != 0) {
/* This entry is associated with an IPv4 interface */
- for (nif=*netifPP; nif!=0; nif=nif->next) {
+ for (nif=*netifPP; nif!=NULL; nif=nif->next) {
if (nif->index == index) {
/* found the interface entry
* set the index to the IPv6 index and add the
@@ -258,7 +281,7 @@
* if this is a duplicate (ipv6Index is the same)
*/
dup_nif = 0;
- for (nif0=*netifPP; nif0!=0; nif0=nif0->next) {
+ for (nif0=*netifPP; nif0!=NULL; nif0=nif0->next) {
if (nif0->hasIpv6Address &&
ptr->Ipv6IfIndex == nif0->ipv6Index) {
dup_nif = nif0;
@@ -267,46 +290,46 @@
}
if (dup_nif == 0) {
/* new interface */
- nif = (netif *) calloc (1, sizeof(netif));
- if (nif == 0) {
- goto err;
- }
- if (ptr->IfType == IF_TYPE_TUNNEL) {
- sprintf (newname, "tun%d", tun);
- tun ++;
- } else {
- sprintf (newname, "net%d", net);
- net ++;
- }
- nif->name = malloc (strlen(newname)+1);
- nif->displayName = malloc (wcslen(ptr->FriendlyName)*2+2);
- if (nif->name == 0 || nif->displayName == 0) {
- goto err;
- }
- strcpy (nif->name, newname);
- wcscpy ((PWCHAR)nif->displayName, ptr->FriendlyName);
- nif->dNameIsUnicode = TRUE;
- nif->index = ptr->Ipv6IfIndex;
- nif->ipv6Index = ptr->Ipv6IfIndex;
- nif->hasIpv6Address = TRUE;
+ nif = (netif *) calloc (1, sizeof(netif));
+ if (nif == 0) {
+ goto err;
+ }
+ if (ptr->IfType == IF_TYPE_TUNNEL) {
+ sprintf (newname, "tun%d", tun);
+ tun ++;
+ } else {
+ sprintf (newname, "net%d", net);
+ net ++;
+ }
+ nif->name = malloc (strlen(newname)+1);
+ nif->displayName = malloc (wcslen(ptr->FriendlyName)*2+2);
+ if (nif->name == 0 || nif->displayName == 0) {
+ goto err;
+ }
+ strcpy (nif->name, newname);
+ wcscpy ((PWCHAR)nif->displayName, ptr->FriendlyName);
+ nif->dNameIsUnicode = TRUE;
+ nif->index = ptr->Ipv6IfIndex;
+ nif->ipv6Index = ptr->Ipv6IfIndex;
+ nif->hasIpv6Address = TRUE;
- last->next = nif;
- last = nif;
- count++;
- c = getAddrsFromAdapter(ptr, &nif->addrs);
- if (c == -1) {
- goto err;
- }
- nif->naddrs += c;
- } else {
- /* add the addresses from this adapter to the
- * original (dup_nif)
- */
- c = getAddrsFromAdapter(ptr, &dup_nif->addrs);
- if (c == -1) {
- goto err;
- }
- dup_nif->naddrs += c;
+ last->next = nif;
+ last = nif;
+ count++;
+ c = getAddrsFromAdapter(ptr, &nif->addrs);
+ if (c == -1) {
+ goto err;
+ }
+ nif->naddrs += c;
+ } else {
+ /* add the addresses from this adapter to the
+ * original (dup_nif)
+ */
+ c = getAddrsFromAdapter(ptr, &dup_nif->addrs);
+ if (c == -1) {
+ goto err;
+ }
+ dup_nif->naddrs += c;
}
}
}
@@ -335,45 +358,47 @@
*/
static int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP) {
- LPSOCKADDR sock;
- int count = 0;
- netaddr *curr, *start=0, *prev=0;
- PIP_ADAPTER_UNICAST_ADDRESS uni_addr;
- PIP_ADAPTER_ANYCAST_ADDRESS any_addr;
- PIP_ADAPTER_PREFIX prefix;
+ LPSOCKADDR sock;
+ int count = 0;
+ netaddr *curr, *start = NULL, *prev = NULL;
+ PIP_ADAPTER_UNICAST_ADDRESS uni_addr;
+ PIP_ADAPTER_ANYCAST_ADDRESS any_addr;
+ PIP_ADAPTER_PREFIX prefix;
- /* If chain passed in, find end */
- if (*netaddrPP != NULL) {
- for (start=*netaddrPP; start->next!=NULL; start=start->next) {
+ /* If chain passed in, find end */
+ if (*netaddrPP != NULL) {
+ for (start=*netaddrPP; start->next!=NULL; start=start->next)
+ ;
+
+ prev=start;
}
- prev=start;
- }
- prefix = ptr->FirstPrefix;
- /* Unicast */
- uni_addr = ptr->FirstUnicastAddress;
- while (uni_addr != NULL) {
+ prefix = ptr->FirstPrefix;
+ /* Unicast */
+ uni_addr = ptr->FirstUnicastAddress;
+ while (uni_addr != NULL) {
/* address is only usable if dad state is preferred or deprecated */
- if (uni_addr->DadState == IpDadStateDeprecated ||
- uni_addr->DadState == IpDadStatePreferred) {
- sock = uni_addr->Address.lpSockaddr;
+ if (uni_addr->DadState == IpDadStateDeprecated ||
+ uni_addr->DadState == IpDadStatePreferred) {
+ sock = uni_addr->Address.lpSockaddr;
- // IPv4 addresses already retrieved with enumAddresses_win
- if (sock->sa_family == AF_INET) {
- uni_addr = uni_addr->Next;
- continue;
- }
+ // IPv4 addresses already retrieved with enumAddresses_win
+ if (sock->sa_family == AF_INET) {
+ uni_addr = uni_addr->Next;
+ continue;
+ }
curr = (netaddr *)calloc (1, sizeof (netaddr));
- if (curr == 0) {
- return -1;
- }
- if (start == NULL) {
+
+ if (curr == NULL)
+ goto freeAllocatedMemory;
+
+ if (start == NULL)
start = curr;
- }
- if (prev != NULL) {
- prev->next = curr;
- }
+
+ if (prev != NULL)
+ prev->next = curr;
+
prev = curr;
SOCKETADDRESS_COPY (&curr->addr, sock);
if (prefix != NULL) {
@@ -388,15 +413,16 @@
any_addr = ptr->FirstAnycastAddress;
while (any_addr != NULL) {
curr = (netaddr *)calloc (1, sizeof (netaddr));
- if (curr == 0) {
- return -1;
- }
- if (start == NULL) {
+
+ if (curr == NULL)
+ goto freeAllocatedMemory;
+
+ if (start == NULL)
start = curr;
- }
- if (prev != NULL) {
+
+ if (prev != NULL)
prev->next = curr;
- }
+
prev = curr;
sock = any_addr->Address.lpSockaddr;
SOCKETADDRESS_COPY (&curr->addr, sock);
@@ -407,6 +433,25 @@
*netaddrPP = start;
}
return count;
+
+freeAllocatedMemory:
+
+ if (*netaddrPP != NULL) {
+ //N.B. the variable "start" cannot be NULL at this point because we started with an
+ //existing list.
+ curr=start->next;
+ start->next = NULL;
+ start = curr;
+ }
+ // otherwise, "start" points to the beginning of an incomplete list that we must deallocate.
+
+ while (start != NULL) {
+ curr = start->next;
+ free(start);
+ start = curr;
+ }
+
+ return -1;
}
/*
@@ -773,10 +818,12 @@
ptr = getAdapter(env, index);
if (ptr != NULL) {
len = ptr->PhysicalAddressLength;
- ret = (*env)->NewByteArray(env, len);
- if (!IS_NULL(ret)) {
- (*env)->SetByteArrayRegion(env, ret, 0, len,
- (jbyte*) ptr->PhysicalAddress);
+ if (len > 0) {
+ ret = (*env)->NewByteArray(env, len);
+ if (!IS_NULL(ret)) {
+ (*env)->SetByteArrayRegion(env, ret, 0, len,
+ (jbyte*) ptr->PhysicalAddress);
+ }
}
free(ptr);
}
--- a/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c Wed May 01 11:34:06 2013 -0700
@@ -122,9 +122,18 @@
*/
size = sizeof(IP_ADAPTER_INFO);
adapterP = (IP_ADAPTER_INFO *)malloc(size);
+ if (adapterP == NULL) {
+ return -1;
+ }
ret = GetAdaptersInfo(adapterP, &size);
if (ret == ERROR_BUFFER_OVERFLOW) {
- adapterP = (IP_ADAPTER_INFO *)realloc(adapterP, size);
+ IP_ADAPTER_INFO *newAdapterP = (IP_ADAPTER_INFO *)realloc(adapterP, size);
+ if (newAdapterP == NULL) {
+ free(adapterP);
+ return -1;
+ }
+ adapterP = newAdapterP;
+
ret = GetAdaptersInfo(adapterP, &size);
}
--- a/jdk/src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c Wed May 01 11:27:12 2013 -0700
+++ b/jdk/src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -196,7 +196,7 @@
break;
}
- localeString = getJavaIDFromLangID(langid);
+ localeString = (char *)getJavaIDFromLangID(langid);
ret = (*env)->NewStringUTF(env, localeString);
free(localeString);
return ret;
@@ -366,12 +366,14 @@
*/
JNIEXPORT jboolean JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_isNativeDigit
(JNIEnv *env, jclass cls, jstring jlangtag) {
- WCHAR buf[BUFLEN];
+ DWORD num;
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
- int got = getLocaleInfoWrapper(langtag, LOCALE_IDIGITSUBSTITUTION, buf, BUFLEN);
+ int got = getLocaleInfoWrapper(langtag,
+ LOCALE_IDIGITSUBSTITUTION | LOCALE_RETURN_NUMBER,
+ (LPWSTR)&num, sizeof(num));
(*env)->ReleaseStringChars(env, jlangtag, langtag);
- return got && buf[0] == L'2'; // 2: native digit substitution
+ return got && num == 2; // 2: native digit substitution
}
/*
@@ -590,25 +592,72 @@
*/
JNIEXPORT jint JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCalendarDataValue
(JNIEnv *env, jclass cls, jstring jlangtag, jint type) {
- WCHAR buf[BUFLEN];
+ DWORD num;
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
int got = 0;
switch (type) {
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_CD_FIRSTDAYOFWEEK:
- got = getLocaleInfoWrapper(langtag, LOCALE_IFIRSTDAYOFWEEK, buf, BUFLEN);
+ got = getLocaleInfoWrapper(langtag,
+ LOCALE_IFIRSTDAYOFWEEK | LOCALE_RETURN_NUMBER,
+ (LPWSTR)&num, sizeof(num));
break;
}
(*env)->ReleaseStringChars(env, jlangtag, langtag);
if (got) {
- return _wtoi(buf);
+ return num;
} else {
return -1;
}
}
+/*
+ * Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
+ * Method: getDisplayString
+ * Signature: (Ljava/lang/String;ILjava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getDisplayString
+ (JNIEnv *env, jclass cls, jstring jlangtag, jint type, jstring jvalue) {
+ LCTYPE lcType;
+ jstring jStr;
+ const jchar * pjChar;
+ WCHAR buf[BUFLEN];
+ int got = 0;
+
+ switch (type) {
+ case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_CURRENCY_NAME:
+ lcType = LOCALE_SNATIVECURRNAME;
+ jStr = jlangtag;
+ break;
+ case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_CURRENCY_SYMBOL:
+ lcType = LOCALE_SCURRENCY;
+ jStr = jlangtag;
+ break;
+ case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_LOCALE_LANGUAGE:
+ lcType = LOCALE_SLOCALIZEDLANGUAGENAME;
+ jStr = jvalue;
+ break;
+ case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_LOCALE_REGION:
+ lcType = LOCALE_SLOCALIZEDCOUNTRYNAME;
+ jStr = jvalue;
+ break;
+ default:
+ return NULL;
+ }
+
+ pjChar = (*env)->GetStringChars(env, jStr, JNI_FALSE);
+ got = getLocaleInfoWrapper(pjChar, lcType, buf, BUFLEN);
+ (*env)->ReleaseStringChars(env, jStr, pjChar);
+
+ if (got) {
+ return (*env)->NewString(env, buf, wcslen(buf));
+ } else {
+ return NULL;
+ }
+}
+
int getLocaleInfoWrapper(const jchar *langtag, LCTYPE type, LPWSTR data, int buflen) {
if (pGetLocaleInfoEx) {
if (wcscmp(L"und", (LPWSTR)langtag) == 0) {
@@ -642,11 +691,13 @@
}
jint getCalendarID(const jchar *langtag) {
- WCHAR type[BUFLEN];
- int got = getLocaleInfoWrapper(langtag, LOCALE_ICALENDARTYPE, type, BUFLEN);
+ DWORD type;
+ int got = getLocaleInfoWrapper(langtag,
+ LOCALE_ICALENDARTYPE | LOCALE_RETURN_NUMBER,
+ (LPWSTR)&type, sizeof(type));
if (got) {
- return _wtoi(type);
+ return type;
} else {
return 0;
}
@@ -691,28 +742,37 @@
}
void getNumberPart(const jchar * langtag, const jint numberStyle, WCHAR * number) {
- WCHAR buf[BUFLEN];
+ DWORD digits = 0;
+ DWORD leadingZero = 0;
WCHAR grouping[BUFLEN];
+ int groupingLen;
WCHAR fractionPattern[BUFLEN];
WCHAR * integerPattern = number;
- int digits;
- BOOL leadingZero;
WCHAR * pDest;
- int groupingLen;
// Get info from Windows
- if (numberStyle == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_CURRENCY) {
- getLocaleInfoWrapper(langtag, LOCALE_ICURRDIGITS, buf, BUFLEN);
- } else {
- getLocaleInfoWrapper(langtag, LOCALE_IDIGITS, buf, BUFLEN);
+ switch (numberStyle) {
+ case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_CURRENCY:
+ getLocaleInfoWrapper(langtag,
+ LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER,
+ (LPWSTR)&digits, sizeof(digits));
+ break;
+
+ case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_INTEGER:
+ break;
+
+ case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_NUMBER:
+ case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_PERCENT:
+ default:
+ getLocaleInfoWrapper(langtag,
+ LOCALE_IDIGITS | LOCALE_RETURN_NUMBER,
+ (LPWSTR)&digits, sizeof(digits));
+ break;
}
- if (numberStyle == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_INTEGER) {
- digits = 0;
- } else {
- digits = _wtoi(buf);
- }
- getLocaleInfoWrapper(langtag, LOCALE_ILZERO, buf, BUFLEN);
- leadingZero = _wtoi(buf) != 0;
+
+ getLocaleInfoWrapper(langtag,
+ LOCALE_ILZERO | LOCALE_RETURN_NUMBER,
+ (LPWSTR)&leadingZero, sizeof(leadingZero));
groupingLen = getLocaleInfoWrapper(langtag, LOCALE_SGROUPING, grouping, BUFLEN);
// fraction pattern
@@ -749,7 +809,7 @@
}
}
- if (leadingZero) {
+ if (leadingZero != 0) {
*pDest++ = L'0';
} else {
*pDest++ = L'#';
@@ -760,29 +820,35 @@
}
void getFixPart(const jchar * langtag, const jint numberStyle, BOOL positive, BOOL prefix, WCHAR * ret) {
- WCHAR buf[BUFLEN];
- int pattern = 0;
+ DWORD pattern = 0;
int style = numberStyle;
int got = 0;
if (positive) {
if (style == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_CURRENCY) {
- got = getLocaleInfoWrapper(langtag, LOCALE_ICURRENCY, buf, BUFLEN);
+ got = getLocaleInfoWrapper(langtag,
+ LOCALE_ICURRENCY | LOCALE_RETURN_NUMBER,
+ (LPWSTR)&pattern, sizeof(pattern));
} else if (style == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_PERCENT) {
- got = getLocaleInfoWrapper(langtag, LOCALE_IPOSITIVEPERCENT, buf, BUFLEN);
+ got = getLocaleInfoWrapper(langtag,
+ LOCALE_IPOSITIVEPERCENT | LOCALE_RETURN_NUMBER,
+ (LPWSTR)&pattern, sizeof(pattern));
}
} else {
if (style == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_CURRENCY) {
- got = getLocaleInfoWrapper(langtag, LOCALE_INEGCURR, buf, BUFLEN);
+ got = getLocaleInfoWrapper(langtag,
+ LOCALE_INEGCURR | LOCALE_RETURN_NUMBER,
+ (LPWSTR)&pattern, sizeof(pattern));
} else if (style == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_PERCENT) {
- got = getLocaleInfoWrapper(langtag, LOCALE_INEGATIVEPERCENT, buf, BUFLEN);
+ got = getLocaleInfoWrapper(langtag,
+ LOCALE_INEGATIVEPERCENT | LOCALE_RETURN_NUMBER,
+ (LPWSTR)&pattern, sizeof(pattern));
} else {
- got = getLocaleInfoWrapper(langtag, LOCALE_INEGNUMBER, buf, BUFLEN);
+ got = getLocaleInfoWrapper(langtag,
+ LOCALE_INEGNUMBER | LOCALE_RETURN_NUMBER,
+ (LPWSTR)&pattern, sizeof(pattern));
}
}
- if (got) {
- pattern = _wtoi(buf);
- }
if (numberStyle == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_INTEGER) {
style = sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_NUMBER;
--- a/jdk/test/Makefile Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/Makefile Wed May 01 11:34:06 2013 -0700
@@ -502,7 +502,7 @@
# Stable agentvm testruns (TestNG)
JDK_DEFAULT_TARGETS += jdk_time
jdk_time: $(call TestDirs, java/time)
- $(call RunOthervmBatch)
+ $(call RunAgentvmBatch)
# Stable agentvm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_other
--- a/jdk/test/ProblemList.txt Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/ProblemList.txt Wed May 01 11:34:06 2013 -0700
@@ -122,6 +122,9 @@
# jdk_lang
+# 8009615
+java/lang/instrument/IsModifiableClassAgent.java generic-all
+
# 6944188
java/lang/management/ThreadMXBean/ThreadStateTest.java generic-all
@@ -144,6 +147,9 @@
# jdk_management
+# 8010897
+sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java macosx-all
+
############################################################################
# jdk_jmx
--- a/jdk/test/java/io/Serializable/accessConstants/AccessConstants.java Wed May 01 11:27:12 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * 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 4067964
-@clean AccessConstants
-@build AccessConstants
-@summary Verify that ObjectStreamConstants is public accessible.
- This test will not compile pre-JDK 1.2.
-*/
-
-import java.io.ObjectStreamConstants;
-
-public class AccessConstants {
- public static void main(String[] args) {
- byte[] ref = new byte[4];
- ref[0] = ObjectStreamConstants.TC_BASE;
- ref[1] = ObjectStreamConstants.TC_NULL;
- ref[2] = ObjectStreamConstants.TC_REFERENCE;
- ref[3] = ObjectStreamConstants.TC_CLASSDESC;
- int version = ObjectStreamConstants.PROTOCOL_VERSION_1;
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/CharSequence/DefaultTest.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.PrimitiveIterator;
+import java.util.stream.Collectors;
+
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+/*
+ * @test
+ * @summary Unit test for CharSequence default methods
+ * @bug 8012665
+ * @run testng DefaultTest
+ */
+
+@Test(groups = "lib")
+public class DefaultTest {
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testEmptyChars() {
+ PrimitiveIterator.OfInt s = "".chars().iterator();
+ assertFalse(s.hasNext());
+ int ch = s.nextInt();
+ }
+
+ public void testSimpleChars() {
+ List<Integer> list = "abc".chars().boxed().collect(Collectors.toList());
+ assertEquals(list, Arrays.asList((int) 'a', (int) 'b', (int) 'c'));
+ }
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testEmptyCodePoints() {
+ PrimitiveIterator.OfInt s = "".codePoints().iterator();
+ assertFalse(s.hasNext());
+ int cp = s.nextInt();
+ }
+
+ public void testSimpleCodePoints() {
+ List<Integer> list = "abc".codePoints().boxed().collect(Collectors.toList());
+ assertEquals(list, Arrays.asList((int)'a', (int)'b', (int)'c'));
+ }
+
+ public void testUndefCodePoints() {
+ List<Integer> list = "X\ufffeY".codePoints().boxed().collect(Collectors.toList());
+ assertEquals(list, Arrays.asList((int)'X', 0xFFFE, (int)'Y'));
+ }
+
+ public void testSurrogatePairing() {
+ // U+1D11E = MUSICAL SYMBOL G CLEF
+ // equivalent to surrogate pair U+D834 U+DD1E
+ List<Integer> list;
+ final int GCLEF = 0x1d11e;
+
+ list = "\ud834\udd1e".codePoints().boxed().collect(Collectors.toList());
+ assertEquals(list, Arrays.asList(GCLEF));
+ list = "A\ud834\udd1e".codePoints().boxed().collect(Collectors.toList());
+ assertEquals(list, Arrays.asList((int)'A', GCLEF));
+ list = "\ud834\udd1eB".codePoints().boxed().collect(Collectors.toList());
+ assertEquals(list, Arrays.asList(GCLEF, (int)'B'));
+ list = "X\ud834\udd1eY".codePoints().boxed().collect(Collectors.toList());
+ assertEquals(list, Arrays.asList((int)'X', GCLEF, (int)'Y'));
+ }
+
+ public void testUndefUnpaired() {
+ List<Integer> list = "W\udd1eX\ud834Y\ufffeZ".codePoints().boxed().collect(Collectors.toList());
+ assertEquals(list, Arrays.asList(
+ (int)'W', 0xdd1e, (int)'X', 0xd834, (int)'Y', 0xfffe, (int)'Z'));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/String/StringJoinTest.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/**
+ * @test @bug 5015163
+ * @summary test String merge/join that is the inverse of String.split()
+ * @run testng StringJoinTest
+ * @author Jim Gish
+ */
+import java.util.ArrayList;
+import java.util.List;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+@Test(groups = {"unit","string","lang","libs"})
+public class StringJoinTest {
+ private final static String DASH = "-";
+ private final static String BEGIN = "Hi there";
+ private final static String JIM = "Jim";
+ private final static String JOHN = "John";
+ private final static String AND_JOE = "and Joe";
+ private final static String BILL = "Bill";
+ private final static String BOB = "Bob";
+ private final static String AND_BO = "and Bo";
+ private final static String ZEKE = "Zeke";
+ private final static String ZACK = "Zack";
+ private final static String AND_ZOE = "and Zoe";
+
+ /**
+ * Tests the join() methods on String
+ */
+ public void testJoinStringVarargs() {
+ // check a non-null join of String array (var-args) elements
+ String expectedResult = BEGIN + DASH + JIM + DASH + JOHN + DASH + AND_JOE;
+ String result = String.join(DASH, BEGIN, JIM, JOHN, AND_JOE);
+
+ assertEquals(result, expectedResult, "BEGIN.join(DASH, JIM, JOHN, AND_JOE)");
+ // test with just one element
+ assertEquals(String.join(DASH, BEGIN), BEGIN);
+ }
+
+ public void testJoinStringArray() {
+ // check a non-null join of Object[] with String elements
+ String[] theBs = {BILL, BOB, AND_BO};
+ String result = String.join(DASH, theBs);
+ String expectedResult = BILL + DASH + BOB + DASH + AND_BO;
+ assertEquals(result, expectedResult, "String.join(DASH, theBs)");
+ }
+
+ public void testJoinEmptyStringArray() {
+ // check a non-null join of Object[] with String elements
+ String[] empties = {};
+ String result = String.join(DASH, empties);
+ assertEquals(result, "", "String.join(DASH, empties)");
+ }
+
+ @Test(expectedExceptions = {NullPointerException.class})
+ public void testJoinNullStringArray() {
+ // check a non-null join of Object[] with String elements
+ String[] empties = null;
+ String result = String.join(DASH, empties);
+ }
+
+ @Test(expectedExceptions = {NullPointerException.class})
+ public void testJoinNullIterableStringList() {
+ // check join of an Iterables
+ List<CharSequence> theZsList = null;
+ String.join(DASH, theZsList);
+ }
+
+ public void testJoinIterableStringList() {
+ // check join of an Iterables
+ List<CharSequence> theZsList = new ArrayList<>();
+ theZsList.add(ZEKE);
+ theZsList.add(ZACK);
+ theZsList.add(AND_ZOE);
+ assertEquals(String.join(DASH, theZsList), ZEKE + DASH + ZACK + DASH
+ + AND_ZOE, "String.join(DASH, theZsList))");
+ }
+
+ public void testJoinNullStringList() {
+ List<CharSequence> nullList = null;
+ try {
+ assertEquals( String.join( DASH, nullList ), "null" );
+ fail("Null container should cause NPE");
+ } catch (NullPointerException npe) {}
+ assertEquals(String.join(DASH, null, null), "null" + DASH + "null");
+ }
+
+ @Test(expectedExceptions = {NullPointerException.class})
+ public void testJoinNullDelimiter() {
+ String.join(null, JIM, JOHN);
+ }
+}
--- a/jdk/test/java/lang/StringBuffer/TestSynchronization.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/lang/StringBuffer/TestSynchronization.java Wed May 01 11:34:06 2013 -0700
@@ -96,6 +96,10 @@
// the right thing.
List<Method> methods = Arrays.asList(aClass.getDeclaredMethods());
for (Method m : methods) {
+ // skip synthetic methods, like default interface methods and lambdas
+ if (m.isSynthetic()) {
+ continue;
+ }
int modifiers = m.getModifiers();
if (Modifier.isPublic(modifiers)
&& !Modifier.isSynchronized(modifiers)) {
--- a/jdk/test/java/lang/Throwable/SuppressedExceptions.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/lang/Throwable/SuppressedExceptions.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
/*
* @test
- * @bug 6911258 6962571 6963622 6991528 7005628
+ * @bug 6911258 6962571 6963622 6991528 7005628 8012044
* @summary Basic tests of suppressed exceptions
* @author Joseph D. Darcy
*/
@@ -40,6 +40,7 @@
serializationTest();
selfReference();
noModification();
+ initCausePlumbing();
}
private static void noSelfSuppression() {
@@ -48,7 +49,9 @@
throwable.addSuppressed(throwable);
throw new RuntimeException("IllegalArgumentException for self-suppresion not thrown.");
} catch (IllegalArgumentException iae) {
- ; // Expected
+ // Expected to be here
+ if (iae.getCause() != throwable)
+ throw new RuntimeException("Bad cause after self-suppresion.");
}
}
@@ -208,4 +211,36 @@
super("The medium.", null, enableSuppression, true);
}
}
+
+ private static void initCausePlumbing() {
+ Throwable t1 = new Throwable();
+ Throwable t2 = new Throwable("message", t1);
+ Throwable t3 = new Throwable();
+
+ try {
+ t2.initCause(t3);
+ throw new RuntimeException("Shouldn't reach.");
+ } catch (IllegalStateException ise) {
+ if (ise.getCause() != t2)
+ throw new RuntimeException("Unexpected cause in ISE", ise);
+ Throwable[] suppressed = ise.getSuppressed();
+ if (suppressed.length != 0)
+ throw new RuntimeException("Bad suppression in ISE", ise);
+ }
+
+ try {
+ t2.initCause(null);
+ throw new RuntimeException("Shouldn't reach.");
+ } catch (IllegalStateException ise) {
+ ; // Expected; don't want an NPE.
+ }
+
+ try {
+ t3.initCause(t3);
+ throw new RuntimeException("Shouldn't reach.");
+ } catch (IllegalArgumentException iae) {
+ if (iae.getCause() != t3)
+ throw new RuntimeException("Unexpected cause in ISE", iae);
+ }
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,1122 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.PrintStream;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.List;
+
+/**
+ * @test
+ * @bug 8007373
+ * @summary jdk7 backward compatibility serialization problem
+ */
+
+public class Inet6AddressSerializationTest {
+
+ static boolean failed;
+
+ public static final int LOOPBACK_SCOPE_ID = 0;
+
+ public static final byte[] IN6ADDR_ANY_INIT = { (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
+
+ public static final byte[] LOOPBACKIPV6ADDRESS = { (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01 };
+
+ // fe80::21b:24ff:febd:f29c
+ public static final byte[] E1000G0IPV6ADDRESS = { (byte) 0xfe, (byte) 0x80,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x02, (byte) 0x1b, (byte) 0x24, (byte) 0xff,
+ (byte) 0xfe, (byte) 0xbd, (byte) 0xf2, (byte) 0x9c };
+
+ public static final String E1000G0HOSTNAME = "fe80:0:0:0:21b:24ff:febd:f29c%e1000g0";
+
+ public static final String LOCALHOSTNAME = "localhost";
+
+ public static final String NETWORK_IF_E1000G0 = "e1000g0";
+
+ public static final String NETWORK_IF_LO0 = "lo0";
+
+ public static final int SCOPE_ID_E1000G0 = 2;
+
+ public static final int SCOPE_ID_LO0 = 1;
+
+ public static final int SCOPE_ID_ZERO = 0;
+
+ public static void main(String[] args) throws Exception {
+ // args[0] == generate-loopback generates serial data for loopback if
+ // args[0] == generateAll generates serial data for interfaces with an
+ // IPV6 address binding
+
+ if (args.length != 0) {
+
+ if (args[0].equals("generate-loopback")) {
+
+ generateSerializedInet6AddressData(Inet6Address.getByAddress(
+ InetAddress.getLoopbackAddress().getHostName(),
+ LOOPBACKIPV6ADDRESS, LOOPBACK_SCOPE_ID), System.out,
+ true);
+
+ } else {
+ generateAllInet6AddressSerializedData();
+ }
+ } else {
+ runTests();
+ }
+ }
+
+ private static void runTests() throws UnknownHostException, Exception,
+ IOException {
+ byte[] thisHostIPV6Address = null;
+ int scope_id = LOOPBACK_SCOPE_ID;
+
+ System.out.println("Hostname: "
+ + InetAddress.getLocalHost().getHostName());
+ System.out.println("LocalHost isLoopback : "
+ + InetAddress.getLocalHost().isLoopbackAddress());
+ thisHostIPV6Address = getThisHostIPV6Address(InetAddress.getLocalHost()
+ .getHostName());
+
+ if (thisHostIPV6Address == null) {
+ thisHostIPV6Address = IN6ADDR_ANY_INIT;
+ }
+
+ // testing JDK7 generated serialized loopback against locally generated
+ // loopback address
+ testInet6AddressSerialization(Inet6Address.getByAddress(InetAddress
+ .getLoopbackAddress().getHostName(), LOOPBACKIPV6ADDRESS,
+ scope_id), JDK7Inet6AddressSerialData);
+ // testing JDK8 generated serialized loopback against locally generated
+ // loopback address
+ testInet6AddressSerialization(Inet6Address.getByAddress(InetAddress
+ .getLoopbackAddress().getHostName(), LOOPBACKIPV6ADDRESS,
+ scope_id), JDK8Inet6AddressSerialData);
+ testInet6AddressSerialization(Inet6Address.getByAddress(InetAddress
+ .getLocalHost().getHostName(), IN6ADDR_ANY_INIT, scope_id),
+ null);
+ testInet6AddressSerialization(Inet6Address.getByAddress(InetAddress
+ .getLocalHost().getHostName(), thisHostIPV6Address, scope_id),
+ null);
+ testAllNetworkInterfaces();
+
+ // test against lo0
+ testSerializedLo0Inet6Address();
+
+ testSerializedE1000gInet6Address();
+
+ if (failed)
+ throw new RuntimeException("Some tests failed, check output");
+ }
+
+ private static byte[] getThisHostIPV6Address(String hostName)
+ throws Exception {
+ InetAddress[] thisHostIPAddresses = null;
+ try {
+ thisHostIPAddresses = InetAddress.getAllByName(InetAddress
+ .getLocalHost().getHostName());
+ } catch (UnknownHostException uhEx) {
+ uhEx.printStackTrace();
+ throw uhEx;
+ }
+ byte[] thisHostIPV6Address = null;
+ for (InetAddress inetAddress : thisHostIPAddresses) {
+ if (inetAddress instanceof Inet6Address) {
+ if (inetAddress.getHostName().equals(hostName)) {
+ thisHostIPV6Address = inetAddress.getAddress();
+ break;
+ }
+ }
+ }
+ // System.err.println("getThisHostIPV6Address: address is "
+ // + Arrays.toString(thisHostIPV6Address));
+ return thisHostIPV6Address;
+ }
+
+ static void testAllNetworkInterfaces() throws Exception {
+ System.err.println("\n testAllNetworkInterfaces: \n ");
+ for (Enumeration<NetworkInterface> e = NetworkInterface
+ .getNetworkInterfaces(); e.hasMoreElements();) {
+ NetworkInterface netIF = e.nextElement();
+ for (Enumeration<InetAddress> iadrs = netIF.getInetAddresses(); iadrs
+ .hasMoreElements();) {
+ InetAddress iadr = iadrs.nextElement();
+ if (iadr instanceof Inet6Address) {
+ System.err.println("Test NetworkInterface: " + netIF);
+ Inet6Address i6adr = (Inet6Address) iadr;
+ System.err.println("Testing with " + iadr);
+ System.err.println(" scoped iface: "
+ + i6adr.getScopedInterface());
+ testInet6AddressSerialization(i6adr, null);
+ }
+ }
+ }
+ }
+
+ static void displayExpectedInet6Address(Inet6Address expectedInet6Address) {
+
+ String expectedHostName = expectedInet6Address.getHostName();
+ byte[] expectedAddress = expectedInet6Address.getAddress();
+ String expectedHostAddress = expectedInet6Address.getHostAddress();
+ int expectedScopeId = expectedInet6Address.getScopeId();
+ NetworkInterface expectedNetIf = expectedInet6Address
+ .getScopedInterface();
+
+ System.err.println("Excpected HostName: " + expectedHostName);
+ System.err.println("Expected Address: "
+ + Arrays.toString(expectedAddress));
+ System.err.println("Expected HostAddress: " + expectedHostAddress);
+ System.err.println("Expected Scope Id " + expectedScopeId);
+ System.err.println("Expected NetworkInterface " + expectedNetIf);
+ System.err.println("Expected Inet6Address " + expectedInet6Address);
+ }
+
+ // test serialization deserialization of Inet6Address
+ static void testInet6AddressSerialization(
+ Inet6Address expectedInet6Address, byte[] serializedAddress)
+ throws IOException {
+ System.err.println("\n testInet6AddressSerialization: enter \n");
+
+ // displayExpectedInet6Address(expectedInet6Address);
+
+ byte[] serialData = serializedAddress != null ? serializedAddress
+ : generateSerializedInet6AddressData(expectedInet6Address,
+ null, false);
+ try (ByteArrayInputStream bis = new ByteArrayInputStream(serialData);
+ ObjectInputStream oin = new ObjectInputStream(bis)) {
+ Inet6Address deserializedIPV6Addr = (Inet6Address) oin.readObject();
+ System.err.println("Deserialized Inet6Address "
+ + deserializedIPV6Addr);
+ assertHostNameEqual(expectedInet6Address.getHostName(),
+ deserializedIPV6Addr.getHostName());
+ assertHostAddressEqual(expectedInet6Address.getHostAddress(),
+ deserializedIPV6Addr.getHostAddress());
+ assertAddressEqual(expectedInet6Address.getAddress(),
+ deserializedIPV6Addr.getAddress());
+ assertScopeIdEqual(expectedInet6Address.getScopeId(),
+ deserializedIPV6Addr.getScopeId());
+ assertNetworkInterfaceEqual(
+ expectedInet6Address.getScopedInterface(),
+ deserializedIPV6Addr.getScopedInterface());
+ } catch (Exception e) {
+ System.err.println("Exception caught during deserialization");
+ failed = true;
+ e.printStackTrace();
+ }
+ }
+
+ static void testSerializedE1000gInet6Address() throws IOException {
+ System.err.println("\n testSerializedE1000gInet6Address: enter \n");
+ boolean testWithNetIf = true;
+ boolean useMockInet6Address = false;
+
+ NetworkInterface testNetIf = NetworkInterface
+ .getByName(NETWORK_IF_E1000G0);
+ Inet6Address expectedInet6Address = null;
+ if (testNetIf != null) {
+ System.err
+ .println("\n testSerializedE1000gInet6Address: using netif \n");
+ try {
+ expectedInet6Address = Inet6Address.getByAddress(
+ E1000G0HOSTNAME, E1000G0IPV6ADDRESS, testNetIf);
+ } catch (UnknownHostException ukhEx) {
+ ukhEx.printStackTrace();
+ testWithNetIf = true;
+ useMockInet6Address = true;
+ }
+ } else {
+ System.err
+ .println("\n testSerializedE1000gInet6Address: using index \n");
+ try {
+ expectedInet6Address = Inet6Address.getByAddress(
+ E1000G0HOSTNAME, E1000G0IPV6ADDRESS, SCOPE_ID_ZERO);
+ } catch (UnknownHostException ukhEx1) {
+ ukhEx1.printStackTrace();
+ useMockInet6Address = true;
+ }
+ testWithNetIf = false;
+ }
+
+ byte[] serializedAddress = SerialData_ifname_e1000g0;
+
+ // displayExpectedInet6Address(expectedInet6Address);
+
+ try (ByteArrayInputStream bis = new ByteArrayInputStream(
+ serializedAddress);
+ ObjectInputStream oin = new ObjectInputStream(bis)) {
+ Inet6Address deserializedIPV6Addr = (Inet6Address) oin.readObject();
+ System.err.println("Deserialized Inet6Address "
+ + deserializedIPV6Addr);
+
+ if (!useMockInet6Address) {
+ assertHostNameEqual(expectedInet6Address.getHostName(),
+ deserializedIPV6Addr.getHostName());
+ if (testWithNetIf) {
+ assertHostAddressEqual(
+ expectedInet6Address.getHostAddress(),
+ deserializedIPV6Addr.getHostAddress());
+ } else {
+ assertHostAddressEqual(
+ MockE1000g0Inet6Address.getBareHostAddress(),
+ deserializedIPV6Addr.getHostAddress());
+ }
+ assertAddressEqual(expectedInet6Address.getAddress(),
+ deserializedIPV6Addr.getAddress());
+ assertScopeIdEqual(expectedInet6Address.getScopeId(),
+ deserializedIPV6Addr.getScopeId());
+ if (testWithNetIf) {
+ assertNetworkInterfaceEqual(
+ expectedInet6Address.getScopedInterface(),
+ deserializedIPV6Addr.getScopedInterface());
+ } else {
+ assertNetworkInterfaceEqual(null,
+ deserializedIPV6Addr.getScopedInterface());
+ }
+ } else { // use MockLo0Inet6Address
+ assertHostNameEqual(MockE1000g0Inet6Address.getHostName(),
+ deserializedIPV6Addr.getHostName());
+ if (testWithNetIf) {
+ assertHostAddressEqual(
+ MockE1000g0Inet6Address.getHostAddress(),
+ deserializedIPV6Addr.getHostAddress());
+ } else {
+ assertHostAddressEqual(
+ MockE1000g0Inet6Address.getHostAddressWithIndex(),
+ deserializedIPV6Addr.getHostAddress());
+ }
+ assertAddressEqual(MockE1000g0Inet6Address.getAddress(),
+ deserializedIPV6Addr.getAddress());
+ if (testWithNetIf) {
+ assertScopeIdEqual(MockE1000g0Inet6Address.getScopeId(),
+ deserializedIPV6Addr.getScopeId());
+ } else {
+ assertScopeIdEqual(MockE1000g0Inet6Address.getScopeZero(),
+ deserializedIPV6Addr.getScopeId());
+ }
+ assertNetworkInterfaceNameEqual(
+ MockE1000g0Inet6Address.getScopeIfName(),
+ deserializedIPV6Addr.getScopedInterface());
+ }
+ } catch (Exception e) {
+ System.err.println("Exception caught during deserialization");
+ failed = true;
+ e.printStackTrace();
+ }
+ }
+
+ static void testSerializedLo0Inet6Address() throws IOException {
+ System.err.println("\n testSerializedLo0Inet6Address: enter \n");
+ boolean testWithNetIf = true;
+ boolean useMockInet6Address = false;
+
+ NetworkInterface testNetIf = NetworkInterface.getByName(NETWORK_IF_LO0);
+ Inet6Address expectedInet6Address = null;
+ if (testNetIf != null) {
+ System.err
+ .println("\n testSerializedLo0Inet6Address: using netif \n");
+ try {
+ expectedInet6Address = Inet6Address.getByAddress(LOCALHOSTNAME,
+ LOOPBACKIPV6ADDRESS, testNetIf);
+ } catch (UnknownHostException ukhEx) {
+ ukhEx.printStackTrace();
+ testWithNetIf = true;
+ useMockInet6Address = true;
+ }
+ } else {
+ System.err
+ .println("\n testSerializedLo0Inet6Address: using index \n");
+ try {
+ expectedInet6Address = Inet6Address.getByAddress(LOCALHOSTNAME,
+ LOOPBACKIPV6ADDRESS, SCOPE_ID_ZERO);
+ } catch (UnknownHostException ukhEx1) {
+ ukhEx1.printStackTrace();
+ useMockInet6Address = true;
+ }
+ testWithNetIf = false;
+ }
+
+ // displayExpectedInet6Address(expectedInet6Address);
+
+ byte[] serializedAddress = SerialData_ifname_lo0;
+
+ try (ByteArrayInputStream bis = new ByteArrayInputStream(
+ serializedAddress);
+ ObjectInputStream oin = new ObjectInputStream(bis)) {
+ Inet6Address deserializedIPV6Addr = (Inet6Address) oin.readObject();
+ System.err.println("Deserialized Inet6Address "
+ + deserializedIPV6Addr);
+ if (!useMockInet6Address) {
+ assertHostNameEqual(expectedInet6Address.getHostName(),
+ deserializedIPV6Addr.getHostName());
+ if (testWithNetIf) {
+ assertHostAddressEqual(
+ expectedInet6Address.getHostAddress(),
+ deserializedIPV6Addr.getHostAddress());
+ } else {
+ assertHostAddressEqual(
+ MockLo0Inet6Address.getBareHostAddress(),
+ deserializedIPV6Addr.getHostAddress());
+ }
+ assertAddressEqual(expectedInet6Address.getAddress(),
+ deserializedIPV6Addr.getAddress());
+ assertScopeIdEqual(expectedInet6Address.getScopeId(),
+ deserializedIPV6Addr.getScopeId());
+ if (testWithNetIf) {
+ assertNetworkInterfaceEqual(
+ expectedInet6Address.getScopedInterface(),
+ deserializedIPV6Addr.getScopedInterface());
+ } else {
+ assertNetworkInterfaceEqual(null,
+ deserializedIPV6Addr.getScopedInterface());
+ }
+ } else { // use MockLo0Inet6Address
+ assertHostNameEqual(MockLo0Inet6Address.getHostName(),
+ deserializedIPV6Addr.getHostName());
+ if (testWithNetIf) {
+ assertHostAddressEqual(
+ MockLo0Inet6Address.getHostAddress(),
+ deserializedIPV6Addr.getHostAddress());
+ } else {
+ assertHostAddressEqual(
+ MockLo0Inet6Address.getHostAddressWithIndex(),
+ deserializedIPV6Addr.getHostAddress());
+ }
+ assertAddressEqual(MockLo0Inet6Address.getAddress(),
+ deserializedIPV6Addr.getAddress());
+ if (testWithNetIf) {
+ assertScopeIdEqual(MockLo0Inet6Address.getScopeId(),
+ deserializedIPV6Addr.getScopeId());
+ } else {
+ assertScopeIdEqual(MockLo0Inet6Address.getScopeZero(),
+ deserializedIPV6Addr.getScopeId());
+ }
+ assertNetworkInterfaceNameEqual(
+ MockLo0Inet6Address.getScopeIfName(),
+ deserializedIPV6Addr.getScopedInterface());
+ }
+ } catch (Exception e) {
+ System.err.println("Exception caught during deserialization");
+ failed = true;
+ e.printStackTrace();
+ }
+ }
+
+ static List<Inet6Address> getAllInet6Addresses() throws Exception {
+ // System.err.println("\n getAllInet6Addresses: \n ");
+ ArrayList<Inet6Address> inet6Addresses = new ArrayList<Inet6Address>();
+ for (Enumeration<NetworkInterface> e = NetworkInterface
+ .getNetworkInterfaces(); e.hasMoreElements();) {
+ NetworkInterface netIF = e.nextElement();
+ for (Enumeration<InetAddress> iadrs = netIF.getInetAddresses(); iadrs
+ .hasMoreElements();) {
+ InetAddress iadr = iadrs.nextElement();
+ if (iadr instanceof Inet6Address) {
+ System.err.println("Test NetworkInterface: " + netIF);
+ Inet6Address i6adr = (Inet6Address) iadr;
+ System.err.println(" address " + iadr);
+ System.err.println(" scoped iface: "
+ + i6adr.getScopedInterface());
+ // using this to actually set the hostName for an
+ // InetAddress
+ // created through the NetworkInterface
+ // have found that the fabricated instances has a null
+ // hostName
+ System.err.println(" hostName: " + i6adr.getHostName());
+ inet6Addresses.add(i6adr);
+ }
+ }
+ }
+ return inet6Addresses;
+ }
+
+ static void assertHostNameEqual(String expectedHostName,
+ String deserializedHostName) {
+ System.err
+ .println("Inet6AddressSerializationTest.assertHostNameEqual:");
+ if (expectedHostName == null) {
+ if (deserializedHostName == null) {
+ // ok, do nothing.
+ } else {
+ System.err.println("Error checking " + " HostName, expected:"
+ + expectedHostName + ", got :" + deserializedHostName);
+ failed = true;
+ }
+ } else if (!expectedHostName.equals(deserializedHostName)) {
+ System.err.println("Error checking "
+ + // versionStr +
+ " HostName, expected:" + expectedHostName + ", got :"
+ + deserializedHostName);
+ failed = true;
+ } else {
+ System.err.println("HostName equality "
+ + // versionStr +
+ " HostName, expected:" + expectedHostName + ", got :"
+ + deserializedHostName);
+ }
+ }
+
+ static void assertHostAddressEqual(String expectedHostAddress,
+ String deserializedHostAddress) {
+ System.err
+ .println("Inet6AddressSerializationTest.assertHostAddressEqual:");
+ if (expectedHostAddress == null) {
+ if (deserializedHostAddress == null) {
+ // ok, do nothing.
+ } else {
+ System.err.println("Error checking "
+ + " HostAddress, expected: " + expectedHostAddress
+ + ", got: " + deserializedHostAddress);
+ failed = true;
+ }
+ } else if (!expectedHostAddress.equals(deserializedHostAddress)) {
+ System.err.println("Error checking "
+ + // versionStr +
+ " HostAddress, expected: " + expectedHostAddress
+ + ", got: " + deserializedHostAddress);
+ failed = true;
+ } else {
+ System.err.println("HostAddress equality "
+ + // versionStr +
+ " HostAddress, expected: " + expectedHostAddress
+ + ", got: " + deserializedHostAddress);
+ }
+ }
+
+ static void assertAddressEqual(byte[] expectedAddress,
+ byte[] deserializedAddress) {
+ System.err.println("Inet6AddressSerializationTest.assertAddressEqual:");
+ if (expectedAddress == null) {
+ if (deserializedAddress == null) {
+ // ok, do nothing.
+ } else {
+ System.err.println("Error checking " + " Address, expected:"
+ + Arrays.toString(expectedAddress) + ", got: "
+ + Arrays.toString(deserializedAddress));
+ failed = true;
+ }
+ } else if (!Arrays.equals(expectedAddress, deserializedAddress)) {
+ System.err.println("Error checking "
+ + // versionStr +
+ " Address, expected: " + Arrays.toString(expectedAddress)
+ + ", got: " + Arrays.toString(deserializedAddress));
+ failed = true;
+ } else {
+ System.err.println("Address equality "
+ + // versionStr +
+ " Address, expected: " + Arrays.toString(expectedAddress)
+ + ", got: " + Arrays.toString(deserializedAddress));
+ }
+ }
+
+ static void assertScopeIdEqual(int expectedScopeId, int deserializedScopeId) {
+ System.err.println("Inet6AddressSerializationTest.assertScopeIdEqual:");
+ if (expectedScopeId != deserializedScopeId) {
+ System.err.println("Error checking " + " ScopeId, expected:"
+ + expectedScopeId + ", got: " + deserializedScopeId);
+ failed = true;
+ } else {
+ System.err.println("ScopeId equality "
+ + // versionStr +
+ " ScopeId, expected: " + expectedScopeId + ", got: "
+ + deserializedScopeId);
+ }
+ }
+
+ static void assertNetworkInterfaceNameEqual(String expectedNetworkIfName,
+ NetworkInterface deserializedNetworkInterface) {
+
+ if (deserializedNetworkInterface != null) {
+ String deserializedNetworkIfName = deserializedNetworkInterface
+ .getName();
+ System.err
+ .println("Inet6AddressSerializationTest.assertHostNameEqual:");
+ if (expectedNetworkIfName == null) {
+ if (deserializedNetworkIfName == null) {
+ // ok, do nothing.
+ } else {
+ System.err.println("Error checking "
+ + " NetworkIfName, expected: "
+ + expectedNetworkIfName + ", got: "
+ + deserializedNetworkIfName);
+ failed = true;
+ }
+ } else if (!expectedNetworkIfName.equals(deserializedNetworkIfName)) {
+ System.err.println("Error checking "
+ + " NetworkIfName, expected: " + expectedNetworkIfName
+ + ", got: " + deserializedNetworkIfName);
+ failed = true;
+ } else {
+ System.err.println("NetworkIfName equality "
+ + " NetworkIfName, expected: " + expectedNetworkIfName
+ + ", got: " + deserializedNetworkIfName);
+ }
+ } else {
+ System.err
+ .println("Warning "
+ + " NetworkInterface expected, but is null - ifname not relevant on deserializing host");
+ }
+ }
+
+ static void assertNetworkInterfaceEqual(
+ NetworkInterface expectedNetworkInterface,
+ NetworkInterface deserializedNetworkInterface) {
+ System.err
+ .println("Inet6AddressSerializationTest.assertNetworkInterfaceEqual:");
+ if (expectedNetworkInterface == null) {
+ if (deserializedNetworkInterface == null) {
+ // ok, do nothing.
+ System.err.println("Network Interface equality "
+ + " NetworkInterface, expected:"
+ + expectedNetworkInterface + ", got :"
+ + deserializedNetworkInterface);
+ } else {
+ System.err.println("Error checking "
+ + " NetworkInterface, expected:"
+ + expectedNetworkInterface + ", got :"
+ + deserializedNetworkInterface);
+ failed = true;
+ }
+ } else if (!expectedNetworkInterface
+ .equals(deserializedNetworkInterface)) {
+ System.err.println("Error checking "
+ + // versionStr +
+ " NetworkInterface, expected:" + expectedNetworkInterface
+ + ", got :" + deserializedNetworkInterface);
+ failed = true;
+ } else {
+ System.err.println("Network Interface equality "
+ + " NetworkInterface, expected:" + expectedNetworkInterface
+ + ", got :" + deserializedNetworkInterface);
+ }
+ }
+
+ static void equal(Object expected, Object got) {
+ if (expected == null) {
+ if (got == null) {
+ // ok, do nothing.
+ } else {
+ System.err.println("Error checking "
+ + " serial data, expected:" + expected + ", got :"
+ + got);
+ failed = true;
+ }
+ } else if (!expected.equals(got)) {
+ System.err.println("Error checking " + // versionStr +
+ " serial data, expected:" + expected + ", got :" + got);
+ failed = true;
+ }
+ }
+
+ // Used to generate serialData.
+ static byte[] generateSerializedInet6AddressData(Inet6Address addr,
+ PrintStream out, boolean outputToFile) throws IOException {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try (ObjectOutputStream oos = new ObjectOutputStream(bos)) {
+ oos.writeObject(addr);
+ }
+
+ String ifname = getIfName(addr);
+ byte[] ba = bos.toByteArray();
+ if (out != null) {
+ out.format("static final byte[] SerialData" + ifname + " = {\n");
+ for (int i = 0; i < ba.length; i++) {
+ out.format(" (byte)0x%02X", ba[i]);
+ if (i != (ba.length - 1))
+ out.format(",");
+ if (((i + 1) % 6) == 0)
+ out.format("\n");
+ }
+ out.format(" };\n \n");
+ }
+ if (outputToFile) {
+ serializeInet6AddressToFile(addr);
+ }
+ return ba;
+ }
+
+ private static String getIfName(Inet6Address inet6Addr) {
+ String ifname;
+ if (inet6Addr.getScopedInterface() != null) {
+ ifname = "_ifname_" + inet6Addr.getScopedInterface().getName();
+ } else {
+ ifname = "_ifname_"
+ + Integer.valueOf(inet6Addr.getScopeId()).toString();
+ }
+ return ifname;
+ }
+
+ static void generateAllInet6AddressSerializedData() throws IOException {
+ // System.err.println("generateAllInet6AddressSerializedData: enter ....");
+
+ List<Inet6Address> inet6Addresses;
+
+ try {
+ inet6Addresses = getAllInet6Addresses();
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new IOException(e);
+ }
+
+ for (Inet6Address inet6Address : inet6Addresses) {
+ generateSerializedInet6AddressData(inet6Address, System.out, true);
+ }
+ }
+
+ static void serializeInet6AddressToFile(Inet6Address inet6Addr) {
+
+ // System.err
+ // .println("serializeInet6AddressToIPV6AddressFile: enter ....");
+
+ FileOutputStream fOut = null;
+ String inet6AddressOutputFilename = null;
+ inet6AddressOutputFilename = createOutputFileName(inet6Addr);
+ try {
+ fOut = new FileOutputStream(inet6AddressOutputFilename);
+ } catch (FileNotFoundException fnfEx) {
+
+ fnfEx.printStackTrace();
+ }
+ ObjectOutputStream ooStream = null;
+ try {
+ if (fOut != null) {
+ ooStream = new ObjectOutputStream(fOut);
+ } else {
+ System.err.println("Problem initilising Object output stream ");
+ System.exit(-1);
+ }
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+
+ // serialise the last Inet6Address
+ /*
+ * System.err
+ * .println("serializeInet6AddressToIPV6AddressFile scoped iface: \n" +
+ * inet6Addr.getScopedInterface());
+ */
+ try {
+ ooStream.writeObject(inet6Addr);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ }
+
+ try {
+ ooStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static String createOutputFileName(Inet6Address inet6Addr) {
+ String inet6AddressOutputFilename;
+ if (inet6Addr.getScopedInterface() != null) {
+ inet6AddressOutputFilename = "IPV6Address_"
+ + inet6Addr.getScopedInterface().getName() + ".out";
+ } else {
+ inet6AddressOutputFilename = "IPV6Address_"
+ + Integer.valueOf(inet6Addr.getScopeId()).toString()
+ + ".out";
+ }
+ return inet6AddressOutputFilename;
+ }
+
+ // --- Generated data ---
+ // JDK7 output java Inet6AddressSerializationTest generate.
+
+ // loopback lo0 interface on Solaris 10
+
+ static final byte[] JDK7Inet6AddressSerialData = { (byte) 0xAC,
+ (byte) 0xED, (byte) 0x00, (byte) 0x05, (byte) 0x73, (byte) 0x72,
+ (byte) 0x00, (byte) 0x15, (byte) 0x6A, (byte) 0x61, (byte) 0x76,
+ (byte) 0x61, (byte) 0x2E, (byte) 0x6E, (byte) 0x65, (byte) 0x74,
+ (byte) 0x2E, (byte) 0x49, (byte) 0x6E, (byte) 0x65, (byte) 0x74,
+ (byte) 0x36, (byte) 0x41, (byte) 0x64, (byte) 0x64, (byte) 0x72,
+ (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x5F, (byte) 0x7C,
+ (byte) 0x20, (byte) 0x81, (byte) 0x52, (byte) 0x2C, (byte) 0x80,
+ (byte) 0x21, (byte) 0x03, (byte) 0x00, (byte) 0x05, (byte) 0x49,
+ (byte) 0x00, (byte) 0x08, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
+ (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64,
+ (byte) 0x5A, (byte) 0x00, (byte) 0x0C, (byte) 0x73, (byte) 0x63,
+ (byte) 0x6F, (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69,
+ (byte) 0x64, (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74,
+ (byte) 0x5A, (byte) 0x00, (byte) 0x10, (byte) 0x73, (byte) 0x63,
+ (byte) 0x6F, (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69,
+ (byte) 0x66, (byte) 0x6E, (byte) 0x61, (byte) 0x6D, (byte) 0x65,
+ (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x4C,
+ (byte) 0x00, (byte) 0x06, (byte) 0x69, (byte) 0x66, (byte) 0x6E,
+ (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x74, (byte) 0x00,
+ (byte) 0x12, (byte) 0x4C, (byte) 0x6A, (byte) 0x61, (byte) 0x76,
+ (byte) 0x61, (byte) 0x2F, (byte) 0x6C, (byte) 0x61, (byte) 0x6E,
+ (byte) 0x67, (byte) 0x2F, (byte) 0x53, (byte) 0x74, (byte) 0x72,
+ (byte) 0x69, (byte) 0x6E, (byte) 0x67, (byte) 0x3B, (byte) 0x5B,
+ (byte) 0x00, (byte) 0x09, (byte) 0x69, (byte) 0x70, (byte) 0x61,
+ (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73,
+ (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x02, (byte) 0x5B,
+ (byte) 0x42, (byte) 0x78, (byte) 0x72, (byte) 0x00, (byte) 0x14,
+ (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2E,
+ (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x2E, (byte) 0x49,
+ (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x41, (byte) 0x64,
+ (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
+ (byte) 0x2D, (byte) 0x9B, (byte) 0x57, (byte) 0xAF, (byte) 0x9F,
+ (byte) 0xE3, (byte) 0xEB, (byte) 0xDB, (byte) 0x02, (byte) 0x00,
+ (byte) 0x03, (byte) 0x49, (byte) 0x00, (byte) 0x07, (byte) 0x61,
+ (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73,
+ (byte) 0x73, (byte) 0x49, (byte) 0x00, (byte) 0x06, (byte) 0x66,
+ (byte) 0x61, (byte) 0x6D, (byte) 0x69, (byte) 0x6C, (byte) 0x79,
+ (byte) 0x4C, (byte) 0x00, (byte) 0x08, (byte) 0x68, (byte) 0x6F,
+ (byte) 0x73, (byte) 0x74, (byte) 0x4E, (byte) 0x61, (byte) 0x6D,
+ (byte) 0x65, (byte) 0x71, (byte) 0x00, (byte) 0x7E, (byte) 0x00,
+ (byte) 0x01, (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x02, (byte) 0x74, (byte) 0x00, (byte) 0x09, (byte) 0x6C,
+ (byte) 0x6F, (byte) 0x63, (byte) 0x61, (byte) 0x6C, (byte) 0x68,
+ (byte) 0x6F, (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x70,
+ (byte) 0x75, (byte) 0x72, (byte) 0x00, (byte) 0x02, (byte) 0x5B,
+ (byte) 0x42, (byte) 0xAC, (byte) 0xF3, (byte) 0x17, (byte) 0xF8,
+ (byte) 0x06, (byte) 0x08, (byte) 0x54, (byte) 0xE0, (byte) 0x02,
+ (byte) 0x00, (byte) 0x00, (byte) 0x78, (byte) 0x70, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x78 };
+
+ // JDK8 output java Inet6AddressSerializationTest generate.
+ // loopback lo0 interface on Solaris 10
+
+ static final byte[] JDK8Inet6AddressSerialData = { (byte) 0xAC,
+ (byte) 0xED, (byte) 0x00, (byte) 0x05, (byte) 0x73, (byte) 0x72,
+ (byte) 0x00, (byte) 0x15, (byte) 0x6A, (byte) 0x61, (byte) 0x76,
+ (byte) 0x61, (byte) 0x2E, (byte) 0x6E, (byte) 0x65, (byte) 0x74,
+ (byte) 0x2E, (byte) 0x49, (byte) 0x6E, (byte) 0x65, (byte) 0x74,
+ (byte) 0x36, (byte) 0x41, (byte) 0x64, (byte) 0x64, (byte) 0x72,
+ (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x5F, (byte) 0x7C,
+ (byte) 0x20, (byte) 0x81, (byte) 0x52, (byte) 0x2C, (byte) 0x80,
+ (byte) 0x21, (byte) 0x03, (byte) 0x00, (byte) 0x05, (byte) 0x49,
+ (byte) 0x00, (byte) 0x08, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
+ (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64,
+ (byte) 0x5A, (byte) 0x00, (byte) 0x0C, (byte) 0x73, (byte) 0x63,
+ (byte) 0x6F, (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69,
+ (byte) 0x64, (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74,
+ (byte) 0x5A, (byte) 0x00, (byte) 0x10, (byte) 0x73, (byte) 0x63,
+ (byte) 0x6F, (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69,
+ (byte) 0x66, (byte) 0x6E, (byte) 0x61, (byte) 0x6D, (byte) 0x65,
+ (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x4C,
+ (byte) 0x00, (byte) 0x06, (byte) 0x69, (byte) 0x66, (byte) 0x6E,
+ (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x74, (byte) 0x00,
+ (byte) 0x12, (byte) 0x4C, (byte) 0x6A, (byte) 0x61, (byte) 0x76,
+ (byte) 0x61, (byte) 0x2F, (byte) 0x6C, (byte) 0x61, (byte) 0x6E,
+ (byte) 0x67, (byte) 0x2F, (byte) 0x53, (byte) 0x74, (byte) 0x72,
+ (byte) 0x69, (byte) 0x6E, (byte) 0x67, (byte) 0x3B, (byte) 0x5B,
+ (byte) 0x00, (byte) 0x09, (byte) 0x69, (byte) 0x70, (byte) 0x61,
+ (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73,
+ (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x02, (byte) 0x5B,
+ (byte) 0x42, (byte) 0x78, (byte) 0x72, (byte) 0x00, (byte) 0x14,
+ (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2E,
+ (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x2E, (byte) 0x49,
+ (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x41, (byte) 0x64,
+ (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
+ (byte) 0x2D, (byte) 0x9B, (byte) 0x57, (byte) 0xAF, (byte) 0x9F,
+ (byte) 0xE3, (byte) 0xEB, (byte) 0xDB, (byte) 0x02, (byte) 0x00,
+ (byte) 0x03, (byte) 0x49, (byte) 0x00, (byte) 0x07, (byte) 0x61,
+ (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73,
+ (byte) 0x73, (byte) 0x49, (byte) 0x00, (byte) 0x06, (byte) 0x66,
+ (byte) 0x61, (byte) 0x6D, (byte) 0x69, (byte) 0x6C, (byte) 0x79,
+ (byte) 0x4C, (byte) 0x00, (byte) 0x08, (byte) 0x68, (byte) 0x6F,
+ (byte) 0x73, (byte) 0x74, (byte) 0x4E, (byte) 0x61, (byte) 0x6D,
+ (byte) 0x65, (byte) 0x71, (byte) 0x00, (byte) 0x7E, (byte) 0x00,
+ (byte) 0x01, (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x02, (byte) 0x74, (byte) 0x00, (byte) 0x09, (byte) 0x6C,
+ (byte) 0x6F, (byte) 0x63, (byte) 0x61, (byte) 0x6C, (byte) 0x68,
+ (byte) 0x6F, (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x70,
+ (byte) 0x75, (byte) 0x72, (byte) 0x00, (byte) 0x02, (byte) 0x5B,
+ (byte) 0x42, (byte) 0xAC, (byte) 0xF3, (byte) 0x17, (byte) 0xF8,
+ (byte) 0x06, (byte) 0x08, (byte) 0x54, (byte) 0xE0, (byte) 0x02,
+ (byte) 0x00, (byte) 0x00, (byte) 0x78, (byte) 0x70, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x78 };
+
+ // java Inet6AddressSerializationTest generateAll produces this inet6address
+ // serial data
+ // jdk8 generated serialization of on address fe80:0:0:0:21b:24ff:febd:f29c
+ // net if e1000g0
+
+ static final byte[] SerialData_ifname_e1000g0 = { (byte) 0xAC, (byte) 0xED,
+ (byte) 0x00, (byte) 0x05, (byte) 0x73, (byte) 0x72, (byte) 0x00,
+ (byte) 0x15, (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61,
+ (byte) 0x2E, (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x2E,
+ (byte) 0x49, (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x36,
+ (byte) 0x41, (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65,
+ (byte) 0x73, (byte) 0x73, (byte) 0x5F, (byte) 0x7C, (byte) 0x20,
+ (byte) 0x81, (byte) 0x52, (byte) 0x2C, (byte) 0x80, (byte) 0x21,
+ (byte) 0x03, (byte) 0x00, (byte) 0x05, (byte) 0x49, (byte) 0x00,
+ (byte) 0x08, (byte) 0x73, (byte) 0x63, (byte) 0x6F, (byte) 0x70,
+ (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64, (byte) 0x5A,
+ (byte) 0x00, (byte) 0x0C, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
+ (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64,
+ (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x5A,
+ (byte) 0x00, (byte) 0x10, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
+ (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x66,
+ (byte) 0x6E, (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x5F,
+ (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x4C, (byte) 0x00,
+ (byte) 0x06, (byte) 0x69, (byte) 0x66, (byte) 0x6E, (byte) 0x61,
+ (byte) 0x6D, (byte) 0x65, (byte) 0x74, (byte) 0x00, (byte) 0x12,
+ (byte) 0x4C, (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61,
+ (byte) 0x2F, (byte) 0x6C, (byte) 0x61, (byte) 0x6E, (byte) 0x67,
+ (byte) 0x2F, (byte) 0x53, (byte) 0x74, (byte) 0x72, (byte) 0x69,
+ (byte) 0x6E, (byte) 0x67, (byte) 0x3B, (byte) 0x5B, (byte) 0x00,
+ (byte) 0x09, (byte) 0x69, (byte) 0x70, (byte) 0x61, (byte) 0x64,
+ (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
+ (byte) 0x74, (byte) 0x00, (byte) 0x02, (byte) 0x5B, (byte) 0x42,
+ (byte) 0x78, (byte) 0x72, (byte) 0x00, (byte) 0x14, (byte) 0x6A,
+ (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2E, (byte) 0x6E,
+ (byte) 0x65, (byte) 0x74, (byte) 0x2E, (byte) 0x49, (byte) 0x6E,
+ (byte) 0x65, (byte) 0x74, (byte) 0x41, (byte) 0x64, (byte) 0x64,
+ (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x2D,
+ (byte) 0x9B, (byte) 0x57, (byte) 0xAF, (byte) 0x9F, (byte) 0xE3,
+ (byte) 0xEB, (byte) 0xDB, (byte) 0x02, (byte) 0x00, (byte) 0x03,
+ (byte) 0x49, (byte) 0x00, (byte) 0x07, (byte) 0x61, (byte) 0x64,
+ (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
+ (byte) 0x49, (byte) 0x00, (byte) 0x06, (byte) 0x66, (byte) 0x61,
+ (byte) 0x6D, (byte) 0x69, (byte) 0x6C, (byte) 0x79, (byte) 0x4C,
+ (byte) 0x00, (byte) 0x08, (byte) 0x68, (byte) 0x6F, (byte) 0x73,
+ (byte) 0x74, (byte) 0x4E, (byte) 0x61, (byte) 0x6D, (byte) 0x65,
+ (byte) 0x71, (byte) 0x00, (byte) 0x7E, (byte) 0x00, (byte) 0x01,
+ (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02,
+ (byte) 0x74, (byte) 0x00, (byte) 0x25, (byte) 0x66, (byte) 0x65,
+ (byte) 0x38, (byte) 0x30, (byte) 0x3A, (byte) 0x30, (byte) 0x3A,
+ (byte) 0x30, (byte) 0x3A, (byte) 0x30, (byte) 0x3A, (byte) 0x32,
+ (byte) 0x31, (byte) 0x62, (byte) 0x3A, (byte) 0x32, (byte) 0x34,
+ (byte) 0x66, (byte) 0x66, (byte) 0x3A, (byte) 0x66, (byte) 0x65,
+ (byte) 0x62, (byte) 0x64, (byte) 0x3A, (byte) 0x66, (byte) 0x32,
+ (byte) 0x39, (byte) 0x63, (byte) 0x25, (byte) 0x65, (byte) 0x31,
+ (byte) 0x30, (byte) 0x30, (byte) 0x30, (byte) 0x67, (byte) 0x30,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x01,
+ (byte) 0x01, (byte) 0x74, (byte) 0x00, (byte) 0x07, (byte) 0x65,
+ (byte) 0x31, (byte) 0x30, (byte) 0x30, (byte) 0x30, (byte) 0x67,
+ (byte) 0x30, (byte) 0x75, (byte) 0x72, (byte) 0x00, (byte) 0x02,
+ (byte) 0x5B, (byte) 0x42, (byte) 0xAC, (byte) 0xF3, (byte) 0x17,
+ (byte) 0xF8, (byte) 0x06, (byte) 0x08, (byte) 0x54, (byte) 0xE0,
+ (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x78, (byte) 0x70,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0xFE,
+ (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x1B, (byte) 0x24,
+ (byte) 0xFF, (byte) 0xFE, (byte) 0xBD, (byte) 0xF2, (byte) 0x9C,
+ (byte) 0x78 };
+
+ // jdk8 generated serialization of address 0::1 on net if lo0 hostname
+ // localhost scope_id 1
+
+ static final byte[] SerialData_ifname_lo0 = { (byte) 0xAC, (byte) 0xED,
+ (byte) 0x00, (byte) 0x05, (byte) 0x73, (byte) 0x72, (byte) 0x00,
+ (byte) 0x15, (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61,
+ (byte) 0x2E, (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x2E,
+ (byte) 0x49, (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x36,
+ (byte) 0x41, (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65,
+ (byte) 0x73, (byte) 0x73, (byte) 0x5F, (byte) 0x7C, (byte) 0x20,
+ (byte) 0x81, (byte) 0x52, (byte) 0x2C, (byte) 0x80, (byte) 0x21,
+ (byte) 0x03, (byte) 0x00, (byte) 0x05, (byte) 0x49, (byte) 0x00,
+ (byte) 0x08, (byte) 0x73, (byte) 0x63, (byte) 0x6F, (byte) 0x70,
+ (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64, (byte) 0x5A,
+ (byte) 0x00, (byte) 0x0C, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
+ (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64,
+ (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x5A,
+ (byte) 0x00, (byte) 0x10, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
+ (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x66,
+ (byte) 0x6E, (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x5F,
+ (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x4C, (byte) 0x00,
+ (byte) 0x06, (byte) 0x69, (byte) 0x66, (byte) 0x6E, (byte) 0x61,
+ (byte) 0x6D, (byte) 0x65, (byte) 0x74, (byte) 0x00, (byte) 0x12,
+ (byte) 0x4C, (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61,
+ (byte) 0x2F, (byte) 0x6C, (byte) 0x61, (byte) 0x6E, (byte) 0x67,
+ (byte) 0x2F, (byte) 0x53, (byte) 0x74, (byte) 0x72, (byte) 0x69,
+ (byte) 0x6E, (byte) 0x67, (byte) 0x3B, (byte) 0x5B, (byte) 0x00,
+ (byte) 0x09, (byte) 0x69, (byte) 0x70, (byte) 0x61, (byte) 0x64,
+ (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
+ (byte) 0x74, (byte) 0x00, (byte) 0x02, (byte) 0x5B, (byte) 0x42,
+ (byte) 0x78, (byte) 0x72, (byte) 0x00, (byte) 0x14, (byte) 0x6A,
+ (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2E, (byte) 0x6E,
+ (byte) 0x65, (byte) 0x74, (byte) 0x2E, (byte) 0x49, (byte) 0x6E,
+ (byte) 0x65, (byte) 0x74, (byte) 0x41, (byte) 0x64, (byte) 0x64,
+ (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x2D,
+ (byte) 0x9B, (byte) 0x57, (byte) 0xAF, (byte) 0x9F, (byte) 0xE3,
+ (byte) 0xEB, (byte) 0xDB, (byte) 0x02, (byte) 0x00, (byte) 0x03,
+ (byte) 0x49, (byte) 0x00, (byte) 0x07, (byte) 0x61, (byte) 0x64,
+ (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
+ (byte) 0x49, (byte) 0x00, (byte) 0x06, (byte) 0x66, (byte) 0x61,
+ (byte) 0x6D, (byte) 0x69, (byte) 0x6C, (byte) 0x79, (byte) 0x4C,
+ (byte) 0x00, (byte) 0x08, (byte) 0x68, (byte) 0x6F, (byte) 0x73,
+ (byte) 0x74, (byte) 0x4E, (byte) 0x61, (byte) 0x6D, (byte) 0x65,
+ (byte) 0x71, (byte) 0x00, (byte) 0x7E, (byte) 0x00, (byte) 0x01,
+ (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02,
+ (byte) 0x74, (byte) 0x00, (byte) 0x09, (byte) 0x6C, (byte) 0x6F,
+ (byte) 0x63, (byte) 0x61, (byte) 0x6C, (byte) 0x68, (byte) 0x6F,
+ (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x74, (byte) 0x00,
+ (byte) 0x03, (byte) 0x6C, (byte) 0x6F, (byte) 0x30, (byte) 0x75,
+ (byte) 0x72, (byte) 0x00, (byte) 0x02, (byte) 0x5B, (byte) 0x42,
+ (byte) 0xAC, (byte) 0xF3, (byte) 0x17, (byte) 0xF8, (byte) 0x06,
+ (byte) 0x08, (byte) 0x54, (byte) 0xE0, (byte) 0x02, (byte) 0x00,
+ (byte) 0x00, (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x78 };
+
+}
+
+class MockLo0Inet6Address {
+
+ private static final byte[] LOOPBACKIPV6ADDRESS = { (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01 };
+
+ private static final String LOCALHOSTNAME = "localhost";
+
+ private static final String LO0HOSTADDRESS = "0:0:0:0:0:0:0:1%lo0";
+
+ private static final String BARE_LO0HOSTADDRESS = "0:0:0:0:0:0:0:1";
+
+ private static final String LO0HOSTADDRESS_WITHINDEX = "0:0:0:0:0:0:0:1%1";
+
+ private static final int SCOPE_ID_LO0 = 1;
+
+ private static final int SCOPE_ID_ZERO = 0;
+
+ public static final String NETWORK_IF_LO0 = "lo0";
+
+ static String getHostName() {
+ return LOCALHOSTNAME;
+ }
+
+ static String getHostAddress() {
+ return LO0HOSTADDRESS;
+ }
+
+ static String getBareHostAddress() {
+ return BARE_LO0HOSTADDRESS;
+ }
+
+ static String getHostAddressWithIndex() {
+ return LO0HOSTADDRESS_WITHINDEX;
+ }
+
+ static byte[] getAddress() {
+ return LOOPBACKIPV6ADDRESS;
+ }
+
+ static int getScopeId() {
+ return SCOPE_ID_LO0;
+ }
+
+ static int getScopeZero() {
+ return SCOPE_ID_ZERO;
+ }
+
+ static String getScopeIfName() {
+ return NETWORK_IF_LO0;
+ }
+
+}
+
+class MockE1000g0Inet6Address {
+
+ // fe80::21b:24ff:febd:f29c
+ private static final byte[] E1000G0IPV6ADDRESS = { (byte) 0xfe,
+ (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x1b, (byte) 0x24,
+ (byte) 0xff, (byte) 0xfe, (byte) 0xbd, (byte) 0xf2, (byte) 0x9c };
+
+ private static final String E1000G0HOSTNAME = "fe80:0:0:0:21b:24ff:febd:f29c%e1000g0";
+
+ private static final String BARE_E1000G0HOSTADDRESS = "fe80:0:0:0:21b:24ff:febd:f29c";
+
+ private static final String E1000G0HOSTADDRESS_WITHINDEX = "fe80:0:0:0:21b:24ff:febd:f29c%2";
+
+ private static final String E1000G0HOSTADDRESS = "fe80:0:0:0:21b:24ff:febd:f29c%e1000g0";
+
+ private static final String NETWORK_IF_E1000G0 = "e1000g0";
+
+ private static final int SCOPE_ID_E1000G0 = 2;
+
+ private static final int SCOPE_ID_ZERO = 0;
+
+ static String getHostName() {
+ return E1000G0HOSTNAME;
+ }
+
+ static String getHostAddress() {
+ return E1000G0HOSTADDRESS;
+ }
+
+ static String getHostAddressWithIndex() {
+ return E1000G0HOSTADDRESS_WITHINDEX;
+ }
+
+ static String getBareHostAddress() {
+ return BARE_E1000G0HOSTADDRESS;
+ }
+
+ static byte[] getAddress() {
+ return E1000G0IPV6ADDRESS;
+ }
+
+ static int getScopeId() {
+ return SCOPE_ID_E1000G0;
+ }
+
+ static int getScopeZero() {
+ return SCOPE_ID_ZERO;
+ }
+
+ static String getScopeIfName() {
+ return NETWORK_IF_E1000G0;
+ }
+
+}
--- a/jdk/test/java/net/NetworkInterface/Test.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/net/NetworkInterface/Test.java Wed May 01 11:34:06 2013 -0700
@@ -21,9 +21,9 @@
* questions.
*/
-/* @test 01/02/14
- * @bug 4405354
- * @summary Exercise java.net.NetworkInterface
+/* @test
+ * @bug 4405354 6594296
+ * @summary Basic tests for NetworkInterface
*/
import java.net.NetworkInterface;
import java.net.InetAddress;
@@ -69,6 +69,12 @@
throw new Exception("hashCode contract broken");
}
System.out.println("hashCode() test passed.");
+
+ byte[] ba = ni.getHardwareAddress();
+ if (ba != null && ba.length == 0) {
+ throw new Exception("getHardwareAddress returned 0 length byte array");
+ }
+ System.out.println("getHardwareAddress() test passed.");
}
// misc tests :-
--- a/jdk/test/java/nio/file/Files/walkFileTree/CreateFileTree.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/nio/file/Files/walkFileTree/CreateFileTree.java Wed May 01 11:34:06 2013 -0700
@@ -32,9 +32,23 @@
public class CreateFileTree {
- static final Random rand = new Random();
+ private static final Random rand = new Random();
- public static void main(String[] args) throws IOException {
+ private static boolean supportsLinks(Path dir) {
+ Path link = dir.resolve("testlink");
+ Path target = dir.resolve("testtarget");
+ try {
+ Files.createSymbolicLink(link, target);
+ Files.delete(link);
+ return true;
+ } catch (UnsupportedOperationException x) {
+ return false;
+ } catch (IOException x) {
+ return false;
+ }
+ }
+
+ static Path create() throws IOException {
Path top = Files.createTempDirectory("tree");
List<Path> dirs = new ArrayList<Path>();
@@ -53,7 +67,6 @@
dirs.add(subdir);
}
}
- assert dirs.size() >= 2;
// create a few regular files in the file tree
int files = dirs.size() * 3;
@@ -64,20 +77,26 @@
}
// create a few sym links in the file tree so as to create cycles
- int links = 1 + rand.nextInt(5);
- for (int i=0; i<links; i++) {
- int x = rand.nextInt(dirs.size());
- int y;
- do {
- y = rand.nextInt(dirs.size());
- } while (y != x);
- String name = "link" + (i+1);
- Path link = dirs.get(x).resolve(name);
- Path target = dirs.get(y);
- Files.createSymbolicLink(link, target);
+ if (supportsLinks(top)) {
+ int links = 1 + rand.nextInt(5);
+ for (int i=0; i<links; i++) {
+ int x = rand.nextInt(dirs.size());
+ int y;
+ do {
+ y = rand.nextInt(dirs.size());
+ } while (y != x);
+ String name = "link" + (i+1);
+ Path link = dirs.get(x).resolve(name);
+ Path target = dirs.get(y);
+ Files.createSymbolicLink(link, target);
+ }
}
- // done
+ return top;
+ }
+
+ public static void main(String[] args) throws IOException {
+ Path top = create();
System.out.println(top);
}
}
--- a/jdk/test/java/nio/file/Files/walkFileTree/MaxDepth.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/nio/file/Files/walkFileTree/MaxDepth.java Wed May 01 11:34:06 2013 -0700
@@ -21,19 +21,30 @@
* questions.
*/
+/*
+ * @test
+ * @summary Unit test for Files.walkFileTree to test maxDepth parameter
+ * @library ../..
+ * @compile MaxDepth.java CreateFileTree.java
+ * @run main MaxDepth
+ */
+
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.io.IOException;
import java.util.*;
-/**
- * Unit test for Files.walkFileTree to test maxDepth parameter
- */
+public class MaxDepth {
+ public static void main(String[] args) throws IOException {
+ Path top = CreateFileTree.create();
+ try {
+ test(top);
+ } finally {
+ TestUtil.removeAll(top);
+ }
+ }
-public class MaxDepth {
- public static void main(String[] args) throws Exception {
- final Path top = Paths.get(args[0]);
-
+ static void test(final Path top) throws IOException {
for (int i=0; i<5; i++) {
Set<FileVisitOption> opts = Collections.emptySet();
final int maxDepth = i;
--- a/jdk/test/java/nio/file/Files/walkFileTree/SkipSiblings.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/nio/file/Files/walkFileTree/SkipSiblings.java Wed May 01 11:34:06 2013 -0700
@@ -21,15 +21,19 @@
* questions.
*/
+/*
+ * @test
+ * @summary Unit test for Files.walkFileTree to test SKIP_SIBLINGS return value
+ * @library ../..
+ * @compile SkipSiblings.java CreateFileTree.java
+ * @run main SkipSiblings
+ */
+
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.io.IOException;
import java.util.*;
-/**
- * Unit test for Files.walkFileTree to test SKIP_SIBLINGS return value.
- */
-
public class SkipSiblings {
static final Random rand = new Random();
@@ -52,9 +56,16 @@
}
public static void main(String[] args) throws Exception {
- Path dir = Paths.get(args[0]);
+ Path top = CreateFileTree.create();
+ try {
+ test(top);
+ } finally {
+ TestUtil.removeAll(top);
+ }
+ }
- Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
+ static void test(final Path start) throws IOException {
+ Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
check(dir);
@@ -74,7 +85,11 @@
if (x != null)
throw new RuntimeException(x);
check(dir);
- return FileVisitResult.CONTINUE;
+ if (rand.nextBoolean()) {
+ return FileVisitResult.CONTINUE;
+ } else {
+ return FileVisitResult.SKIP_SIBLINGS;
+ }
}
});
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/file/Files/walkFileTree/SkipSubtree.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Unit test for Files.walkFileTree to test SKIP_SUBTREE return value
+ * @library ../..
+ * @compile SkipSubtree.java CreateFileTree.java
+ * @run main SkipSubtree
+ */
+import java.nio.file.*;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+
+public class SkipSubtree {
+
+ static final Random rand = new Random();
+ static final Set<Path> skipped = new HashSet<>();
+
+ // check if this path should have been skipped
+ static void check(Path path) {
+ do {
+ if (skipped.contains(path))
+ throw new RuntimeException(path + " should not have been visited");
+ path = path.getParent();
+ } while (path != null);
+ }
+
+ // indicates if the subtree should be skipped
+ static boolean skip(Path path) {
+ if (rand.nextInt(3) == 0) {
+ skipped.add(path);
+ return true;
+ }
+ return false;
+ }
+
+ public static void main(String[] args) throws Exception {
+ Path top = CreateFileTree.create();
+ try {
+ test(top);
+ } finally {
+ TestUtil.removeAll(top);
+ }
+ }
+
+ static void test(final Path start) throws IOException {
+ Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
+ check(dir);
+ if (skip(dir))
+ return FileVisitResult.SKIP_SUBTREE;
+ return FileVisitResult.CONTINUE;
+ }
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+ check(file);
+ return FileVisitResult.CONTINUE;
+ }
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException x) {
+ if (x != null)
+ throw new RuntimeException(x);
+ check(dir);
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ }
+}
--- a/jdk/test/java/nio/file/Files/walkFileTree/TerminateWalk.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/nio/file/Files/walkFileTree/TerminateWalk.java Wed May 01 11:34:06 2013 -0700
@@ -21,15 +21,19 @@
* questions.
*/
+/*
+ * @test
+ * @summary Unit test for Files.walkFileTree to test TERMINATE return value
+ * @library ../..
+ * @compile TerminateWalk.java CreateFileTree.java
+ * @run main TerminateWalk
+ */
+
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.io.IOException;
import java.util.*;
-/**
- * Unit test for Files.walkFileTree to test TERMINATE return value
- */
-
public class TerminateWalk {
static final Random rand = new Random();
@@ -47,9 +51,16 @@
}
public static void main(String[] args) throws Exception {
- Path dir = Paths.get(args[0]);
+ Path top = CreateFileTree.create();
+ try {
+ test(top);
+ } finally {
+ TestUtil.removeAll(top);
+ }
+ }
- Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
+ static void test(Path start) throws IOException {
+ Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
return maybeTerminate();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/file/Files/walkFileTree/find.sh Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,86 @@
+#
+# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# @test
+# @bug 4313887 6907737
+# @summary Tests that walkFileTree is consistent with the native find program
+# @build CreateFileTree PrintFileTree
+# @run shell find.sh
+
+# if TESTJAVA isn't set then we assume an interactive run.
+
+if [ -z "$TESTJAVA" ]; then
+ TESTSRC=.
+ TESTCLASSES=.
+ JAVA=java
+else
+ JAVA="${TESTJAVA}/bin/java"
+fi
+
+OS=`uname -s`
+case "$OS" in
+ Windows_* | CYGWIN* )
+ echo "This test does not run on Windows"
+ exit 0
+ ;;
+ * )
+ CLASSPATH=${TESTCLASSES}:${TESTSRC}
+ ;;
+esac
+export CLASSPATH
+
+# create the file tree
+ROOT=`$JAVA CreateFileTree`
+if [ $? != 0 ]; then exit 1; fi
+
+failures=0
+
+# print the file tree and compare output with find(1)
+$JAVA ${TESTVMOPTS} PrintFileTree "$ROOT" > out1
+find "$ROOT" > out2
+diff out1 out2
+if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
+
+# repeat test following links. Some versions of find(1) output
+# cycles (sym links to ancestor directories), other versions do
+# not. For that reason we run PrintFileTree with the -printCycles
+# option when the output without this option differs to find(1).
+find "$ROOT" -follow > out1
+$JAVA ${TESTVMOPTS} PrintFileTree -follow "$ROOT" > out2
+diff out1 out2
+if [ $? != 0 ];
+ then
+ # re-run printing cycles to stdout
+ $JAVA ${TESTVMOPTS} PrintFileTree -follow -printCycles "$ROOT" > out2
+ diff out1 out2
+ if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
+ fi
+
+# clean-up
+rm -r "$ROOT"
+
+echo ''
+if [ $failures -gt 0 ];
+ then echo "$failures test(s) failed";
+ else echo "Test passed"; fi
+exit $failures
--- a/jdk/test/java/nio/file/Files/walkFileTree/walk_file_tree.sh Wed May 01 11:27:12 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-#
-# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4313887 6907737
-# @summary Unit test for walkFileTree method
-# @build CreateFileTree PrintFileTree SkipSiblings TerminateWalk MaxDepth
-# @run shell walk_file_tree.sh
-
-# if TESTJAVA isn't set then we assume an interactive run.
-
-if [ -z "$TESTJAVA" ]; then
- TESTSRC=.
- TESTCLASSES=.
- JAVA=java
-else
- JAVA="${TESTJAVA}/bin/java"
-fi
-
-OS=`uname -s`
-case "$OS" in
- Windows_* | CYGWIN* )
- echo "This test does not run on Windows"
- exit 0
- ;;
- * )
- CLASSPATH=${TESTCLASSES}:${TESTSRC}
- ;;
-esac
-export CLASSPATH
-
-# create the file tree
-ROOT=`$JAVA CreateFileTree`
-if [ $? != 0 ]; then exit 1; fi
-
-failures=0
-
-# print the file tree and compare output with find(1)
-$JAVA ${TESTVMOPTS} PrintFileTree "$ROOT" > out1
-find "$ROOT" > out2
-diff out1 out2
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-# repeat test following links. Some versions of find(1) output
-# cycles (sym links to ancestor directories), other versions do
-# not. For that reason we run PrintFileTree with the -printCycles
-# option when the output without this option differs to find(1).
-find "$ROOT" -follow > out1
-$JAVA ${TESTVMOPTS} PrintFileTree -follow "$ROOT" > out2
-diff out1 out2
-if [ $? != 0 ];
- then
- # re-run printing cycles to stdout
- $JAVA ${TESTVMOPTS} PrintFileTree -follow -printCycles "$ROOT" > out2
- diff out1 out2
- if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
- fi
-
-# test SKIP_SIBLINGS
-$JAVA ${TESTVMOPTS} SkipSiblings "$ROOT"
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-# test TERMINATE
-$JAVA ${TESTVMOPTS} TerminateWalk "$ROOT"
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-# test maxDepth
-$JAVA ${TESTVMOPTS} MaxDepth "$ROOT"
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-# clean-up
-rm -r "$ROOT"
-
-echo ''
-if [ $failures -gt 0 ];
- then echo "$failures test(s) failed";
- else echo "Test passed"; fi
-exit $failures
--- a/jdk/test/java/nio/file/attribute/BasicFileAttributeView/Basic.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/nio/file/attribute/BasicFileAttributeView/Basic.java Wed May 01 11:34:06 2013 -0700
@@ -70,22 +70,16 @@
check(f.lastModified()/1000 == attrs.lastModifiedTime().to(TimeUnit.SECONDS),
"last-modified time should be the same");
- // copy last-modified time and file create time from directory to file,
+ // copy last-modified time from directory to file,
// re-read attribtues, and check they match
BasicFileAttributeView view =
Files.getFileAttributeView(file, BasicFileAttributeView.class);
BasicFileAttributes dirAttrs = Files.readAttributes(dir, BasicFileAttributes.class);
view.setTimes(dirAttrs.lastModifiedTime(), null, null);
- if (dirAttrs.creationTime() != null) {
- view.setTimes(null, null, dirAttrs.creationTime());
- }
+
attrs = view.readAttributes();
check(attrs.lastModifiedTime().equals(dirAttrs.lastModifiedTime()),
"last-modified time should be equal");
- if (dirAttrs.creationTime() != null) {
- check(attrs.creationTime().equals(dirAttrs.creationTime()),
- "create time should be the same");
- }
// security tests
check (!(attrs instanceof PosixFileAttributes),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8011536
+ * @summary Basic test for creationTime attribute on platforms/file systems
+ * that support it.
+ * @library ../..
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Files;
+import java.nio.file.attribute.*;
+import java.time.Instant;
+import java.io.IOException;
+
+public class CreationTime {
+
+ private static final java.io.PrintStream err = System.err;
+
+ /**
+ * Reads the creationTime attribute
+ */
+ private static FileTime creationTime(Path file) throws IOException {
+ return Files.readAttributes(file, BasicFileAttributes.class).creationTime();
+ }
+
+ /**
+ * Sets the creationTime attribute
+ */
+ private static void setCreationTime(Path file, FileTime time) throws IOException {
+ BasicFileAttributeView view =
+ Files.getFileAttributeView(file, BasicFileAttributeView.class);
+ view.setTimes(null, null, time);
+ }
+
+ static void test(Path top) throws IOException {
+ Path file = Files.createFile(top.resolve("foo"));
+
+ /**
+ * Check that creationTime reported
+ */
+ FileTime creationTime = creationTime(file);
+ Instant now = Instant.now();
+ if (Math.abs(creationTime.toMillis()-now.toEpochMilli()) > 10000L) {
+ err.println("File creation time reported as: " + creationTime);
+ throw new RuntimeException("Expected to be close to: " + now);
+ }
+
+ /**
+ * Is the creationTime attribute supported here?
+ */
+ boolean supportsCreationTimeRead = false;
+ boolean supportsCreationTimeWrite = false;
+ String os = System.getProperty("os.name");
+ if (os.contains("OS X") && Files.getFileStore(file).type().equals("hfs")) {
+ supportsCreationTimeRead = true;
+ } else if (os.startsWith("Windows")) {
+ String type = Files.getFileStore(file).type();
+ if (type.equals("NTFS") || type.equals("FAT")) {
+ supportsCreationTimeRead = true;
+ supportsCreationTimeWrite = true;
+ }
+ }
+
+ /**
+ * If the creation-time attribute is supported then change the file's
+ * last modified and check that it doesn't change the creation-time.
+ */
+ if (supportsCreationTimeRead) {
+ // change modified time by +1 hour
+ Instant plusHour = Instant.now().plusSeconds(60L * 60L);
+ Files.setLastModifiedTime(file, FileTime.from(plusHour));
+ FileTime current = creationTime(file);
+ if (!current.equals(creationTime))
+ throw new RuntimeException("Creation time should not have changed");
+ }
+
+ /**
+ * If the creation-time attribute is supported and can be changed then
+ * check that the change is effective.
+ */
+ if (supportsCreationTimeWrite) {
+ // change creation time by -1 hour
+ Instant minusHour = Instant.now().minusSeconds(60L * 60L);
+ creationTime = FileTime.from(minusHour);
+ setCreationTime(file, creationTime);
+ FileTime current = creationTime(file);
+ if (Math.abs(creationTime.toMillis()-current.toMillis()) > 1000L)
+ throw new RuntimeException("Creation time not changed");
+ }
+ }
+
+ public static void main(String[] args) throws IOException {
+ // create temporary directory to run tests
+ Path dir = TestUtil.createTemporaryDirectory();
+ try {
+ test(dir);
+ } finally {
+ TestUtil.removeAll(dir);
+ }
+ }
+}
--- a/jdk/test/java/text/Format/DateFormat/Bug7130335.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/text/Format/DateFormat/Bug7130335.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,34 +23,47 @@
/**
* @test
- * @bug 7130335
+ * @bug 7130335 7130335
* @summary Make sure that round-trip conversion (format/parse) works
- * with old timestamps in Europe/Moscow.
+ * with old timestamps in Europe/Moscow and with multiple time zone letters.
*/
import java.text.*;
import java.util.*;
+import static java.util.GregorianCalendar.*;
public class Bug7130335 {
private static final TimeZone MOSCOW = TimeZone.getTimeZone("Europe/Moscow");
+ private static final TimeZone LONDON = TimeZone.getTimeZone("Europe/London");
+ private static final TimeZone LA = TimeZone.getTimeZone("America/Los_Angeles");
+ private static final TimeZone[] ZONES = {
+ MOSCOW, LONDON, LA
+ };
public static void main(String[] args) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS z", Locale.US);
sdf.setTimeZone(MOSCOW);
- Calendar cal = new GregorianCalendar(MOSCOW);
+ Calendar cal = new GregorianCalendar(MOSCOW, Locale.US);
cal.clear();
// Try both +03:00 and +02:00
- cal.set(1922, Calendar.SEPTEMBER, 30);
+ cal.set(1922, SEPTEMBER, 30);
test(sdf, cal);
- cal.add(Calendar.DAY_OF_YEAR, 1);
+ cal.add(DAY_OF_YEAR, 1);
test(sdf, cal);
- cal.set(1991, Calendar.MARCH, 31);
+ cal.set(1991, MARCH, 31);
// in daylight saving time
test(sdf, cal);
- cal.add(Calendar.DAY_OF_YEAR, 1);
+ cal.add(DAY_OF_YEAR, 1);
test(sdf, cal);
// Try the current timestamp
cal.setTimeInMillis(System.currentTimeMillis());
test(sdf, cal);
+
+ // tests for multiple time zone letters (8000529)
+ test8000529("yyyy-MM-dd HH:mm:ss.SSS Z (z)");
+ test8000529("yyyy-MM-dd HH:mm:ss.SSS Z (zzzz)");
+ test8000529("yyyy-MM-dd HH:mm:ss.SSS z (Z)");
+ test8000529("yyyy-MM-dd HH:mm:ss.SSS zzzz (Z)");
+
}
private static void test(SimpleDateFormat sdf, Calendar cal) throws Exception {
@@ -63,4 +76,19 @@
throw new RuntimeException("format: " + f + ", parse: " + p);
}
}
+
+ private static void test8000529(String fmt) throws Exception {
+ for (TimeZone tz : ZONES) {
+ SimpleDateFormat sdf = new SimpleDateFormat(fmt, Locale.US);
+ sdf.setTimeZone(tz);
+ Calendar cal = new GregorianCalendar(tz, Locale.US);
+ cal.clear();
+ cal.set(2012, JUNE, 22);
+ test(sdf, cal);
+ cal.set(2012, DECEMBER, 22);
+ test(sdf, cal);
+ cal.setTimeInMillis(System.currentTimeMillis());
+ test(sdf, cal);
+ }
+ }
}
--- a/jdk/test/java/time/TEST.properties Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/time/TEST.properties Wed May 01 11:34:06 2013 -0700
@@ -1,3 +1,3 @@
# Threeten test uses TestNG
TestNG.dirs = .
-
+othervm.dirs = tck/java/time/chrono test/java/time/chrono test/java/time/format
--- a/jdk/test/java/time/test/java/util/TestFormatter.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/time/test/java/util/TestFormatter.java Wed May 01 11:34:06 2013 -0700
@@ -25,6 +25,7 @@
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
+import java.time.ZoneId;
import java.time.temporal.ChronoField;
import java.util.*;
@@ -34,6 +35,7 @@
/* @test
* @summary Unit test for j.u.Formatter threeten date/time support
+ * @bug 8003680 8012638
*/
@Test
public class TestFormatter {
@@ -64,25 +66,33 @@
//locales = Locale.getAvailableLocales();
Locale[] locales = new Locale[] {
Locale.ENGLISH, Locale.FRENCH, Locale.JAPANESE, Locale.CHINESE};
-
Random r = new Random();
- ZonedDateTime zdt = ZonedDateTime.now();
- while (N-- > 0) {
- zdt = zdt.withDayOfYear(r.nextInt(365) + 1)
- .with(ChronoField.SECOND_OF_DAY, r.nextInt(86400));
- Instant instant = zdt.toInstant();
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(instant.toEpochMilli());
+ ZonedDateTime zdt0 = ZonedDateTime.now();
+ ZonedDateTime[] zdts = new ZonedDateTime[] {
+ zdt0,
+ zdt0.withZoneSameLocal(ZoneId.of("UTC")),
+ zdt0.withZoneSameLocal(ZoneId.of("GMT")),
+ zdt0.withZoneSameLocal(ZoneId.of("UT")),
+ };
- for (Locale locale : locales) {
+ while (N-- > 0) {
+ for (ZonedDateTime zdt : zdts) {
+ zdt = zdt.withDayOfYear(r.nextInt(365) + 1)
+ .with(ChronoField.SECOND_OF_DAY, r.nextInt(86400));
+ Instant instant = zdt.toInstant();
+ Calendar cal = Calendar.getInstance();
+ cal.setTimeInMillis(instant.toEpochMilli());
+ cal.setTimeZone(TimeZone.getTimeZone(zdt.getZone()));
+ for (Locale locale : locales) {
for (String fmtStr : fmtStrDate) {
- testDate(fmtStr, locale, zdt, cal);
+ testDate(fmtStr, locale, zdt, cal);
+ }
+ for (String fmtStr : fmtStrTime) {
+ testTime(fmtStr, locale, zdt, cal);
+ }
+ testZoneId(locale, zdt, cal);
+ testInstant(locale, instant, zdt, cal);
}
- for (String fmtStr : fmtStrTime) {
- testTime(fmtStr, locale, zdt, cal);
- }
- testZoneId(locale, zdt, cal);
- testInstant(locale, instant, zdt, cal);
}
}
if (verbose) {
@@ -146,6 +156,10 @@
}
private String toZoneIdStr(String expected) {
+ return expected.replaceAll("(?:GMT|UTC)(?<off>[+\\-]?[0-9]{2}:[0-9]{2})", "${off}");
+ }
+
+ private String toZoneOffsetStr(String expected) {
return expected.replaceAll("(?:GMT|UTC)(?<off>[+\\-]?[0-9]{2}:[0-9]{2})", "${off}")
.replaceAll("GMT|UTC|UT", "Z");
}
@@ -159,7 +173,7 @@
Calendar cal0 = Calendar.getInstance();
cal0.setTimeInMillis(zdt.toInstant().toEpochMilli());
cal0.setTimeZone(TimeZone.getTimeZone("GMT" + zdt.getOffset().getId()));
- expected = toZoneIdStr(test(fmtStr, locale, null, cal0));
+ expected = toZoneOffsetStr(test(fmtStr, locale, null, cal0));
test(fmtStr, locale, expected, zdt.toOffsetDateTime());
test(fmtStr, locale, expected, zdt.toOffsetDateTime().toOffsetTime());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Arrays/SetAllTest.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8012650
+ * @summary Unit test for setAll, parallelSetAll variants
+ * @run testng SetAllTest
+ */
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+import java.util.function.IntFunction;
+import java.util.function.IntToDoubleFunction;
+import java.util.function.IntToLongFunction;
+import java.util.function.IntUnaryOperator;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertSame;
+import static org.testng.Assert.fail;
+
+@Test
+public class SetAllTest {
+ private static final IntFunction<String> toString = i -> "N" + Integer.valueOf(i);
+ private static final IntFunction<String> fillString = i -> "X";
+ private static final String[] r0 = {};
+ private static final String[] r1 = { "N0" };
+ private static final String[] r10 = { "N0", "N1", "N2", "N3", "N4", "N5", "N6", "N7", "N8", "N9" };
+
+ private Object[][] stringData = new Object[][] {
+ { "empty", 0, toString, r0 },
+ { "one", 1, toString, r1 },
+ { "ten", 10, toString, r10 },
+ { "fill", 3, fillString, new String[] { "X", "X", "X" }}
+ };
+
+ private static final IntUnaryOperator toInt = i -> i << 1;
+ private static final IntUnaryOperator fillInt = i -> 99;
+ private static final int[] ir0 = {};
+ private static final int[] ir1 = { 0 };
+ private static final int[] ir10 = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18 };
+ private Object[][] intData = new Object[][] {
+ { "empty", 0, toInt, ir0 },
+ { "one", 1, toInt, ir1 },
+ { "ten", 10, toInt, ir10 },
+ { "fill", 3, fillInt, new int[] { 99, 99, 99 }}
+ };
+
+ private static final IntToLongFunction toLong = i -> i << 1;
+ private static final IntToLongFunction fillLong = i -> 9999L;
+ private static final long[] lr0 = {};
+ private static final long[] lr1 = { 0L };
+ private static final long[] lr10 = { 0L, 2L, 4L, 6L, 8L, 10L, 12L, 14L, 16L, 18L };
+ private Object[][] longData = new Object[][] {
+ { "empty", 0, toLong, lr0 },
+ { "one", 1, toLong, lr1 },
+ { "ten", 10, toLong, lr10 },
+ { "fill", 3, fillLong, new long[] { 9999L, 9999L, 9999L }}
+ };
+
+ private static final IntToDoubleFunction toDouble = i -> i * 1.1;
+ private static final IntToDoubleFunction fillDouble = i -> 3.14;
+ private static final double[] dr0 = {};
+ private static final double[] dr1 = { 0.0 };
+ private static final double[] dr10 = { 0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9 };
+ private Object[][] doubleData = new Object[][] {
+ { "empty", 0, toDouble, dr0 },
+ { "one", 1, toDouble, dr1 },
+ { "ten", 10, toDouble, dr10 },
+ { "fill", 3, fillDouble, new double[] { 3.14, 3.14, 3.14 }}
+ };
+
+ @DataProvider(name="string")
+ public Object[][] stringTests() { return stringData; }
+
+ @DataProvider(name="int")
+ public Object[][] intTests() { return intData; }
+
+ @DataProvider(name="long")
+ public Object[][] longTests() { return longData; }
+
+ @DataProvider(name="double")
+ public Object[][] doubleTests() { return doubleData; }
+
+ @Test(dataProvider = "string")
+ public void testSetAllString(String name, int size, IntFunction<String> generator, String[] expected) {
+ String[] result = new String[size];
+ Arrays.setAll(result, generator);
+ assertEquals(result, expected, "setAll(String[], IntFunction<String>) case " + name + " failed.");
+
+ // ensure fresh array
+ result = new String[size];
+ Arrays.parallelSetAll(result, generator);
+ assertEquals(result, expected, "parallelSetAll(String[], IntFunction<String>) case " + name + " failed.");
+ }
+
+ @Test(dataProvider = "int")
+ public void testSetAllInt(String name, int size, IntUnaryOperator generator, int[] expected) {
+ int[] result = new int[size];
+ Arrays.setAll(result, generator);
+ assertEquals(result, expected, "setAll(int[], IntUnaryOperator) case " + name + " failed.");
+
+ // ensure fresh array
+ result = new int[size];
+ Arrays.parallelSetAll(result, generator);
+ assertEquals(result, expected, "parallelSetAll(int[], IntUnaryOperator) case " + name + " failed.");
+ }
+
+ @Test(dataProvider = "long")
+ public void testSetAllLong(String name, int size, IntToLongFunction generator, long[] expected) {
+ long[] result = new long[size];
+ Arrays.setAll(result, generator);
+ assertEquals(result, expected, "setAll(long[], IntToLongFunction) case " + name + " failed.");
+
+ // ensure fresh array
+ result = new long[size];
+ Arrays.parallelSetAll(result, generator);
+ assertEquals(result, expected, "parallelSetAll(long[], IntToLongFunction) case " + name + " failed.");
+ }
+
+ private void assertDoubleArrayEquals(double[] actual, double[] expected, double delta, String msg) {
+ if (actual.length != expected.length) {
+ fail(msg + ": length mismatch, expected " + expected.length + ", got " + actual.length);
+ }
+
+ for (int i = 0; i < actual.length; i++) {
+ assertEquals(actual[i], expected[i], delta, msg + "(mismatch at index " + i + ")");
+ }
+ }
+
+ @Test(dataProvider = "double")
+ public void testSetAllDouble(String name, int size, IntToDoubleFunction generator, double[] expected) {
+ double[] result = new double[size];
+ Arrays.setAll(result, generator);
+ assertDoubleArrayEquals(result, expected, 0.05, "setAll(double[], IntToDoubleFunction) case " + name + " failed.");
+
+ // ensure fresh array
+ result = new double[size];
+ Arrays.parallelSetAll(result, generator);
+ assertDoubleArrayEquals(result, expected, 0.05, "setAll(double[], IntToDoubleFunction) case " + name + " failed.");
+ }
+
+ @Test
+ public void testStringSetNulls() {
+ String[] ar = new String[2];
+ try {
+ Arrays.setAll(null, i -> "X");
+ fail("Arrays.setAll(null, foo) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ try {
+ Arrays.parallelSetAll(null, i -> "X");
+ fail("Arrays.parallelSetAll(null, foo) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ try {
+ Arrays.setAll(ar, null);
+ fail("Arrays.setAll(array, null) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ try {
+ Arrays.parallelSetAll(ar, null);
+ fail("Arrays.parallelSetAll(array, null) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ }
+
+ @Test
+ public void testIntSetNulls() {
+ int[] ar = new int[2];
+ try {
+ Arrays.setAll(null, (IntUnaryOperator) i -> i);
+ fail("Arrays.setAll(null, foo) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ try {
+ Arrays.parallelSetAll(null, (IntUnaryOperator) i -> i);
+ fail("Arrays.parallelSetAll(null, foo) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ try {
+ Arrays.setAll(ar, null);
+ fail("Arrays.setAll(array, null) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ try {
+ Arrays.parallelSetAll(ar, null);
+ fail("Arrays.parallelSetAll(array, null) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ }
+
+ @Test
+ public void testLongSetNulls() {
+ long[] ar = new long[2];
+ try {
+ Arrays.setAll(null, (IntToLongFunction) i -> Long.MAX_VALUE);
+ fail("Arrays.setAll(null, foo) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ try {
+ Arrays.parallelSetAll(null, (IntToLongFunction) i -> Long.MAX_VALUE);
+ fail("Arrays.parallelSetAll(null, foo) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ try {
+ Arrays.setAll(ar, null);
+ fail("Arrays.setAll(array, null) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ try {
+ Arrays.parallelSetAll(ar, null);
+ fail("Arrays.parallelSetAll(array, null) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ }
+
+ @Test
+ public void testDoubleSetNulls() {
+ double[] ar = new double[2];
+ try {
+ Arrays.setAll(null, (IntToDoubleFunction) i -> Math.E);
+ fail("Arrays.setAll(null, foo) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ try {
+ Arrays.parallelSetAll(null, (IntToDoubleFunction) i -> Math.E);
+ fail("Arrays.parallelSetAll(null, foo) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ try {
+ Arrays.setAll(ar, null);
+ fail("Arrays.setAll(array, null) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ try {
+ Arrays.parallelSetAll(ar, null);
+ fail("Arrays.parallelSetAll(array, null) should throw NPE");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Base64/Base64GetEncoderTest.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+import java.util.Base64;
+
+import static java.nio.charset.StandardCharsets.US_ASCII;
+
+/**
+ * @test
+ * @bug 8007799
+ * @summary test Encoder with linemax == 0, line separator should not appear in encoded data
+ */
+
+public class Base64GetEncoderTest {
+
+ public static void main(String args[]) throws Throwable {
+ final Base64.Encoder encoder = Base64.getEncoder(0, "$$$".getBytes(US_ASCII));
+
+ testEncodeToString(encoder);
+
+ testWrapEncode1(encoder);
+
+ testEncodeToStringWithLongInputData(encoder);
+
+ testWrapEncode2(encoder);
+
+ testEncodeWithByteBuffer(encoder);
+
+ }
+
+ private static void testEncodeWithByteBuffer(final Base64.Encoder encoder) {
+ System.err.println("\n\nEncoder.encode with ByteBuffer test ");
+ final byte[] secondTestBuffer =
+ "api/java_util/Base64/index.html#GetEncoderMimeCustom[noLineSeparatorInEncodedString]"
+ .getBytes(US_ASCII);
+ String base64EncodedString;
+ ByteBuffer srcData = ByteBuffer.wrap(secondTestBuffer);
+ ByteBuffer dstData = ByteBuffer.allocate(secondTestBuffer.length * 2);
+
+ encoder.encode(srcData, dstData, 0);
+ dstData.flip();
+ if (dstData.hasArray()) {
+ System.err.println("\nByteBuffer test dstData is Base64 encoding = "
+ + new String(dstData.array(), US_ASCII) + "\n");
+ }
+
+ base64EncodedString = new String(dstData.array(), US_ASCII);
+ if (base64EncodedString.contains("$$$")) {
+ throw new RuntimeException("Base64 encoding contains line separator after Encoder.encode ByteBuffer ... \n");
+ }
+ }
+
+ private static void testWrapEncode2(final Base64.Encoder encoder)
+ throws IOException {
+ System.err.println("\nEncoder.wrap test II ");
+ final byte[] secondTestBuffer =
+ "api/java_util/Base64/index.html#GetEncoderMimeCustom[noLineSeparatorInEncodedString]"
+ .getBytes(US_ASCII);
+ String base64EncodedString;
+ ByteArrayOutputStream secondEncodingStream = new ByteArrayOutputStream();
+ OutputStream base64EncodingStream = encoder.wrap(secondEncodingStream);
+ base64EncodingStream.write(secondTestBuffer);
+ base64EncodingStream.close();
+
+ final byte[] encodedByteArray = secondEncodingStream.toByteArray();
+
+ System.err.print("result = " + new String(encodedByteArray, US_ASCII)
+ + " after wrap Base64 encoding of string");
+
+ base64EncodedString = new String(encodedByteArray, US_ASCII);
+
+ if (base64EncodedString.contains("$$$")) {
+ throw new RuntimeException(
+ "Base64 encoding contains line separator after wrap 2 invoked ... \n");
+ }
+ }
+
+ private static void testEncodeToStringWithLongInputData(
+ final Base64.Encoder encoder) {
+ System.err.println("\n\nEncoder.encodeToStringWithLongInputData test ");
+
+ final byte[] secondTestBuffer =
+ "api/java_util/Base64/index.html#GetEncoderMimeCustom[noLineSeparatorInEncodedString]"
+ .getBytes(US_ASCII);
+ String base64EncodedString;
+ base64EncodedString = encoder.encodeToString(secondTestBuffer);
+
+ System.err.println("Second Base64 encoded string is "
+ + base64EncodedString);
+
+ if (base64EncodedString.contains("$$$")) {
+ throw new RuntimeException(
+ "Base64 encoding contains line separator after encodeToString invoked ... \n");
+ }
+ }
+
+ private static void testWrapEncode1(final Base64.Encoder encoder)
+ throws IOException {
+ System.err.println("\nEncoder.wrap test I ");
+
+ final byte[] bytesIn = "fo".getBytes(US_ASCII);
+ String base64EncodedString;
+ ByteArrayOutputStream encodingStream = new ByteArrayOutputStream();
+ OutputStream encoding = encoder.wrap(encodingStream);
+ encoding.write(bytesIn);
+ encoding.close();
+
+ final byte[] encodedBytes = encodingStream.toByteArray();
+
+ System.err.print("result = " + new String(encodedBytes, US_ASCII)
+ + " after the Base64 encoding \n");
+
+ base64EncodedString = new String(encodedBytes, US_ASCII);
+
+ if (base64EncodedString.contains("$$$")) {
+ throw new RuntimeException(
+ "Base64 encoding contains line separator after wrap I test ... \n");
+ }
+ }
+
+ private static void testEncodeToString(final Base64.Encoder encoder) {
+ final byte[] bytesIn = "fo".getBytes(US_ASCII);
+
+ System.err.println("\nEncoder.encodeToString test ");
+
+ String base64EncodedString = encoder.encodeToString(bytesIn);
+
+ System.err.println("Base64 encoded string is " + base64EncodedString);
+
+ if (base64EncodedString.contains("$$$")) {
+ throw new RuntimeException("Base64 encoding contains line separator after Encoder.encodeToString invoked ... \n");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Collection/CollectionDefaults.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.function.Predicate;
+
+/**
+ * @test
+ * @library testlibrary
+ * @build CollectionAsserts CollectionSupplier
+ * @run testng CollectionDefaults
+ * @summary Unit tests for extension methods on Collection
+ */
+public class CollectionDefaults {
+
+ public static final Predicate<Integer> pEven = x -> 0 == x % 2;
+ public static final Predicate<Integer> pOdd = x -> 1 == x % 2;
+
+ private static final String[] SET_CLASSES = {
+ "java.util.HashSet",
+ "java.util.LinkedHashSet",
+ "java.util.TreeSet"
+ };
+
+ private static final int SIZE = 100;
+
+ @DataProvider(name="setProvider", parallel=true)
+ public static Object[][] setCases() {
+ final List<Object[]> cases = new LinkedList<>();
+ cases.add(new Object[] { new HashSet<>() });
+ cases.add(new Object[] { new LinkedHashSet<>() });
+ cases.add(new Object[] { new TreeSet<>() });
+
+ cases.add(new Object[] { Collections.newSetFromMap(new HashMap<>()) });
+ cases.add(new Object[] { Collections.newSetFromMap(new LinkedHashMap()) });
+ cases.add(new Object[] { Collections.newSetFromMap(new TreeMap<>()) });
+
+ cases.add(new Object[] { new HashSet(){{add(42);}} });
+ cases.add(new Object[] { new LinkedHashSet(){{add(42);}} });
+ cases.add(new Object[] { new TreeSet(){{add(42);}} });
+ return cases.toArray(new Object[0][cases.size()]);
+ }
+
+ @Test(dataProvider = "setProvider")
+ public void testProvidedWithNull(final Set<Integer> set) throws Exception {
+ try {
+ set.forEach(null);
+ fail("expected NPE not thrown");
+ } catch (NullPointerException npe) {}
+ try {
+ set.removeIf(null);
+ fail("expected NPE not thrown");
+ } catch (NullPointerException npe) {}
+ }
+
+ @Test
+ public void testForEach() throws Exception {
+ final CollectionSupplier supplier = new CollectionSupplier(SET_CLASSES, SIZE);
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final Set<Integer> original = ((Set<Integer>) test.original);
+ final Set<Integer> set = ((Set<Integer>) test.collection);
+
+ try {
+ set.forEach(null);
+ fail("expected NPE not thrown");
+ } catch (NullPointerException npe) {}
+ if (test.className.equals("java.util.HashSet")) {
+ CollectionAsserts.assertContentsUnordered(set, original);
+ } else {
+ CollectionAsserts.assertContents(set, original);
+ }
+
+ final List<Integer> actual = new LinkedList<>();
+ set.forEach(actual::add);
+ if (test.className.equals("java.util.HashSet")) {
+ CollectionAsserts.assertContentsUnordered(actual, set);
+ CollectionAsserts.assertContentsUnordered(actual, original);
+ } else {
+ CollectionAsserts.assertContents(actual, set);
+ CollectionAsserts.assertContents(actual, original);
+ }
+ }
+ }
+
+ @Test
+ public void testRemoveIf() throws Exception {
+ final CollectionSupplier supplier = new CollectionSupplier(SET_CLASSES, SIZE);
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final Set<Integer> original = ((Set<Integer>) test.original);
+ final Set<Integer> set = ((Set<Integer>) test.collection);
+
+ try {
+ set.removeIf(null);
+ fail("expected NPE not thrown");
+ } catch (NullPointerException npe) {}
+ if (test.className.equals("java.util.HashSet")) {
+ CollectionAsserts.assertContentsUnordered(set, original);
+ } else {
+ CollectionAsserts.assertContents(set, original);
+ }
+
+ set.removeIf(pEven);
+ for (int i : set) {
+ assertTrue((i % 2) == 1);
+ }
+ for (int i : original) {
+ if (i % 2 == 1) {
+ assertTrue(set.contains(i));
+ }
+ }
+ set.removeIf(pOdd);
+ assertTrue(set.isEmpty());
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Collection/ListDefaults.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,530 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Comparators;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Stack;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.Vector;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.lang.reflect.Constructor;
+import java.util.ConcurrentModificationException;
+import java.util.function.Predicate;
+
+/**
+ * @test
+ * @library testlibrary
+ * @build CollectionAsserts CollectionSupplier
+ * @run testng ListDefaults
+ * @summary Unit tests for extension methods on List
+ */
+public class ListDefaults {
+
+ private static final String[] LIST_CLASSES = {
+ "java.util.ArrayList",
+ "java.util.LinkedList",
+ "java.util.Vector",
+ "java.util.concurrent.CopyOnWriteArrayList"
+ };
+
+ private static final String[] LIST_CME_CLASSES = {
+ "java.util.ArrayList",
+ "java.util.Vector"
+ };
+
+ private static final Predicate<Integer> pEven = x -> 0 == x % 2;
+ private static final Predicate<Integer> pOdd = x -> 1 == x % 2;
+
+ private static final Comparator<Integer> BIT_COUNT_COMPARATOR =
+ (x, y) -> Integer.bitCount(x) - Integer.bitCount(y);
+
+ private static final Comparator<AtomicInteger> ATOMIC_INTEGER_COMPARATOR =
+ (x, y) -> x.intValue() - y.intValue();
+
+ private static final int SIZE = 100;
+ private static final int SUBLIST_FROM = 20;
+ private static final int SUBLIST_TO = SIZE - 5;
+ private static final int SUBLIST_SIZE = SUBLIST_TO - SUBLIST_FROM;
+
+ private static interface Callback {
+ void call(List<Integer> list);
+ }
+
+ // call the callback for each recursive subList
+ private void trimmedSubList(final List<Integer> list, final Callback callback) {
+ int size = list.size();
+ if (size > 1) {
+ // trim 1 element from both ends
+ final List<Integer> subList = list.subList(1, size - 1);
+ callback.call(subList);
+ trimmedSubList(subList, callback);
+ }
+ }
+
+ @DataProvider(name="listProvider", parallel=true)
+ public static Object[][] listCases() {
+ final List<Object[]> cases = new LinkedList<>();
+ cases.add(new Object[] { new ArrayList<>() });
+ cases.add(new Object[] { new LinkedList<>() });
+ cases.add(new Object[] { new Vector<>() });
+ cases.add(new Object[] { new Stack<>() });
+ cases.add(new Object[] { new CopyOnWriteArrayList<>() });
+
+ cases.add(new Object[] { new ArrayList(){{add(42);}} });
+ cases.add(new Object[] { new LinkedList(){{add(42);}} });
+ cases.add(new Object[] { new Vector(){{add(42);}} });
+ cases.add(new Object[] { new Stack(){{add(42);}} });
+ cases.add(new Object[] { new CopyOnWriteArrayList(){{add(42);}} });
+ return cases.toArray(new Object[0][cases.size()]);
+ }
+
+ @Test(dataProvider = "listProvider")
+ public void testProvidedWithNull(final List<Integer> list) throws Exception {
+ try {
+ list.forEach(null);
+ fail("expected NPE not thrown");
+ } catch (NullPointerException npe) {}
+ try {
+ list.replaceAll(null);
+ fail("expected NPE not thrown");
+ } catch (NullPointerException npe) {}
+ try {
+ list.removeIf(null);
+ fail("expected NPE not thrown");
+ } catch (NullPointerException npe) {}
+ }
+
+ @Test
+ public void testForEach() throws Exception {
+ final CollectionSupplier supplier = new CollectionSupplier(LIST_CLASSES, SIZE);
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> original = ((List<Integer>) test.original);
+ final List<Integer> list = ((List<Integer>) test.collection);
+ }
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> original = ((List<Integer>) test.original);
+ final List<Integer> list = ((List<Integer>) test.collection);
+
+ try {
+ list.forEach(null);
+ fail("expected NPE not thrown");
+ } catch (NullPointerException npe) {}
+ CollectionAsserts.assertContents(list, original);
+
+ final List<Integer> actual = new LinkedList<>();
+ list.forEach(actual::add);
+ CollectionAsserts.assertContents(actual, list);
+ CollectionAsserts.assertContents(actual, original);
+
+ if (original.size() > SUBLIST_SIZE) {
+ final List<Integer> subList = original.subList(SUBLIST_FROM, SUBLIST_TO);
+ final List<Integer> actualSubList = new LinkedList<>();
+ subList.forEach(actualSubList::add);
+ assertEquals(actualSubList.size(), SUBLIST_SIZE);
+ for (int i = 0; i < SUBLIST_SIZE; i++) {
+ assertEquals(actualSubList.get(i), original.get(i + SUBLIST_FROM));
+ }
+ }
+
+ trimmedSubList(list, new Callback() {
+ @Override
+ public void call(final List<Integer> list) {
+ final List<Integer> actual = new LinkedList<>();
+ list.forEach(actual::add);
+ CollectionAsserts.assertContents(actual, list);
+ }
+ });
+ }
+ }
+
+ @Test
+ public void testRemoveIf() throws Exception {
+ final CollectionSupplier supplier = new CollectionSupplier(LIST_CLASSES, SIZE);
+
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> original = ((List<Integer>) test.original);
+ final List<Integer> list = ((List<Integer>) test.collection);
+
+ try {
+ list.removeIf(null);
+ fail("expected NPE not thrown");
+ } catch (NullPointerException npe) {}
+ CollectionAsserts.assertContents(list, original);
+
+ final AtomicInteger offset = new AtomicInteger(1);
+ while (list.size() > 0) {
+ removeFirst(original, list, offset);
+ }
+ }
+
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> original = ((List<Integer>) test.original);
+ final List<Integer> list = ((List<Integer>) test.collection);
+ list.removeIf(pOdd);
+ for (int i : list) {
+ assertTrue((i % 2) == 0);
+ }
+ for (int i : original) {
+ if (i % 2 == 0) {
+ assertTrue(list.contains(i));
+ }
+ }
+ list.removeIf(pEven);
+ assertTrue(list.isEmpty());
+ }
+
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> original = ((List<Integer>) test.original);
+ final List<Integer> list = ((List<Integer>) test.collection);
+ final List<Integer> listCopy = new ArrayList<>(list);
+ if (original.size() > SUBLIST_SIZE) {
+ final List<Integer> subList = list.subList(SUBLIST_FROM, SUBLIST_TO);
+ final List<Integer> subListCopy = new ArrayList<>(subList);
+ listCopy.removeAll(subList);
+ subList.removeIf(pOdd);
+ for (int i : subList) {
+ assertTrue((i % 2) == 0);
+ }
+ for (int i : subListCopy) {
+ if (i % 2 == 0) {
+ assertTrue(subList.contains(i));
+ } else {
+ assertFalse(subList.contains(i));
+ }
+ }
+ subList.removeIf(pEven);
+ assertTrue(subList.isEmpty());
+ // elements outside the view should remain
+ CollectionAsserts.assertContents(list, listCopy);
+ }
+ }
+
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> list = ((List<Integer>) test.collection);
+ trimmedSubList(list, new Callback() {
+ @Override
+ public void call(final List<Integer> list) {
+ final List<Integer> copy = new ArrayList<>(list);
+ list.removeIf(pOdd);
+ for (int i : list) {
+ assertTrue((i % 2) == 0);
+ }
+ for (int i : copy) {
+ if (i % 2 == 0) {
+ assertTrue(list.contains(i));
+ } else {
+ assertFalse(list.contains(i));
+ }
+ }
+ }
+ });
+ }
+ }
+
+ // remove the first element
+ private void removeFirst(final List<Integer> original, final List<Integer> list, final AtomicInteger offset) {
+ final AtomicBoolean first = new AtomicBoolean(true);
+ list.removeIf(x -> first.getAndSet(false));
+ CollectionAsserts.assertContents(original.subList(offset.getAndIncrement(), original.size()), list);
+ }
+
+ @Test
+ public void testReplaceAll() throws Exception {
+ final int scale = 3;
+ final CollectionSupplier supplier = new CollectionSupplier(LIST_CLASSES, SIZE);
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> original = ((List<Integer>) test.original);
+ final List<Integer> list = ((List<Integer>) test.collection);
+
+ try {
+ list.replaceAll(null);
+ fail("expected NPE not thrown");
+ } catch (NullPointerException npe) {}
+ CollectionAsserts.assertContents(list, original);
+
+ list.replaceAll(x -> scale * x);
+ for (int i=0; i < original.size(); i++) {
+ assertTrue(list.get(i) == (scale * original.get(i)), "mismatch at index " + i);
+ }
+
+ if (original.size() > SUBLIST_SIZE) {
+ final List<Integer> subList = list.subList(SUBLIST_FROM, SUBLIST_TO);
+ subList.replaceAll(x -> x + 1);
+ // verify elements in view [from, to) were replaced
+ for (int i = 0; i < SUBLIST_SIZE; i++) {
+ assertTrue(subList.get(i) == ((scale * original.get(i + SUBLIST_FROM)) + 1),
+ "mismatch at sublist index " + i);
+ }
+ // verify that elements [0, from) remain unmodified
+ for (int i = 0; i < SUBLIST_FROM; i++) {
+ assertTrue(list.get(i) == (scale * original.get(i)),
+ "mismatch at original index " + i);
+ }
+ // verify that elements [to, size) remain unmodified
+ for (int i = SUBLIST_TO; i < list.size(); i++) {
+ assertTrue(list.get(i) == (scale * original.get(i)),
+ "mismatch at original index " + i);
+ }
+ }
+ }
+
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> list = ((List<Integer>) test.collection);
+ trimmedSubList(list, new Callback() {
+ @Override
+ public void call(final List<Integer> list) {
+ final List<Integer> copy = new ArrayList<>(list);
+ final int offset = 5;
+ list.replaceAll(x -> offset + x);
+ for (int i=0; i < copy.size(); i++) {
+ assertTrue(list.get(i) == (offset + copy.get(i)), "mismatch at index " + i);
+ }
+ }
+ });
+ }
+ }
+
+ @Test
+ public void testSort() throws Exception {
+ final CollectionSupplier supplier = new CollectionSupplier(LIST_CLASSES, SIZE);
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> original = ((List<Integer>) test.original);
+ final List<Integer> list = ((List<Integer>) test.collection);
+ CollectionSupplier.shuffle(list);
+ list.sort(Integer::compare);
+ CollectionAsserts.assertSorted(list, Integer::compare);
+ if (test.name.startsWith("reverse")) {
+ Collections.reverse(list);
+ }
+ CollectionAsserts.assertContents(list, original);
+
+ CollectionSupplier.shuffle(list);
+ list.sort(null);
+ CollectionAsserts.assertSorted(list, Comparators.<Integer>naturalOrder());
+ if (test.name.startsWith("reverse")) {
+ Collections.reverse(list);
+ }
+ CollectionAsserts.assertContents(list, original);
+
+ CollectionSupplier.shuffle(list);
+ list.sort(Comparators.<Integer>naturalOrder());
+ CollectionAsserts.assertSorted(list, Comparators.<Integer>naturalOrder());
+ if (test.name.startsWith("reverse")) {
+ Collections.reverse(list);
+ }
+ CollectionAsserts.assertContents(list, original);
+
+ CollectionSupplier.shuffle(list);
+ list.sort(Comparators.<Integer>reverseOrder());
+ CollectionAsserts.assertSorted(list, Comparators.<Integer>reverseOrder());
+ if (!test.name.startsWith("reverse")) {
+ Collections.reverse(list);
+ }
+ CollectionAsserts.assertContents(list, original);
+
+ CollectionSupplier.shuffle(list);
+ list.sort(BIT_COUNT_COMPARATOR);
+ CollectionAsserts.assertSorted(list, BIT_COUNT_COMPARATOR);
+ // check sort by verifying that bitCount increases and never drops
+ int minBitCount = 0;
+ int bitCount = 0;
+ for (final Integer i : list) {
+ bitCount = Integer.bitCount(i);
+ assertTrue(bitCount >= minBitCount);
+ minBitCount = bitCount;
+ }
+
+ @SuppressWarnings("unchecked")
+ final Class<? extends List<AtomicInteger>> type =
+ (Class<? extends List<AtomicInteger>>) Class.forName(test.className);
+ final Constructor<? extends List<AtomicInteger>> defaultConstructor = type.getConstructor();
+ final List<AtomicInteger> incomparables = (List<AtomicInteger>) defaultConstructor.newInstance();
+
+ for (int i=0; i < test.original.size(); i++) {
+ incomparables.add(new AtomicInteger(i));
+ }
+ CollectionSupplier.shuffle(incomparables);
+ incomparables.sort(ATOMIC_INTEGER_COMPARATOR);
+ for (int i=0; i < test.original.size(); i++) {
+ assertEquals(i, incomparables.get(i).intValue());
+ }
+
+ if (original.size() > SUBLIST_SIZE) {
+ final List<Integer> copy = new ArrayList<>(list);
+ final List<Integer> subList = list.subList(SUBLIST_FROM, SUBLIST_TO);
+ CollectionSupplier.shuffle(subList);
+ subList.sort(Comparators.<Integer>naturalOrder());
+ CollectionAsserts.assertSorted(subList, Comparators.<Integer>naturalOrder());
+ // verify that elements [0, from) remain unmodified
+ for (int i = 0; i < SUBLIST_FROM; i++) {
+ assertTrue(list.get(i) == copy.get(i),
+ "mismatch at index " + i);
+ }
+ // verify that elements [to, size) remain unmodified
+ for (int i = SUBLIST_TO; i < list.size(); i++) {
+ assertTrue(list.get(i) == copy.get(i),
+ "mismatch at index " + i);
+ }
+ }
+ }
+
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> list = ((List<Integer>) test.collection);
+ trimmedSubList(list, new Callback() {
+ @Override
+ public void call(final List<Integer> list) {
+ final List<Integer> copy = new ArrayList<>(list);
+ CollectionSupplier.shuffle(list);
+ list.sort(Comparators.<Integer>naturalOrder());
+ CollectionAsserts.assertSorted(list, Comparators.<Integer>naturalOrder());
+ }
+ });
+ }
+ }
+
+ @Test
+ public void testForEachThrowsCME() throws Exception {
+ final CollectionSupplier supplier = new CollectionSupplier(LIST_CME_CLASSES, SIZE);
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> list = ((List<Integer>) test.collection);
+ if (list.size() <= 1) {
+ continue;
+ }
+ boolean gotException = false;
+ try {
+ // bad predicate that modifies its list, should throw CME
+ list.forEach((x) -> {list.add(x);});
+ } catch (ConcurrentModificationException cme) {
+ gotException = true;
+ }
+ if (!gotException) {
+ fail("expected CME was not thrown from " + test);
+ }
+ }
+ }
+
+ @Test
+ public void testRemoveIfThrowsCME() throws Exception {
+ final CollectionSupplier supplier = new CollectionSupplier(LIST_CME_CLASSES, SIZE);
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> list = ((List<Integer>) test.collection);
+ if (list.size() <= 1) {
+ continue;
+ }
+ boolean gotException = false;
+ try {
+ // bad predicate that modifies its list, should throw CME
+ list.removeIf((x) -> {return list.add(x);});
+ } catch (ConcurrentModificationException cme) {
+ gotException = true;
+ }
+ if (!gotException) {
+ fail("expected CME was not thrown from " + test);
+ }
+ }
+ }
+
+ @Test
+ public void testReplaceAllThrowsCME() throws Exception {
+ final CollectionSupplier supplier = new CollectionSupplier(LIST_CME_CLASSES, SIZE);
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> list = ((List<Integer>) test.collection);
+ if (list.size() <= 1) {
+ continue;
+ }
+ boolean gotException = false;
+ try {
+ // bad predicate that modifies its list, should throw CME
+ list.replaceAll(x -> {int n = 3 * x; list.add(n); return n;});
+ } catch (ConcurrentModificationException cme) {
+ gotException = true;
+ }
+ if (!gotException) {
+ fail("expected CME was not thrown from " + test);
+ }
+ }
+ }
+
+ @Test
+ public void testSortThrowsCME() throws Exception {
+ final CollectionSupplier supplier = new CollectionSupplier(LIST_CME_CLASSES, SIZE);
+ for (final CollectionSupplier.TestCase test : supplier.get()) {
+ final List<Integer> list = ((List<Integer>) test.collection);
+ if (list.size() <= 1) {
+ continue;
+ }
+ boolean gotException = false;
+ try {
+ // bad predicate that modifies its list, should throw CME
+ list.sort((x, y) -> {list.add(x); return x - y;});
+ } catch (ConcurrentModificationException cme) {
+ gotException = true;
+ }
+ if (!gotException) {
+ fail("expected CME was not thrown from " + test);
+ }
+ }
+ }
+
+ private static final List<Integer> SLICED_EXPECTED = Arrays.asList(0, 1, 2, 3, 5, 6, 7, 8, 9);
+ private static final List<Integer> SLICED_EXPECTED2 = Arrays.asList(0, 1, 2, 5, 6, 7, 8, 9);
+
+ @DataProvider(name="shortIntListProvider", parallel=true)
+ public static Object[][] intListCases() {
+ final Integer[] DATA = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ final List<Object[]> cases = new LinkedList<>();
+ cases.add(new Object[] { new ArrayList<>(Arrays.asList(DATA)) });
+ cases.add(new Object[] { new LinkedList<>(Arrays.asList(DATA)) });
+ cases.add(new Object[] { new Vector<>(Arrays.asList(DATA)) });
+ cases.add(new Object[] { new CopyOnWriteArrayList<>(Arrays.asList(DATA)) });
+ return cases.toArray(new Object[0][cases.size()]);
+ }
+
+ @Test(dataProvider = "shortIntListProvider")
+ public void testRemoveIfFromSlice(final List<Integer> list) throws Exception {
+ final List<Integer> sublist = list.subList(3, 6);
+ assertTrue(sublist.removeIf(x -> x == 4));
+ CollectionAsserts.assertContents(list, SLICED_EXPECTED);
+
+ final List<Integer> sublist2 = list.subList(2, 5);
+ assertTrue(sublist2.removeIf(x -> x == 3));
+ CollectionAsserts.assertContents(list, SLICED_EXPECTED2);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Collection/testlibrary/CollectionAsserts.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+/**
+ * @library
+ * CollectionAssert -- assertion methods for lambda test cases
+ */
+public class CollectionAsserts {
+
+ public static void assertCountSum(Iterable<? super Integer> it, int count, int sum) {
+ assertCountSum(it.iterator(), count, sum);
+ }
+
+ public static void assertCountSum(Iterator<? super Integer> it, int count, int sum) {
+ int c = 0;
+ int s = 0;
+ while (it.hasNext()) {
+ int i = (Integer) it.next();
+ c++;
+ s += i;
+ }
+
+ assertEquals(c, count);
+ assertEquals(s, sum);
+ }
+
+ public static void assertConcat(Iterator<Character> it, String result) {
+ StringBuilder sb = new StringBuilder();
+ while (it.hasNext()) {
+ sb.append(it.next());
+ }
+
+ assertEquals(result, sb.toString());
+ }
+
+ public static<T extends Comparable<? super T>> void assertSorted(Iterator<T> i) {
+ if (!i.hasNext())
+ return;
+ T last = i.next();
+ while (i.hasNext()) {
+ T t = i.next();
+ assertTrue(last.compareTo(t) <= 0);
+ assertTrue(t.compareTo(last) >= 0);
+ last = t;
+ }
+ }
+
+ public static<T> void assertSorted(Iterator<T> i, Comparator<? super T> comp) {
+ if (!i.hasNext())
+ return;
+ T last = i.next();
+ while (i.hasNext()) {
+ T t = i.next();
+ assertTrue(comp.compare(last, t) <= 0);
+ assertTrue(comp.compare(t, last) >= 0);
+ last = t;
+ }
+ }
+
+ public static<T extends Comparable<? super T>> void assertSorted(Iterable<T> iter) {
+ assertSorted(iter.iterator());
+ }
+
+ public static<T> void assertSorted(Iterable<T> iter, Comparator<? super T> comp) {
+ assertSorted(iter.iterator(), comp);
+ }
+
+ public static <T> void assertUnique(Iterable<T> iter) {
+ assertUnique(iter.iterator());
+ }
+
+ public static<T> void assertUnique(Iterator<T> iter) {
+ if (!iter.hasNext()) {
+ return;
+ }
+
+ Set<T> uniq = new HashSet<>();
+ while(iter.hasNext()) {
+ T each = iter.next();
+ assertTrue(!uniq.contains(each));
+ uniq.add(each);
+ }
+ }
+
+ public static<T> void assertContents(Iterable<T> actual, Iterable<T> expected) {
+ assertContents(actual.iterator(), expected.iterator());
+ }
+
+ public static<T> void assertContents(Iterator<T> actual, Iterator<T> expected) {
+ List<T> history = new ArrayList<>();
+
+ while (expected.hasNext()) {
+ if (!actual.hasNext()) {
+ List<T> expectedData = new ArrayList<>(history);
+ while (expected.hasNext())
+ expectedData.add(expected.next());
+ fail(String.format("Premature end of data; expected=%s, found=%s", expectedData, history));
+ }
+ T a = actual.next();
+ T e = expected.next();
+ history.add(a);
+
+ if (!Objects.equals(a, e))
+ fail(String.format("Data mismatch; preceding=%s, nextExpected=%s, nextFound=%s", history, e, a));
+ }
+ if (actual.hasNext()) {
+ List<T> rest = new ArrayList<>();
+ while (actual.hasNext())
+ rest.add(actual.next());
+ fail(String.format("Unexpected data %s after %s", rest, history));
+ }
+ }
+
+ @SafeVarargs
+ @SuppressWarnings("varargs")
+ public static<T> void assertContents(Iterator<T> actual, T... expected) {
+ assertContents(actual, Arrays.asList(expected).iterator());
+ }
+
+ public static <T> boolean equalsContentsUnordered(Iterable<T> a, Iterable<T> b) {
+ Set<T> sa = new HashSet<>();
+ for (T t : a) {
+ sa.add(t);
+ }
+
+ Set<T> sb = new HashSet<>();
+ for (T t : b) {
+ sb.add(t);
+ }
+
+ return Objects.equals(sa, sb);
+ }
+
+ public static<T extends Comparable<? super T>> void assertContentsUnordered(Iterable<T> actual, Iterable<T> expected) {
+ ArrayList<T> one = new ArrayList<>();
+ for (T t : actual)
+ one.add(t);
+ ArrayList<T> two = new ArrayList<>();
+ for (T t : expected)
+ two.add(t);
+ Collections.sort(one);
+ Collections.sort(two);
+ assertContents(one, two);
+ }
+
+ static <T> void assertSplitContents(Iterable<Iterable<T>> splits, Iterable<T> list) {
+ Iterator<Iterable<T>> mI = splits.iterator();
+ Iterator<T> pI = null;
+ Iterator<T> lI = list.iterator();
+
+ while (lI.hasNext()) {
+ if (pI == null)
+ pI = mI.next().iterator();
+ while (!pI.hasNext()) {
+ if (!mI.hasNext()) {
+ break;
+ }
+ else {
+ pI = mI.next().iterator();
+ }
+ }
+ assertTrue(pI.hasNext());
+ T pT = pI.next();
+ T lT = lI.next();
+ assertEquals(pT, lT);
+ }
+
+ if (pI != null) {
+ assertTrue(!pI.hasNext());
+ }
+
+ while(mI.hasNext()) {
+ pI = mI.next().iterator();
+ assertTrue(!pI.hasNext());
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Collection/testlibrary/CollectionSupplier.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,304 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.Exception;
+import java.lang.Integer;
+import java.lang.Iterable;
+import java.lang.Override;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+
+import org.testng.TestException;
+
+import static org.testng.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.function.Supplier;
+
+/**
+ * @library
+ * @summary A Supplier of test cases for Collection tests
+ */
+public final class CollectionSupplier implements Supplier<Iterable<CollectionSupplier.TestCase>> {
+
+ private final String[] classNames;
+ private final int size;
+
+ /**
+ * A Collection test case.
+ */
+ public static final class TestCase {
+
+ /**
+ * The name of the test case.
+ */
+ public final String name;
+
+ /**
+ * Class name of the instantiated Collection.
+ */
+ public final String className;
+
+ /**
+ * Unmodifiable reference collection, useful for comparisons.
+ */
+ public final Collection<Integer> original;
+
+ /**
+ * A modifiable test collection.
+ */
+ public final Collection<Integer> collection;
+
+ /**
+ * Create a Collection test case.
+ * @param name name of the test case
+ * @param className class name of the instantiated collection
+ * @param original reference collection
+ * @param collection the modifiable test collection
+ */
+ public TestCase(String name, String className,
+ Collection<Integer> original, Collection<Integer> collection) {
+ this.name = name;
+ this.className = className;
+ this.original =
+ List.class.isAssignableFrom(original.getClass()) ?
+ Collections.unmodifiableList((List<Integer>) original) :
+ Set.class.isAssignableFrom(original.getClass()) ?
+ Collections.unmodifiableSet((Set<Integer>) original) :
+ Collections.unmodifiableCollection(original);
+ this.collection = collection;
+ }
+
+ @Override
+ public String toString() {
+ return name + " " + className +
+ "\n original: " + original +
+ "\n target: " + collection;
+ }
+ }
+
+ /**
+ * Shuffle a list using a PRNG with known seed for repeatability
+ * @param list the list to be shuffled
+ */
+ public static <E> void shuffle(final List<E> list) {
+ // PRNG with known seed for repeatable tests
+ final Random prng = new Random(13);
+ final int size = list.size();
+ for (int i=0; i < size; i++) {
+ // random index in interval [i, size)
+ final int j = i + prng.nextInt(size - i);
+ // swap elements at indices i & j
+ final E e = list.get(i);
+ list.set(i, list.get(j));
+ list.set(j, e);
+ }
+ }
+
+ /**
+ * Create a {@code Supplier} that creates instances of specified collection
+ * classes of specified length.
+ *
+ * @param classNames class names that implement {@code Collection}
+ * @param size the desired size of each collection
+ */
+ public CollectionSupplier(String[] classNames, int size) {
+ this.classNames = Arrays.copyOf(classNames, classNames.length);
+ this.size = size;
+ }
+
+ @Override
+ public Iterable<TestCase> get() {
+ try {
+ return getThrows();
+ } catch (Exception e) {
+ throw new TestException(e);
+ }
+ }
+
+ private Iterable<TestCase> getThrows() throws Exception {
+ final Collection<TestCase> collections = new LinkedList<>();
+ for (final String className : classNames) {
+ @SuppressWarnings("unchecked")
+ final Class<? extends Collection<Integer>> type =
+ (Class<? extends Collection<Integer>>) Class.forName(className);
+ final Constructor<? extends Collection<Integer>>
+ defaultConstructor = type.getConstructor();
+ final Constructor<? extends Collection<Integer>>
+ copyConstructor = type.getConstructor(Collection.class);
+
+ final Collection<Integer> empty = defaultConstructor.newInstance();
+ collections.add(new TestCase("empty",
+ className,
+ copyConstructor.newInstance(empty),
+ empty));
+
+ final Collection<Integer> single = defaultConstructor.newInstance();
+ single.add(42);
+ collections.add(new TestCase("single",
+ className,
+ copyConstructor.newInstance(single),
+ single));
+
+ final Collection<Integer> regular = defaultConstructor.newInstance();
+ for (int i=0; i < size; i++) {
+ regular.add(i);
+ }
+ collections.add(new TestCase("regular",
+ className,
+ copyConstructor.newInstance(regular),
+ regular));
+
+ final Collection<Integer> reverse = defaultConstructor.newInstance();
+ for (int i=size; i >= 0; i--) {
+ reverse.add(i);
+ }
+ collections.add(new TestCase("reverse",
+ className,
+ copyConstructor.newInstance(reverse),
+ reverse));
+
+ final Collection<Integer> odds = defaultConstructor.newInstance();
+ for (int i=0; i < size; i++) {
+ odds.add((i * 2) + 1);
+ }
+ collections.add(new TestCase("odds",
+ className,
+ copyConstructor.newInstance(odds),
+ odds));
+
+ final Collection<Integer> evens = defaultConstructor.newInstance();
+ for (int i=0; i < size; i++) {
+ evens.add(i * 2);
+ }
+ collections.add(new TestCase("evens",
+ className,
+ copyConstructor.newInstance(evens),
+ evens));
+
+ final Collection<Integer> fibonacci = defaultConstructor.newInstance();
+ int prev2 = 0;
+ int prev1 = 1;
+ for (int i=0; i < size; i++) {
+ final int n = prev1 + prev2;
+ if (n < 0) { // stop on overflow
+ break;
+ }
+ fibonacci.add(n);
+ prev2 = prev1;
+ prev1 = n;
+ }
+ collections.add(new TestCase("fibonacci",
+ className,
+ copyConstructor.newInstance(fibonacci),
+ fibonacci));
+
+ // variants where the size of the backing storage != reported size
+ // created by removing half of the elements
+
+ final Collection<Integer> emptyWithSlack = defaultConstructor.newInstance();
+ emptyWithSlack.add(42);
+ assertTrue(emptyWithSlack.remove(42));
+ collections.add(new TestCase("emptyWithSlack",
+ className,
+ copyConstructor.newInstance(emptyWithSlack),
+ emptyWithSlack));
+
+ final Collection<Integer> singleWithSlack = defaultConstructor.newInstance();
+ singleWithSlack.add(42);
+ singleWithSlack.add(43);
+ assertTrue(singleWithSlack.remove(43));
+ collections.add(new TestCase("singleWithSlack",
+ className,
+ copyConstructor.newInstance(singleWithSlack),
+ singleWithSlack));
+
+ final Collection<Integer> regularWithSlack = defaultConstructor.newInstance();
+ for (int i=0; i < (2 * size); i++) {
+ regularWithSlack.add(i);
+ }
+ assertTrue(regularWithSlack.removeIf((x) -> {return x >= size;}));
+ collections.add(new TestCase("regularWithSlack",
+ className,
+ copyConstructor.newInstance(regularWithSlack),
+ regularWithSlack));
+
+ final Collection<Integer> reverseWithSlack = defaultConstructor.newInstance();
+ for (int i=2 * size; i >= 0; i--) {
+ reverseWithSlack.add(i);
+ }
+ assertTrue(reverseWithSlack.removeIf((x) -> {return x < size;}));
+ collections.add(new TestCase("reverseWithSlack",
+ className,
+ copyConstructor.newInstance(reverseWithSlack),
+ reverseWithSlack));
+
+ final Collection<Integer> oddsWithSlack = defaultConstructor.newInstance();
+ for (int i = 0; i < 2 * size; i++) {
+ oddsWithSlack.add((i * 2) + 1);
+ }
+ assertTrue(oddsWithSlack.removeIf((x) -> {return x >= size;}));
+ collections.add(new TestCase("oddsWithSlack",
+ className,
+ copyConstructor.newInstance(oddsWithSlack),
+ oddsWithSlack));
+
+ final Collection<Integer> evensWithSlack = defaultConstructor.newInstance();
+ for (int i = 0; i < 2 * size; i++) {
+ evensWithSlack.add(i * 2);
+ }
+ assertTrue(evensWithSlack.removeIf((x) -> {return x >= size;}));
+ collections.add(new TestCase("evensWithSlack",
+ className,
+ copyConstructor.newInstance(evensWithSlack),
+ evensWithSlack));
+
+ final Collection<Integer> fibonacciWithSlack = defaultConstructor.newInstance();
+ prev2 = 0;
+ prev1 = 1;
+ for (int i=0; i < size; i++) {
+ final int n = prev1 + prev2;
+ if (n < 0) { // stop on overflow
+ break;
+ }
+ fibonacciWithSlack.add(n);
+ prev2 = prev1;
+ prev1 = n;
+ }
+ assertTrue(fibonacciWithSlack.removeIf((x) -> {return x < 20;}));
+ collections.add(new TestCase("fibonacciWithSlack",
+ className,
+ copyConstructor.newInstance(fibonacciWithSlack),
+ fibonacciWithSlack));
+
+ }
+
+ return collections;
+ }
+
+}
--- a/jdk/test/java/util/Locale/LocaleProviders.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/util/Locale/LocaleProviders.java Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
import java.text.*;
import java.text.spi.*;
import java.util.*;
+import java.util.spi.*;
import sun.util.locale.provider.LocaleProviderAdapter;
public class LocaleProviders {
@@ -55,6 +56,10 @@
bug8001440Test();
break;
+ case "bug8010666Test":
+ bug8010666Test();
+ break;
+
default:
throw new RuntimeException("Test method '"+methodName+"' not found.");
}
@@ -103,4 +108,38 @@
NumberFormat nf = NumberFormat.getInstance(locale);
String nu = nf.format(1234560);
}
+
+ // This test assumes Windows localized language/country display names.
+ static void bug8010666Test() {
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ NumberFormat nf = NumberFormat.getInstance(Locale.US);
+ try {
+ double ver = nf.parse(System.getProperty("os.version")).doubleValue();
+ System.out.printf("Windows version: %.1f\n", ver);
+ if (ver >= 6.0) {
+ LocaleProviderAdapter lda = LocaleProviderAdapter.getAdapter(LocaleNameProvider.class, Locale.ENGLISH);
+ LocaleProviderAdapter.Type type = lda.getAdapterType();
+ if (type == LocaleProviderAdapter.Type.HOST) {
+ Locale mkmk = Locale.forLanguageTag("mk-MK");
+ String result = mkmk.getDisplayLanguage(Locale.ENGLISH);
+ if (!"Macedonian (FYROM)".equals(result)) {
+ throw new RuntimeException("Windows locale name provider did not return expected localized language name for \"mk\". Returned name was \"" + result + "\"");
+ }
+ result = Locale.US.getDisplayLanguage(Locale.ENGLISH);
+ if (!"English".equals(result)) {
+ throw new RuntimeException("Windows locale name provider did not return expected localized language name for \"en\". Returned name was \"" + result + "\"");
+ }
+ result = Locale.US.getDisplayCountry(Locale.ENGLISH);
+ if (ver >= 6.1 && !"United States".equals(result)) {
+ throw new RuntimeException("Windows locale name provider did not return expected localized country name for \"US\". Returned name was \"" + result + "\"");
+ }
+ } else {
+ throw new RuntimeException("Windows Host LocaleProviderAdapter was not selected for English locale.");
+ }
+ }
+ } catch (ParseException pe) {
+ throw new RuntimeException("Parsing Windows version failed: "+pe.toString());
+ }
+ }
+ }
}
--- a/jdk/test/java/util/Locale/LocaleProviders.sh Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/util/Locale/LocaleProviders.sh Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
#!/bin/sh
#
# @test
-# @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440
+# @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8010666
# @summary tests for "java.locale.providers" system property
# @compile -XDignore.symbol.file LocaleProviders.java
# @run shell/timeout=600 LocaleProviders.sh
@@ -258,4 +258,15 @@
PARAM3=
runTest
+# testing 8010666 fix.
+if [ "${DEFLANG}" = "en" ]
+then
+ METHODNAME=bug8010666Test
+ PREFLIST=HOST
+ PARAM1=
+ PARAM2=
+ PARAM3=
+ runTest
+fi
+
exit $result
--- a/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java Wed May 01 11:34:06 2013 -0700
@@ -184,6 +184,8 @@
@Override
public boolean tryAdvance(Consumer<? super Integer> action) {
+ if (action == null)
+ throw new NullPointerException();
if (it.hasNext()) {
action.accept(it.next());
return true;
@@ -193,7 +195,7 @@
}
}
}
- db.add("new Spliterators.AbstractAdvancingSpliterator()",
+ db.add("new Spliterators.AbstractSpliterator()",
() -> new SpliteratorFromIterator(exp.iterator(), exp.size()));
// Collections
@@ -370,7 +372,28 @@
db.addCollection(c -> Collections.singletonList(exp.get(0)));
}
- // @@@ Collections.synchronized/unmodifiable/checked wrappers
+ // Collections.synchronized/unmodifiable/checked wrappers
+ db.addCollection(Collections::unmodifiableCollection);
+ db.addCollection(c -> Collections.unmodifiableSet(new HashSet<>(c)));
+ db.addCollection(c -> Collections.unmodifiableSortedSet(new TreeSet<>(c)));
+ db.addList(c -> Collections.unmodifiableList(new ArrayList<>(c)));
+ db.addMap(Collections::unmodifiableMap);
+ db.addMap(m -> Collections.unmodifiableSortedMap(new TreeMap<>(m)));
+
+ db.addCollection(Collections::synchronizedCollection);
+ db.addCollection(c -> Collections.synchronizedSet(new HashSet<>(c)));
+ db.addCollection(c -> Collections.synchronizedSortedSet(new TreeSet<>(c)));
+ db.addList(c -> Collections.synchronizedList(new ArrayList<>(c)));
+ db.addMap(Collections::synchronizedMap);
+ db.addMap(m -> Collections.synchronizedSortedMap(new TreeMap<>(m)));
+
+ db.addCollection(c -> Collections.checkedCollection(c, Integer.class));
+ db.addCollection(c -> Collections.checkedQueue(new ArrayDeque<>(c), Integer.class));
+ db.addCollection(c -> Collections.checkedSet(new HashSet<>(c), Integer.class));
+ db.addCollection(c -> Collections.checkedSortedSet(new TreeSet<>(c), Integer.class));
+ db.addList(c -> Collections.checkedList(new ArrayList<>(c), Integer.class));
+ db.addMap(c -> Collections.checkedMap(c, Integer.class, Integer.class));
+ db.addMap(m -> Collections.checkedSortedMap(new TreeMap<>(m), Integer.class, Integer.class));
// Maps
@@ -402,6 +425,13 @@
@Test(dataProvider = "Spliterator<Integer>")
@SuppressWarnings({"unchecked", "rawtypes"})
+ public void testNullPointerException(String description, Collection exp, Supplier<Spliterator> s) {
+ executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining(null));
+ executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance(null));
+ }
+
+ @Test(dataProvider = "Spliterator<Integer>")
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testForEach(String description, Collection exp, Supplier<Spliterator> s) {
testForEach(exp, s, (Consumer<Object> b) -> b);
}
@@ -507,6 +537,8 @@
@Override
public boolean tryAdvance(IntConsumer action) {
+ if (action == null)
+ throw new NullPointerException();
if (index < a.length) {
action.accept(a[index++]);
return true;
@@ -553,6 +585,12 @@
}
@Test(dataProvider = "Spliterator.OfInt")
+ public void testIntNullPointerException(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
+ executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining((IntConsumer) null));
+ executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance((IntConsumer) null));
+ }
+
+ @Test(dataProvider = "Spliterator.OfInt")
public void testIntForEach(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
testForEach(exp, s, intBoxingConsumer());
}
@@ -652,6 +690,8 @@
@Override
public boolean tryAdvance(LongConsumer action) {
+ if (action == null)
+ throw new NullPointerException();
if (index < a.length) {
action.accept(a[index++]);
return true;
@@ -705,6 +745,12 @@
}
@Test(dataProvider = "Spliterator.OfLong")
+ public void testLongNullPointerException(String description, Collection<Long> exp, Supplier<Spliterator.OfLong> s) {
+ executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining((LongConsumer) null));
+ executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance((LongConsumer) null));
+ }
+
+ @Test(dataProvider = "Spliterator.OfLong")
public void testLongForEach(String description, Collection<Long> exp, Supplier<Spliterator.OfLong> s) {
testForEach(exp, s, longBoxingConsumer());
}
@@ -804,6 +850,8 @@
@Override
public boolean tryAdvance(DoubleConsumer action) {
+ if (action == null)
+ throw new NullPointerException();
if (index < a.length) {
action.accept(a[index++]);
return true;
@@ -857,6 +905,12 @@
}
@Test(dataProvider = "Spliterator.OfDouble")
+ public void testDoubleNullPointerException(String description, Collection<Double> exp, Supplier<Spliterator.OfDouble> s) {
+ executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining((DoubleConsumer) null));
+ executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance((DoubleConsumer) null));
+ }
+
+ @Test(dataProvider = "Spliterator.OfDouble")
public void testDoubleForEach(String description, Collection<Double> exp, Supplier<Spliterator.OfDouble> s) {
testForEach(exp, s, doubleBoxingConsumer());
}
@@ -1057,8 +1111,8 @@
}
private static <T, S extends Spliterator<T>> void visit(int depth, int curLevel,
- List<T> dest, S spliterator, UnaryOperator<Consumer<T>> boxingAdapter,
- int rootCharacteristics, boolean useTryAdvance) {
+ List<T> dest, S spliterator, UnaryOperator<Consumer<T>> boxingAdapter,
+ int rootCharacteristics, boolean useTryAdvance) {
if (curLevel < depth) {
long beforeSize = spliterator.getExactSizeIfKnown();
Spliterator<T> split = spliterator.trySplit();
@@ -1187,13 +1241,13 @@
assertTrue(leftSplit.estimateSize() < parentEstimateSize,
String.format("Left split size estimate %d >= parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
assertTrue(parentAndRightSplit.estimateSize() < parentEstimateSize,
- String.format("Right split size estimate %d >= parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
+ String.format("Right split size estimate %d >= parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
}
else {
assertTrue(leftSplit.estimateSize() <= parentEstimateSize,
- String.format("Left split size estimate %d > parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
+ String.format("Left split size estimate %d > parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
assertTrue(parentAndRightSplit.estimateSize() <= parentEstimateSize,
- String.format("Right split size estimate %d > parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
+ String.format("Right split size estimate %d > parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
}
long leftSize = leftSplit.getExactSizeIfKnown();
@@ -1254,4 +1308,22 @@
});
return result;
}
+
+ private void executeAndCatch(Class<? extends Exception> expected, Runnable r) {
+ Exception caught = null;
+ try {
+ r.run();
+ }
+ catch (Exception e) {
+ caught = e;
+ }
+
+ assertNotNull(caught,
+ String.format("No Exception was thrown, expected an Exception of %s to be thrown",
+ expected.getName()));
+ assertTrue(expected.isInstance(caught),
+ String.format("Exception thrown %s not an instance of %s",
+ caught.getClass().getName(), expected.getName()));
+ }
+
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/StringJoiner/StringJoinerTest.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,336 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/**
+ * @test
+ * @bug 5015163 7172553
+ * @summary tests StringJoinerTest
+ * @run testng StringJoinerTest
+ * @author Jim Gish
+ */
+import java.util.StringJoiner;
+import org.testng.annotations.Test;
+import static org.testng.Assert.assertEquals;
+
+@Test(groups = {"unit","string","util","libs"})
+public class StringJoinerTest {
+
+ private static final String EMPTY = "EMPTY";
+ private static final String ONE = "One";
+ private static final int ONE_LEN = ONE.length();
+ private static final String TWO = "Two";
+ private static final int TWO_LEN = TWO.length();
+ private static final String THREE = "Three";
+ private static final String FOUR = "Four";
+ private static final String FIVE = "Five";
+ private static final String DASH = "-";
+
+ /* Uncomment when we have streams
+ public void addAddAll() {
+ StringJoiner sj = new StringJoiner(DASH, "{", "}");
+ sj.add(ONE);
+
+ ArrayList<String> nextOne = new ArrayList<>();
+ nextOne.add(TWO);
+ nextOne.add(THREE);
+ nextOne.stream().forEach(sj::add);
+
+ String expected = "{"+ONE+DASH+TWO+DASH+THREE+"}";
+ assertEquals(sj.toString(), expected);
+ }
+
+ void addAlladd() {
+ StringJoiner sj = new StringJoiner(DASH, "{", "}");
+
+ ArrayList<String> firstOne = new ArrayList<>();
+ firstOne.add(ONE);
+ firstOne.add(TWO);
+ firstOne.stream().forEach(sj::add);
+
+ sj.add(THREE);
+
+ String expected = "{"+ONE+DASH+TWO+DASH+THREE+"}";
+ assertEquals(sj.toString(), expected);
+ }
+
+ // The following tests do two successive adds of different types
+ public void addAlladdAll() {
+ StringJoiner sj = new StringJoiner(DASH, "{", "}");
+ ArrayList<String> firstOne = new ArrayList<>();
+ firstOne.add(ONE);
+ firstOne.add(TWO);
+ firstOne.add(THREE);
+ firstOne.stream().forEach(sj::add);
+
+ ArrayList<String> nextOne = new ArrayList<>();
+ nextOne.add(FOUR);
+ nextOne.add(FIVE);
+ nextOne.stream().forEach(sj::add);
+
+ String expected = "{"+ONE+DASH+TWO+DASH+THREE+DASH+FOUR+DASH+FIVE+"}";
+ assertEquals(sj.toString(), expected);
+ }
+
+ public void testInto() {
+ ArrayList<String> list = new ArrayList<>();
+ list.add(ONE);
+ list.add(TWO);
+ list.add(THREE);
+
+ StringJoiner target = new StringJoiner(",", "{", "}");
+ assertEquals(target.toString(), "{" + ONE + "," + TWO + "," + THREE +
+ "}");
+ }
+ */
+
+ public void addCharSequence() {
+ StringJoiner sj = new StringJoiner(",");
+ CharSequence cs_one = ONE;
+ CharSequence cs_two = TWO;
+
+ sj.add(cs_one);
+ sj.add(cs_two);
+
+ assertEquals(sj.toString(), ONE + "," + TWO);
+
+ sj = new StringJoiner(DASH, "{", "}");
+ sj.add(cs_one);
+ sj.add(cs_two);
+
+ assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
+
+ StringBuilder builder = new StringBuilder(ONE);
+ StringBuffer buffer = new StringBuffer(THREE);
+ sj = new StringJoiner(", ", "{ ", " }");
+ sj.add(builder).add(buffer);
+ builder.append(TWO);
+ buffer.append(FOUR);
+ assertEquals(sj.toString(), "{ " + ONE + ", " + THREE + " }",
+ "CharSequence is copied when add");
+ sj.add(builder);
+ assertEquals(sj.toString(), "{ " + ONE + ", " + THREE + ", " + ONE +
+ TWO + " }");
+ }
+
+ public void addCharSequenceWithEmptyValue() {
+ StringJoiner sj = new StringJoiner(",").setEmptyValue(EMPTY);
+ CharSequence cs_one = ONE;
+ CharSequence cs_two = TWO;
+
+ sj.add(cs_one);
+ sj.add(cs_two);
+
+ assertEquals(sj.toString(), ONE + "," + TWO);
+
+ sj = new StringJoiner(DASH, "{", "}");
+ sj.add(cs_one);
+ sj.add(cs_two);
+ assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
+
+ sj = new StringJoiner(DASH, "{", "}");
+ assertEquals(sj.toString(), "{}");
+
+ sj = new StringJoiner("=", "{", "}").setEmptyValue("");
+ assertEquals(sj.toString(), "");
+
+ sj = new StringJoiner(DASH, "{", "}").setEmptyValue(EMPTY);
+ assertEquals(sj.toString(), EMPTY);
+
+ sj.add(cs_one);
+ sj.add(cs_two);
+ assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
+ }
+
+ public void addString() {
+ StringJoiner sj = new StringJoiner(DASH);
+ sj.add(ONE);
+ assertEquals(sj.toString(), ONE);
+
+ sj = new StringJoiner(DASH, "{", "}");
+ sj.add(ONE);
+ assertEquals(sj.toString(), "{" + ONE + "}");
+
+ sj.add(TWO);
+ assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
+ }
+
+ public void lengthWithCustomEmptyValue() {
+ StringJoiner sj = new StringJoiner(DASH, "<", ">").setEmptyValue(EMPTY);
+ assertEquals(sj.length(), EMPTY.length());
+ sj.add("");
+ assertEquals(sj.length(), "<>".length());
+ sj.add("");
+ assertEquals(sj.length(), "<->".length());
+ sj.add(ONE);
+ assertEquals(sj.length(), 4 + ONE_LEN);
+ assertEquals(sj.toString().length(), sj.length());
+ sj.add(TWO);
+ assertEquals(sj.length(), 5 + ONE_LEN + TWO_LEN);
+ assertEquals(sj.toString().length(), sj.length());
+ sj = new StringJoiner("||", "<", "-->");
+ assertEquals(sj.length(), 4);
+ assertEquals(sj.toString().length(), sj.length());
+ sj.add("abcdef");
+ assertEquals(sj.length(), 10);
+ assertEquals(sj.toString().length(), sj.length());
+ sj.add("xyz");
+ assertEquals(sj.length(), 15);
+ assertEquals(sj.toString().length(), sj.length());
+ }
+
+ public void noAddAndEmptyValue() {
+ StringJoiner sj = new StringJoiner(DASH, "", "").setEmptyValue(EMPTY);
+ assertEquals(sj.toString(), EMPTY);
+
+ sj = new StringJoiner(DASH, "<..", "");
+ assertEquals(sj.toString(), "<..");
+
+ sj = new StringJoiner(DASH, "<..", "");
+ assertEquals(sj.toString(), "<..");
+
+ sj = new StringJoiner(DASH, "", "==>");
+ assertEquals(sj.toString(), "==>");
+
+ sj = new StringJoiner(DASH, "{", "}");
+ assertEquals(sj.toString(), "{}");
+ }
+
+ @Test(expectedExceptions = {NullPointerException.class})
+ public void setEmptyValueNull() {
+ new StringJoiner(DASH, "{", "}").setEmptyValue(null);
+ }
+
+ @Test(expectedExceptions = {NullPointerException.class})
+ public void setDelimiterNull() {
+ new StringJoiner(null);
+ }
+
+ @Test(expectedExceptions = {NullPointerException.class})
+ public void setPrefixNull() {
+ new StringJoiner(DASH, null, "}");
+ }
+
+ @Test(expectedExceptions = {NullPointerException.class})
+ public void setSuffixNull() {
+ new StringJoiner(DASH, "{", null);
+ }
+
+ public void stringFromtoString() {
+ StringJoiner sj = new StringJoiner(", ");
+ assertEquals(sj.toString(), "");
+ sj = new StringJoiner(",", "{", "}");
+ assertEquals(sj.toString(), "{}");
+
+ sj = new StringJoiner(",");
+ sj.add(ONE);
+ assertEquals(sj.toString(), ONE);
+
+ sj.add(TWO);
+ assertEquals(sj.toString(), ONE + "," + TWO);
+
+ sj = new StringJoiner(",", "{--", "--}");
+ sj.add(ONE);
+ sj.add(TWO);
+ assertEquals(sj.toString(), "{--" + ONE + "," + TWO + "--}");
+
+ }
+
+ public void stringFromtoStringWithEmptyValue() {
+ StringJoiner sj = new StringJoiner(" ", "", "");
+ assertEquals(sj.toString(), "");
+ sj = new StringJoiner(", ");
+ assertEquals(sj.toString(), "");
+ sj = new StringJoiner(",", "{", "}");
+ assertEquals(sj.toString(), "{}");
+
+ sj = new StringJoiner(",", "{", "}").setEmptyValue("");
+ assertEquals(sj.toString(), "");
+
+ sj = new StringJoiner(",");
+ sj.add(ONE);
+ assertEquals(sj.toString(), ONE);
+
+ sj.add(TWO);
+ assertEquals(sj.toString(), ONE + "," + TWO);
+
+ sj = new StringJoiner(",", "{--", "--}");
+ sj.add(ONE);
+ assertEquals(sj.toString(), "{--" + ONE + "--}" );
+
+ sj.add(TWO);
+ assertEquals(sj.toString(), "{--" + ONE + "," + TWO + "--}");
+
+ }
+
+ public void toStringWithCustomEmptyValue() {
+ StringJoiner sj = new StringJoiner(DASH, "<", ">").setEmptyValue(EMPTY);
+ assertEquals(sj.toString(), EMPTY);
+ sj.add("");
+ assertEquals(sj.toString(), "<>");
+ sj.add("");
+ assertEquals(sj.toString(), "<->");
+ }
+
+ private void testCombos(String infix, String prefix, String suffix) {
+ StringJoiner sj = new StringJoiner(infix, prefix, suffix);
+ assertEquals(sj.toString(), prefix + suffix);
+ assertEquals(sj.toString().length(), sj.length());
+ // EmptyValue
+ sj = new StringJoiner(infix, prefix, suffix).setEmptyValue("<NONE>");
+ assertEquals(sj.toString(), "<NONE>");
+ assertEquals(sj.toString().length(), sj.length());
+
+ // empty in front
+ sj.add("");
+ assertEquals(sj.toString(), prefix + suffix);
+ // empty in middle
+ sj.add("");
+ assertEquals(sj.toString(), prefix + infix + suffix);
+ sj.add("1");
+ assertEquals(sj.toString(), prefix + infix + infix + "1" + suffix);
+ // empty at end
+ sj.add("");
+ assertEquals(sj.toString(), prefix + infix + infix + "1" + infix + suffix);
+
+ sj = new StringJoiner(infix, prefix, suffix).setEmptyValue("<NONE>");
+ sj.add("1");
+ assertEquals(sj.toString(), prefix + "1" + suffix);
+ sj.add("2");
+ assertEquals(sj.toString(), prefix + "1" + infix + "2" + suffix);
+ sj.add("");
+ assertEquals(sj.toString(), prefix + "1" + infix + "2" +infix + suffix);
+ sj.add("3");
+ assertEquals(sj.toString(), prefix + "1" + infix + "2" +infix + infix + "3" + suffix);
+ }
+
+ public void testDelimiterCombinations() {
+ testCombos("", "", "");
+ testCombos("", "<", "");
+ testCombos("", "", ">");
+ testCombos("", "<", ">");
+ testCombos(",", "", "");
+ testCombos(",", "<", "");
+ testCombos(",", "", ">");
+ testCombos(",", "<", ">");
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/DrainFindDeadlockTest.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+import java.lang.Thread.State;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+import java.util.Map;
+
+/**
+ * @test
+ * @bug 8010939
+ * @summary check for deadlock between findLogger() and drainLoggerRefQueueBounded()
+ * @author jim.gish@oracle.com
+ * @build DrainFindDeadlockTest
+ * @run main/othervm/timeout=10 DrainFindDeadlockTest
+ */
+
+/**
+ * This test is checking for a deadlock between
+ * LogManager$LoggerContext.findLogger() and
+ * LogManager.drainLoggerRefQueueBounded() (which could happen by calling
+ * Logger.getLogger() and LogManager.readConfiguration() in different threads)
+ */
+public class DrainFindDeadlockTest {
+ private LogManager mgr = LogManager.getLogManager();
+ private final static int MAX_ITERATIONS = 100;
+
+ // Get a ThreadMXBean so we can check for deadlock. N.B. this may
+ // not be supported on all platforms, which means we will have to
+ // resort to the traditional test timeout method. However, if
+ // we have the support we'll get the deadlock details if one
+ // is detected.
+ private final static ThreadMXBean threadMXBean =
+ ManagementFactory.getThreadMXBean();
+ private final boolean threadMXBeanDeadlockSupported =
+ threadMXBean.isSynchronizerUsageSupported();
+
+ public static void main(String... args) throws IOException, Exception {
+ new DrainFindDeadlockTest().testForDeadlock();
+ }
+
+ public static void randomDelay() {
+ int runs = (int) Math.random() * 1000000;
+ int c = 0;
+
+ for (int i=0; i<runs; ++i) {
+ c=c+i;
+ }
+ }
+
+ public void testForDeadlock() throws IOException, Exception {
+ System.out.println("Deadlock detection "
+ + (threadMXBeanDeadlockSupported ? "is" : "is not") +
+ " available.");
+ Thread setup = new Thread(new SetupLogger(), "SetupLogger");
+ Thread readConfig = new Thread(new ReadConfig(), "ReadConfig");
+ Thread check = new Thread(new DeadlockChecker(setup, readConfig),
+ "DeadlockChecker");
+
+ // make the threads daemon threads so they will go away when the
+ // test exits
+ setup.setDaemon(true);
+ readConfig.setDaemon(true);
+ check.setDaemon(true);
+
+ check.start(); setup.start(); readConfig.start();
+ try {
+ check.join();
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+ try {
+ readConfig.join();
+ setup.join();
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+ System.out.println("Test passed");
+ }
+
+ class SetupLogger implements Runnable {
+ Logger logger = null;
+
+ @Override
+ public void run() {
+ System.out.println("Running " + Thread.currentThread().getName());
+
+ for (int i=0; i < MAX_ITERATIONS; i++) {
+ logger = Logger.getLogger("DrainFindDeadlockTest"+i);
+ DrainFindDeadlockTest.randomDelay();
+ }
+ }
+ }
+
+ class ReadConfig implements Runnable {
+ @Override
+ public void run() {
+ System.out.println("Running " + Thread.currentThread().getName());
+ for (int i=0; i < MAX_ITERATIONS; i++) {
+ try {
+ mgr.readConfiguration();
+ } catch (IOException | SecurityException ex) {
+ throw new RuntimeException("FAILED: test setup problem", ex);
+ }
+ DrainFindDeadlockTest.randomDelay();
+ }
+ }
+ }
+
+ class DeadlockChecker implements Runnable {
+ Thread t1, t2;
+
+ DeadlockChecker(Thread t1, Thread t2) {
+ this.t1 = t1;
+ this.t2 = t2;
+ }
+
+ void checkState(Thread x, Thread y) {
+ // System.out.println("checkstate");
+ boolean isXblocked = x.getState().equals(State.BLOCKED);
+ boolean isYblocked = y.getState().equals(State.BLOCKED);
+ long[] deadlockedThreads = null;
+
+ if (isXblocked && isYblocked) {
+ System.out.println("threads blocked");
+ // they are both blocked, but this doesn't necessarily mean
+ // they are deadlocked
+ if (threadMXBeanDeadlockSupported) {
+ System.out.println("checking for deadlock");
+ deadlockedThreads = threadMXBean.findDeadlockedThreads();
+ } else {
+ System.out.println("Can't check for deadlock");
+ }
+ if (deadlockedThreads != null) {
+ System.out.println("We detected a deadlock! ");
+ ThreadInfo[] threadInfos = threadMXBean.getThreadInfo(
+ deadlockedThreads, true, true);
+ for (ThreadInfo threadInfo: threadInfos) {
+ System.out.println(threadInfo);
+ }
+ throw new RuntimeException("TEST FAILED: Deadlock detected");
+ }
+ System.out.println("We may have a deadlock");
+ Map<Thread, StackTraceElement[]> threadMap =
+ Thread.getAllStackTraces();
+ dumpStack(threadMap.get(x), x);
+ dumpStack(threadMap.get(y), y);
+ }
+ }
+
+ private void dumpStack(StackTraceElement[] aStackElt, Thread aThread) {
+ if (aStackElt != null) {
+ System.out.println("Thread:" + aThread.getName() + ": " +
+ aThread.getState());
+ for (StackTraceElement element: aStackElt) {
+ System.out.println(" " + element);
+ }
+ }
+ }
+
+ @Override
+ public void run() {
+ System.out.println("Running " + Thread.currentThread().getName());
+ for (int i=0; i < MAX_ITERATIONS*2; i++) {
+ checkState(t1, t2);
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException ex) {
+ };
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/bundlesearch/ClassPathTestBundle_en.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+sample1=translation #2 for sample1
+sample2=translation #2 for sample2
+supports-test=ResourceBundleSearchTest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/bundlesearch/IndirectlyLoadABundle.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Paths;
+
+/**
+ * This class is used to ensure that a resource bundle loadable by a classloader
+ * is on the caller's stack, but not on the classpath or TCCL to ensure that
+ * Logger.getLogger() can't load the bundle via a stack search
+ *
+ * @author Jim Gish
+ */
+public class IndirectlyLoadABundle {
+
+ private final static String rbName = "StackSearchableResource";
+
+ public boolean loadAndTest() throws Throwable {
+ // Find out where we are running from so we can setup the URLClassLoader URLs
+ // test.src and test.classes will be set if running in jtreg, but probably
+ // not otherwise
+ String testDir = System.getProperty("test.src", System.getProperty("user.dir"));
+ String testClassesDir = System.getProperty("test.classes",
+ System.getProperty("user.dir"));
+ String sep = System.getProperty("file.separator");
+
+ URL[] urls = new URL[2];
+
+ // Allow for both jtreg and standalone cases here
+ urls[0] = Paths.get(testDir, "resources").toUri().toURL();
+ urls[1] = Paths.get(testClassesDir).toUri().toURL();
+
+ System.out.println("INFO: urls[0] = " + urls[0]);
+ System.out.println("INFO: urls[1] = " + urls[1]);
+
+ // Make sure we can find it via the URLClassLoader
+ URLClassLoader yetAnotherResourceCL = new URLClassLoader(urls, null);
+ if (!testForValidResourceSetup(yetAnotherResourceCL)) {
+ throw new Exception("Couldn't directly load bundle " + rbName
+ + " as expected. Test config problem");
+ }
+ // But it shouldn't be available via the system classloader
+ ClassLoader myCL = this.getClass().getClassLoader();
+ if (testForValidResourceSetup(myCL)) {
+ throw new Exception("Was able to directly load bundle " + rbName
+ + " from " + myCL + " but shouldn't have been"
+ + " able to. Test config problem");
+ }
+
+ Class<?> loadItUpClazz = Class.forName("LoadItUp", true, yetAnotherResourceCL);
+ ClassLoader actual = loadItUpClazz.getClassLoader();
+ if (actual != yetAnotherResourceCL) {
+ throw new Exception("LoadItUp was loaded by an unexpected CL: " + actual);
+ }
+ Object loadItUp = loadItUpClazz.newInstance();
+ Method testMethod = loadItUpClazz.getMethod("test", String.class);
+ try {
+ return (Boolean) testMethod.invoke(loadItUp, rbName);
+ } catch (InvocationTargetException ex) {
+ throw ex.getTargetException();
+ }
+ }
+
+ private boolean testForValidResourceSetup(ClassLoader cl) {
+ // First make sure the test environment is setup properly and the bundle actually
+ // exists
+ return ResourceBundleSearchTest.isOnClassPath(rbName, cl);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/bundlesearch/LoadItUp.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.util.MissingResourceException;
+import java.util.logging.Logger;
+
+/*
+ * This class is loaded onto the call stack when the test method is called
+ * and then its classloader can be used to find a property bundle in the same
+ * directory as the class. However, Logger is not allowed
+ * to find the bundle by looking up the stack for this classloader.
+ * We verify that this cannot happen.
+ *
+ * @author Jim Gish
+ */
+public class LoadItUp {
+
+ private final static boolean DEBUG = false;
+
+ public Boolean test(String rbName) throws Exception {
+ // we should not be able to find the resource in this directory via
+ // getLogger calls. The only way that would be possible given this setup
+ // is that if Logger.getLogger searched up the call stack
+ return lookupBundle(rbName);
+ }
+
+ private boolean lookupBundle(String rbName) {
+ // See if Logger.getLogger can find the resource in this directory
+ try {
+ Logger aLogger = Logger.getLogger("NestedLogger", rbName);
+ } catch (MissingResourceException re) {
+ if (DEBUG) {
+ System.out.println(
+ "As expected, LoadItUp.lookupBundle() did not find the bundle "
+ + rbName);
+ }
+ return false;
+ }
+ System.out.println("FAILED: LoadItUp.lookupBundle() found the bundle "
+ + rbName + " using a stack search.");
+ return true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/bundlesearch/ResourceBundleSearchTest.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8002070
+ * @summary Remove the stack search for a resource bundle Logger to use
+ * @author Jim Gish
+ * @build ResourceBundleSearchTest IndirectlyLoadABundle LoadItUp
+ * @run main ResourceBundleSearchTest
+ */
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+
+public class ResourceBundleSearchTest {
+
+ private final static boolean DEBUG = false;
+ private final static String LOGGER_PREFIX = "myLogger.";
+ private static int loggerNum = 0;
+ private final static String PROP_RB_NAME = "ClassPathTestBundle";
+ private final static String TCCL_TEST_BUNDLE = "ContextClassLoaderTestBundle";
+
+ private static int numPass = 0;
+ private static int numFail = 0;
+ private static List<String> msgs = new ArrayList<>();
+
+ public static void main(String[] args) throws Throwable {
+ ResourceBundleSearchTest test = new ResourceBundleSearchTest();
+ test.runTests();
+ }
+
+ private void runTests() throws Throwable {
+ // ensure we are using en as the default Locale so we can find the resource
+ Locale.setDefault(Locale.ENGLISH);
+
+ String testClasses = System.getProperty("test.classes");
+ System.out.println( "test.classes = " + testClasses );
+
+ ClassLoader myClassLoader = ClassLoader.getSystemClassLoader();
+
+ // Find out where we are running from so we can setup the URLClassLoader URL
+ String userDir = System.getProperty("user.dir");
+ String testDir = System.getProperty("test.src", userDir);
+ String sep = System.getProperty("file.separator");
+
+ URL[] urls = new URL[1];
+
+ urls[0] = Paths.get(testDir, "resources").toUri().toURL();
+ URLClassLoader rbClassLoader = new URLClassLoader(urls);
+
+ // Test 1 - can we find a Logger bundle from doing a stack search?
+ // We shouldn't be able to
+ assertFalse(testGetBundleFromStackSearch(), "testGetBundleFromStackSearch");
+
+ // Test 2 - can we find a Logger bundle off of the Thread context class
+ // loader? We should be able to.
+ assertTrue(
+ testGetBundleFromTCCL(TCCL_TEST_BUNDLE, rbClassLoader),
+ "testGetBundleFromTCCL");
+
+ // Test 3 - Can we find a Logger bundle from the classpath? We should be
+ // able to, but ....
+ // We check to see if the bundle is on the classpath or not so that this
+ // will work standalone. In the case of jtreg/samevm,
+ // the resource bundles are not on the classpath. Running standalone
+ // (or othervm), they are
+ if (isOnClassPath(PROP_RB_NAME, myClassLoader)) {
+ debug("We should be able to see " + PROP_RB_NAME + " on the classpath");
+ assertTrue(testGetBundleFromSystemClassLoader(PROP_RB_NAME),
+ "testGetBundleFromSystemClassLoader");
+ } else {
+ debug("We should not be able to see " + PROP_RB_NAME + " on the classpath");
+ assertFalse(testGetBundleFromSystemClassLoader(PROP_RB_NAME),
+ "testGetBundleFromSystemClassLoader");
+ }
+
+ report();
+ }
+
+ private void report() throws Exception {
+ System.out.println("Num passed = " + numPass + " Num failed = " + numFail);
+ if (numFail > 0) {
+ // We only care about the messages if they were errors
+ for (String msg : msgs) {
+ System.out.println(msg);
+ }
+ throw new Exception(numFail + " out of " + (numPass + numFail)
+ + " tests failed.");
+ }
+ }
+
+ public void assertTrue(boolean testResult, String testName) {
+ if (testResult) {
+ numPass++;
+ } else {
+ numFail++;
+ System.out.println("FAILED: " + testName
+ + " was supposed to return true but did NOT!");
+ }
+ }
+
+ public void assertFalse(boolean testResult, String testName) {
+ if (!testResult) {
+ numPass++;
+ } else {
+ numFail++;
+ System.out.println("FAILED: " + testName
+ + " was supposed to return false but did NOT!");
+ }
+ }
+
+ public boolean testGetBundleFromStackSearch() throws Throwable {
+ // This should fail. This was the old functionality to search up the
+ // caller's call stack
+ IndirectlyLoadABundle indirectLoader = new IndirectlyLoadABundle();
+ return indirectLoader.loadAndTest();
+ }
+
+ public boolean testGetBundleFromTCCL(String bundleName,
+ ClassLoader setOnTCCL) throws InterruptedException {
+ // This should succeed. We should be able to get the bundle from the
+ // thread context class loader
+ debug("Looking for " + bundleName + " using TCCL");
+ LoggingThread lr = new LoggingThread(bundleName, setOnTCCL);
+ lr.start();
+ synchronized (lr) {
+ try {
+ lr.wait();
+ } catch (InterruptedException ex) {
+ throw ex;
+ }
+ }
+ msgs.add(lr.msg);
+ return lr.foundBundle;
+ }
+
+ /*
+ * @param String bundleClass
+ * @param ClassLoader to use for search
+ * @return true iff bundleClass is on system classpath
+ */
+ public static boolean isOnClassPath(String baseName, ClassLoader cl) {
+ ResourceBundle rb = null;
+ try {
+ rb = ResourceBundle.getBundle(baseName, Locale.getDefault(), cl);
+ System.out.println("INFO: Found bundle " + baseName + " on " + cl);
+ } catch (MissingResourceException e) {
+ System.out.println("INFO: Could not find bundle " + baseName + " on " + cl);
+ return false;
+ }
+ return (rb != null);
+ }
+
+ private static String newLoggerName() {
+ // we need a new logger name every time we attempt to find a bundle via
+ // the Logger.getLogger call, so we'll simply tack on an integer which
+ // we increment each time this is called
+ loggerNum++;
+ return LOGGER_PREFIX + loggerNum;
+ }
+
+ public boolean testGetBundleFromSystemClassLoader(String bundleName) {
+ // this should succeed if the bundle is on the system classpath.
+ try {
+ Logger aLogger = Logger.getLogger(ResourceBundleSearchTest.newLoggerName(),
+ bundleName);
+ } catch (MissingResourceException re) {
+ msgs.add("INFO: testGetBundleFromSystemClassLoader() did not find bundle "
+ + bundleName);
+ return false;
+ }
+ msgs.add("INFO: testGetBundleFromSystemClassLoader() found the bundle "
+ + bundleName);
+ return true;
+ }
+
+ public static class LoggingThread extends Thread {
+
+ boolean foundBundle = false;
+ String msg = null;
+ ClassLoader clToSetOnTCCL = null;
+ String bundleName = null;
+
+ public LoggingThread(String bundleName) {
+ this.bundleName = bundleName;
+ }
+
+ public LoggingThread(String bundleName, ClassLoader setOnTCCL) {
+ this.clToSetOnTCCL = setOnTCCL;
+ this.bundleName = bundleName;
+ }
+
+ public void run() {
+ boolean setTCCL = false;
+ try {
+ if (clToSetOnTCCL != null) {
+ Thread.currentThread().setContextClassLoader(clToSetOnTCCL);
+ setTCCL = true;
+ }
+ // this should succeed if the bundle is on the system classpath.
+ try {
+ Logger aLogger = Logger.getLogger(ResourceBundleSearchTest.newLoggerName(),
+ bundleName);
+ msg = "INFO: LoggingRunnable() found the bundle " + bundleName
+ + (setTCCL ? " with " : " without ") + "setting the TCCL";
+ foundBundle = true;
+ } catch (MissingResourceException re) {
+ msg = "INFO: LoggingRunnable() did not find the bundle " + bundleName
+ + (setTCCL ? " with " : " without ") + "setting the TCCL";
+ foundBundle = false;
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+ }
+
+ private void debug(String msg) {
+ if (DEBUG) {
+ System.out.println(msg);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/bundlesearch/resources/ContextClassLoaderTestBundle_en.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+sample1=translation #3 for sample1
+sample2=translation #3 for sample2
+supports-test=ResourceBundleSearchTest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/bundlesearch/resources/StackSearchableResource_en.properties Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+sample1=translation #4 for sample1
+sample2=translation #4 for sample2
+supports-test=ResourceBundleSearchTest
--- a/jdk/test/java/util/regex/RegExTest.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/java/util/regex/RegExTest.java Wed May 01 11:34:06 2013 -0700
@@ -33,7 +33,7 @@
* 5013885 5003322 4988891 5098443 5110268 6173522 4829857 5027748 6376940
* 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133
* 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
- * 7067045 7014640 7189363
+ * 7067045 7014640 7189363 8007395
*/
import java.util.regex.*;
@@ -144,6 +144,7 @@
horizontalAndVerticalWSTest();
linebreakTest();
branchTest();
+ groupCurlyNotFoundSuppTest();
if (failure) {
throw new
RuntimeException("RegExTest failed, 1st failure: " +
@@ -3947,4 +3948,27 @@
report("branchTest");
}
+ // This test is for 8007395
+ private static void groupCurlyNotFoundSuppTest() throws Exception {
+ String input = "test this as \ud83d\ude0d";
+ for (String pStr : new String[] { "test(.)+(@[a-zA-Z.]+)",
+ "test(.)*(@[a-zA-Z.]+)",
+ "test([^B])+(@[a-zA-Z.]+)",
+ "test([^B])*(@[a-zA-Z.]+)",
+ "test(\\P{IsControl})+(@[a-zA-Z.]+)",
+ "test(\\P{IsControl})*(@[a-zA-Z.]+)",
+ }) {
+ Matcher m = Pattern.compile(pStr, Pattern.CASE_INSENSITIVE)
+ .matcher(input);
+ try {
+ if (m.find()) {
+ failCount++;
+ }
+ } catch (Exception x) {
+ failCount++;
+ }
+ }
+ report("GroupCurly NotFoundSupp");
+ }
+
}
--- a/jdk/test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java Wed May 01 11:34:06 2013 -0700
@@ -46,10 +46,10 @@
* @bug 8010117
* @summary Verify if CallerSensitive methods are annotated with
* sun.reflect.CallerSensitive annotation
- * @build CallerSensitiveFinder MethodFinder
+ * @build CallerSensitiveFinder
* @run main/othervm/timeout=900 -mx600m CallerSensitiveFinder
*/
-public class CallerSensitiveFinder extends MethodFinder {
+public class CallerSensitiveFinder {
private static int numThreads = 3;
private static boolean verbose = false;
public static void main(String[] args) throws Exception {
@@ -71,8 +71,7 @@
if (classes.isEmpty()) {
classes.addAll(PlatformClassPath.getJREClasses());
}
- final String method = "sun/reflect/Reflection.getCallerClass";
- CallerSensitiveFinder csfinder = new CallerSensitiveFinder(method);
+ CallerSensitiveFinder csfinder = new CallerSensitiveFinder();
List<String> errors = csfinder.run(classes);
if (!errors.isEmpty()) {
@@ -82,8 +81,46 @@
}
private final List<String> csMethodsMissingAnnotation = new ArrayList<>();
- public CallerSensitiveFinder(String... methods) {
- super(methods);
+ private final ReferenceFinder finder;
+ public CallerSensitiveFinder() {
+ this.finder = new ReferenceFinder(getFilter(), getVisitor());
+ }
+
+ private ReferenceFinder.Filter getFilter() {
+ final String classname = "sun/reflect/Reflection";
+ final String method = "getCallerClass";
+ return new ReferenceFinder.Filter() {
+ public boolean accept(ConstantPool cpool, CPRefInfo cpref) {
+ try {
+ CONSTANT_NameAndType_info nat = cpref.getNameAndTypeInfo();
+ return cpref.getClassName().equals(classname) && nat.getName().equals(method);
+ } catch (ConstantPoolException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ };
+ }
+
+ private ReferenceFinder.Visitor getVisitor() {
+ return new ReferenceFinder.Visitor() {
+ public void visit(ClassFile cf, Method m, List<CPRefInfo> refs) {
+ try {
+ String name = String.format("%s#%s %s", cf.getName(),
+ m.getName(cf.constant_pool),
+ m.descriptor.getValue(cf.constant_pool));
+ if (!CallerSensitiveFinder.isCallerSensitive(m, cf.constant_pool)) {
+ csMethodsMissingAnnotation.add(name);
+ System.err.println("Missing @CallerSensitive: " + name);
+ } else {
+ if (verbose) {
+ System.out.format("@CS %s%n", name);
+ }
+ }
+ } catch (ConstantPoolException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ };
}
public List<String> run(List<Path> classes) throws IOException, InterruptedException,
@@ -125,27 +162,12 @@
return false;
}
- public void referenceFound(ClassFile cf, Method m, Set<Integer> refs)
- throws ConstantPoolException
- {
- String name = String.format("%s#%s %s", cf.getName(),
- m.getName(cf.constant_pool),
- m.descriptor.getValue(cf.constant_pool));
- if (!CallerSensitiveFinder.isCallerSensitive(m, cf.constant_pool)) {
- csMethodsMissingAnnotation.add(name);
- System.err.println("Missing @CallerSensitive: " + name);
- } else {
- if (verbose) {
- System.out.format("@CS %s%n", name);
- }
- }
- }
-
- private final List<FutureTask<String>> tasks = new ArrayList<FutureTask<String>>();
- private FutureTask<String> getTask(final ClassFile cf) {
- FutureTask<String> task = new FutureTask<String>(new Callable<String>() {
- public String call() throws Exception {
- return parse(cf);
+ private final List<FutureTask<Void>> tasks = new ArrayList<FutureTask<Void>>();
+ private FutureTask<Void> getTask(final ClassFile cf) {
+ FutureTask<Void> task = new FutureTask<Void>(new Callable<Void>() {
+ public Void call() throws Exception {
+ finder.parse(cf);
+ return null;
}
});
tasks.add(task);
@@ -153,8 +175,8 @@
}
private void waitForCompletion() throws InterruptedException, ExecutionException {
- for (FutureTask<String> t : tasks) {
- String s = t.get();
+ for (FutureTask<Void> t : tasks) {
+ t.get();
}
System.out.println("Parsed " + tasks.size() + " classfiles");
}
--- a/jdk/test/sun/reflect/CallerSensitive/MethodFinder.java Wed May 01 11:27:12 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.util.*;
-import com.sun.tools.classfile.*;
-import static com.sun.tools.classfile.ConstantPool.*;
-import com.sun.tools.classfile.Instruction.TypeKind;
-
-/**
- * MethodFinder utility class to find references to the given methods.
- */
-public abstract class MethodFinder {
- final List<String> methods;
- public MethodFinder(String... methods) {
- this.methods = Arrays.asList(methods);
- }
-
- /**
- * A callback method will be invoked when a method referencing
- * any of the lookup methods.
- *
- * @param cf ClassFile
- * @param m Method
- * @param refs Set of constant pool indices that reference the methods
- * matching the given lookup method names
- */
- public abstract void referenceFound(ClassFile cf, Method m, Set<Integer> refs)
- throws ConstantPoolException;
-
- public String parse(ClassFile cf) throws ConstantPoolException {
- List<Integer> cprefs = new ArrayList<Integer>();
- int index = 1;
- for (ConstantPool.CPInfo cpInfo : cf.constant_pool.entries()) {
- if (cpInfo.accept(cpVisitor, null)) {
- cprefs.add(index);
- }
- index += cpInfo.size();
- }
-
- if (!cprefs.isEmpty()) {
- for (Method m : cf.methods) {
- Set<Integer> refs = new HashSet<Integer>();
- Code_attribute c_attr = (Code_attribute) m.attributes.get(Attribute.Code);
- if (c_attr != null) {
- for (Instruction instr : c_attr.getInstructions()) {
- int idx = instr.accept(codeVisitor, cprefs);
- if (idx > 0) {
- refs.add(idx);
- }
- }
- }
- if (refs.size() > 0) {
- referenceFound(cf, m, refs);
- }
- }
- }
- return cprefs.isEmpty() ? "" : cf.getName();
- }
-
- private ConstantPool.Visitor<Boolean,Void> cpVisitor =
- new ConstantPool.Visitor<Boolean,Void>()
- {
- private boolean matches(CPRefInfo info) {
- try {
- CONSTANT_NameAndType_info nat = info.getNameAndTypeInfo();
- return matches(info.getClassName(), nat.getName(), nat.getType());
- } catch (ConstantPoolException ex) {
- return false;
- }
- }
-
- private boolean matches(String cn, String name, String type) {
- return methods.contains(cn + "." + name);
- }
-
- public Boolean visitClass(CONSTANT_Class_info info, Void p) {
- return false;
- }
-
- public Boolean visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) {
- return matches(info);
- }
-
- public Boolean visitMethodref(CONSTANT_Methodref_info info, Void p) {
- return matches(info);
- }
-
- public Boolean visitDouble(CONSTANT_Double_info info, Void p) {
- return false;
- }
-
- public Boolean visitFieldref(CONSTANT_Fieldref_info info, Void p) {
- return false;
- }
-
- public Boolean visitFloat(CONSTANT_Float_info info, Void p) {
- return false;
- }
-
- public Boolean visitInteger(CONSTANT_Integer_info info, Void p) {
- return false;
- }
-
- public Boolean visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
- return false;
- }
-
- public Boolean visitLong(CONSTANT_Long_info info, Void p) {
- return false;
- }
-
- public Boolean visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
- return false;
- }
-
- public Boolean visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
- return false;
- }
-
- public Boolean visitMethodType(CONSTANT_MethodType_info info, Void p) {
- return false;
- }
-
- public Boolean visitString(CONSTANT_String_info info, Void p) {
- return false;
- }
-
- public Boolean visitUtf8(CONSTANT_Utf8_info info, Void p) {
- return false;
- }
- };
-
- private Instruction.KindVisitor<Integer, List<Integer>> codeVisitor =
- new Instruction.KindVisitor<Integer, List<Integer>>()
- {
- public Integer visitNoOperands(Instruction instr, List<Integer> p) {
- return 0;
- }
-
- public Integer visitArrayType(Instruction instr, TypeKind kind, List<Integer> p) {
- return 0;
- }
-
- public Integer visitBranch(Instruction instr, int offset, List<Integer> p) {
- return 0;
- }
-
- public Integer visitConstantPoolRef(Instruction instr, int index, List<Integer> p) {
- return p.contains(index) ? index : 0;
- }
-
- public Integer visitConstantPoolRefAndValue(Instruction instr, int index, int value, List<Integer> p) {
- return p.contains(index) ? index : 0;
- }
-
- public Integer visitLocal(Instruction instr, int index, List<Integer> p) {
- return 0;
- }
-
- public Integer visitLocalAndValue(Instruction instr, int index, int value, List<Integer> p) {
- return 0;
- }
-
- public Integer visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, List<Integer> p) {
- return 0;
- }
-
- public Integer visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, List<Integer> p) {
- return 0;
- }
-
- public Integer visitValue(Instruction instr, int value, List<Integer> p) {
- return 0;
- }
-
- public Integer visitUnknown(Instruction instr, List<Integer> p) {
- return 0;
- }
- };
-}
-
--- a/jdk/test/sun/reflect/CallerSensitive/MissingCallerSensitive.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/sun/reflect/CallerSensitive/MissingCallerSensitive.java Wed May 01 11:34:06 2013 -0700
@@ -27,7 +27,7 @@
* @bug 8010117
* @summary Test CallerSensitiveFinder to find missing annotation
* @compile -XDignore.symbol.file MissingCallerSensitive.java
- * @build CallerSensitiveFinder MethodFinder
+ * @build CallerSensitiveFinder
* @run main MissingCallerSensitive
*/
@@ -40,8 +40,7 @@
List<Path> classes = new ArrayList<>();
classes.add(Paths.get(testclasses, "MissingCallerSensitive.class"));
- final String method = "sun/reflect/Reflection.getCallerClass";
- CallerSensitiveFinder csfinder = new CallerSensitiveFinder(method);
+ CallerSensitiveFinder csfinder = new CallerSensitiveFinder();
List<String> errors = csfinder.run(classes);
if (errors.size() != 1) {
throw new RuntimeException("Unexpected number of methods found: " + errors.size());
--- a/jdk/test/sun/security/krb5/auto/SSL.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/sun/security/krb5/auto/SSL.java Wed May 01 11:34:06 2013 -0700
@@ -23,10 +23,11 @@
/*
* @test
- * @bug 6894643 6913636
+ * @bug 6894643 6913636 8005523
* @summary Test JSSE Kerberos ciphersuite
+
* @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA
- * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_MD5
+ * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA unbound
* @run main/othervm SSL TLS_KRB5_WITH_3DES_EDE_CBC_SHA
* @run main/othervm SSL TLS_KRB5_WITH_3DES_EDE_CBC_MD5
* @run main/othervm SSL TLS_KRB5_WITH_DES_CBC_SHA
@@ -38,14 +39,17 @@
*/
import java.io.*;
import java.net.InetAddress;
+import java.security.AccessControlException;
+import java.security.Permission;
import javax.net.ssl.*;
import java.security.Principal;
import java.util.Date;
+import javax.security.auth.kerberos.ServicePermission;
import sun.security.jgss.GSSUtil;
import sun.security.krb5.PrincipalName;
import sun.security.krb5.internal.ktab.KeyTab;
-public class SSL {
+public class SSL extends SecurityManager {
private static String krb5Cipher;
private static final int LOOP_LIMIT = 3;
@@ -53,13 +57,32 @@
private static volatile String server;
private static volatile int port;
+ private static String permChecks = "";
+
// 0-Not started, 1-Start OK, 2-Failure
private static volatile int serverState = 0;
+ @Override
+ public void checkPermission(Permission perm, Object context) {
+ checkPermission(perm);
+ }
+
+ public void checkPermission(Permission perm) {
+ if (!(perm instanceof ServicePermission)) {
+ return;
+ }
+ ServicePermission p = (ServicePermission)perm;
+ permChecks = permChecks + p.getActions().toUpperCase().charAt(0);
+ }
+
public static void main(String[] args) throws Exception {
krb5Cipher = args[0];
+ boolean unbound = args.length > 1;
+
+ System.setSecurityManager(new SSL());
+
KDC kdc = KDC.create(OneKDC.REALM);
// Run this after KDC, so our own DNS service can be started
try {
@@ -85,6 +108,7 @@
// and use the middle one as the real key
kdc.addPrincipal("host/" + server, "pass2".toCharArray());
+
// JAAS config entry name ssl
System.setProperty("java.security.auth.login.config", OneKDC.JAAS_CONF);
File f = new File(OneKDC.JAAS_CONF);
@@ -92,7 +116,9 @@
fos.write((
"ssl {\n" +
" com.sun.security.auth.module.Krb5LoginModule required\n" +
- " principal=\"host/" + server + "\"\n" +
+ (unbound ?
+ " principal=*\n" :
+ " principal=\"host/" + server + "\"\n") +
" useKeyTab=true\n" +
" keyTab=" + OneKDC.KTAB + "\n" +
" isInitiator=false\n" +
@@ -103,7 +129,6 @@
Context c;
final Context s = Context.fromJAAS("ssl");
- // There's no keytab file when server starts.
s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
Thread server = new Thread(new Runnable() {
@@ -127,21 +152,6 @@
throw new Exception("Server already failed");
}
- // Now create the keytab
-
- /*
- // Add 3 versions of keys into keytab
- KeyTab ktab = KeyTab.create(OneKDC.KTAB);
- PrincipalName service = new PrincipalName(
- "host/" + server, PrincipalName.KRB_NT_SRV_HST);
- ktab.addEntry(service, "pass1".toCharArray(), 1);
- ktab.addEntry(service, "pass2".toCharArray(), 2);
- ktab.addEntry(service, "pass3".toCharArray(), 3);
- ktab.save();
-
- // and use the middle one as the real key
- kdc.addPrincipal("host/" + server, "pass2".toCharArray());
- */
c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID);
c.doAs(new JsseClientAction(), null);
@@ -157,20 +167,22 @@
c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID);
c.doAs(new JsseClientAction(), null);
- // Revoke the old key
- /*Thread.sleep(2000);
- ktab = KeyTab.create(OneKDC.KTAB);
- ktab.addEntry(service, "pass5".toCharArray(), 5, false);
- ktab.save();
-
- c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
- c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID);
- try {
- c.doAs(new JsseClientAction(), null);
- throw new Exception("Should fail this time.");
- } catch (SSLException e) {
- // Correct behavior.
- }*/
+ // Permission checking check. Please note this is highly
+ // implementation related.
+ if (unbound) {
+ // For unbound, server does not know what name to check.
+ // Client checks "initiate", then server gets the name
+ // and checks "accept". Second connection resume.
+ if (!permChecks.equals("IA")) {
+ throw new Exception();
+ }
+ } else {
+ // For bound, JAAS checks "accept" once. Server checks again,
+ // client then checks "initiate". Second connection resume.
+ if (!permChecks.equals("AAI")) {
+ throw new Exception();
+ }
+ }
}
// Following codes copied from
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/SaslGSS.java Wed May 01 11:34:06 2013 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8012082
+ * @summary SASL: auth-conf negotiated, but unencrypted data is accepted,
+ * reset to unencrypt
+ * @compile -XDignore.symbol.file SaslGSS.java
+ * @run main/othervm SaslGSS
+ */
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.sasl.AuthorizeCallback;
+import javax.security.sasl.RealmCallback;
+import javax.security.sasl.Sasl;
+import javax.security.sasl.SaslServer;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Locale;
+import org.ietf.jgss.*;
+import sun.security.jgss.GSSUtil;
+
+public class SaslGSS {
+
+ public static void main(String[] args) throws Exception {
+
+ String name = "host." + OneKDC.REALM.toLowerCase(Locale.US);
+
+ new OneKDC(null).writeJAASConf();
+ System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
+
+ // Client in JGSS so that it can control wrap privacy mode
+ GSSManager m = GSSManager.getInstance();
+ GSSContext sc = m.createContext(
+ m.createName(OneKDC.SERVER, GSSUtil.NT_GSS_KRB5_PRINCIPAL),
+ GSSUtil.GSS_KRB5_MECH_OID,
+ null,
+ GSSContext.DEFAULT_LIFETIME);
+ sc.requestMutualAuth(false);
+
+ // Server in SASL
+ final HashMap props = new HashMap();
+ props.put(Sasl.QOP, "auth-conf");
+ SaslServer ss = Sasl.createSaslServer("GSSAPI", "server",
+ name, props,
+ new CallbackHandler() {
+ public void handle(Callback[] callbacks)
+ throws IOException, UnsupportedCallbackException {
+ for (Callback cb : callbacks) {
+ if (cb instanceof RealmCallback) {
+ ((RealmCallback) cb).setText(OneKDC.REALM);
+ } else if (cb instanceof AuthorizeCallback) {
+ ((AuthorizeCallback) cb).setAuthorized(true);
+ }
+ }
+ }
+ });
+
+ // Handshake
+ byte[] token = new byte[0];
+ token = sc.initSecContext(token, 0, token.length);
+ token = ss.evaluateResponse(token);
+ token = sc.unwrap(token, 0, token.length, new MessageProp(0, false));
+ token[0] = (byte)(((token[0] & 4) != 0) ? 4 : 2);
+ token = sc.wrap(token, 0, token.length, new MessageProp(0, false));
+ ss.evaluateResponse(token);
+
+ // Talk
+ // 1. Client sends a auth-int message
+ byte[] hello = "hello".getBytes();
+ MessageProp qop = new MessageProp(0, false);
+ token = sc.wrap(hello, 0, hello.length, qop);
+ // 2. Server accepts it anyway
+ ss.unwrap(token, 0, token.length);
+ // 3. Server sends a message
+ token = ss.wrap(hello, 0, hello.length);
+ // 4. Client accepts, should be auth-conf
+ sc.unwrap(token, 0, token.length, qop);
+ if (!qop.getPrivacy()) {
+ throw new Exception();
+ }
+ }
+}
--- a/jdk/test/sun/security/provider/SecureRandom/StrongSeedReader.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/sun/security/provider/SecureRandom/StrongSeedReader.java Wed May 01 11:34:06 2013 -0700
@@ -49,7 +49,7 @@
File file = null;
try {
- file = new File(System.getProperty("java.io.tmpdir") +
+ file = new File(System.getProperty("java.io.tmpdir"),
"StrongSeedReader.tmpdata");
// write a bunch of 0's to the file.
--- a/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java Wed May 01 11:34:06 2013 -0700
@@ -260,6 +260,8 @@
jarsigner(cmd, 7, false); // tsbad2
jarsigner(cmd, 8, false); // tsbad3
jarsigner(cmd, 9, false); // no cert in timestamp
+ jarsigner(cmd + " -tsapolicyid 1.2.3.4", 0, true);
+ jarsigner(cmd + " -tsapolicyid 1.2.3.5", 0, false);
} else { // Run as a standalone server
System.err.println("Press Enter to quit server");
System.in.read();
--- a/jdk/test/sun/security/tools/jarsigner/ts.sh Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/ts.sh Wed May 01 11:34:06 2013 -0700
@@ -22,7 +22,7 @@
#
# @test
-# @bug 6543842 6543440 6939248
+# @bug 6543842 6543440 6939248 8009636
# @summary checking response of timestamp
#
# @run shell/timeout=600 ts.sh
--- a/jdk/test/sun/security/tools/keytool/console.sh Wed May 01 11:27:12 2013 -0700
+++ b/jdk/test/sun/security/tools/keytool/console.sh Wed May 01 11:34:06 2013 -0700
@@ -1,5 +1,3 @@
-#! /bin/sh
-
#
# Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,10 +22,11 @@
#
# @test
-# @bug 6418647
+# @bug 6418647 8005527
# @summary Doc bug 5035358 shows sun.security.util.Password.readPassword() is buggy.
# @author Weijun Wang
-#
+# @ignore unable to test manual tools that have input from stdin,
+# and output to stderr and stdout
# @run shell/manual console.sh
if [ "$ALT_PASS" = "" ]; then