Skip to content

Commit 2fd9300

Browse files
author
svorenova
committed
Adding a unit test for specialisation of implicitly generic classes
1 parent 9617a41 commit 2fd9300

17 files changed

+694
-11
lines changed

unit/java_bytecode/generate_concrete_generic_type/generate_java_generic_type.cpp

+14-11
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ SCENARIO(
1919
"generate_java_generic_type_from_file",
2020
"[core][java_bytecode][generate_java_generic_type]")
2121
{
22-
auto expected_symbol = "java::generic_two_fields$bound_element<Integer>";
22+
auto expected_symbol =
23+
"java::generic_two_fields$bound_element<java::java.lang.Integer>";
2324

2425
GIVEN("A generic java type with two generic fields and a concrete "
2526
"substitution")
@@ -35,7 +36,7 @@ SCENARIO(
3536
THEN("The class should contain two instantiated fields.")
3637
{
3738
const auto &class_symbol = new_symbol_table.lookup(
38-
"java::generic_two_fields$bound_element<Integer>");
39+
"java::generic_two_fields$bound_element<java::java.lang.Integer>");
3940
const typet &symbol_type=class_symbol->type;
4041

4142
REQUIRE(symbol_type.id()==ID_struct);
@@ -68,7 +69,8 @@ SCENARIO(
6869
"[core][java_bytecode][generate_java_generic_type]")
6970
{
7071
auto expected_symbol =
71-
"java::generic_two_parameters$KeyValuePair<String, Integer>";
72+
"java::generic_two_parameters$KeyValuePair<java::java.lang.String, "
73+
"java::java.lang.Integer>";
7274

7375
GIVEN("A generic java type with two generic parameters, like a Hashtable")
7476
{
@@ -109,8 +111,10 @@ SCENARIO(
109111
// After we have loaded the class and converted the generics,
110112
// the presence of these two symbols in the symbol table is
111113
// proof enough that we did the work we needed to do correctly.
112-
auto first_expected_symbol = "java::generic_two_instances$element<Boolean>";
113-
auto second_expected_symbol = "java::generic_two_instances$element<Integer>";
114+
auto first_expected_symbol =
115+
"java::generic_two_instances$element<java::java.lang.Boolean>";
116+
auto second_expected_symbol =
117+
"java::generic_two_instances$element<java::java.lang.Integer>";
114118

115119
GIVEN("A generic java type with a field that refers to another generic with"
116120
" an uninstantiated parameter.")
@@ -204,8 +208,7 @@ SCENARIO(
204208
{
205209
const irep_idt test_class_integer =
206210
"java::generic_field_array_instantiation$generic<array[reference]"
207-
"of_"
208-
"java::java.lang.Integer>";
211+
"of_java::java.lang.Integer>";
209212

210213
const irep_idt test_class_int =
211214
"java::generic_field_array_instantiation$generic<array[int]>";
@@ -258,8 +261,9 @@ SCENARIO(
258261
"There should be a specialised version of the class in the symbol "
259262
"table")
260263
{
261-
const irep_idt specialised_class_name =
262-
id2string(harness_class) + "$" + id2string(inner_class) + "<Float>";
264+
const irep_idt specialised_class_name = id2string(harness_class) + "$" +
265+
id2string(inner_class) +
266+
"<java::java.lang.Float>";
263267
REQUIRE(new_symbol_table.has_symbol(specialised_class_name));
264268

265269
const symbolt test_class_symbol =
@@ -309,8 +313,7 @@ SCENARIO(
309313
"table")
310314
{
311315
const std::string specialised_string =
312-
"<array[reference]of_"
313-
"java::java.lang.Float>";
316+
"<array[reference]of_java::java.lang.Float>";
314317
const irep_idt specialised_class_name = id2string(harness_class) + "$" +
315318
id2string(inner_class) +
316319
specialised_string;

0 commit comments

Comments
 (0)