Patch: gcj access$0 error
Tom Tromey
tromey@redhat.com
Wed Mar 6 14:41:00 GMT 2002
This patch fixes a bug I found while trying to build SWT.
Suppose an inner class references a field in the superclass of the
outer class. In this situation, maybe_build_thisn_access_method()
will do nothing once we've hit the outer class, because the superclass
access doesn't require an access method.
However, build_access_to_thisn doesn't detect this scenario.
I don't have a concise test case. I can try to write one if you like.
This patch fixes the problem for me. However, I don't fully
understand this code, so I'd appreciate your input: is it correct? Is
there something else I should be doing here?
I'm wondering if there is some strange case we need to support, for
instance a chain like this:
superclass -> derived inner -> top-level subclass -> inner-derived -> here
Here I guess the loop would stop at "top-level subclass", but we'd
actually need to call the access method for "derived inner". Is this
right? How would I do that?
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* parse.y (build_access_to_thisn): Stop when FROM is not an inner
class.
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.356
diff -u -r1.356 parse.y
--- parse.y 2002/03/03 14:07:32 1.356
+++ parse.y 2002/03/06 22:25:29
@@ -8547,7 +8553,7 @@
{
tree access = NULL_TREE;
- while (from != to)
+ while (from != to && PURE_INNER_CLASS_TYPE_P (from))
{
if (!access)
{
@@ -8567,8 +8573,8 @@
access = make_qualified_primary (cn, access, lc);
}
- /* if FROM isn't an inter class, that's fine, we've done
- enough. What we're looking for can be accessed from there. */
+ /* If FROM isn't an inner class, that's fine, we've done enough.
+ What we're looking for can be accessed from there. */
from = DECL_CONTEXT (TYPE_NAME (from));
if (!from)
break;
More information about the Java-patches
mailing list