This is the mail archive of the
java-discuss@sources.redhat.com
mailing list for the Java project.
Re: build error
- To: Oskar Liljeblad <osk at hem dot passagen dot se>
- Subject: Re: build error
- From: Alexandre Petit-Bianco <apbianco at cygnus dot com>
- Date: Thu, 30 Nov 2000 10:42:22 -0800 (PST)
- Cc: java-discuss at sourceware dot cygnus dot com
- References: <20001130191205.A5354@oskar>
- Reply-To: apbianco at cygnus dot com
Oskar Liljeblad writes:
> I am writing this email partly as a test... let me know if I should
> try a newer version of gcj.
This looks like gcj/297. Are you defining a static inner class? You
should try this patch.
./A
2000-10-31 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (outer_field_access_p): Inherited fields aren't
consider outer fields.
(maybe_build_thisn_access_method): Use
PURE_INNER_CLASS_TYPE_P instead of INNER_CLASS_TYPE_P.
(resolve_expression_name): Trigger an error if a static field
is being accessed as an outer field.
Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.221
diff -u -p -r1.221 parse.y
--- parse.y 2000/10/25 05:47:28 1.221
+++ parse.y 2000/11/02 19:39:46
@@ -7886,6 +7946,11 @@ outer_field_access_p (type, decl)
|| TREE_CODE (decl) != FIELD_DECL
|| DECL_CONTEXT (decl) == type)
return 0;
+
+ /* If the inner class extends the declaration context of the field
+ we're try to acces, then this isn't an outer field access */
+ if (inherits_from_p (type, DECL_CONTEXT (decl)))
+ return 0;
for (type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))); ;
type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))))
@@ -8237,7 +8303,7 @@ maybe_build_thisn_access_method (type)
/* If TYPE is a top-level class, no access method is required.
If there already is such an access method, bail out. */
- if (CLASS_ACCESS0_GENERATED_P (type) || !INNER_CLASS_TYPE_P (type))
+ if (CLASS_ACCESS0_GENERATED_P (type) || !PURE_INNER_CLASS_TYPE_P (type))
return NULL_TREE;
/* We generate the method. The method looks like:
@@ -8865,7 +8931,14 @@ resolve_expression_name (id, orig)
to access a field belonging to an outer class, build
the access to the field */
if (!fs && outer_field_access_p (current_class, decl))
- return build_outer_field_access (id, decl);
+ {
+ if (CLASS_STATIC (TYPE_NAME (current_class)))
+ {
+ static_ref_err (id, DECL_NAME (decl), current_class);
+ return error_mark_node;
+ }
+ return build_outer_field_access (id, decl);
+ }
/* Otherwise build what it takes to access the field */
access = build_field_ref ((fs ? NULL_TREE : current_this),