comparison test/compiler/6894807/IsInstanceTest.java @ 1715:495caa35b1b5

6977952: Test: Sync missing tests from hs16.3 to hs17.x Reviewed-by: wrockett
author asaha
date Tue, 17 Aug 2010 22:52:50 -0700
parents
children
comparison
equal deleted inserted replaced
1714:f121b2772674 1715:495caa35b1b5
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
9 public 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 }