@@ -677,10 +677,37 @@ void java_bytecode_convert_classt::convert(
677
677
else
678
678
field_type = *java_type_from_string (f.descriptor );
679
679
680
+ // determine access
681
+ irep_idt access ;
682
+
683
+ if (f.is_private )
684
+ access = ID_private;
685
+ else if (f.is_protected )
686
+ access = ID_protected;
687
+ else if (f.is_public )
688
+ access = ID_public;
689
+ else
690
+ access = ID_default;
691
+
692
+ auto &class_type = to_java_class_type (class_symbol.type );
693
+
680
694
// is this a static field?
681
695
if (f.is_static )
682
696
{
683
- // Create the symbol; we won't add to the struct type.
697
+ const irep_idt field_identifier =
698
+ id2string (class_symbol.name ) + " ." + id2string (f.name );
699
+
700
+ class_type.static_members ().emplace_back ();
701
+ auto &component = class_type.static_members ().back ();
702
+
703
+ component.set_name (field_identifier);
704
+ component.set_base_name (f.name );
705
+ component.set_pretty_name (f.name );
706
+ component.set_access (access );
707
+ component.set_is_final (f.is_final );
708
+ component.type () = field_type;
709
+
710
+ // Create the symbol
684
711
symbolt new_symbol;
685
712
686
713
new_symbol.is_static_lifetime =true ;
@@ -740,26 +767,15 @@ void java_bytecode_convert_classt::convert(
740
767
}
741
768
else
742
769
{
743
- auto &class_type = to_java_class_type (class_symbol.type );
744
-
745
770
class_type.components ().emplace_back ();
746
771
auto &component = class_type.components ().back ();
747
772
748
773
component.set_name (f.name );
749
774
component.set_base_name (f.name );
750
775
component.set_pretty_name (f.name );
751
- component.type ()=field_type;
752
-
753
- if (f.is_private )
754
- component.set_access (ID_private);
755
- else if (f.is_protected )
756
- component.set_access (ID_protected);
757
- else if (f.is_public )
758
- component.set_access (ID_public);
759
- else
760
- component.set_access (ID_default);
761
-
776
+ component.set_access (access );
762
777
component.set_is_final (f.is_final );
778
+ component.type () = field_type;
763
779
764
780
// Load annotations
765
781
if (!f.annotations .empty ())
0 commit comments