This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: fix for PR 5165


I'm checking this in.

This fixes PR 5165.  In this PR we have a case where a non-final
static String field is initialized.  Previously we failed to convert
such a field from Utf8Const to String; now we do.

Tom

Index: ChangeLog
from  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.

Index: java/lang/natClassLoader.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natClassLoader.cc,v
retrieving revision 1.46
diff -u -r1.46 natClassLoader.cc
--- java/lang/natClassLoader.cc 2001/12/16 22:28:35 1.46
+++ java/lang/natClassLoader.cc 2001/12/21 21:57:43
@@ -292,12 +292,10 @@
       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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]