[gcjx] Patch: FYI: wildcards -vs- type descriptor

Tom Tromey tromey@redhat.com
Wed Oct 26 00:37:00 GMT 2005


I'm checking this in on the gcjx branch.

This is a workaround for a bug in model_class where it would try to
dereference the compilation unit even if there isn't one.  I suppose I
could make this method virtual and override it in model_wildcard, or
change the array type to compute the type descriptor lazily, but this
was convenient.  Also I think there is a similar hack elsewhere in the
model already.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* model/class.cc (get_fully_qualified_name): Only dereference
	compilation unit if it exists.

Index: model/class.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/model/Attic/class.cc,v
retrieving revision 1.1.2.17
diff -u -r1.1.2.17 class.cc
--- model/class.cc 18 Oct 2005 22:16:55 -0000 1.1.2.17
+++ model/class.cc 26 Oct 2005 00:36:01 -0000
@@ -475,7 +475,12 @@
 	      + get_assigned_name ());
   else
     {
-      result = compilation_unit->get_package ()->get_fully_qualified_name ();
+      // Ordinarily there is always a compilation unit.  However, this
+      // is not the case for wildcard types.  Doing this simplifies
+      // the model_array_type constructor (which precomputes the array
+      // descriptor), and doesn't matter in practice.
+      if (compilation_unit)
+	result = compilation_unit->get_package ()->get_fully_qualified_name ();
       if (! result.empty ())
 	result += ".";
       result += name;



More information about the Java-patches mailing list