test/compiler/7090976/Test7090976.java

Thu, 17 Apr 2014 16:09:08 -0700

author
amurillo
date
Thu, 17 Apr 2014 16:09:08 -0700
changeset 6635
49b5160951dd
parent 0
f90c822e73f8
permissions
-rw-r--r--

Added tag hs25.20-b11 for changeset b6a2ba7d3ea7

     1 /*
     2  * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  *
    23  */
    25 /**
    26  * @test
    27  * @bug 7090976
    28  * @summary Eclipse/CDT causes a JVM crash while indexing C++ code
    29  *
    30  * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement Test7090976
    31  */
    33 public class Test7090976 {
    35     static interface I1 {
    36         public void m1();
    37     };
    39     static interface I2 {
    40         public void m2();
    41     };
    43     static interface I extends I1,I2 {
    44     }
    46     static class A implements I1 {
    47         int v = 0;
    48         int v2;
    50         public void m1() {
    51             v2 = v;
    52         }
    53     }
    55     static class B implements I2 {
    56         Object v = new Object();
    57         Object v2;
    59         public void m2() {
    60             v2 = v;
    61         }
    62     }
    64     private void test(A a)
    65     {
    66         if (a instanceof I) {
    67             I i = (I)a;
    68             i.m1();
    69             i.m2();
    70         }
    71     }
    73     public static void main(String[] args)
    74     {
    75         Test7090976 t = new Test7090976();
    76         A a = new A();
    77         B b = new B();
    78         for (int i = 0; i < 10000; i++) {
    79             t.test(a);
    80         }
    81     }
    82 }

mercurial