test/script/basic/JDK-8059443.js

Mon, 03 Nov 2014 09:49:52 +0100

author
attila
date
Mon, 03 Nov 2014 09:49:52 +0100
changeset 1090
99571b7922c0
permissions
-rw-r--r--

8059443: NPE when unboxing return values
Reviewed-by: lagergren, sundar

attila@1090 1 /*
attila@1090 2 * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
attila@1090 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
attila@1090 4 *
attila@1090 5 * This code is free software; you can redistribute it and/or modify it
attila@1090 6 * under the terms of the GNU General Public License version 2 only, as
attila@1090 7 * published by the Free Software Foundation.
attila@1090 8 *
attila@1090 9 * This code is distributed in the hope that it will be useful, but WITHOUT
attila@1090 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
attila@1090 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
attila@1090 12 * version 2 for more details (a copy is included in the LICENSE file that
attila@1090 13 * accompanied this code).
attila@1090 14 *
attila@1090 15 * You should have received a copy of the GNU General Public License version
attila@1090 16 * 2 along with this work; if not, write to the Free Software Foundation,
attila@1090 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
attila@1090 18 *
attila@1090 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
attila@1090 20 * or visit www.oracle.com if you need additional information or have any
attila@1090 21 * questions.
attila@1090 22 */
attila@1090 23
attila@1090 24 /**
attila@1090 25 * JDK-8059443: NPE when unboxing return values
attila@1090 26 *
attila@1090 27 * NOTE: this test can only pass when running with a JDK where
attila@1090 28 * JDK-8060483 is also fixed (9b37 or later).
attila@1090 29 *
attila@1090 30 * @test
attila@1090 31 * @run
attila@1090 32 */
attila@1090 33
attila@1090 34 var NullProvider = Java.type("jdk.nashorn.test.models.NullProvider");
attila@1090 35
attila@1090 36 if (!NullProvider.getBoolean()) { print("yay"); }
attila@1090 37 print(NullProvider.getLong() * (1 << 33));
attila@1090 38 print(NullProvider.getDouble() / 2.5);
attila@1090 39 print(NullProvider.getInteger() << 1);

mercurial