855N/A/*
1949N/A * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
855N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
855N/A *
855N/A * This code is free software; you can redistribute it and/or modify it
855N/A * under the terms of the GNU General Public License version 2 only, as
855N/A * published by the Free Software Foundation.
855N/A *
855N/A * This code is distributed in the hope that it will be useful, but WITHOUT
855N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
855N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
855N/A * version 2 for more details (a copy is included in the LICENSE file that
855N/A * accompanied this code).
855N/A *
855N/A * You should have received a copy of the GNU General Public License version
855N/A * 2 along with this work; if not, write to the Free Software Foundation,
855N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
855N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
855N/A *
855N/A */
855N/A
855N/A/**
855N/A * @test
855N/A * @bug 6857159
855N/A * @summary local schedule failed with checkcast of Thread.currentThread()
855N/A *
855N/A * @run shell Test6857159.sh
855N/A */
855N/A
855N/Apublic class Test6857159 extends Thread {
855N/A static class ct0 extends Test6857159 {
855N/A public void message() {
855N/A // System.out.println("message");
855N/A }
855N/A
855N/A public void run() {
855N/A message();
855N/A ct0 ct = (ct0) Thread.currentThread();
855N/A ct.message();
855N/A }
855N/A }
855N/A static class ct1 extends ct0 {
855N/A public void message() {
855N/A // System.out.println("message");
855N/A }
855N/A }
855N/A static class ct2 extends ct0 {
855N/A public void message() {
855N/A // System.out.println("message");
855N/A }
855N/A }
855N/A
855N/A public static void main(String[] args) throws Exception {
1816N/A for (int i = 0; i < 20000; i++) {
855N/A Thread t = null;
855N/A switch (i % 3) {
855N/A case 0: t = new ct0(); break;
855N/A case 1: t = new ct1(); break;
855N/A case 2: t = new ct2(); break;
855N/A }
855N/A t.start();
855N/A t.join();
855N/A }
855N/A }
855N/A}