gcc/libjava/testsuite/libjava.lang/pr24321.java
Tom Tromey 2bb6e0cefe re PR libgcj/24321 (instanceof erroneously causes class initialization)
PR java/24321:
	* testsuite/libjava.lang/pr24321.java: New file.
	* testsuite/libjava.lang/pr24321.out: New file.
	* java/lang/natClass.cc (isInstance): Don't initialize class.
	(isAssignableFrom): Likewise.

From-SVN: r111603
2006-03-01 16:01:34 +00:00

22 lines
507 B
Java

public class pr24321 {
static class Z {
static {
System.out.println("init");
}
}
static class Y extends Z { }
public static Object x () { return new Object(); }
public static void main(String[] args) throws Throwable
{
System.out.println(x() instanceof Z);
ClassLoader cl = pr24321.class.getClassLoader();
Class zk = Class.forName("pr24321$Z", false, cl);
Class yk = Class.forName("pr24321$Y", false, cl);
System.out.println(zk.isAssignableFrom(yk));
}
}