Mon, 01 Jul 2013 17:21:09 +0530
8019482: Number("0x0.0p0") should evaluate to NaN
Reviewed-by: lagergren
1.1 --- a/src/jdk/nashorn/internal/objects/NativeError.java Mon Jul 01 14:15:07 2013 +0530 1.2 +++ b/src/jdk/nashorn/internal/objects/NativeError.java Mon Jul 01 17:21:09 2013 +0530 1.3 @@ -30,10 +30,7 @@ 1.4 1.5 import java.lang.invoke.MethodHandle; 1.6 import java.lang.invoke.MethodHandles; 1.7 -import java.util.ArrayList; 1.8 -import java.util.List; 1.9 import jdk.nashorn.api.scripting.NashornException; 1.10 -import jdk.nashorn.internal.codegen.CompilerConstants; 1.11 import jdk.nashorn.internal.lookup.MethodHandleFactory; 1.12 import jdk.nashorn.internal.objects.annotations.Attribute; 1.13 import jdk.nashorn.internal.objects.annotations.Constructor; 1.14 @@ -41,7 +38,6 @@ 1.15 import jdk.nashorn.internal.objects.annotations.Property; 1.16 import jdk.nashorn.internal.objects.annotations.ScriptClass; 1.17 import jdk.nashorn.internal.objects.annotations.Where; 1.18 -import jdk.nashorn.internal.runtime.ECMAErrors; 1.19 import jdk.nashorn.internal.runtime.ECMAException; 1.20 import jdk.nashorn.internal.runtime.JSType; 1.21 import jdk.nashorn.internal.runtime.PropertyMap; 1.22 @@ -123,6 +119,7 @@ 1.23 * Nashorn extension: Error.captureStackTrace. Capture stack trace at the point of call into the Error object provided. 1.24 * 1.25 * @param self self reference 1.26 + * @return undefined 1.27 */ 1.28 @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) 1.29 public static Object captureStackTrace(final Object self, final Object errorObj) {
2.1 --- a/src/jdk/nashorn/internal/runtime/ECMAException.java Mon Jul 01 14:15:07 2013 +0530 2.2 +++ b/src/jdk/nashorn/internal/runtime/ECMAException.java Mon Jul 01 17:21:09 2013 +0530 2.3 @@ -51,7 +51,7 @@ 2.4 /** Field handle to the{@link ECMAException#thrown} field, so that it can be accessed from generated code */ 2.5 public static final FieldAccess THROWN = virtualField(ECMAException.class, "thrown", Object.class); 2.6 2.7 - public static final String EXCEPTION_PROPERTY = "nashornException"; 2.8 + private static final String EXCEPTION_PROPERTY = "nashornException"; 2.9 2.10 /** Object thrown. */ 2.11 public final Object thrown;
3.1 --- a/src/jdk/nashorn/internal/runtime/JSType.java Mon Jul 01 14:15:07 2013 +0530 3.2 +++ b/src/jdk/nashorn/internal/runtime/JSType.java Mon Jul 01 17:21:09 2013 +0530 3.3 @@ -911,7 +911,7 @@ 3.4 3.5 for (int i = start; i < length ; i++) { 3.6 if (digit(chars[i], radix) == -1) { 3.7 - break; 3.8 + return Double.NaN; 3.9 } 3.10 pos++; 3.11 }
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/test/script/basic/JDK-8019482.js Mon Jul 01 17:21:09 2013 +0530 4.3 @@ -0,0 +1,41 @@ 4.4 +/* 4.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 + * 4.8 + * This code is free software; you can redistribute it and/or modify it 4.9 + * under the terms of the GNU General Public License version 2 only, as 4.10 + * published by the Free Software Foundation. 4.11 + * 4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.15 + * version 2 for more details (a copy is included in the LICENSE file that 4.16 + * accompanied this code). 4.17 + * 4.18 + * You should have received a copy of the GNU General Public License version 4.19 + * 2 along with this work; if not, write to the Free Software Foundation, 4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.21 + * 4.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.23 + * or visit www.oracle.com if you need additional information or have any 4.24 + * questions. 4.25 + */ 4.26 + 4.27 +/** 4.28 + * JDK-8019482: Number("0x0.0p0") should evaluate to NaN 4.29 + * 4.30 + * @test 4.31 + * @run 4.32 + */ 4.33 + 4.34 +function checkHexLiteral(str) { 4.35 + if (! isNaN(Number(str))) { 4.36 + fail("Number(" + str + ") is not NaN"); 4.37 + } 4.38 +} 4.39 + 4.40 +checkHexLiteral("0x0.0"); 4.41 +checkHexLiteral("0x0.0p"); 4.42 +checkHexLiteral("0x12tu"); 4.43 +checkHexLiteral("0x12.2e22"); 4.44 +checkHexLiteral("0xtu");