diff options
author | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-30 21:08:32 +0000 |
---|---|---|
committer | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-30 21:08:32 +0000 |
commit | 49add0022489e2bada881e75d4a515586b58c591 (patch) | |
tree | 0a3e102f4903a3458ca1b8037ffd7d48b66c1484 /gcc/java/jcf-write.c | |
parent | 17c7a04d1c73b837492a822490fa59ee17db094f (diff) | |
download | gcc-49add0022489e2bada881e75d4a515586b58c591.tar.gz |
* jcf-write.c (generate_classfile): Don't write ConstantValue
attribute if field is not final, for compatibility with jdk.
* jcf-write.c (generate_classfile): Convert ConstantValue values
to correct type. Work-around for front-end bug.
* class.c (set_constant_value): Error if constant has wrong type.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45298 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/jcf-write.c')
-rw-r--r-- | gcc/java/jcf-write.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index 31493fd0aae..d090b5678ae 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -2884,7 +2884,8 @@ generate_classfile (clas, state) build_java_signature (TREE_TYPE (part))); PUT2(i); have_value = DECL_INITIAL (part) != NULL_TREE - && FIELD_STATIC (part) && CONSTANT_VALUE_P (DECL_INITIAL (part)); + && FIELD_STATIC (part) && CONSTANT_VALUE_P (DECL_INITIAL (part)) + && FIELD_FINAL (part); if (have_value) attr_count++; @@ -2896,6 +2897,8 @@ generate_classfile (clas, state) { tree init = DECL_INITIAL (part); static tree ConstantValue_node = NULL_TREE; + // This conversion is a work-around for front-end bug. + init = convert (TREE_TYPE (part), init); ptr = append_chunk (NULL, 8, state); if (ConstantValue_node == NULL_TREE) ConstantValue_node = get_identifier ("ConstantValue"); |