NASHORN-473.js revision 457:4b06441b7624
1214571Sdim/*
2214571Sdim * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
3214571Sdim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4214571Sdim *
5214571Sdim * This code is free software; you can redistribute it and/or modify it
6214571Sdim * under the terms of the GNU General Public License version 2 only, as
7214571Sdim * published by the Free Software Foundation.
8214571Sdim *
9214571Sdim * This code is distributed in the hope that it will be useful, but WITHOUT
10214571Sdim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11214571Sdim * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12214571Sdim * version 2 for more details (a copy is included in the LICENSE file that
13214571Sdim * accompanied this code).
14214571Sdim *
15214571Sdim * You should have received a copy of the GNU General Public License version
16214571Sdim * 2 along with this work; if not, write to the Free Software Foundation,
17214571Sdim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18214571Sdim *
19214571Sdim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20214571Sdim * or visit www.oracle.com if you need additional information or have any
21214571Sdim * questions.
22214571Sdim */
23214571Sdim
24214571Sdim/**
25214571Sdim * NASHORN-473 : Java primitive arrays can not be iterated with for.. in and for each .. in constructs
26214571Sdim *
27214571Sdim * @test
28214571Sdim * @run
29214571Sdim */
30214571Sdim
31214571Sdimvar boolArr = new (Java.type("boolean[]"))(2);
32214571SdimboolArr[0] = true;
33214571SdimboolArr[1] = false;
34214571Sdim
35214571Sdimfor (i in boolArr) {
36214571Sdim    print(i + " -> " + boolArr[i]);
37214571Sdim}
38214571Sdim
39214571Sdimfor each (i in boolArr) {
40214571Sdim    print(i);
41214571Sdim}
42214571Sdim
43214571Sdim