source: trunk/openjdk/hotspot/test/compiler/6894807/IsInstanceTest.java

Last change on this file was 278, checked in by dmik, 14 years ago

trunk: Merged in openjdk6 b22 from branches/vendor/oracle.

File size: 1.5 KB
Line 
1/*
2 * @test
3 * @bug 6894807
4 * @summary No ClassCastException for HashAttributeSet constructors if run with -Xcomp
5 * @compile IsInstanceTest.java
6 * @run shell Test6894807.sh
7*/
8
9public class IsInstanceTest {
10
11 public static void main(String[] args) {
12 BaseInterface baseInterfaceImpl = new BaseInterfaceImpl();
13 for (int i = 0; i < 100000; i++) {
14 if (isInstanceOf(baseInterfaceImpl, ExtendedInterface.class)) {
15 System.out.println("Failed at index:" + i);
16 System.out.println("Arch: "+System.getProperty("os.arch", "")+
17 " OS: "+System.getProperty("os.name", "")+
18 " OSV: "+System.getProperty("os.version", "")+
19 " Cores: "+Runtime.getRuntime().availableProcessors()+
20 " JVM: "+System.getProperty("java.version", "")+" "+System.getProperty("sun.arch.data.model", ""));
21 break;
22 }
23 }
24 System.out.println("Done!");
25 }
26
27 public static boolean isInstanceOf(BaseInterface baseInterfaceImpl, Class... baseInterfaceClasses) {
28 for (Class baseInterfaceClass : baseInterfaceClasses) {
29 if (baseInterfaceClass.isInstance(baseInterfaceImpl)) {
30 return true;
31 }
32 }
33 return false;
34 }
35
36 private interface BaseInterface {
37 }
38
39 private interface ExtendedInterface extends BaseInterface {
40 }
41
42 private static class BaseInterfaceImpl implements BaseInterface {
43 }
44}
Note: See TracBrowser for help on using the repository browser.