sundar@60: /* sundar@60: * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. sundar@60: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. attila@962: * sundar@60: * This code is free software; you can redistribute it and/or modify it sundar@60: * under the terms of the GNU General Public License version 2 only, as sundar@60: * published by the Free Software Foundation. attila@962: * sundar@60: * This code is distributed in the hope that it will be useful, but WITHOUT sundar@60: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or sundar@60: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License sundar@60: * version 2 for more details (a copy is included in the LICENSE file that sundar@60: * accompanied this code). attila@962: * sundar@60: * You should have received a copy of the GNU General Public License version sundar@60: * 2 along with this work; if not, write to the Free Software Foundation, sundar@60: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. attila@962: * sundar@60: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA sundar@60: * or visit www.oracle.com if you need additional information or have any sundar@60: * questions. sundar@60: */ sundar@60: sundar@34: /** sundar@34: * JDK-8006424 : Passing null or undefined to adapter class constructors results in NPE or ClassCastException sundar@34: * sundar@34: * @test sundar@34: * @run sundar@34: */ sundar@34: sundar@34: function check(callback) { sundar@34: try { sundar@34: callback(); sundar@34: fail("should have thrown exception"); sundar@34: } catch (e) { sundar@34: if (! (e instanceof TypeError)) { sundar@34: fail("TypeError expected, but got " + e); sundar@34: } sundar@34: } sundar@34: } sundar@34: sundar@34: check(function() { new java.lang.ClassLoader(null) }); sundar@34: check(function() { new java.lang.ClassLoader(undefined) }); sundar@34: check(function() { new java.lang.Runnable(null) }); sundar@34: check(function() { new java.lang.Runnable(undefined) });