Test7002666.java revision 1911
1911N/A/*
1911N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
1911N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1911N/A *
1911N/A * This code is free software; you can redistribute it and/or modify it
1911N/A * under the terms of the GNU General Public License version 2 only, as
1911N/A * published by the Free Software Foundation.
1911N/A *
1911N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1911N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1911N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1911N/A * version 2 for more details (a copy is included in the LICENSE file that
1911N/A * accompanied this code).
1911N/A *
1911N/A * You should have received a copy of the GNU General Public License version
1911N/A * 2 along with this work; if not, write to the Free Software Foundation,
1911N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1911N/A *
1911N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1911N/A * or visit www.oracle.com if you need additional information or have any
1911N/A * questions.
1911N/A *
1911N/A */
1911N/A
1911N/A/**
1911N/A * @test
1911N/A * @bug 7002666
1911N/A * @summary eclipse CDT projects crash with compressed oops
1911N/A *
1911N/A * @run main/othervm -Xbatch -XX:CompileOnly=Test7002666.test,java/lang/reflect/Array Test7002666
1911N/A *
1911N/A * This will only reliably fail with a fastdebug build since it relies
1911N/A * on seeing garbage in the heap to die. It could be made more
1911N/A * reliable in product mode but that would require greatly increasing
1911N/A * the runtime.
1911N/A */
1911N/A
1911N/Apublic class Test7002666 {
1911N/A public static void main(String[] args) {
1911N/A for (int i = 0; i < 25000; i++) {
1911N/A Object[] a = test(Test7002666.class, new Test7002666());
1911N/A if (a[0] != null) {
1911N/A // The element should be null but if it's not then
1911N/A // we've hit the bug. This will most likely crash but
1911N/A // at least throw an exception.
1911N/A System.err.println(a[0]);
1911N/A throw new InternalError(a[0].toString());
1911N/A
1911N/A }
1911N/A }
1911N/A }
1911N/A public static Object[] test(Class c, Object o) {
1911N/A // allocate an array small enough to be trigger the bug
1911N/A Object[] a = (Object[])java.lang.reflect.Array.newInstance(c, 1);
1911N/A return a;
1911N/A }
1911N/A}