[gcjx] Patch: FYI: revert earlier patch

Tom Tromey tromey@redhat.com
Sat Jan 15 23:29:00 GMT 2005


I'm checking this in on the gcjx branch.

This reverts an earlier patch but adds commentary explaining the
problem and eventual solution.  No time today.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* model/fieldref.cc (resolve): Reverted earlier patch, with
	commentary.

Index: model/fieldref.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/model/Attic/fieldref.cc,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 fieldref.cc
--- model/fieldref.cc 15 Jan 2005 22:35:28 -0000 1.1.2.2
+++ model/fieldref.cc 15 Jan 2005 23:27:24 -0000
@@ -171,8 +171,17 @@
   else
     {
       // This is an unqualified reference to a field.  In this case we
-      // use the implicit qualifier, which is the current class.
-      qualifier = scope->get_current_class ();
+      // use the implicit qualifier.  FIXME: if we have a qualified
+      // reference like 'Derived.field', but the field is actually
+      // declared in 'Base', we will wind up with 'Base.field' here,
+      // which is incorrect.  Fixing this requires extracting more
+      // information from classify_expression_name().  Even the
+      // commented out code here doesn't work, since for something
+      // like 'System.out.println()', nothing tells the field reference
+      // that it is qualified.
+      //       qualifier = (qualified ? field->get_declaring_class ()
+      // 		   : scope->get_current_class ());
+      qualifier = field->get_declaring_class ();
     }
 
   set_type (field->type ());



More information about the Java-patches mailing list