Commit d47eb5d3 by Tom Tromey Committed by Tom Tromey

re PR java/5165 (Loading class fields with a ConstantValue attribute)

	Fix for PR java/5165:
	* java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass):
	Convert any constant string field to a String; not just final
	fields.

From-SVN: r48255
parent 655781b7
2001-12-21 Tom Tromey <tromey@redhat.com> 2001-12-21 Tom Tromey <tromey@redhat.com>
Fix for PR java/5165:
* java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass):
Convert any constant string field to a String; not just final
fields.
Fix for PR libgcj/2428: Fix for PR libgcj/2428:
* java/lang/natClass.cc: Include RuntimePermission.h. * java/lang/natClass.cc: Include RuntimePermission.h.
(getClassLoader): Define. (getClassLoader): Define.
......
...@@ -292,12 +292,10 @@ _Jv_PrepareCompiledClass (jclass klass) ...@@ -292,12 +292,10 @@ _Jv_PrepareCompiledClass (jclass klass)
for (int n = JvNumStaticFields (klass); n > 0; --n) for (int n = JvNumStaticFields (klass); n > 0; --n)
{ {
int mod = f->getModifiers (); int mod = f->getModifiers ();
// Maybe the compiler should mark these with // If we have a static String field with a non-null initial
// _Jv_FIELD_CONSTANT_VALUE? For now we just know that this // value, we know it points to a Utf8Const.
// only happens for constant strings.
if (f->getClass () == &StringClass if (f->getClass () == &StringClass
&& java::lang::reflect::Modifier::isStatic (mod) && java::lang::reflect::Modifier::isStatic (mod))
&& java::lang::reflect::Modifier::isFinal (mod))
{ {
jstring *strp = (jstring *) f->u.addr; jstring *strp = (jstring *) f->u.addr;
if (*strp) if (*strp)
......
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