aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/parse.y
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2003-03-11 20:37:02 +0000
committerTom Tromey <tromey@gcc.gnu.org>2003-03-11 20:37:02 +0000
commit8b8e6c64afcc492a3b124a229e9b7774e032fdb9 (patch)
treefa514899cdd4ebb3ba4558eb16c3f0be370427be /gcc/java/parse.y
parent218d1401afae50f7ec94e61f75d0ce397c22e944 (diff)
downloadgcc-8b8e6c64afcc492a3b124a229e9b7774e032fdb9.zip
gcc-8b8e6c64afcc492a3b124a229e9b7774e032fdb9.tar.gz
gcc-8b8e6c64afcc492a3b124a229e9b7774e032fdb9.tar.bz2
parse.y (resolve_field_access): Initialize class if field is found in another static field.
* parse.y (resolve_field_access): Initialize class if field is found in another static field. * expr.c (build_class_init): Don't optimize out initialization of implemented interface. From-SVN: r64185
Diffstat (limited to 'gcc/java/parse.y')
-rw-r--r--gcc/java/parse.y13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 5c28ce7..82293ed 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -9301,6 +9301,19 @@ resolve_field_access (tree qual_wfl, tree *field_decl, tree *field_type)
return error_mark_node;
if (is_static)
field_ref = maybe_build_class_init_for_field (decl, field_ref);
+
+ /* If we're looking at a static field, we may need to generate a
+ class initialization for it. This can happen when the access
+ looks like `field.ref', where `field' is a static field in an
+ interface we implement. */
+ if (!flag_emit_class_files
+ && !flag_emit_xref
+ && TREE_CODE (where_found) == VAR_DECL
+ && FIELD_STATIC (where_found))
+ {
+ build_static_field_ref (where_found);
+ field_ref = build_class_init (DECL_CONTEXT (where_found), field_ref);
+ }
}
else
field_ref = decl;