jcf-write.c (generate_classfile): Check that field is primitive or string before emitting ConstantValue attribute.

* jcf-write.c (generate_classfile):  Check that field is primitive
	or string before emitting ConstantValue attribute.

From-SVN: r45306
This commit is contained in:
Per Bothner 2001-08-30 21:14:44 -07:00 committed by Per Bothner
parent f0cdee96aa
commit be0c7ff405
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2001-08-30 Per Bothner <per@bothner.com>
* jcf-write.c (generate_classfile): Check that field is primitive
or string before emitting ConstantValue attribute.
2001-08-30 Per Bothner <per@bothner.com>
* parse.y (resolve_qualified_expression_name): If creating a

View File

@ -2885,7 +2885,9 @@ generate_classfile (clas, state)
PUT2(i);
have_value = DECL_INITIAL (part) != NULL_TREE
&& FIELD_STATIC (part) && CONSTANT_VALUE_P (DECL_INITIAL (part))
&& FIELD_FINAL (part);
&& FIELD_FINAL (part)
&& (JPRIMITIVE_TYPE_P (TREE_TYPE (part))
|| TREE_TYPE (part) == string_ptr_type_node);
if (have_value)
attr_count++;