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]

[gcjx] Patch: FYI: <clinit> and .class files


I'm checking this in on the gcjx branch.

This avoids an error if we see a blank final field in a .class file.
In this situation we don't want to create a new <clinit> method, but
instead we just want to see if one already exists.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* model/class.cc (resolve): Put name of field in error.  Correctly
	compute found_clinit for a .class file.

Index: model/class.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/model/Attic/class.cc,v
retrieving revision 1.1.2.10
diff -u -r1.1.2.10 class.cc
--- model/class.cc 17 Apr 2005 21:26:15 -0000 1.1.2.10
+++ model/class.cc 17 Apr 2005 21:32:48 -0000
@@ -1747,7 +1747,11 @@
 			       "be a compile-time constant");
     }
 
-  bool found_clinit = create_clinit_method ();
+  bool found_clinit;
+  if (from_class_p ())
+    found_clinit = has_method_with_descriptor_p ("<clinit>", "()V");
+  else
+    found_clinit = create_clinit_method ();
 
   for (std::list<ref_method>::const_iterator i = methods.begin ();
        i != methods.end ();
@@ -1780,14 +1784,14 @@
   // fields.
   if (! found_clinit)
     {
-      for (std::list< owner<model_field> >::const_iterator i
-	     = fields.begin ();
+      for (std::list< owner<model_field> >::const_iterator i = fields.begin ();
 	   i != fields.end ();
 	   ++i)
 	{
 	  if ((*i)->static_p () && (*i)->final_p ()
 	      && ! (*i)->has_initializer_p ())
-	    std::cerr << (*i)->error ("blank final field must be assigned");
+	    std::cerr << (*i)->error ("blank final field %1 must be assigned")
+	      % (*i).get ();
 	}
     }
 


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