This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: fix array.clone()
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 02 Dec 2005 11:22:09 -0700
- Subject: [gcjx] Patch: FYI: fix array.clone()
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
In 1.5 the clone() method of an array returns the array type.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* model/arraytype.cc (model_array_type): Make clone() covariant.
Index: model/arraytype.cc
===================================================================
--- model/arraytype.cc (revision 107604)
+++ model/arraytype.cc (working copy)
@@ -57,7 +57,13 @@
model_method *clone = new model_method (LOCATION_UNKNOWN, this);
clone->set_name ("clone");
- clone->set_return_type (res_obj);
+ // If generics are enabled, then an array's clone method has the
+ // array type as its return type.
+ if (global->get_compiler ()->feature_generics ())
+ clone->set_return_type (new model_forwarding_resolved (LOCATION_UNKNOWN,
+ this));
+ else
+ clone->set_return_type (res_obj);
clone->set_modifiers (ACC_PUBLIC);
add (ref_method (clone));
}