nashorn/test/script/basic/JDK-8006424.js
author lagergren
Mon, 04 Feb 2013 16:20:05 +0100
changeset 16210 8ad1381b69d0
parent 16204 c53eef0eb729
permissions -rw-r--r--
8007215: Varargs broken for the case of passing more than the arg limit arguments. Reviewed-by: jlaskey, attila
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16204
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
     1
/*
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
     2
 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
     4
 * 
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
     7
 * published by the Free Software Foundation.
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
     8
 * 
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    13
 * accompanied this code).
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    14
 * 
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    18
 * 
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    21
 * questions.
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    22
 */
c53eef0eb729 8007140: Java.extend crashes when attempting to extend java.lang.Object
sundar
parents: 16178
diff changeset
    23
16178
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    24
/**
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    25
 * JDK-8006424 : Passing null or undefined to adapter class constructors results in NPE or ClassCastException
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    26
 *
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    27
 * @test
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    28
 * @run
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    29
 */
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    30
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    31
function check(callback) {
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    32
    try {
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    33
        callback();
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    34
        fail("should have thrown exception");
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    35
    } catch (e) {
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    36
        if (! (e instanceof TypeError)) {
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    37
            fail("TypeError expected, but got " + e);
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    38
        }
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    39
    }
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    40
}
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    41
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    42
check(function() { new java.lang.ClassLoader(null) });
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    43
check(function() { new java.lang.ClassLoader(undefined) });
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    44
check(function() { new java.lang.Runnable(null) });
2704dd3b2691 8006424: Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar
parents:
diff changeset
    45
check(function() { new java.lang.Runnable(undefined) });