Skip to content

Commit b67d6e8

Browse files
author
Thomas Kiley
authored
Merge pull request diffblue#1543 from chrisr-diffblue/cleanup/add-java-array-element-type-helper
Add a helper function for accessing the element type of a Java array type
2 parents ebabdb9 + a523d6f commit b67d6e8

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/java_bytecode/java_types.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ reference_typet java_array_type(const char subtype)
123123
return java_reference_type(symbol_type);
124124
}
125125

126+
/// Return the type of the elements of a given java array type
127+
/// \param array_type The java array type
128+
/// \return The type of the elements of the array
129+
typet java_array_element_type(const symbol_typet &array_type)
130+
{
131+
INVARIANT(
132+
is_java_array_tag(array_type.get_identifier()),
133+
"Symbol should have array tag");
134+
return array_type.find_type(ID_C_element_type);
135+
}
136+
126137
/// See above
127138
/// \par parameters: Struct tag 'tag'
128139
/// \return True if the given struct is a Java array

src/java_bytecode/java_types.h

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ reference_typet java_lang_object_type();
5656
symbol_typet java_classname(const std::string &);
5757

5858
reference_typet java_array_type(const char subtype);
59+
typet java_array_element_type(const symbol_typet &array_type);
5960

6061
bool is_reference_type(char t);
6162

0 commit comments

Comments
 (0)