hotspot/test/compiler/6857159/Test6857159.java
author never
Tue, 21 Jul 2009 16:42:58 -0700
changeset 3272 5a1e113bfed5
child 5547 f4b087cbb361
permissions -rw-r--r--
6857159: local schedule failed with checkcast of Thread.currentThread() Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3272
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     1
/*
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     2
 * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     4
 *
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     7
 * published by the Free Software Foundation.
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     8
 *
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    13
 * accompanied this code).
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    14
 *
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    18
 *
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    21
 * have any questions.
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    22
 *
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    23
 */
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    24
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    25
/**
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    26
 * @test
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    27
 * @bug 6857159
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    28
 * @summary local schedule failed with checkcast of Thread.currentThread()
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    29
 *
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    30
 * @run shell Test6857159.sh
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    31
 */
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    32
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    33
public class Test6857159 extends Thread {
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    34
    static class ct0 extends Test6857159 {
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    35
        public void message() {
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    36
            // System.out.println("message");
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    37
        }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    38
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    39
        public void run() {
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    40
             message();
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    41
             ct0 ct = (ct0) Thread.currentThread();
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    42
             ct.message();
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    43
        }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    44
    }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    45
    static class ct1 extends ct0 {
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    46
        public void message() {
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    47
            // System.out.println("message");
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    48
        }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    49
    }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    50
    static class ct2 extends ct0 {
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    51
        public void message() {
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    52
            // System.out.println("message");
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    53
        }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    54
    }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    55
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    56
    public static void main(String[] args) throws Exception {
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    57
        for (int i = 0; i < 100000; i++) {
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    58
            Thread t = null;
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    59
            switch (i % 3) {
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    60
              case 0: t = new ct0(); break;
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    61
              case 1: t = new ct1(); break;
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    62
              case 2: t = new ct2(); break;
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    63
            }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    64
            t.start();
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    65
            t.join();
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    66
        }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    67
    }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    68
}