[gcjx] Patch: FYI: fix use of boxing conversion

Tom Tromey tromey@redhat.com
Fri Oct 28 20:12:00 GMT 2005


I'm checking this in on the gcjx branch.

This fixes a bug with the way boxing_conversion was used in the
previous patch.  It also adds an assertion to catch errors when doing
class instantiation.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* model/parameters.cc (create_type_map): Added assert.
	* model/classref.cc (resolve): Correctly use boxing_conversion.

Index: model/classref.cc
===================================================================
--- model/classref.cc	(revision 105954)
+++ model/classref.cc	(working copy)
@@ -46,7 +46,9 @@
   model_class *dest = global->get_compiler ()->java_lang_Class ();
   if (global->get_compiler ()->feature_generics ())
     {
-      model_type *boxed = boxing_conversion (klass->type ());
+      model_type *boxed = klass->type ();
+      if (boxed->primitive_p ())
+	boxed = box_primitive_type (boxed);
       model_class *boxed_class = assert_cast<model_class *> (boxed);
 
       std::list<model_class *> args;
Index: model/parameters.cc
===================================================================
--- model/parameters.cc	(revision 105944)
+++ model/parameters.cc	(working copy)
@@ -1,6 +1,6 @@
 // Parameters for a generic method or class.
 
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 //
 // This file is part of GCC.
 //
@@ -83,6 +83,7 @@
 
   while (type_iter != type_list.end () && var_iter != type_parameters.end ())
     {
+      assert (*type_iter != NULL);
       (*var_iter)->validate (request, *type_iter);
       result.add ((*var_iter).get (), *type_iter);
       ++type_iter;



More information about the Java-patches mailing list