Commit 4ea9cbf1 by Tom Tromey Committed by Tom Tromey

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

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

From-SVN: r34910
parent 261985c3
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> 2000-07-03 Tom Tromey <tromey@cygnus.com>
* java/io/PrintWriter.java (print): Call write(String), not * java/io/PrintWriter.java (print): Call write(String), not
......
...@@ -261,7 +261,6 @@ _Jv_PrepareCompiledClass(jclass klass) ...@@ -261,7 +261,6 @@ _Jv_PrepareCompiledClass(jclass klass)
pool->data[index].clazz = found; pool->data[index].clazz = found;
pool->tags[index] |= JV_CONSTANT_ResolvedFlag; pool->tags[index] |= JV_CONSTANT_ResolvedFlag;
} }
else if (pool->tags[index] == JV_CONSTANT_String) else if (pool->tags[index] == JV_CONSTANT_String)
{ {
jstring str; jstring str;
...@@ -271,6 +270,24 @@ _Jv_PrepareCompiledClass(jclass klass) ...@@ -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 (); klass->notifyAll ();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment