mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-05 17:30:58 +08:00
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
This commit is contained in:
parent
1809ff6b9a
commit
2bb6e0cefe
@ -1,3 +1,11 @@
|
||||
2006-03-01 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
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.
|
||||
|
||||
2006-02-27 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR other/26208
|
||||
@ -109,7 +117,7 @@
|
||||
is_attribute_name): Likewise.
|
||||
* prims.cc (_Jv_strLengthUtf8, _Jv_hashUtf8String, _Jv_Utf8Const::init,
|
||||
_Jv_makeUtf8Const, _Jv_InitPrimClass): Likewise.
|
||||
|
||||
|
||||
2006-02-08 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
PR libgcj/26063, PR libgcj/17978, PR libgcj/10598:
|
||||
|
@ -621,8 +621,9 @@ jboolean
|
||||
java::lang::Class::isAssignableFrom (jclass klass)
|
||||
{
|
||||
// Arguments may not have been initialized, given ".class" syntax.
|
||||
_Jv_InitClass (this);
|
||||
_Jv_InitClass (klass);
|
||||
// This ensures we can at least look at their superclasses.
|
||||
_Jv_Linker::wait_for_state (this, JV_STATE_LOADING);
|
||||
_Jv_Linker::wait_for_state (klass, JV_STATE_LOADING);
|
||||
return _Jv_IsAssignableFrom (klass, this);
|
||||
}
|
||||
|
||||
@ -631,7 +632,6 @@ java::lang::Class::isInstance (jobject obj)
|
||||
{
|
||||
if (! obj)
|
||||
return false;
|
||||
_Jv_InitClass (this);
|
||||
return _Jv_IsAssignableFrom (JV_CLASS (obj), this);
|
||||
}
|
||||
|
||||
|
21
libjava/testsuite/libjava.lang/pr24321.java
Normal file
21
libjava/testsuite/libjava.lang/pr24321.java
Normal file
@ -0,0 +1,21 @@
|
||||
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));
|
||||
}
|
||||
}
|
2
libjava/testsuite/libjava.lang/pr24321.out
Normal file
2
libjava/testsuite/libjava.lang/pr24321.out
Normal file
@ -0,0 +1,2 @@
|
||||
false
|
||||
true
|
Loading…
x
Reference in New Issue
Block a user