test/script/basic/JDK-8066226.js

Wed, 03 Jun 2015 18:08:57 +0200

author
hannesw
date
Wed, 03 Jun 2015 18:08:57 +0200
changeset 1396
d5a9705a27b1
parent 1354
24a72d0aef36
permissions
-rw-r--r--

8066237: Fuzzing bug: Parser error on optimistic recompilation
Reviewed-by: lagergren, attila

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

mercurial