diff options
author | Per Bothner <per@bothner.com> | 2001-08-30 14:08:32 -0700 |
---|---|---|
committer | Per Bothner <bothner@gcc.gnu.org> | 2001-08-30 14:08:32 -0700 |
commit | 1b9ee7233caa4e6ff8f964318f0762bf2df6639b (patch) | |
tree | 0a3e102f4903a3458ca1b8037ffd7d48b66c1484 /gcc/java/class.c | |
parent | b8ec576419e8dd1e335dd16d22a0cd7a9b1865e0 (diff) | |
download | gcc-1b9ee7233caa4e6ff8f964318f0762bf2df6639b.zip gcc-1b9ee7233caa4e6ff8f964318f0762bf2df6639b.tar.gz gcc-1b9ee7233caa4e6ff8f964318f0762bf2df6639b.tar.bz2 |
jcf-write.c (generate_classfile): Don't write ConstantValue attribute if field is not final...
* 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.
From-SVN: r45298
Diffstat (limited to 'gcc/java/class.c')
-rw-r--r-- | gcc/java/class.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/java/class.c b/gcc/java/class.c index e0caeae..eb4be8e 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -777,6 +777,12 @@ set_constant_value (field, constant) else { DECL_INITIAL (field) = constant; + if (TREE_TYPE (constant) != TREE_TYPE (field) + && ! (TREE_TYPE (constant) == int_type_node + && INTEGRAL_TYPE_P (TREE_TYPE (field)) + && TYPE_PRECISION (TREE_TYPE (field)) <= 32)) + error ("ConstantValue attribute of field '%s' has wrong type", + IDENTIFIER_POINTER (DECL_NAME (field))); if (FIELD_FINAL (field)) DECL_FIELD_FINAL_IUD (field) = 1; } |