[gcjx] Patch: FYI: avoid crash with type variables

Tom Tromey tromey@redhat.com
Wed Jan 19 01:34:00 GMT 2005


I'm checking this in on the gcjx branch.

While it doesn't really make sense to ask for the descriptor of a type
variable, it still can happen (since arrays create their descriptors
eagerly).  So, we implement this method to avoid a crash that would
occur if the model_class version of the method were called instead.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* model/typevar.hh (model_type_variable::compute_descriptor): New
	method.

Index: model/typevar.hh
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/model/Attic/typevar.hh,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 typevar.hh
--- model/typevar.hh 13 Jan 2005 03:18:36 -0000 1.1.2.1
+++ model/typevar.hh 19 Jan 2005 01:33:05 -0000
@@ -1,6 +1,6 @@
 // A type variable.
 
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 //
 // This file is part of GCC.
 //
@@ -33,6 +33,12 @@
 
   void resolve_hook (resolution_scope *);
 
+  void compute_descriptor ()
+  {
+    // We override this method to avoid crashes if our superclass'
+    // method is called.  There's no sensible value here however.    
+  }
+
 public:
 
   model_type_variable (const location &w)



More information about the Java-patches mailing list