Skip to content

Commit e9c7f36

Browse files
Stores inner class data in java class types.
Though this data is stored, it will not be used in test-gen yet because test-gen is assuming all non-public inner classes are private.
1 parent 77e8752 commit e9c7f36

File tree

5 files changed

+24
-4
lines changed

5 files changed

+24
-4
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_class.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ void java_bytecode_convert_classt::convert(
268268
class_type.set(ID_interface, c.is_interface);
269269
class_type.set(ID_synthetic, c.is_synthetic);
270270
class_type.set_final(c.is_final);
271+
class_type.set_inner_class(c.is_inner_class);
271272
if(c.is_enum)
272273
{
273274
if(max_array_length != 0 && c.enum_elements > max_array_length)

jbmc/src/java_bytecode/java_bytecode_parse_tree.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ class java_bytecode_parse_treet
212212
bool is_interface = false;
213213
bool is_synthetic = false;
214214
bool is_annotation = false;
215+
bool is_inner_class = false;
215216
bool attribute_bootstrapmethods_read = false;
216217
size_t enum_elements=0;
217218

jbmc/src/java_bytecode/java_bytecode_parser.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,16 +1668,23 @@ void java_bytecode_parsert::rclass_attribute(classt &parsed_class)
16681668
std::string inner_class_info_name =
16691669
class_infot(pool_entry(inner_class_info_index))
16701670
.get_name(pool_entry_lambda);
1671-
UNUSED bool is_private = inner_class_access_flags & ACC_PRIVATE;
1672-
UNUSED bool is_public = inner_class_access_flags & ACC_PUBLIC;
1673-
UNUSED bool is_protected = inner_class_access_flags & ACC_PROTECTED;
1671+
bool is_private = inner_class_access_flags & ACC_PRIVATE;
1672+
bool is_public = inner_class_access_flags & ACC_PUBLIC;
1673+
bool is_protected = inner_class_access_flags & ACC_PROTECTED;
16741674

16751675
// If the original parsed class name matches the inner class name
16761676
// the parsed class is an inner class, so overwrite the parsed class'
16771677
// access information and mark it as an inner class
1678-
UNUSED bool is_inner_class =
1678+
bool is_inner_class =
16791679
remove_separator_char(id2string(parsed_class.name), '.') ==
16801680
remove_separator_char(inner_class_info_name, '/');
1681+
if(is_inner_class)
1682+
{
1683+
parsed_class.is_inner_class = is_inner_class;
1684+
parsed_class.is_private = is_private;
1685+
parsed_class.is_protected = is_protected;
1686+
parsed_class.is_public = is_public;
1687+
}
16811688
}
16821689
}
16831690
}

jbmc/src/java_bytecode/java_types.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ class java_class_typet:public class_typet
111111
return set(ID_access, access);
112112
}
113113

114+
const irep_idt &get_inner_class() const
115+
{
116+
return get(ID_is_inner_class);
117+
}
118+
119+
void set_inner_class(const bool &is_inner_class)
120+
{
121+
return set(ID_is_inner_class, is_inner_class);
122+
}
123+
114124
bool get_final()
115125
{
116126
return get_bool(ID_final);

src/util/irep_ids.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,7 @@ IREP_ID_ONE(interface)
674674
IREP_ID_TWO(C_must_not_throw, #must_not_throw)
675675
IREP_ID_ONE(always_inline)
676676
IREP_ID_ONE(is_always_inline)
677+
IREP_ID_ONE(is_inner_class)
677678

678679
// Projects depending on this code base that wish to extend the list of
679680
// available ids should provide a file local_irep_ids.h in their source tree and

0 commit comments

Comments
 (0)