natClassLoader.cc (_Jv_PrepareCompiledClass): Initialize static final String fields.

* java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass):
	Initialize static final String fields.

From-SVN: r34910
This commit is contained in:
Tom Tromey 2000-07-07 20:54:32 +00:00 committed by Tom Tromey
parent 261985c30c
commit 4ea9cbf197
2 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2000-07-06 Tom Tromey <tromey@cygnus.com>
* java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass):
Initialize static final String fields.
2000-07-03 Tom Tromey <tromey@cygnus.com>
* java/io/PrintWriter.java (print): Call write(String), not

View File

@ -261,7 +261,6 @@ _Jv_PrepareCompiledClass(jclass klass)
pool->data[index].clazz = found;
pool->tags[index] |= JV_CONSTANT_ResolvedFlag;
}
else if (pool->tags[index] == JV_CONSTANT_String)
{
jstring str;
@ -271,6 +270,24 @@ _Jv_PrepareCompiledClass(jclass klass)
}
}
jfieldID f = JvGetFirstStaticField (klass);
for (int n = JvNumStaticFields (klass); n > 0; --n)
{
int mod = f->getModifiers ();
// Maybe the compiler should mark these with
// _Jv_FIELD_CONSTANT_VALUE? For now we just know that this
// only happens for constant strings.
if (f->getClass () == &StringClass
&& java::lang::reflect::Modifier::isStatic (mod)
&& java::lang::reflect::Modifier::isFinal (mod))
{
jstring *strp = (jstring *) f->u.addr;
if (*strp)
*strp = _Jv_NewStringUtf8Const ((_Jv_Utf8Const *) *strp);
}
f = f->getNextField ();
}
klass->notifyAll ();
}