[gcjx] Patch: FYI: code generator -vs- "known" methods and fields

Tom Tromey tromey@redhat.com
Mon Dec 12 16:32:00 GMT 2005


I'm checking this in on the gcjx branch.

We weren't properly finding methods like 'iterator()' on generic
types, as we weren't looking for the erasure of the type.  Likewise
for fields.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* bytecode/generate.cc (find_method): Look for erasure of return
	type.
	(find_field): Look for erasure of field's type.

Index: bytecode/generate.cc
===================================================================
--- bytecode/generate.cc	(revision 108412)
+++ bytecode/generate.cc	(working copy)
@@ -2241,7 +2241,8 @@
        ++it)
     {
       model_field *field = (*it).get ();
-      if (field->get_name () == name && field->type ()->erasure () == type)
+      if (field->get_name () == name
+	  && field->type ()->erasure () == type->erasure ())
         return field;
     }
   throw request->error ("couldn't find field %1 of type %2 in class %3")
@@ -2286,7 +2287,7 @@
 	% mname % (argtype ? argtype : primitive_void_type) % klass;
     }
 
-  if (result->get_return_type ()->erasure () != result_type)
+  if (result->get_return_type ()->erasure () != result_type->erasure ())
     {
       throw request->error ("method %1 doesn't have expected return type"
 			    " of %2")



More information about the Java-patches mailing list