nashorn/test/script/basic/JDK-8066226.js
author hannesw
Fri, 03 Feb 2017 13:28:00 +0100
changeset 43555 1bb10bccf057
parent 28127 08a5e0d3248d
permissions -rw-r--r--
8173888: Test for JDK-8169481 causes stack overflows in parser tests Reviewed-by: jlaskey, sundar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28127
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
     1
/*
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
     4
 * 
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
     7
 * published by the Free Software Foundation.
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
     8
 * 
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    13
 * accompanied this code).
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    14
 * 
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    18
 * 
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    21
 * questions.
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    22
 */
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    23
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    24
/**
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    25
 *
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    26
 JDK-8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    27
 *
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    28
 * @test
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    29
 * @run
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    30
 */
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    31
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    32
Object.defineProperty(Object.prototype, "accessor", {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    33
    set: function(value) {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    34
        print("Setting accessor on " + this + " to " + value);
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    35
    }
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    36
});
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    37
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    38
Object.defineProperty(Object.prototype, "getterOnly", {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    39
    get: function() {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    40
        return 1;
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    41
    }
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    42
});
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    43
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    44
function set(o) {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    45
    print("set(" + o + ")");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    46
    o.foo = 1;
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    47
    o.constructor = 1;
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    48
    o.accessor = 1;
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    49
    o.getterOnly = 1;
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    50
    print();
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    51
}
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    52
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    53
function setStrict(o) {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    54
    "use strict";
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    55
    print("setStrict(" + o + ")")
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    56
    try {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    57
        o.foo = 1;
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    58
    } catch (e) {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    59
        print(e);
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    60
    }
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    61
    try {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    62
        o.constructor = 1;
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    63
    } catch (e) {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    64
        print(e);
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    65
    }
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    66
    try {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    67
        o.accessor = 1;
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    68
    } catch (e) {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    69
        print(e);
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    70
    }
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    71
    try {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    72
        o.getterOnly = 1;
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    73
    } catch (e) {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    74
        print(e);
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    75
    }
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    76
    print();
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    77
}
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    78
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    79
function setAttr(o, id) {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    80
    print("setAttr(" + o + ", " + id + ")")
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    81
    o[id] = 1;
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    82
    print();
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    83
}
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    84
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    85
function setAttrStrict(o, id) {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    86
    "use strict";
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    87
    print("setAttrStrict(" + o + ", " + id + ")")
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    88
    try {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    89
        o[id] = 1;
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    90
    } catch (e) {
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    91
        print(e);
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    92
    }
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    93
    print();
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    94
}
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    95
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    96
set(1);
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    97
set("str");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    98
set(true);
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
    99
set({});
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   100
set([]);
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   101
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   102
setStrict(1);
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   103
setStrict("str");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   104
setStrict(true);
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   105
setStrict({});
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   106
setStrict([]);
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   107
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   108
setAttr(1, "foo");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   109
setAttr(1, "constructor");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   110
setAttr(1, "accessor");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   111
setAttr(1, "getterOnly");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   112
setAttr("str", "foo");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   113
setAttr("str", "constructor");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   114
setAttr("str", "accessor");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   115
setAttr("str", "getterOnly");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   116
setAttr(true, "foo");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   117
setAttr(true, "constructor");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   118
setAttr(true, "accessor");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   119
setAttr(true, "getterOnly");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   120
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   121
setAttrStrict(1, "foo");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   122
setAttrStrict(1, "constructor");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   123
setAttrStrict(1, "accessor");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   124
setAttrStrict(1, "getterOnly");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   125
setAttrStrict("str", "foo");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   126
setAttrStrict("str", "constructor");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   127
setAttrStrict("str", "accessor");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   128
setAttrStrict("str", "getterOnly");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   129
setAttrStrict(true, "foo");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   130
setAttrStrict(true, "constructor");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   131
setAttrStrict(true, "accessor");
08a5e0d3248d 8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
hannesw
parents:
diff changeset
   132
setAttrStrict(true, "getterOnly");