re PR java/5165 (Loading class fields with a ConstantValue attribute)
authorTom Tromey <tromey@redhat.com>
Fri, 21 Dec 2001 21:59:27 +0000 (21:59 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Fri, 21 Dec 2001 21:59:27 +0000 (21:59 +0000)
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

libjava/ChangeLog
libjava/java/lang/natClassLoader.cc

index a9ce3528f8ce0ae0e1c0035c4e20e294a88e4cb1..b4daf82ee9c9827c29e00515b37c27f2e5e92dcf 100644 (file)
@@ -1,5 +1,10 @@
 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:
        * java/lang/natClass.cc: Include RuntimePermission.h.
        (getClassLoader): Define.
index a6f7b60e4c588919c910577afe09e8b6c3d0a4b1..75d9e32ff2e542b8245cab988c40e46d51a36d6f 100644 (file)
@@ -292,12 +292,10 @@ _Jv_PrepareCompiledClass (jclass 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 we have a static String field with a non-null initial
+         // value, we know it points to a Utf8Const.
          if (f->getClass () == &StringClass
-             && java::lang::reflect::Modifier::isStatic (mod)
-             && java::lang::reflect::Modifier::isFinal (mod))
+             && java::lang::reflect::Modifier::isStatic (mod))
            {
              jstring *strp = (jstring *) f->u.addr;
              if (*strp)