988N/A/*
988N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
988N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
988N/A *
988N/A * This code is free software; you can redistribute it and/or modify it
988N/A * under the terms of the GNU General Public License version 2 only, as
988N/A * published by the Free Software Foundation.
988N/A *
988N/A * This code is distributed in the hope that it will be useful, but WITHOUT
988N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
988N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
988N/A * version 2 for more details (a copy is included in the LICENSE file that
988N/A * accompanied this code).
988N/A *
988N/A * You should have received a copy of the GNU General Public License version
988N/A * 2 along with this work; if not, write to the Free Software Foundation,
988N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
988N/A *
988N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
988N/A * or visit www.oracle.com if you need additional information or have any
988N/A * questions.
988N/A */
988N/A
988N/A/*
988N/A * @test
988N/A * @bug 7040104
988N/A * @summary javac NPE on Object a[]; Object o = (a=null)[0];
988N/A */
988N/A
988N/Apublic class T7040104 {
988N/A public static void main(String[] args) {
988N/A T7040104 t = new T7040104();
988N/A t.test1();
988N/A t.test2();
988N/A t.test3();
988N/A if (t.npeCount != 3) {
988N/A throw new AssertionError();
988N/A }
988N/A }
988N/A
988N/A int npeCount = 0;
988N/A
988N/A void test1() {
988N/A Object a[];
988N/A try {
988N/A Object o = (a = null)[0];
988N/A }
988N/A catch (NullPointerException npe) {
988N/A npeCount++;
988N/A }
988N/A }
988N/A
988N/A void test2() {
988N/A Object a[][];
988N/A try {
988N/A Object o = (a = null)[0][0];
988N/A }
988N/A catch (NullPointerException npe) {
988N/A npeCount++;
988N/A }
988N/A }
988N/A
988N/A void test3() {
988N/A Object a[][][];
988N/A try {
988N/A Object o = (a = null)[0][0][0];
988N/A }
988N/A catch (NullPointerException npe) {
988N/A npeCount++;
988N/A }
988N/A }
988N/A}