Merge

Thu, 28 Apr 2016 10:06:06 -0700

author
asaha
date
Thu, 28 Apr 2016 10:06:06 -0700
changeset 1909
ccf934e3116f
parent 1908
edede37674ea
parent 1876
1fcce949f957
child 1910
f038b30fef79

Merge

.hgtags file | annotate | diff | comparison | revisions
     1.1 --- a/.hgignore	Mon Apr 11 12:35:19 2016 -0700
     1.2 +++ b/.hgignore	Thu Apr 28 10:06:06 2016 -0700
     1.3 @@ -22,6 +22,6 @@
     1.4  CC/*
     1.5  jcov2/*
     1.6  .idea/*
     1.7 -test/lib/testng.jar
     1.8 +test/lib/*.jar
     1.9  test/script/external/*
    1.10  .project
     2.1 --- a/.hgtags	Mon Apr 11 12:35:19 2016 -0700
     2.2 +++ b/.hgtags	Thu Apr 28 10:06:06 2016 -0700
     2.3 @@ -555,6 +555,10 @@
     2.4  a2c005a7b33abed886cfb4309a846dd80c87bd4e jdk8u91-b00
     2.5  22925b345dffe4ba96fe2f429c4185cda1b30239 jdk8u91-b13
     2.6  6296644a2c9c30db0062117fc776341e937ca1f9 jdk8u91-b14
     2.7 +7bce03d47545e6a5341a2722168cd6bf697c4132 jdk8u77-b00
     2.8 +678b645aa10aaf27895c87872c399c15daa026a1 jdk8u77-b01
     2.9 +09abd795d1d143933224bcb3f12f5d4686b65373 jdk8u77-b02
    2.10 +b6ee21a35619ce4d3b46a9b825438a3bc9bb63cd jdk8u77-b03
    2.11  9ff5c21813330147bf08389b3992534780c93247 jdk8u76-b00
    2.12  b7bbed8b05dd50c27050c7e10e20d25329dcd32b jdk8u76-b01
    2.13  4c1aa7b8c43c6fd38f9c13a6df2264378dd6a873 jdk8u76-b02
    2.14 @@ -576,4 +580,13 @@
    2.15  793156da7cc9c74489ab5fa5f5598bba172846e2 jdk8u101-b01
    2.16  79fc469a68bbe03f69919f4cebe0381df1b1d2a3 jdk8u101-b02
    2.17  d93088bdd15d507b35bc4ced85c6c748705511fc jdk8u101-b03
    2.18 +9bd5aadd8e739d4ad4bb2e30741cdbe9ae2bae66 jdk8u101-b04
    2.19 +a347853dbf17605c650532c4291bb9117d80f568 jdk8u101-b05
    2.20 +120c1b8b458170ed017d2ee60cc9d63896eeb4b9 jdk8u102-b00
    2.21 +120c1b8b458170ed017d2ee60cc9d63896eeb4b9 jdk8u82-b00
    2.22 +79dcbdb92a8c39de6d1417557af9e6c2c03f806d jdk8u102-b01
    2.23 +17416ae62bd720ebb53d20bb24272991084633bd jdk8u102-b02
    2.24 +75728277aeee30f31c9418f37faf8f4216c539d7 jdk8u102-b03
    2.25 +8ebcaf17bc745aa581aa8eff807da97f2f74058e jdk8u102-b04
    2.26 +676a870491e5934e88d40cf2c68bef646c63b4ea jdk8u102-b05
    2.27  9bd5aadd8e739d4ad4bb2e30741cdbe9ae2bae66 jdk8u111-b00
     3.1 --- a/make/build.xml	Mon Apr 11 12:35:19 2016 -0700
     3.2 +++ b/make/build.xml	Thu Apr 28 10:06:06 2016 -0700
     3.3 @@ -49,9 +49,17 @@
     3.4      <condition property="git.executable" value="/usr/local/bin/git" else="git">
     3.5        <available file="/usr/local/bin/git"/>
     3.6      </condition>
     3.7 -    <!-- check if testng.jar is avaiable -->
     3.8 -    <available property="testng.available" file="${file.reference.testng.jar}"/>
     3.9 -    <!-- check if Jemmy ang testng.jar are avaiable -->
    3.10 +    <!-- check if TestNG and dependencies are available, and download them if they aren't -->
    3.11 +    <antcall target="get-testng"/>
    3.12 +    <condition property="testng.available" value="true">
    3.13 +      <and>
    3.14 +        <available file="${file.reference.testng.jar}"/>
    3.15 +        <available file="${file.reference.jcommander.jar}"/>
    3.16 +        <available file="${file.reference.bsh.jar}"/>
    3.17 +        <available file="${file.reference.snakeyaml.jar}"/>
    3.18 +      </and>
    3.19 +    </condition>
    3.20 +    <!-- check if Jemmy ang TestNG are avaiable -->
    3.21      <condition property="jemmy.jfx.testng.available" value="true">
    3.22        <and>
    3.23          <available file="${file.reference.jemmyfx.jar}"/>
    3.24 @@ -214,6 +222,7 @@
    3.25      <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${src.dir}/overview.html" 
    3.26          extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
    3.27          additionalparam="-quiet" failonerror="true" useexternalfile="true">
    3.28 +      <arg value="${javadoc.option}"/>
    3.29        <classpath>
    3.30          <pathelement location="${build.classes.dir}"/>
    3.31        </classpath>
    3.32 @@ -232,6 +241,7 @@
    3.33      <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${src.dir}/overview.html"
    3.34          extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
    3.35          additionalparam="-quiet" failonerror="true" useexternalfile="true">
    3.36 +      <arg value="${javadoc.option}"/>
    3.37        <classpath>
    3.38          <pathelement location="${build.classes.dir}"/>
    3.39        </classpath>
    3.40 @@ -244,6 +254,7 @@
    3.41    <target name="javadocapi" depends="jar">
    3.42      <javadoc destdir="${dist.javadoc.dir}" use="yes" extdirs="${nashorn.ext.path}" 
    3.43          windowtitle="${nashorn.product.name}" additionalparam="-quiet" failonerror="true" useexternalfile="true">
    3.44 +      <arg value="${javadoc.option}"/>
    3.45        <classpath>
    3.46          <pathelement location="${build.classes.dir}"/>
    3.47        </classpath>
    3.48 @@ -275,7 +286,7 @@
    3.49    <target name="compile-test" depends="compile, run-nasgen" if="testng.available">
    3.50      <!-- testng task -->
    3.51      <taskdef name="testng" classname="org.testng.TestNGAntTask"
    3.52 -        classpath="${file.reference.testng.jar}"/>
    3.53 +        classpath="${testng.ant.classpath}"/>
    3.54  
    3.55      <javac srcdir="${test.src.dir}"
    3.56             destdir="${build.test.classes.dir}"
    3.57 @@ -331,6 +342,15 @@
    3.58  grant codeBase "file:/${basedir}/${file.reference.testng.jar}" {
    3.59      permission java.security.AllPermission;
    3.60  };
    3.61 +grant codeBase "file:/${basedir}/${file.reference.jcommander.jar}" {
    3.62 +    permission java.security.AllPermission;
    3.63 +};
    3.64 +grant codeBase "file:/${basedir}/${file.reference.bsh.jar}" {
    3.65 +    permission java.security.AllPermission;
    3.66 +};
    3.67 +grant codeBase "file:/${basedir}/${file.reference.snakeyaml.jar}" {
    3.68 +    permission java.security.AllPermission;
    3.69 +};
    3.70  //// in case of absolute path:
    3.71  grant codeBase "file:/${nashorn.internal.tests.jar}" {
    3.72      permission java.security.AllPermission;
    3.73 @@ -339,6 +359,16 @@
    3.74  grant codeBase "file:/${file.reference.testng.jar}" {
    3.75      permission java.security.AllPermission;
    3.76  };
    3.77 +grant codeBase "file:/${file.reference.jcommander.jar}" {
    3.78 +    permission java.security.AllPermission;
    3.79 +};
    3.80 +grant codeBase "file:/${file.reference.bsh.jar}" {
    3.81 +    permission java.security.AllPermission;
    3.82 +};
    3.83 +grant codeBase "file:/${file.reference.snakeyaml.jar}" {
    3.84 +    permission java.security.AllPermission;
    3.85 +};
    3.86 +
    3.87  
    3.88  grant codeBase "file:/${basedir}/test/script/trusted/*" {
    3.89      permission java.security.AllPermission;
    3.90 @@ -408,7 +438,7 @@
    3.91    </target>
    3.92  
    3.93    <target name="check-testng" unless="testng.available">
    3.94 -    <echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under ${test.lib} directory."/>
    3.95 +    <echo message="WARNING: TestNG not available, will not run tests. Please copy TestNG and dependency JARs to the ${test.lib} directory."/>
    3.96    </target>
    3.97  
    3.98    <!-- only to be invoked as dependency of "test" target -->
    3.99 @@ -480,7 +510,7 @@
   3.100      </testng>
   3.101    </target>
   3.102  
   3.103 -  <target name="test" depends="get-testng, javadocnh, test-pessimistic, test-optimistic"/>
   3.104 +  <target name="test" depends="prepare, javadocnh, test-pessimistic, test-optimistic"/>
   3.105  
   3.106    <target name="test-optimistic" depends="jar, -test-classes-all,-test-classes-single, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
   3.107      <echo message="Running test suite in OPTIMISTIC mode..."/>
   3.108 @@ -507,7 +537,7 @@
   3.109    </target>
   3.110  
   3.111    <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available">
   3.112 -    <echo message="WARNING: Jemmy or JavaFX or TestNG not available, will not run tests. Please copy testng.jar, JemmyCore.jar, JemmyFX.jar, JemmyAWTInput.jar under test${file.separator}lib directory. And make sure you have jfxrt.jar in ${java.home}${file.separator}lib${file.separator}ext dir."/>
   3.113 +    <echo message="WARNING: Jemmy or JavaFX or TestNG not available, will not run tests. Please copy TestNG and dependency JARs, JemmyCore.jar, JemmyFX.jar, JemmyAWTInput.jar to the test${file.separator}lib directory. And make sure you have jfxrt.jar in ${java.home}${file.separator}lib${file.separator}ext dir."/>
   3.114    </target>
   3.115  
   3.116    <target name="testjfx" depends="jar, get-testng, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available">
   3.117 @@ -742,15 +772,13 @@
   3.118    <target name="perf" depends="externals, update-externals, sunspider, octane"/>
   3.119  
   3.120    <!-- download and install testng.jar -->
   3.121 -  <target name="get-testng" depends="prepare" unless="testng.available">
   3.122 -    <get src="http://testng.org/testng-6.8.zip" dest="${test.lib}" skipexisting="true" ignoreerrors="true"/>
   3.123 -    <unzip src="${test.lib}${file.separator}testng-6.8.zip" dest="${test.lib}">
   3.124 -      <patternset>
   3.125 -        <include name="testng-6.8/testng-6.8.jar"/>
   3.126 -      </patternset>
   3.127 -    </unzip>
   3.128 -    <move file="${test.lib}${file.separator}testng-6.8${file.separator}testng-6.8.jar" tofile="${test.lib}${file.separator}testng.jar"/>
   3.129 -    <delete dir="${test.lib}${file.separator}testng-6.8"/>
   3.130 +  <target name="get-testng">
   3.131 +    <get dest="${test.lib}" skipexisting="true">
   3.132 +      <url url="http://central.maven.org/maven2/org/testng/testng/6.8/testng-6.8.jar"/>
   3.133 +      <url url="http://central.maven.org/maven2/com/beust/jcommander/1.27/jcommander-1.27.jar"/>
   3.134 +      <url url="http://central.maven.org/maven2/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar"/>
   3.135 +      <url url="http://central.maven.org/maven2/org/yaml/snakeyaml/1.6/snakeyaml-1.6.jar"/>
   3.136 +    </get>
   3.137    </target>
   3.138  
   3.139    <!-- run all tests -->
     4.1 --- a/make/project.properties	Mon Apr 11 12:35:19 2016 -0700
     4.2 +++ b/make/project.properties	Thu Apr 28 10:06:06 2016 -0700
     4.3 @@ -33,6 +33,8 @@
     4.4  test.javac.source=1.8
     4.5  test.javac.target=1.8
     4.6  
     4.7 +javadoc.option=-tag "implSpec:a:Implementation Requirements:"
     4.8 +
     4.9  # nashorn version information
    4.10  nashorn.version=0.1
    4.11  nashorn.fullversion=0.1
    4.12 @@ -83,7 +85,17 @@
    4.13  test.lib=${basedir}${file.separator}test${file.separator}lib
    4.14  
    4.15  # jars refererred
    4.16 -file.reference.testng.jar=${test.lib}${file.separator}testng.jar
    4.17 +file.reference.testng.jar=${test.lib}${file.separator}testng-6.8.jar
    4.18 +file.reference.jcommander.jar=${test.lib}${file.separator}jcommander-1.27.jar
    4.19 +file.reference.bsh.jar=${test.lib}${file.separator}bsh-2.0b4.jar
    4.20 +file.reference.snakeyaml.jar=${test.lib}${file.separator}snakeyaml-1.6.jar
    4.21 +
    4.22 +# TestNG ant task classpath
    4.23 +testng.ant.classpath=\
    4.24 +    ${file.reference.testng.jar}${path.separator}\
    4.25 +    ${file.reference.jcommander.jar}${path.separator}\
    4.26 +    ${file.reference.bsh.jar}${path.separator}\
    4.27 +    ${file.reference.snakeyaml.jar}${path.separator}
    4.28  
    4.29  # Set testng verbose level
    4.30  # From TestNG docs: "the verbosity level (0 to 10 where 10 is most detailed) 
    4.31 @@ -112,7 +124,10 @@
    4.32  javac.test.classpath=\
    4.33      ${build.classes.dir}${path.separator}\
    4.34      ${build.test.classes.dir}${path.separator}\
    4.35 -    ${file.reference.testng.jar}
    4.36 +    ${file.reference.testng.jar}${path.separator}\
    4.37 +    ${file.reference.jcommander.jar}${path.separator}\
    4.38 +    ${file.reference.bsh.jar}${path.separator}\
    4.39 +    ${file.reference.snakeyaml.jar}
    4.40  
    4.41  meta.inf.dir=${src.dir}/META-INF
    4.42  
    4.43 @@ -251,6 +266,9 @@
    4.44      ${file.reference.jemmycore.jar}${path.separator}\
    4.45      ${file.reference.jemmyawtinput.jar}${path.separator}\
    4.46      ${file.reference.testng.jar}${path.separator}\
    4.47 +    ${file.reference.jcommander.jar}${path.separator}\
    4.48 +    ${file.reference.bsh.jar}${path.separator}\
    4.49 +    ${file.reference.snakeyaml.jar}${path.separator}\
    4.50      ${nashorn.internal.tests.jar}${path.separator}\
    4.51      ${nashorn.api.tests.jar}
    4.52  
    4.53 @@ -259,6 +277,9 @@
    4.54  
    4.55  run.test.classpath=\
    4.56      ${file.reference.testng.jar}${path.separator}\
    4.57 +    ${file.reference.jcommander.jar}${path.separator}\
    4.58 +    ${file.reference.bsh.jar}${path.separator}\
    4.59 +    ${file.reference.snakeyaml.jar}${path.separator}\
    4.60      ${nashorn.internal.tests.jar}${path.separator}\
    4.61      ${nashorn.api.tests.jar}
    4.62  
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/samples/lines.js	Thu Apr 28 10:06:06 2016 -0700
     5.3 @@ -0,0 +1,41 @@
     5.4 +/*
     5.5 + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     5.6 + *
     5.7 + * Redistribution and use in source and binary forms, with or without
     5.8 + * modification, are permitted provided that the following conditions
     5.9 + * are met:
    5.10 + *
    5.11 + *   - Redistributions of source code must retain the above copyright
    5.12 + *     notice, this list of conditions and the following disclaimer.
    5.13 + *
    5.14 + *   - Redistributions in binary form must reproduce the above copyright
    5.15 + *     notice, this list of conditions and the following disclaimer in the
    5.16 + *     documentation and/or other materials provided with the distribution.
    5.17 + *
    5.18 + *   - Neither the name of Oracle nor the names of its
    5.19 + *     contributors may be used to endorse or promote products derived
    5.20 + *     from this software without specific prior written permission.
    5.21 + *
    5.22 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    5.23 + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    5.24 + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    5.25 + * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    5.26 + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    5.27 + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    5.28 + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    5.29 + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    5.30 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    5.31 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    5.32 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    5.33 + */
    5.34 +
    5.35 +var Files = java.nio.file.Files;
    5.36 +var File = java.io.File;
    5.37 +var d = arguments.length == 0? "." : arguments[0];
    5.38 +
    5.39 +// print total number of lines in all .java files under a
    5.40 +// given directory (recursively)
    5.41 +
    5.42 +print(Files.walk(new File(d).toPath()).
    5.43 +  filter(function(p) p.toString().endsWith(".java")).
    5.44 +  mapToInt(function(p) Files.lines(p).count()).sum())
     6.1 --- a/src/jdk/nashorn/api/scripting/AbstractJSObject.java	Mon Apr 11 12:35:19 2016 -0700
     6.2 +++ b/src/jdk/nashorn/api/scripting/AbstractJSObject.java	Thu Apr 28 10:06:06 2016 -0700
     6.3 @@ -27,6 +27,7 @@
     6.4  
     6.5  import java.util.Collection;
     6.6  import java.util.Collections;
     6.7 +import java.util.Objects;
     6.8  import java.util.Set;
     6.9  import jdk.nashorn.internal.runtime.JSONListAdapter;
    6.10  import jdk.nashorn.internal.runtime.JSType;
    6.11 @@ -36,7 +37,7 @@
    6.12   *
    6.13   * This class can also be subclassed by an arbitrary Java class. Nashorn will
    6.14   * treat objects of such classes just like nashorn script objects. Usual nashorn
    6.15 - * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be glued
    6.16 + * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be delegated
    6.17   * to appropriate method call of this class.
    6.18   *
    6.19   * @since 1.8u40
    6.20 @@ -44,12 +45,12 @@
    6.21  @jdk.Exported
    6.22  public abstract class AbstractJSObject implements JSObject {
    6.23      /**
    6.24 -     * Call this object as a JavaScript function. This is equivalent to
    6.25 -     * 'func.apply(thiz, args)' in JavaScript.
    6.26 -     *
    6.27 -     * @param thiz 'this' object to be passed to the function
    6.28 -     * @param args arguments to method
    6.29 -     * @return result of call
    6.30 +     * The default constructor.
    6.31 +     */
    6.32 +    public AbstractJSObject() {}
    6.33 +
    6.34 +    /**
    6.35 +     * @implSpec This implementation always throws UnsupportedOperationException
    6.36       */
    6.37      @Override
    6.38      public Object call(final Object thiz, final Object... args) {
    6.39 @@ -57,11 +58,7 @@
    6.40      }
    6.41  
    6.42      /**
    6.43 -     * Call this 'constructor' JavaScript function to create a new object.
    6.44 -     * This is equivalent to 'new func(arg1, arg2...)' in JavaScript.
    6.45 -     *
    6.46 -     * @param args arguments to method
    6.47 -     * @return result of constructor call
    6.48 +     * @implSpec This implementation always throws UnsupportedOperationException
    6.49       */
    6.50      @Override
    6.51      public Object newObject(final Object... args) {
    6.52 @@ -69,10 +66,7 @@
    6.53      }
    6.54  
    6.55      /**
    6.56 -     * Evaluate a JavaScript expression.
    6.57 -     *
    6.58 -     * @param s JavaScript expression to evaluate
    6.59 -     * @return evaluation result
    6.60 +     * @implSpec This imlementation always throws UnsupportedOperationException
    6.61       */
    6.62      @Override
    6.63      public Object eval(final String s) {
    6.64 @@ -80,21 +74,16 @@
    6.65      }
    6.66  
    6.67      /**
    6.68 -     * Retrieves a named member of this JavaScript object.
    6.69 -     *
    6.70 -     * @param name of member
    6.71 -     * @return member
    6.72 +     * @implSpec This implementation always returns null
    6.73       */
    6.74      @Override
    6.75      public Object getMember(final String name) {
    6.76 +        Objects.requireNonNull(name);
    6.77          return null;
    6.78      }
    6.79  
    6.80      /**
    6.81 -     * Retrieves an indexed member of this JavaScript object.
    6.82 -     *
    6.83 -     * @param index index slot to retrieve
    6.84 -     * @return member
    6.85 +     * @implSpec This implementation always returns null
    6.86       */
    6.87      @Override
    6.88      public Object getSlot(final int index) {
    6.89 @@ -102,21 +91,16 @@
    6.90      }
    6.91  
    6.92      /**
    6.93 -     * Does this object have a named member?
    6.94 -     *
    6.95 -     * @param name name of member
    6.96 -     * @return true if this object has a member of the given name
    6.97 +     * @implSpec This implementation always returns false
    6.98       */
    6.99      @Override
   6.100      public boolean hasMember(final String name) {
   6.101 +        Objects.requireNonNull(name);
   6.102          return false;
   6.103      }
   6.104  
   6.105      /**
   6.106 -     * Does this object have a indexed property?
   6.107 -     *
   6.108 -     * @param slot index to check
   6.109 -     * @return true if this object has a slot
   6.110 +     * @implSpec This implementation always returns false
   6.111       */
   6.112      @Override
   6.113      public boolean hasSlot(final int slot) {
   6.114 @@ -124,31 +108,25 @@
   6.115      }
   6.116  
   6.117      /**
   6.118 -     * Remove a named member from this JavaScript object
   6.119 -     *
   6.120 -     * @param name name of the member
   6.121 +     * @implSpec This implementation is a no-op
   6.122       */
   6.123      @Override
   6.124      public void removeMember(final String name) {
   6.125 +        Objects.requireNonNull(name);
   6.126          //empty
   6.127      }
   6.128  
   6.129      /**
   6.130 -     * Set a named member in this JavaScript object
   6.131 -     *
   6.132 -     * @param name  name of the member
   6.133 -     * @param value value of the member
   6.134 +     * @implSpec This implementation is a no-op
   6.135       */
   6.136      @Override
   6.137      public void setMember(final String name, final Object value) {
   6.138 +        Objects.requireNonNull(name);
   6.139          //empty
   6.140      }
   6.141  
   6.142      /**
   6.143 -     * Set an indexed member in this JavaScript object
   6.144 -     *
   6.145 -     * @param index index of the member slot
   6.146 -     * @param value value of the member
   6.147 +     * @implSpec This implementation is a no-op
   6.148       */
   6.149      @Override
   6.150      public void setSlot(final int index, final Object value) {
   6.151 @@ -158,9 +136,7 @@
   6.152      // property and value iteration
   6.153  
   6.154      /**
   6.155 -     * Returns the set of all property names of this object.
   6.156 -     *
   6.157 -     * @return set of property names
   6.158 +     * @implSpec This implementation returns empty set
   6.159       */
   6.160      @Override
   6.161      public Set<String> keySet() {
   6.162 @@ -168,9 +144,7 @@
   6.163      }
   6.164  
   6.165      /**
   6.166 -     * Returns the set of all property values of this object.
   6.167 -     *
   6.168 -     * @return set of property values.
   6.169 +     * @implSpec This implementation returns empty set
   6.170       */
   6.171      @Override
   6.172      public Collection<Object> values() {
   6.173 @@ -180,22 +154,13 @@
   6.174      // JavaScript instanceof check
   6.175  
   6.176      /**
   6.177 -     * Checking whether the given object is an instance of 'this' object.
   6.178 -     *
   6.179 -     * @param instance instance to check
   6.180 -     * @return true if the given 'instance' is an instance of this 'function' object
   6.181 +     * @implSpec This implementation always returns false
   6.182       */
   6.183      @Override
   6.184      public boolean isInstance(final Object instance) {
   6.185          return false;
   6.186      }
   6.187  
   6.188 -    /**
   6.189 -     * Checking whether this object is an instance of the given 'clazz' object.
   6.190 -     *
   6.191 -     * @param clazz clazz to check
   6.192 -     * @return true if this object is an instance of the given 'clazz'
   6.193 -     */
   6.194      @Override
   6.195      public boolean isInstanceOf(final Object clazz) {
   6.196          if (clazz instanceof JSObject) {
   6.197 @@ -205,20 +170,13 @@
   6.198          return false;
   6.199      }
   6.200  
   6.201 -    /**
   6.202 -     * ECMA [[Class]] property
   6.203 -     *
   6.204 -     * @return ECMA [[Class]] property value of this object
   6.205 -     */
   6.206      @Override
   6.207      public String getClassName() {
   6.208          return getClass().getName();
   6.209      }
   6.210  
   6.211      /**
   6.212 -     * Is this a function object?
   6.213 -     *
   6.214 -     * @return if this mirror wraps a ECMAScript function instance
   6.215 +     * @implSpec This implementation always returns false
   6.216       */
   6.217      @Override
   6.218      public boolean isFunction() {
   6.219 @@ -226,9 +184,7 @@
   6.220      }
   6.221  
   6.222      /**
   6.223 -     * Is this a 'use strict' function object?
   6.224 -     *
   6.225 -     * @return true if this mirror represents a ECMAScript 'use strict' function
   6.226 +     * @implSpec This implementation always returns false
   6.227       */
   6.228      @Override
   6.229      public boolean isStrictFunction() {
   6.230 @@ -236,9 +192,7 @@
   6.231      }
   6.232  
   6.233      /**
   6.234 -     * Is this an array object?
   6.235 -     *
   6.236 -     * @return if this mirror wraps a ECMAScript array object
   6.237 +     * @implSpec This implementation always returns false
   6.238       */
   6.239      @Override
   6.240      public boolean isArray() {
     7.1 --- a/src/jdk/nashorn/api/scripting/JSObject.java	Mon Apr 11 12:35:19 2016 -0700
     7.2 +++ b/src/jdk/nashorn/api/scripting/JSObject.java	Thu Apr 28 10:06:06 2016 -0700
     7.3 @@ -31,7 +31,7 @@
     7.4  /**
     7.5   * This interface can be implemented by an arbitrary Java class. Nashorn will
     7.6   * treat objects of such classes just like nashorn script objects. Usual nashorn
     7.7 - * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be glued
     7.8 + * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be delegated
     7.9   * to appropriate method call of this interface.
    7.10   *
    7.11   * @since 1.8u40
    7.12 @@ -42,7 +42,7 @@
    7.13       * Call this object as a JavaScript function. This is equivalent to
    7.14       * 'func.apply(thiz, args)' in JavaScript.
    7.15       *
    7.16 -     * @param thiz 'this' object to be passed to the function
    7.17 +     * @param thiz 'this' object to be passed to the function. This may be null.
    7.18       * @param args arguments to method
    7.19       * @return result of call
    7.20       */
    7.21 @@ -70,6 +70,7 @@
    7.22       *
    7.23       * @param name of member
    7.24       * @return member
    7.25 +     * @throws NullPointerException if name is null
    7.26       */
    7.27      public Object getMember(final String name);
    7.28  
    7.29 @@ -101,6 +102,7 @@
    7.30       * Remove a named member from this JavaScript object
    7.31       *
    7.32       * @param name name of the member
    7.33 +     * @throws NullPointerException if name is null
    7.34       */
    7.35      public void removeMember(final String name);
    7.36  
    7.37 @@ -109,6 +111,7 @@
    7.38       *
    7.39       * @param name  name of the member
    7.40       * @param value value of the member
    7.41 +     * @throws NullPointerException if name is null
    7.42       */
    7.43      public void setMember(final String name, final Object value);
    7.44  
     8.1 --- a/src/jdk/nashorn/api/scripting/NashornException.java	Mon Apr 11 12:35:19 2016 -0700
     8.2 +++ b/src/jdk/nashorn/api/scripting/NashornException.java	Thu Apr 28 10:06:06 2016 -0700
     8.3 @@ -47,6 +47,8 @@
     8.4  @jdk.Exported
     8.5  @SuppressWarnings("serial")
     8.6  public abstract class NashornException extends RuntimeException {
     8.7 +    private static final long serialVersionUID = 1L;
     8.8 +
     8.9      // script file name
    8.10      private String fileName;
    8.11      // script line number
    8.12 @@ -59,7 +61,7 @@
    8.13      private Object ecmaError;
    8.14  
    8.15      /**
    8.16 -     * Constructor
    8.17 +     * Constructor to initialize error message, file name, line and column numbers.
    8.18       *
    8.19       * @param msg       exception message
    8.20       * @param fileName  file name
    8.21 @@ -71,7 +73,7 @@
    8.22      }
    8.23  
    8.24      /**
    8.25 -     * Constructor
    8.26 +     * Constructor to initialize error message, cause exception, file name, line and column numbers.
    8.27       *
    8.28       * @param msg       exception message
    8.29       * @param cause     exception cause
    8.30 @@ -87,7 +89,7 @@
    8.31      }
    8.32  
    8.33      /**
    8.34 -     * Constructor
    8.35 +     * Constructor to initialize error message and cause exception.
    8.36       *
    8.37       * @param msg       exception message
    8.38       * @param cause     exception cause
     9.1 --- a/src/jdk/nashorn/api/scripting/NashornScriptEngineFactory.java	Mon Apr 11 12:35:19 2016 -0700
     9.2 +++ b/src/jdk/nashorn/api/scripting/NashornScriptEngineFactory.java	Thu Apr 28 10:06:06 2016 -0700
     9.3 @@ -155,7 +155,7 @@
     9.4      }
     9.5  
     9.6      /**
     9.7 -     * Create a new Script engine initialized by given class loader.
     9.8 +     * Create a new Script engine initialized with the given class loader.
     9.9       *
    9.10       * @param appLoader class loader to be used as script "app" class loader.
    9.11       * @return newly created script engine.
    9.12 @@ -168,7 +168,7 @@
    9.13      }
    9.14  
    9.15      /**
    9.16 -     * Create a new Script engine initialized by given class filter.
    9.17 +     * Create a new Script engine initialized with the given class filter.
    9.18       *
    9.19       * @param classFilter class filter to use.
    9.20       * @return newly created script engine.
    9.21 @@ -182,7 +182,7 @@
    9.22      }
    9.23  
    9.24      /**
    9.25 -     * Create a new Script engine initialized by given arguments.
    9.26 +     * Create a new Script engine initialized with the given arguments.
    9.27       *
    9.28       * @param args arguments array passed to script engine.
    9.29       * @return newly created script engine.
    9.30 @@ -196,7 +196,7 @@
    9.31      }
    9.32  
    9.33      /**
    9.34 -     * Create a new Script engine initialized by given arguments.
    9.35 +     * Create a new Script engine initialized with the given arguments and the given class loader.
    9.36       *
    9.37       * @param args arguments array passed to script engine.
    9.38       * @param appLoader class loader to be used as script "app" class loader.
    9.39 @@ -211,7 +211,7 @@
    9.40      }
    9.41  
    9.42      /**
    9.43 -     * Create a new Script engine initialized by given arguments.
    9.44 +     * Create a new Script engine initialized with the given arguments, class loader and class filter.
    9.45       *
    9.46       * @param args arguments array passed to script engine.
    9.47       * @param appLoader class loader to be used as script "app" class loader.
    10.1 --- a/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Mon Apr 11 12:35:19 2016 -0700
    10.2 +++ b/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Thu Apr 28 10:06:06 2016 -0700
    10.3 @@ -288,22 +288,21 @@
    10.4          });
    10.5      }
    10.6  
    10.7 -
    10.8      @Override
    10.9 -    public boolean isInstance(final Object obj) {
   10.10 -        if (! (obj instanceof ScriptObjectMirror)) {
   10.11 +    public boolean isInstance(final Object instance) {
   10.12 +        if (! (instance instanceof ScriptObjectMirror)) {
   10.13              return false;
   10.14          }
   10.15  
   10.16 -        final ScriptObjectMirror instance = (ScriptObjectMirror)obj;
   10.17 +        final ScriptObjectMirror mirror = (ScriptObjectMirror)instance;
   10.18          // if not belongs to my global scope, return false
   10.19 -        if (global != instance.global) {
   10.20 +        if (global != mirror.global) {
   10.21              return false;
   10.22          }
   10.23  
   10.24          return inGlobal(new Callable<Boolean>() {
   10.25              @Override public Boolean call() {
   10.26 -                return sobj.isInstance(instance.sobj);
   10.27 +                return sobj.isInstance(mirror.sobj);
   10.28              }
   10.29          });
   10.30      }
   10.31 @@ -654,10 +653,10 @@
   10.32      }
   10.33  
   10.34      /**
   10.35 -     * Make a script object mirror on given object if needed. Also converts ConsString instances to Strings.
   10.36 +     * Make a script object mirror on given object if needed.
   10.37       *
   10.38       * @param obj object to be wrapped/converted
   10.39 -     * @param homeGlobal global to which this object belongs. Not used for ConsStrings.
   10.40 +     * @param homeGlobal global to which this object belongs.
   10.41       * @return wrapped/converted object
   10.42       */
   10.43      public static Object wrap(final Object obj, final Object homeGlobal) {
   10.44 @@ -665,13 +664,13 @@
   10.45      }
   10.46  
   10.47      /**
   10.48 -     * Make a script object mirror on given object if needed. Also converts ConsString instances to Strings. The
   10.49 -     * created wrapper will implement the Java {@code List} interface if {@code obj} is a JavaScript
   10.50 -     * {@code Array} object; this is compatible with Java JSON libraries expectations. Arrays retrieved through its
   10.51 +     * Make a script object mirror on given object if needed. The created wrapper will implement
   10.52 +     * the Java {@code List} interface if {@code obj} is a JavaScript {@code Array} object;
   10.53 +     * this is compatible with Java JSON libraries expectations. Arrays retrieved through its
   10.54       * properties (transitively) will also implement the list interface.
   10.55       *
   10.56       * @param obj object to be wrapped/converted
   10.57 -     * @param homeGlobal global to which this object belongs. Not used for ConsStrings.
   10.58 +     * @param homeGlobal global to which this object belongs.
   10.59       * @return wrapped/converted object
   10.60       */
   10.61      public static Object wrapAsJSONCompatible(final Object obj, final Object homeGlobal) {
   10.62 @@ -679,10 +678,10 @@
   10.63      }
   10.64  
   10.65      /**
   10.66 -     * Make a script object mirror on given object if needed. Also converts ConsString instances to Strings.
   10.67 +     * Make a script object mirror on given object if needed.
   10.68       *
   10.69       * @param obj object to be wrapped/converted
   10.70 -     * @param homeGlobal global to which this object belongs. Not used for ConsStrings.
   10.71 +     * @param homeGlobal global to which this object belongs.
   10.72       * @param jsonCompatible if true, the created wrapper will implement the Java {@code List} interface if
   10.73       * {@code obj} is a JavaScript {@code Array} object. Arrays retrieved through its properties (transitively)
   10.74       * will also implement the list interface.
    11.1 --- a/src/jdk/nashorn/api/scripting/ScriptUtils.java	Mon Apr 11 12:35:19 2016 -0700
    11.2 +++ b/src/jdk/nashorn/api/scripting/ScriptUtils.java	Thu Apr 28 10:06:06 2016 -0700
    11.3 @@ -77,9 +77,15 @@
    11.4       * @param func the function to wrap
    11.5       * @param sync the object to synchronize on
    11.6       * @return a synchronizing wrapper function
    11.7 +     * @throws IllegalArgumentException if func does not represent a script function
    11.8       */
    11.9 -    public static Object makeSynchronizedFunction(final ScriptFunction func, final Object sync) {
   11.10 -        return func.createSynchronized(unwrap(sync));
   11.11 +    public static Object makeSynchronizedFunction(final Object func, final Object sync) {
   11.12 +        final Object unwrapped = unwrap(func);
   11.13 +        if (unwrapped instanceof ScriptFunction) {
   11.14 +            return ((ScriptFunction)unwrapped).createSynchronized(unwrap(sync));
   11.15 +        }
   11.16 +
   11.17 +        throw new IllegalArgumentException();
   11.18      }
   11.19  
   11.20      /**
   11.21 @@ -87,9 +93,19 @@
   11.22       *
   11.23       * @param obj object to be wrapped
   11.24       * @return wrapped object
   11.25 +     * @throws IllegalArgumentException if obj cannot be wrapped
   11.26       */
   11.27 -    public static ScriptObjectMirror wrap(final ScriptObject obj) {
   11.28 -        return (ScriptObjectMirror) ScriptObjectMirror.wrap(obj, Context.getGlobal());
   11.29 +    public static ScriptObjectMirror wrap(final Object obj) {
   11.30 +        if (obj instanceof ScriptObjectMirror) {
   11.31 +            return (ScriptObjectMirror)obj;
   11.32 +        }
   11.33 +
   11.34 +        if (obj instanceof ScriptObject) {
   11.35 +            final ScriptObject sobj = (ScriptObject)obj;
   11.36 +            return (ScriptObjectMirror) ScriptObjectMirror.wrap(sobj, Context.getGlobal());
   11.37 +        }
   11.38 +
   11.39 +        throw new IllegalArgumentException();
   11.40      }
   11.41  
   11.42      /**
   11.43 @@ -138,7 +154,8 @@
   11.44       * Convert the given object to the given type.
   11.45       *
   11.46       * @param obj object to be converted
   11.47 -     * @param type destination type to convert to
   11.48 +     * @param type destination type to convert to. type is either a Class
   11.49 +     * or nashorn representation of a Java type returned by Java.type() call in script.
   11.50       * @return converted object
   11.51       */
   11.52      public static Object convert(final Object obj, final Object type) {
    12.1 --- a/src/jdk/nashorn/internal/runtime/PropertyListeners.java	Mon Apr 11 12:35:19 2016 -0700
    12.2 +++ b/src/jdk/nashorn/internal/runtime/PropertyListeners.java	Thu Apr 28 10:06:06 2016 -0700
    12.3 @@ -54,7 +54,13 @@
    12.4       */
    12.5      PropertyListeners(final PropertyListeners listener) {
    12.6          if (listener != null && listener.listeners != null) {
    12.7 -            this.listeners = new WeakHashMap<>(listener.listeners);
    12.8 +            this.listeners = new WeakHashMap<>();
    12.9 +            // We need to copy the nested weak sets in order to avoid concurrent modification issues, see JDK-8146274
   12.10 +            synchronized (listener) {
   12.11 +                for (final Map.Entry<String, WeakPropertyMapSet> entry : listener.listeners.entrySet()) {
   12.12 +                    this.listeners.put(entry.getKey(), new WeakPropertyMapSet(entry.getValue()));
   12.13 +                }
   12.14 +            }
   12.15          }
   12.16      }
   12.17  
   12.18 @@ -228,7 +234,15 @@
   12.19  
   12.20      private static class WeakPropertyMapSet {
   12.21  
   12.22 -        private final WeakHashMap<PropertyMap, Boolean> map = new WeakHashMap<>();
   12.23 +        private final WeakHashMap<PropertyMap, Boolean> map;
   12.24 +
   12.25 +        WeakPropertyMapSet() {
   12.26 +            this.map = new WeakHashMap<>();
   12.27 +        }
   12.28 +
   12.29 +        WeakPropertyMapSet(final WeakPropertyMapSet set) {
   12.30 +            this.map = new WeakHashMap<>(set.map);
   12.31 +        }
   12.32  
   12.33          void add(final PropertyMap propertyMap) {
   12.34              map.put(propertyMap, Boolean.TRUE);
    13.1 --- a/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Mon Apr 11 12:35:19 2016 -0700
    13.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Thu Apr 28 10:06:06 2016 -0700
    13.3 @@ -81,14 +81,11 @@
    13.4          }
    13.5  
    13.6          private ArrayData toRealArrayData() {
    13.7 -            return toRealArrayData(0);
    13.8 +            return new IntArrayData(0);
    13.9          }
   13.10  
   13.11          private ArrayData toRealArrayData(final int index) {
   13.12              final IntArrayData newData = new IntArrayData(index + 1);
   13.13 -            if (index == 0) {
   13.14 -                return newData;
   13.15 -            }
   13.16              return new DeletedRangeArrayFilter(newData, 0, index);
   13.17          }
   13.18  
   13.19 @@ -122,7 +119,7 @@
   13.20  
   13.21          @Override
   13.22          public ArrayData convert(final Class<?> type) {
   13.23 -            return toRealArrayData(0).convert(type);
   13.24 +            return toRealArrayData().convert(type);
   13.25          }
   13.26  
   13.27          @Override
    14.1 --- a/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java	Mon Apr 11 12:35:19 2016 -0700
    14.2 +++ b/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java	Thu Apr 28 10:06:06 2016 -0700
    14.3 @@ -1,5 +1,5 @@
    14.4  /*
    14.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    14.6 + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
    14.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.8   *
    14.9   * This code is free software; you can redistribute it and/or modify it
   14.10 @@ -238,8 +238,18 @@
   14.11          public void setTarget(final MethodHandle newTarget) {
   14.12              final MethodType type   = type();
   14.13              final boolean    isVoid = type.returnType() == void.class;
   14.14 +            final Class<?> newSelfType = newTarget.type().parameterType(0);
   14.15  
   14.16 -            MethodHandle methodHandle = MH.filterArguments(newTarget, 0, MH.bindTo(PROFILEENTRY, this));
   14.17 +            MethodHandle selfFilter = MH.bindTo(PROFILEENTRY, this);
   14.18 +            if (newSelfType != Object.class) {
   14.19 +                // new target uses a more precise 'self' type than Object.class. We need to
   14.20 +                // convert the filter type. Note that the profileEntry method returns "self"
   14.21 +                // argument "as is" and so the cast introduced will succeed for any type.
   14.22 +                MethodType selfFilterType = MethodType.methodType(newSelfType, newSelfType);
   14.23 +                selfFilter = selfFilter.asType(selfFilterType);
   14.24 +            }
   14.25 +
   14.26 +            MethodHandle methodHandle = MH.filterArguments(newTarget, 0, selfFilter);
   14.27  
   14.28              if (isVoid) {
   14.29                  methodHandle = MH.filterReturnValue(methodHandle, MH.bindTo(PROFILEVOIDEXIT, this));
    15.1 --- a/test/script/basic/JDK-8026367.js	Mon Apr 11 12:35:19 2016 -0700
    15.2 +++ b/test/script/basic/JDK-8026367.js	Thu Apr 28 10:06:06 2016 -0700
    15.3 @@ -37,10 +37,12 @@
    15.4      // Sync called with one argument will synchronize on this-object of invocation
    15.5      inc: sync(function(d) {
    15.6          this.count += d;
    15.7 +        Assert.assertTrue(java.lang.Thread.holdsLock(this));
    15.8      }),
    15.9      // Pass explicit object to synchronize on as second argument
   15.10      dec: sync(function(d) {
   15.11          this.count -= d;
   15.12 +        Assert.assertTrue(java.lang.Thread.holdsLock(obj));
   15.13      }, obj)
   15.14  };
   15.15  
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/test/script/nosecurity/JDK-8148926.js	Thu Apr 28 10:06:06 2016 -0700
    16.3 @@ -0,0 +1,34 @@
    16.4 +/*
    16.5 + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
    16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.7 + *
    16.8 + * This code is free software; you can redistribute it and/or modify it
    16.9 + * under the terms of the GNU General Public License version 2 only, as
   16.10 + * published by the Free Software Foundation.
   16.11 + *
   16.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   16.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   16.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   16.15 + * version 2 for more details (a copy is included in the LICENSE file that
   16.16 + * accompanied this code).
   16.17 + *
   16.18 + * You should have received a copy of the GNU General Public License version
   16.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   16.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   16.21 + *
   16.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   16.23 + * or visit www.oracle.com if you need additional information or have any
   16.24 + * questions.
   16.25 + */
   16.26 +
   16.27 +/**
   16.28 + * JDK-8148926: Call site profiling fails on braces-wrapped anonymous function
   16.29 + *
   16.30 + * @test
   16.31 + * @option -pcs
   16.32 + * @run
   16.33 + */
   16.34 +
   16.35 +(function() {})() 
   16.36 +
   16.37 +var i = (function() { return 2 })()
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/test/script/nosecurity/JDK-8149334.js	Thu Apr 28 10:06:06 2016 -0700
    17.3 @@ -0,0 +1,41 @@
    17.4 +/*
    17.5 + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
    17.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.7 + *
    17.8 + * This code is free software; you can redistribute it and/or modify it
    17.9 + * under the terms of the GNU General Public License version 2 only, as
   17.10 + * published by the Free Software Foundation.
   17.11 + *
   17.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   17.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   17.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   17.15 + * version 2 for more details (a copy is included in the LICENSE file that
   17.16 + * accompanied this code).
   17.17 + *
   17.18 + * You should have received a copy of the GNU General Public License version
   17.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   17.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   17.21 + *
   17.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   17.23 + * or visit www.oracle.com if you need additional information or have any
   17.24 + * questions.
   17.25 + */
   17.26 +
   17.27 +/**
   17.28 + * JDK-8149334: JSON.parse(JSON.stringify([])).push(10) creates an array containing two elements
   17.29 + *
   17.30 + * @test
   17.31 + * @run
   17.32 + */
   17.33 +
   17.34 +var a = JSON.parse(JSON.stringify([]))
   17.35 +print(a.length)
   17.36 +a.push(10)
   17.37 +print(a.length)
   17.38 +print(a)
   17.39 +
   17.40 +var b = JSON.parse(JSON.stringify([]))
   17.41 +print(b.length)
   17.42 +b.push('ieps')
   17.43 +print(b.length)
   17.44 +print(b)
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/test/script/nosecurity/JDK-8149334.js.EXPECTED	Thu Apr 28 10:06:06 2016 -0700
    18.3 @@ -0,0 +1,6 @@
    18.4 +0
    18.5 +1
    18.6 +10
    18.7 +0
    18.8 +1
    18.9 +ieps

mercurial