[gcjx] Patch: FYI: fix class instance thinko
Tom Tromey
tromey@redhat.com
Thu Jul 14 16:26:00 GMT 2005
I'm checking this in on the gcjx branch.
Jacks was showing incorrect parameterizations of some generic classes
when using a 1.5 class library.
The problem turned out to be a misconception in model_class.
model_class represents both the class declaration and the raw type.
It does not represent any other parameterization of the class -- that
is what model_class_instance is for. However,
model_class::apply_type_map was still actually applying the type map,
when really the correct thing to do is just return 'this', as applying
a type map to a raw type doesn't change anything.
This fixes a few jacks regressions as compared to gcjx using a 1.4
class library.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* model/class.cc (apply_type_map): Moved body ...
(create_instance): ... here.
Index: model/class.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/model/Attic/class.cc,v
retrieving revision 1.1.2.12
diff -u -r1.1.2.12 class.cc
--- model/class.cc 11 Jul 2005 16:41:50 -0000 1.1.2.12
+++ model/class.cc 14 Jul 2005 16:22:48 -0000
@@ -2003,12 +2003,25 @@
}
model_class *
-model_class::apply_type_map (model_element *request,
- const model_type_map &type_map)
+model_class::apply_type_map (model_element *, const model_type_map &)
{
assert (! anonymous);
assert (! static_context);
+ // The model_class object represents the class declaration and also
+ // the raw type. Applying a type map to the raw type does nothing,
+ // hence we simply return 'this'. Creating a parameterized instance
+ // is done with create_instance.
+ return this;
+}
+
+model_class *
+model_class::create_instance (model_element *request,
+ const std::list<model_class *> ¶ms)
+{
+ model_type_map type_map;
+ create_type_map (type_map, request, params);
+
if (type_parameters.empty () || type_map.empty_p ())
return this;
@@ -2078,15 +2091,6 @@
return result.get ();
}
-model_class *
-model_class::create_instance (model_element *request,
- const std::list<model_class *> ¶ms)
-{
- model_type_map typemap;
- create_type_map (typemap, request, params);
- return apply_type_map (request, typemap);
-}
-
void
model_class::clean_up ()
{
More information about the Java-patches
mailing list