This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gcjx] Patch: FYI: fix array.clone()


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));
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]