diff options
author | Tom Tromey <tromey@redhat.com> | 2006-09-12 15:55:07 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2006-09-12 15:55:07 +0000 |
commit | 4b943588d131d6fa709b89903c920b726a85df82 (patch) | |
tree | 104cd59776422baa7f42d64413a35b465fdfd18b | |
parent | 91da2e7c337d584339a6d5ee28ca6d7e30a2b3f4 (diff) | |
download | gcc-4b943588d131d6fa709b89903c920b726a85df82.zip gcc-4b943588d131d6fa709b89903c920b726a85df82.tar.gz gcc-4b943588d131d6fa709b89903c920b726a85df82.tar.bz2 |
re PR java/28754 (java.lang.nullPointerException while accessing final static members of an interface)
PR java/28754:
* expr.c (expand_java_field_op): Initialize field's declaring
interface if necessary.
From-SVN: r116890
-rw-r--r-- | gcc/java/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/java/expr.c | 7 |
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index e7508bf..1df29cc 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,5 +1,11 @@ 2006-09-12 Tom Tromey <tromey@redhat.com> + PR java/28754: + * expr.c (expand_java_field_op): Initialize field's declaring + interface if necessary. + +2006-09-12 Tom Tromey <tromey@redhat.com> + PR java/28892: * expr.c (expand_java_field_op): No error for assignments not in class initializer or constructor. diff --git a/gcc/java/expr.c b/gcc/java/expr.c index b08d33e..26cd7da 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -2837,7 +2837,12 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index) field_ref = build_field_ref (field_ref, self_type, field_name); if (is_static && ! flag_indirect_dispatch) - field_ref = build_class_init (self_type, field_ref); + { + tree context = DECL_CONTEXT (field_ref); + if (context != self_type && CLASS_INTERFACE (TYPE_NAME (context))) + field_ref = build_class_init (context, field_ref); + field_ref = build_class_init (self_type, field_ref); + } if (is_putting) { flush_quick_stack (); |