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: code generator -vs- "known" methods and fields


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")


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