Skip to content

Commit c336455

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 457bac9 commit c336455

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

+1
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_is_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

+1
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

+11-4
Original file line numberDiff line numberDiff line change
@@ -1669,16 +1669,23 @@ void java_bytecode_parsert::rclass_attribute(classt &parsed_class)
16691669
std::string inner_class_info_name =
16701670
class_infot(pool_entry(inner_class_info_index))
16711671
.get_name(pool_entry_lambda);
1672-
UNUSED bool is_private = inner_class_access_flags & ACC_PRIVATE;
1673-
UNUSED bool is_public = inner_class_access_flags & ACC_PUBLIC;
1674-
UNUSED bool is_protected = inner_class_access_flags & ACC_PROTECTED;
1672+
bool is_private = inner_class_access_flags & ACC_PRIVATE;
1673+
bool is_public = inner_class_access_flags & ACC_PUBLIC;
1674+
bool is_protected = inner_class_access_flags & ACC_PROTECTED;
16751675

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

jbmc/src/java_bytecode/java_types.h

+10
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 bool get_is_inner_class() const
115+
{
116+
return get_bool(ID_is_inner_class);
117+
}
118+
119+
void set_is_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

+1
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)