From db40a8396bdd76ca78b268e2a6b919c756160fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Mon, 18 Jan 2016 10:25:36 +0100 Subject: [PATCH 1/5] 8146274: Thread spinning on WeakHashMap.getEntry() with concurrent use of nashorn Reviewed-by: mhaupt, attila --- .../internal/runtime/PropertyListeners.java | 18 ++++++++++++++++-- .../runtime/resources/Functions.properties | 13 +++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyListeners.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyListeners.java index ca64212c654..a6e5ec363fa 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyListeners.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyListeners.java @@ -54,7 +54,13 @@ public class PropertyListeners { */ PropertyListeners(final PropertyListeners listener) { if (listener != null && listener.listeners != null) { - this.listeners = new WeakHashMap<>(listener.listeners); + this.listeners = new WeakHashMap<>(); + // We need to copy the nested weak sets in order to avoid concurrent modification issues, see JDK-8146274 + synchronized (listener) { + for (final Map.Entry entry : listener.listeners.entrySet()) { + this.listeners.put(entry.getKey(), new WeakPropertyMapSet(entry.getValue())); + } + } } } @@ -228,7 +234,15 @@ public class PropertyListeners { private static class WeakPropertyMapSet { - private final WeakHashMap map = new WeakHashMap<>(); + private final WeakHashMap map; + + WeakPropertyMapSet() { + this.map = new WeakHashMap<>(); + } + + WeakPropertyMapSet(final WeakPropertyMapSet set) { + this.map = new WeakHashMap<>(set.map); + } void add(final PropertyMap propertyMap) { map.put(propertyMap, Boolean.TRUE); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties index e3310559a31..567c7871846 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties @@ -24,7 +24,7 @@ Object.preventExtensions=prevents new properties from ever being added to the gi Object.isSealed=tells if an object is sealed or not -Object.isFrozen=tells if an object is fronzen or not +Object.isFrozen=tells if an object is frozen or not Object.isExtensible=tells if an object is extensible or not @@ -32,7 +32,7 @@ Object.keys=returns an array of the given object's own enumerable properties Object=creates a new script object or converts given value as a script object -Object.prototype.toString=returns a string representing of this object +Object.prototype.toString=returns a string representation of this object Object.prototype.hasOwnProperty=tells whether this object has the specified property or not @@ -42,3 +42,12 @@ Object.prototype.propertyIsEnumerable=tells whether the given property is enumer Object.bindProperties=binds the source object's properties to the target object (nashorn extension) +Function=creates a new function with the given parameters and function body + +Function.prototype.toString=returns a string representation of this function + +Function.prototype.apply=invokes the function with the given this-reference and arguments array + +Function.prototype.call=invokes the function with the given this-reference and arguments + +Function.prototype.bind=returns a new function with bound this-reference and arguments From 56fb28f292f675e4f12e807e3e6d94f4f251f99d Mon Sep 17 00:00:00 2001 From: Michael Haupt Date: Mon, 18 Jan 2016 11:31:43 +0100 Subject: [PATCH 2/5] 8145305: fix Nashorn shebang handling on Cygwin Reviewed-by: hannesw, sundar --- .../runtime/resources/Functions.properties | 48 +++++++++++++++++++ nashorn/test/script/nosecurity/JDK-8144221.js | 12 ++--- 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties index 567c7871846..91651252da1 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties @@ -42,6 +42,54 @@ Object.prototype.propertyIsEnumerable=tells whether the given property is enumer Object.bindProperties=binds the source object's properties to the target object (nashorn extension) +Array.isArray=tells whether the argument is an array + +Array.prototype.toString=returns a string representation of this array + +Array.prototype.assertNumeric=asserts that the array is numeric, throws a type error if this is not the case + +Array.prototype.toLocaleString=returns a locale-specific string representation of this array + +Array=creates a new array + +Array.prototype.concat=concatenates arrays + +Array.prototype.join=returns a string representation of the array, with a separator placed between elements + +Array.prototype.pop=returns the element from the end of the array, or undefined + +Array.prototype.push=appends an element to the end of the array + +Array.prototype.reverse=reverses the array + +Array.prototype.shift=removes the first element from the array and returns that element + +Array.prototype.slice=returns a shallow copy of a slice of the array + +Array.prototype.sort=sorts the array + +Array.prototype.splice=changes the content of the array by removing and/or adding elements + +Array.prototype.unshift=adds one or more elements to the beginning of the array + +Array.prototype.indexOf=retrieves the first index of an element in the array, or -1 if the element is not found + +Array.prototype.lastIndexOf=retrieves the last index of an element in the array, or -1 if the element is not found + +Array.prototype.every=applies a predicate to all elements of the array, returns true if the predicate evaluates to true for all + +Array.prototype.some=tests whether a predicate evaluates to true for some element in the array + +Array.prototype.forEach=applies a function to all elements in the array + +Array.prototype.map=applies a function to all elements in the array, returns the array of results + +Array.prototype.filter=returns an array with those elements from this array that match a filter function + +Array.prototype.reduce=applies a left-fold to the array and returns the result + +Array.prototype.reduceRight=applies a right-fold to the array and returns the result + Function=creates a new function with the given parameters and function body Function.prototype.toString=returns a string representation of this function diff --git a/nashorn/test/script/nosecurity/JDK-8144221.js b/nashorn/test/script/nosecurity/JDK-8144221.js index b5bf647bfac..619332de032 100644 --- a/nashorn/test/script/nosecurity/JDK-8144221.js +++ b/nashorn/test/script/nosecurity/JDK-8144221.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * Test that shebang handling works properly. * * @test - * @runif os.not.windows * @option -scripting * @run */ @@ -126,8 +125,9 @@ function insn(name) { } function run(viajjs, name, arg1, arg2) { - var prefix = viajjs ? "${jjs} -scripting " : '' - $EXEC("${prefix}./shebang.js ${arg1} ${arg2}") + var prefix = viajjs ? "${jjs} -scripting " : win ? 'sh -c "' : '', + suffix = viajjs ? '' : win ? '"' : '' + $EXEC("${prefix}./shebang.js ${arg1} ${arg2}${suffix}") print("* ${name} via ${viajjs ? 'jjs' : 'shebang'}") print($OUT.trim()) print($ERR.trim()) @@ -143,8 +143,8 @@ shebs.forEach(function(sheb) { $EXEC('chmod +x shebang.js') run(false, 'noargs', '', '') run(true, 'noargs', '', '') - run(false, 'withargs', 'a.js', '"hello world"') - run(true, 'withargs', 'a.js', '"hello world"') + run(false, 'withargs', 'a.js', "'hello world'") + run(true, 'withargs', 'a.js', "'hello world'") $EXEC('rm shebang.js') }) From a5d096be2e3c7b0ea3119ca2bff264eddfa77c77 Mon Sep 17 00:00:00 2001 From: Srinivas Dama Date: Wed, 20 Jan 2016 09:56:29 +0100 Subject: [PATCH 3/5] 8144113: enable jjs testing Reviewed-by: mhaupt, sundar --- nashorn/test/script/nosecurity/Hello.java | 34 ++++ nashorn/test/script/nosecurity/jjs-common.js | 190 ++++++++++++++++++ .../test/script/nosecurity/jjs-option-cp.js | 61 ++++++ .../nosecurity/jjs-option-cp.js.EXPECTED | 6 + .../script/nosecurity/jjs-option-define.js | 50 +++++ .../nosecurity/jjs-option-define.js.EXPECTED | 4 + .../test/script/nosecurity/jjs-option-doe.js | 61 ++++++ .../nosecurity/jjs-option-doe.js.EXPECTED | 6 + .../test/script/nosecurity/jjs-option-fv.js | 60 ++++++ .../nosecurity/jjs-option-fv.js.EXPECTED | 6 + .../test/script/nosecurity/jjs-option-fx.js | 49 +++++ .../nosecurity/jjs-option-fx.js.EXPECTED | 4 + .../test/script/nosecurity/jjs-option-lang.js | 60 ++++++ .../nosecurity/jjs-option-lang.js.EXPECTED | 6 + .../test/script/nosecurity/jjs-option-ot.js | 43 ++++ .../nosecurity/jjs-option-ot.js.EXPECTED | 4 + .../script/nosecurity/jjs-option-scripting.js | 60 ++++++ .../jjs-option-scripting.js.EXPECTED | 6 + .../script/nosecurity/jjs-option-strict.js | 55 +++++ .../nosecurity/jjs-option-strict.js.EXPECTED | 6 + .../script/nosecurity/jjs-option-version.js | 50 +++++ .../nosecurity/jjs-option-version.js.EXPECTED | 4 + 22 files changed, 825 insertions(+) create mode 100644 nashorn/test/script/nosecurity/Hello.java create mode 100644 nashorn/test/script/nosecurity/jjs-common.js create mode 100644 nashorn/test/script/nosecurity/jjs-option-cp.js create mode 100644 nashorn/test/script/nosecurity/jjs-option-cp.js.EXPECTED create mode 100644 nashorn/test/script/nosecurity/jjs-option-define.js create mode 100644 nashorn/test/script/nosecurity/jjs-option-define.js.EXPECTED create mode 100644 nashorn/test/script/nosecurity/jjs-option-doe.js create mode 100644 nashorn/test/script/nosecurity/jjs-option-doe.js.EXPECTED create mode 100644 nashorn/test/script/nosecurity/jjs-option-fv.js create mode 100644 nashorn/test/script/nosecurity/jjs-option-fv.js.EXPECTED create mode 100644 nashorn/test/script/nosecurity/jjs-option-fx.js create mode 100644 nashorn/test/script/nosecurity/jjs-option-fx.js.EXPECTED create mode 100644 nashorn/test/script/nosecurity/jjs-option-lang.js create mode 100644 nashorn/test/script/nosecurity/jjs-option-lang.js.EXPECTED create mode 100644 nashorn/test/script/nosecurity/jjs-option-ot.js create mode 100644 nashorn/test/script/nosecurity/jjs-option-ot.js.EXPECTED create mode 100644 nashorn/test/script/nosecurity/jjs-option-scripting.js create mode 100644 nashorn/test/script/nosecurity/jjs-option-scripting.js.EXPECTED create mode 100644 nashorn/test/script/nosecurity/jjs-option-strict.js create mode 100644 nashorn/test/script/nosecurity/jjs-option-strict.js.EXPECTED create mode 100644 nashorn/test/script/nosecurity/jjs-option-version.js create mode 100644 nashorn/test/script/nosecurity/jjs-option-version.js.EXPECTED diff --git a/nashorn/test/script/nosecurity/Hello.java b/nashorn/test/script/nosecurity/Hello.java new file mode 100644 index 00000000000..45879a38e1c --- /dev/null +++ b/nashorn/test/script/nosecurity/Hello.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * This is a test program used in the test jjs-option-cp.js + */ +public class Hello { + public Hello() { + } + + public String getString() { + return "hello"; + } +} diff --git a/nashorn/test/script/nosecurity/jjs-common.js b/nashorn/test/script/nosecurity/jjs-common.js new file mode 100644 index 00000000000..3ea30843a84 --- /dev/null +++ b/nashorn/test/script/nosecurity/jjs-common.js @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8144113: Nashorn: enable jjs testing. + * @subtest + * @summary test used by all other jjs-option* test cases + */ +var javaHome = $ENV.JAVA_HOME, + homeJjs = "${javaHome}/bin/jjs", + altJjs = $EXEC('which jjs').trim(), + homejavac = "${javaHome}/bin/javac", + altjavac = $EXEC('which javac').trim() + +var Files = Java.type('java.nio.file.Files'), + Paths = Java.type('java.nio.file.Paths'), + System = Java.type('java.lang.System') + +// Initialize default values for variables used in different functions +var func_cond_p = < -1 +EOD + +var func_cond_n = <<'EOD' +err.indexOf("internal") <= -1 +EOD + +// one particular test starts here +testjjs_flag_and_func("-doe", "") diff --git a/nashorn/test/script/nosecurity/jjs-option-doe.js.EXPECTED b/nashorn/test/script/nosecurity/jjs-option-doe.js.EXPECTED new file mode 100644 index 00000000000..1925827ab71 --- /dev/null +++ b/nashorn/test/script/nosecurity/jjs-option-doe.js.EXPECTED @@ -0,0 +1,6 @@ +-doe flag positive test: +flag test PASSED +functionality test PASSED +-doe flag negative test: +flag test PASSED +functionality test PASSED diff --git a/nashorn/test/script/nosecurity/jjs-option-fv.js b/nashorn/test/script/nosecurity/jjs-option-fv.js new file mode 100644 index 00000000000..2e36d0bd238 --- /dev/null +++ b/nashorn/test/script/nosecurity/jjs-option-fv.js @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8144113: Nashorn: enable jjs testing. + * @test + * @option -scripting + * @runif os.not.windows + * @run + * @summary Test if -fv flag its basic funnctionality + */ + +load(__DIR__ + "jjs-common.js") + +// code to check -flag +var msg_flag = "print($OPTIONS._fullversion)" + +// code to check basic functionality +var msg_func = < -1 +EOD + +var func_cond_n = <<'EOD' +err.indexOf("full") <= -1 +EOD + +// one particular test starts here +testjjs_flag_and_func("-fv", "") diff --git a/nashorn/test/script/nosecurity/jjs-option-fv.js.EXPECTED b/nashorn/test/script/nosecurity/jjs-option-fv.js.EXPECTED new file mode 100644 index 00000000000..e364ec60909 --- /dev/null +++ b/nashorn/test/script/nosecurity/jjs-option-fv.js.EXPECTED @@ -0,0 +1,6 @@ +-fv flag positive test: +flag test PASSED +functionality test PASSED +-fv flag negative test: +flag test PASSED +functionality test PASSED diff --git a/nashorn/test/script/nosecurity/jjs-option-fx.js b/nashorn/test/script/nosecurity/jjs-option-fx.js new file mode 100644 index 00000000000..3a5c44cfefb --- /dev/null +++ b/nashorn/test/script/nosecurity/jjs-option-fx.js @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8144113: Nashorn: enable jjs testing. + * check -fx option. + * @test + * @option -scripting + * @runif os.not.windows + * @run + * @summary Test -fx flag and its basic functionality + * the JavaFX primary stage is available to Nashorn as a global property $STAGE with -fx + * used this to check with and without -fx + */ + +load(__DIR__ + "jjs-common.js") + +var msg_flag = "print(typeof($STAGE));"; + +// flag test expected output variables +var e_outn = "undefined" + +// positive flag test condition expression string other than the default +var flag_cond_p = <<'EOD' +out != "undefined" +EOD + +// Testing starts here +testjjs_flag("-fx","") diff --git a/nashorn/test/script/nosecurity/jjs-option-fx.js.EXPECTED b/nashorn/test/script/nosecurity/jjs-option-fx.js.EXPECTED new file mode 100644 index 00000000000..92a9f2ad007 --- /dev/null +++ b/nashorn/test/script/nosecurity/jjs-option-fx.js.EXPECTED @@ -0,0 +1,4 @@ +-fx flag positive test: +flag test PASSED +-fx flag negative test: +flag test PASSED diff --git a/nashorn/test/script/nosecurity/jjs-option-lang.js b/nashorn/test/script/nosecurity/jjs-option-lang.js new file mode 100644 index 00000000000..f0ad0622d96 --- /dev/null +++ b/nashorn/test/script/nosecurity/jjs-option-lang.js @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8144113: Nashorn: enable jjs testing. + * @test + * @option -scripting + * @runif os.not.windows + * @run + * @summary Test -lang flag and its basic functionality + */ + +load(__DIR__ + "jjs-common.js") + +// code to check -flag +var msg_flag = "print($OPTIONS._es6)" + +// code to check basic functionality +var msg_func = < Date: Tue, 19 Jan 2016 20:31:40 -0800 Subject: [PATCH 4/5] 8136494: Update "@since 1.9" to "@since 9" to match java.version.specification Reviewed-by: alanb, chegar, lancea --- .../share/classes/jdk/dynalink/beans/package-info.java | 2 +- .../share/classes/jdk/dynalink/linker/package-info.java | 2 +- .../share/classes/jdk/dynalink/linker/support/package-info.java | 2 +- .../share/classes/jdk/dynalink/support/package-info.java | 2 +- .../share/classes/jdk/nashorn/api/tree/ArrayAccessTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/ArrayLiteralTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/AssignmentTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/BinaryTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/BlockTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/BreakTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/CaseTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/CatchTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/CompilationUnitTree.java | 2 +- .../classes/jdk/nashorn/api/tree/CompoundAssignmentTree.java | 2 +- .../classes/jdk/nashorn/api/tree/ConditionalExpressionTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/ConditionalLoopTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/ContinueTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/DebuggerTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/Diagnostic.java | 2 +- .../share/classes/jdk/nashorn/api/tree/DiagnosticListener.java | 2 +- .../share/classes/jdk/nashorn/api/tree/DoWhileLoopTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/EmptyStatementTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/ErroneousTree.java | 2 +- .../classes/jdk/nashorn/api/tree/ExpressionStatementTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/ExpressionTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/ForInLoopTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/ForLoopTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/FunctionCallTree.java | 2 +- .../classes/jdk/nashorn/api/tree/FunctionDeclarationTree.java | 2 +- .../classes/jdk/nashorn/api/tree/FunctionExpressionTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/GotoTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/IdentifierTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/IfTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/InstanceOfTree.java | 2 +- .../classes/jdk/nashorn/api/tree/LabeledStatementTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/LineMap.java | 2 +- .../share/classes/jdk/nashorn/api/tree/LiteralTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/LoopTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/MemberSelectTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/NewTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/ObjectLiteralTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/ParenthesizedTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/Parser.java | 2 +- .../share/classes/jdk/nashorn/api/tree/PropertyTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/RegExpLiteralTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/ReturnTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/StatementTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/SwitchTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/ThrowTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/Tree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/TreeVisitor.java | 2 +- .../share/classes/jdk/nashorn/api/tree/TryTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/UnaryTree.java | 2 +- .../classes/jdk/nashorn/api/tree/UnknownTreeException.java | 2 +- .../share/classes/jdk/nashorn/api/tree/VariableTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/WhileLoopTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/WithTree.java | 2 +- .../share/classes/jdk/nashorn/api/tree/package-info.java | 2 +- 58 files changed, 58 insertions(+), 58 deletions(-) diff --git a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/package-info.java b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/package-info.java index 0f154617309..806955ea755 100644 --- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/package-info.java +++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/package-info.java @@ -83,6 +83,6 @@ /** * Contains the linker for ordinary Java objects. - * @since 1.9 + * @since 9 */ package jdk.dynalink.beans; diff --git a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/package-info.java b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/package-info.java index ab71a0a98fb..fda777fff01 100644 --- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/package-info.java +++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/package-info.java @@ -111,6 +111,6 @@ * implement the {@link jdk.dynalink.linker.GuardingTypeConverterFactory} * interface to provide the logic for these conversions. *

- * @since 1.9 + * @since 9 */ package jdk.dynalink.linker; diff --git a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/package-info.java b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/package-info.java index b5726e851c4..8d35717d6b6 100644 --- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/package-info.java +++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/package-info.java @@ -87,6 +87,6 @@ * by providing basic implementations of some classes as well as various * utilities. *

- * @since 1.9 + * @since 9 */ package jdk.dynalink.linker.support; diff --git a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/support/package-info.java b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/support/package-info.java index f2fe698be5a..d8a2d46ae1b 100644 --- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/support/package-info.java +++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/support/package-info.java @@ -85,6 +85,6 @@ *

Contains classes that make using Dynalink more convenient by providing * basic implementations of some classes as well as various utilities. *

- * @since 1.9 + * @since 9 */ package jdk.dynalink.support; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayAccessTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayAccessTree.java index a1373a3f197..4fda2dc91d8 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayAccessTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayAccessTree.java @@ -33,7 +33,7 @@ package jdk.nashorn.api.tree; * expression [ index ] * * - * @since 1.9 + * @since 9 */ public interface ArrayAccessTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayLiteralTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayLiteralTree.java index 327b585d4ac..f6ed2211f83 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayLiteralTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayLiteralTree.java @@ -30,7 +30,7 @@ import java.util.List; /** * Represents ECMAScript array literal expression. * - * @since 1.9 + * @since 9 */ public interface ArrayLiteralTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/AssignmentTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/AssignmentTree.java index 8199aefd3d0..5999cc71a8f 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/AssignmentTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/AssignmentTree.java @@ -33,7 +33,7 @@ package jdk.nashorn.api.tree; * variable = expression * * - * @since 1.9 + * @since 9 */ public interface AssignmentTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BinaryTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BinaryTree.java index 84187c23dca..ecc80727786 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BinaryTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BinaryTree.java @@ -34,7 +34,7 @@ package jdk.nashorn.api.tree; * leftOperand operator rightOperand * * - * @since 1.9 + * @since 9 */ public interface BinaryTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BlockTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BlockTree.java index efc6d86a7ec..afb7f1cd0ba 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BlockTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BlockTree.java @@ -37,7 +37,7 @@ import java.util.List; * { statements } * * - * @since 1.9 + * @since 9 */ public interface BlockTree extends StatementTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BreakTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BreakTree.java index cdf7297a37a..81d606778c3 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BreakTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BreakTree.java @@ -35,7 +35,7 @@ package jdk.nashorn.api.tree; * break label ; * * - * @since 1.9 + * @since 9 */ public interface BreakTree extends GotoTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CaseTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CaseTree.java index 4d8578dd203..b01d1984b22 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CaseTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CaseTree.java @@ -39,7 +39,7 @@ import java.util.List; * statements * * - * @since 1.9 + * @since 9 */ public interface CaseTree extends Tree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CatchTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CatchTree.java index ac9b2af2139..87e30ae9428 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CatchTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CatchTree.java @@ -34,7 +34,7 @@ package jdk.nashorn.api.tree; * block * * - * @since 1.9 + * @since 9 */ public interface CatchTree extends Tree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompilationUnitTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompilationUnitTree.java index 0f69ad64441..472e451f05f 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompilationUnitTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompilationUnitTree.java @@ -31,7 +31,7 @@ import java.util.List; * Represents the abstract syntax tree for compilation units (source * files) * - * @since 1.9 + * @since 9 */ public interface CompilationUnitTree extends Tree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompoundAssignmentTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompoundAssignmentTree.java index 66d4e990de3..b181759ed54 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompoundAssignmentTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompoundAssignmentTree.java @@ -34,7 +34,7 @@ package jdk.nashorn.api.tree; * variable operator expression * * - * @since 1.9 + * @since 9 */ public interface CompoundAssignmentTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalExpressionTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalExpressionTree.java index 0eb16e1016a..459682fedb8 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalExpressionTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalExpressionTree.java @@ -33,7 +33,7 @@ package jdk.nashorn.api.tree; * condition ? trueExpression : falseExpression * * - * @since 1.9 + * @since 9 */ public interface ConditionalExpressionTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalLoopTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalLoopTree.java index 103ce58c44a..10031edeec4 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalLoopTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalLoopTree.java @@ -28,7 +28,7 @@ package jdk.nashorn.api.tree; /** * A mixin for conditional "loop" statements. * - * @since 1.9 + * @since 9 */ public interface ConditionalLoopTree extends LoopTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ContinueTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ContinueTree.java index e1c7d4262e4..6be05bd3749 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ContinueTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ContinueTree.java @@ -34,7 +34,7 @@ package jdk.nashorn.api.tree; * continue label ; * * - * @since 1.9 + * @since 9 */ public interface ContinueTree extends GotoTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DebuggerTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DebuggerTree.java index 70a98923234..625ca0dba25 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DebuggerTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DebuggerTree.java @@ -33,7 +33,7 @@ package jdk.nashorn.api.tree; * debugger; * * - * @since 1.9 + * @since 9 */ public interface DebuggerTree extends StatementTree { } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Diagnostic.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Diagnostic.java index 5eae67eaadd..3ca43457c6c 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Diagnostic.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Diagnostic.java @@ -40,7 +40,7 @@ package jdk.nashorn.api.tree; *

Line terminator is as defined in ECMAScript specification which is one * of { \u000A, \u000B, \u2028, \u2029 }. * - * @since 1.9 + * @since 9 */ public interface Diagnostic { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DiagnosticListener.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DiagnosticListener.java index a79829f9829..e0053a7950a 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DiagnosticListener.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DiagnosticListener.java @@ -28,7 +28,7 @@ package jdk.nashorn.api.tree; /** * Interface for receiving diagnostics from Nashorn parser. * - * @since 1.9 + * @since 9 */ @FunctionalInterface public interface DiagnosticListener { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTree.java index de4d848fe73..45f4a8abddb 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTree.java @@ -35,7 +35,7 @@ package jdk.nashorn.api.tree; * while ( expression ); * * - * @since 1.9 + * @since 9 */ public interface DoWhileLoopTree extends ConditionalLoopTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/EmptyStatementTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/EmptyStatementTree.java index 280ae6db867..5f499924919 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/EmptyStatementTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/EmptyStatementTree.java @@ -33,6 +33,6 @@ package jdk.nashorn.api.tree; * ; * * - * @since 1.9 + * @since 9 */ public interface EmptyStatementTree extends StatementTree {} diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ErroneousTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ErroneousTree.java index eb7805114aa..dd0c95a6d5f 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ErroneousTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ErroneousTree.java @@ -28,7 +28,7 @@ package jdk.nashorn.api.tree; /** * A tree node to stand in for a malformed expression. * - * @since 1.9 + * @since 9 */ public interface ErroneousTree extends ExpressionTree { } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionStatementTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionStatementTree.java index 8881031db57..dbf09a59d5f 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionStatementTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionStatementTree.java @@ -33,7 +33,7 @@ package jdk.nashorn.api.tree; * expression ; * * - * @since 1.9 + * @since 9 */ public interface ExpressionStatementTree extends StatementTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionTree.java index 7fa88a17541..6076ba07775 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionTree.java @@ -29,6 +29,6 @@ package jdk.nashorn.api.tree; * A tree node used as the base class for the different types of * expressions. * - * @since 1.9 + * @since 9 */ public interface ExpressionTree extends Tree {} diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTree.java index 84a91558501..302a4f53dd5 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTree.java @@ -34,7 +34,7 @@ package jdk.nashorn.api.tree; * statement * * - * @since 1.9 + * @since 9 */ public interface ForInLoopTree extends LoopTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForLoopTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForLoopTree.java index 83fc3904e9c..1e260a8e3df 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForLoopTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForLoopTree.java @@ -34,7 +34,7 @@ package jdk.nashorn.api.tree; * statement * * - * @since 1.9 + * @since 9 */ public interface ForLoopTree extends ConditionalLoopTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionCallTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionCallTree.java index 82a0651ff61..38ee487d400 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionCallTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionCallTree.java @@ -37,7 +37,7 @@ import java.util.List; * this . identifier ( arguments ) * * - * @since 1.9 + * @since 9 */ public interface FunctionCallTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTree.java index 345346873fd..1fbd0945c8f 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTree.java @@ -37,7 +37,7 @@ import java.util.List; * body * * - * @since 1.9 + * @since 9 */ public interface FunctionDeclarationTree extends StatementTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTree.java index 260eef9c555..13a89bdadbd 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTree.java @@ -37,7 +37,7 @@ import java.util.List; * body * * - * @since 1.9 + * @since 9 */ public interface FunctionExpressionTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/GotoTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/GotoTree.java index 4c77ad47f0c..b08484c4d4f 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/GotoTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/GotoTree.java @@ -31,7 +31,7 @@ package jdk.nashorn.api.tree; * type serves as a super interface for {@link BreakTree} and * {@link ContinueTree}. * - * @since 1.9 + * @since 9 */ public interface GotoTree extends StatementTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IdentifierTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IdentifierTree.java index 8af19227f2d..95498572e86 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IdentifierTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IdentifierTree.java @@ -33,7 +33,7 @@ package jdk.nashorn.api.tree; * name * * - * @since 1.9 + * @since 9 */ public interface IdentifierTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IfTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IfTree.java index d0ffebfb040..a1a65691dd0 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IfTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IfTree.java @@ -39,7 +39,7 @@ package jdk.nashorn.api.tree; * elseStatement * * - * @since 1.9 + * @since 9 */ public interface IfTree extends StatementTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTree.java index 7eb4506430e..5b72ead221b 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTree.java @@ -33,7 +33,7 @@ package jdk.nashorn.api.tree; * expression instanceof type * * - * @since 1.9 + * @since 9 */ public interface InstanceOfTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LabeledStatementTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LabeledStatementTree.java index dd2c6433d88..3b009fff56d 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LabeledStatementTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LabeledStatementTree.java @@ -33,7 +33,7 @@ package jdk.nashorn.api.tree; * label : statement * * - * @since 1.9 + * @since 9 */ public interface LabeledStatementTree extends StatementTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LineMap.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LineMap.java index 3a4f050ff52..042df249be3 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LineMap.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LineMap.java @@ -29,7 +29,7 @@ package jdk.nashorn.api.tree; * Provides methods to convert between character positions and line numbers * for a compilation unit. * - * @since 1.9 + * @since 9 */ public interface LineMap { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LiteralTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LiteralTree.java index 5ec1c327c7b..b1c94f72f91 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LiteralTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LiteralTree.java @@ -34,7 +34,7 @@ package jdk.nashorn.api.tree; * value * * - * @since 1.9 + * @since 9 */ public interface LiteralTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LoopTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LoopTree.java index 97687059831..54f7e3973ad 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LoopTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LoopTree.java @@ -28,7 +28,7 @@ package jdk.nashorn.api.tree; /** * A mixin for "loop" statements. * - * @since 1.9 + * @since 9 */ public interface LoopTree extends StatementTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/MemberSelectTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/MemberSelectTree.java index d145737d4db..61fd6f1a70c 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/MemberSelectTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/MemberSelectTree.java @@ -33,7 +33,7 @@ package jdk.nashorn.api.tree; * expression . identifier * * - * @since 1.9 + * @since 9 */ public interface MemberSelectTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTree.java index ecad024d42d..35e51ac5378 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTree.java @@ -35,7 +35,7 @@ package jdk.nashorn.api.tree; * new identifier ( arguments ) * * - * @since 1.9 + * @since 9 */ public interface NewTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ObjectLiteralTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ObjectLiteralTree.java index f287786a41e..35c745e9fff 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ObjectLiteralTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ObjectLiteralTree.java @@ -30,7 +30,7 @@ import java.util.List; /** * Represents ECMAScript object literal expression. * - * @since 1.9 + * @since 9 */ public interface ObjectLiteralTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParenthesizedTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParenthesizedTree.java index d90bc8c8d9e..8a840d4c035 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParenthesizedTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParenthesizedTree.java @@ -34,7 +34,7 @@ package jdk.nashorn.api.tree; * ( expression ) * * - * @since 1.9 + * @since 9 */ public interface ParenthesizedTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java index 10bbebe2639..63a1bad3a91 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java @@ -36,7 +36,7 @@ import jdk.nashorn.api.scripting.ScriptObjectMirror; /** * Represents nashorn ECMAScript parser instance. * - * @since 1.9 + * @since 9 */ public interface Parser { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/PropertyTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/PropertyTree.java index fed1e42d1ed..0b4af44ce4b 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/PropertyTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/PropertyTree.java @@ -28,7 +28,7 @@ package jdk.nashorn.api.tree; /** * To represent property setting in an object literal tree. * - * @since 1.9 + * @since 9 */ public interface PropertyTree extends Tree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTree.java index 2b09e5233ce..d3729e47dd8 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTree.java @@ -28,7 +28,7 @@ package jdk.nashorn.api.tree; /** * Represents regular expression literal in the source code. * - * @since 1.9 + * @since 9 */ public interface RegExpLiteralTree extends Tree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ReturnTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ReturnTree.java index 765c9d713a7..b8d2dc8e9c8 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ReturnTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ReturnTree.java @@ -34,7 +34,7 @@ package jdk.nashorn.api.tree; * return expression; * * - * @since 1.9 + * @since 9 */ public interface ReturnTree extends StatementTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/StatementTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/StatementTree.java index 7dc58da667d..a62d463a0f8 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/StatementTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/StatementTree.java @@ -29,7 +29,7 @@ package jdk.nashorn.api.tree; * A tree node used as the base class for the different kinds of * statements. * - * @since 1.9 + * @since 9 */ public interface StatementTree extends Tree { } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTree.java index 3c9da0e773e..0f70dd5c8a8 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTree.java @@ -37,7 +37,7 @@ import java.util.List; * } * * - * @since 1.9 + * @since 9 */ public interface SwitchTree extends StatementTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ThrowTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ThrowTree.java index c1f0a679a3c..230b5b6f901 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ThrowTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ThrowTree.java @@ -33,7 +33,7 @@ package jdk.nashorn.api.tree; * throw expression; * * - * @since 1.9 + * @since 9 */ public interface ThrowTree extends StatementTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Tree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Tree.java index 13cd6f88266..6b3de2c3591 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Tree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Tree.java @@ -31,7 +31,7 @@ package jdk.nashorn.api.tree; *

WARNING: This interface and its sub-interfaces are * subject to change as the ECMAScript programming language evolves. * - * @since 1.9 + * @since 9 */ public interface Tree { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeVisitor.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeVisitor.java index f97b5208e39..c9c8a9666d8 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeVisitor.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeVisitor.java @@ -51,7 +51,7 @@ package jdk.nashorn.api.tree; * methods. Use {@code Void} for visitors that do not need an * additional parameter. * - * @since 1.9 + * @since 9 */ public interface TreeVisitor { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TryTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TryTree.java index 583d560900a..e6b6bb8f89a 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TryTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TryTree.java @@ -39,7 +39,7 @@ import java.util.List; * finallyBlock * * - * @since 1.9 + * @since 9 */ public interface TryTree extends StatementTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnaryTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnaryTree.java index 16fb334402b..2e57ad81962 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnaryTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnaryTree.java @@ -36,7 +36,7 @@ package jdk.nashorn.api.tree; * expression operator * * - * @since 1.9 + * @since 9 */ public interface UnaryTree extends ExpressionTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnknownTreeException.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnknownTreeException.java index 0a801b8fbfb..00f65cd9d19 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnknownTreeException.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnknownTreeException.java @@ -33,7 +33,7 @@ package jdk.nashorn.api.tree; * {@linkplain TreeVisitor tree visitor} to indicate that the * visitor was created for a prior version of the language. * - * @since 1.9 + * @since 9 */ public class UnknownTreeException extends RuntimeException { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/VariableTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/VariableTree.java index 2fd4d427b16..8697360b9bc 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/VariableTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/VariableTree.java @@ -33,7 +33,7 @@ package jdk.nashorn.api.tree; * var name initializer ; * * - * @since 1.9 + * @since 9 */ public interface VariableTree extends StatementTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTree.java index 63fb01a5fbc..a345e503ba2 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTree.java @@ -34,7 +34,7 @@ package jdk.nashorn.api.tree; * statement * * - * @since 1.9 + * @since 9 */ public interface WhileLoopTree extends ConditionalLoopTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WithTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WithTree.java index 684498ca65b..a7af282393b 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WithTree.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WithTree.java @@ -34,7 +34,7 @@ package jdk.nashorn.api.tree; * statement * * - * @since 1.9 + * @since 9 */ public interface WithTree extends StatementTree { /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/package-info.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/package-info.java index 725856c447f..832de0b0596 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/package-info.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/package-info.java @@ -68,7 +68,7 @@ * * * - * @since 1.9 + * @since 9 */ package jdk.nashorn.api.tree; From fdfdf19e75b6982efd9609b797400f679a687d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Thu, 21 Jan 2016 16:31:27 +0100 Subject: [PATCH 5/5] 8147845: Varargs Array functions still leaking longs Reviewed-by: mhaupt, sundar --- .../internal/codegen/FoldConstants.java | 2 +- .../nashorn/internal/objects/NativeArray.java | 9 ++-- .../jdk/nashorn/internal/runtime/JSType.java | 24 ++++------ nashorn/test/script/basic/JDK-8147845.js | 44 +++++++++++++++++++ 4 files changed, 58 insertions(+), 21 deletions(-) create mode 100644 nashorn/test/script/basic/JDK-8147845.js diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java index f79be1dafaa..c288e80bb89 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java @@ -335,7 +335,7 @@ final class FoldConstants extends SimpleNodeVisitor implements Loggable { break; case SHR: final long result = JSType.toUint32(lhs.getInt32() >>> rhs.getInt32()); - return LiteralNode.newInstance(token, finish, JSType.isRepresentableAsInt(result) ? (int) result : (double) result); + return LiteralNode.newInstance(token, finish, JSType.toNarrowestNumber(result)); case SAR: return LiteralNode.newInstance(token, finish, lhs.getInt32() >> rhs.getInt32()); case SHL: diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java index 4441dd8bed8..6773840a0a8 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java @@ -70,7 +70,6 @@ import jdk.nashorn.internal.runtime.arrays.ArrayIndex; import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator; import jdk.nashorn.internal.runtime.arrays.ContinuousArrayData; import jdk.nashorn.internal.runtime.arrays.IntElements; -import jdk.nashorn.internal.runtime.arrays.IntOrLongElements; import jdk.nashorn.internal.runtime.arrays.IteratorAction; import jdk.nashorn.internal.runtime.arrays.NumericElements; import jdk.nashorn.internal.runtime.linker.Bootstrap; @@ -285,7 +284,7 @@ public final class NativeArray extends ScriptObject implements OptimisticBuiltin final long newLen = NativeArray.validLength(newLenDesc.getValue()); // Step 3e - note that we need to convert to int or double as long is not considered a JS number type anymore - newLenDesc.setValue(JSType.isRepresentableAsInt(newLen) ? Integer.valueOf((int) newLen) : Double.valueOf((double) newLen)); + newLenDesc.setValue(JSType.toNarrowestNumber(newLen)); // Step 3f // increasing array length - just need to set new length value (and attributes if any) and return @@ -1043,7 +1042,7 @@ public final class NativeArray extends ScriptObject implements OptimisticBuiltin if (bulkable(sobj) && sobj.getArray().length() + args.length <= JSType.MAX_UINT) { final ArrayData newData = sobj.getArray().push(true, args); sobj.setArray(newData); - return newData.length(); + return JSType.toNarrowestNumber(newData.length()); } long len = JSType.toUint32(sobj.getLength()); @@ -1052,7 +1051,7 @@ public final class NativeArray extends ScriptObject implements OptimisticBuiltin } sobj.set("length", len, CALLSITE_STRICT); - return len; + return JSType.toNarrowestNumber(len); } catch (final ClassCastException | NullPointerException e) { throw typeError(Context.getGlobal(), e, "not.an.object", ScriptRuntime.safeToString(self)); } @@ -1471,7 +1470,7 @@ public final class NativeArray extends ScriptObject implements OptimisticBuiltin final long newLength = len + items.length; sobj.set("length", newLength, CALLSITE_STRICT); - return newLength; + return JSType.toNarrowestNumber(newLength); } /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java index b791acd92d1..22925e8a0c4 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java @@ -791,6 +791,15 @@ public enum JSType { return Double.NaN; } + /** + * Convert a long to the narrowest JavaScript Number type. This returns either a + * {@link Integer} or {@link Double} depending on the magnitude of {@code l}. + * @param l a long value + * @return the value converted to Integer or Double + */ + public static Number toNarrowestNumber(final long l) { + return isRepresentableAsInt(l) ? Integer.valueOf((int) l) : Double.valueOf((double) l); + } /** * JavaScript compliant conversion of Boolean to number @@ -1726,21 +1735,6 @@ public enum JSType { } } - /** - * Returns the boxed version of a primitive class - * @param clazz the class - * @return the boxed type of clazz, or unchanged if not primitive - */ - public static Class getBoxedClass(final Class clazz) { - if (clazz == int.class) { - return Integer.class; - } else if (clazz == double.class) { - return Double.class; - } - assert !clazz.isPrimitive(); - return clazz; - } - /** * Create a method handle constant of the correct primitive type * for a constant object diff --git a/nashorn/test/script/basic/JDK-8147845.js b/nashorn/test/script/basic/JDK-8147845.js new file mode 100644 index 00000000000..87dbb50b22c --- /dev/null +++ b/nashorn/test/script/basic/JDK-8147845.js @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8147845: Varargs Array functions still leaking longs + * + * @test + * @run + */ + +Assert.assertTrue([].push() === 0); +Assert.assertTrue([].unshift() === 0); +Assert.assertTrue(typeof [].push() === 'number'); +Assert.assertTrue(typeof [].unshift() === 'number'); + +Assert.assertTrue([].push(1, 2, 3) === 3); +Assert.assertTrue([].unshift(1, 2, 3) === 3); +Assert.assertTrue(typeof [].push(1, 2, 3) === 'number'); +Assert.assertTrue(typeof [].unshift(1, 2, 3) === 'number'); + +Assert.assertTrue([].push(1) === 1); +Assert.assertTrue([].unshift(1) === 1); +Assert.assertTrue(typeof [].push(1) === 'number'); +Assert.assertTrue(typeof [].unshift(1) === 'number');