Skip to content

Commit 79f743b

Browse files
thk123svorenova
thk123
authored and
svorenova
committed
Adding conversions for wild cards
Need to check all these are actually required after the other fixes
1 parent a60ead4 commit 79f743b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/java_bytecode/java_types.cpp

+35
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,41 @@ typet java_type_from_string(
392392
}
393393
case '*':
394394
{
395+
#ifdef DEBUG
396+
std::cout << class_name << std::endl;
397+
#endif
398+
// parse name of type variable
399+
INVARIANT(src[src.size()-1]==';', "Generic type name must end on ';'.");
400+
PRECONDITION(!class_name.empty());
401+
// INVARIANT(
402+
// src.substr(1, src.size()-2)=="*",
403+
// "Wildcard types do not have a name");
404+
irep_idt type_var_name(class_name+"::*");
405+
return java_generic_parametert(
406+
type_var_name,
407+
java_type_from_string("Ljava/lang/Object;").subtype());
408+
}
409+
case '+':
410+
{
411+
#ifdef DEBUG
412+
std::cout << class_name << std::endl;
413+
#endif
414+
// parse name of type variable
415+
INVARIANT(src[src.size()-1]==';', "Generic type name must end on ';'.");
416+
PRECONDITION(!class_name.empty());
417+
// INVARIANT(
418+
// src.substr(1, src.size()-2)=="*",
419+
// "Wildcard types do not have a name");
420+
irep_idt type_var_name(class_name+"::*");
421+
return java_generic_parametert(
422+
type_var_name,
423+
java_type_from_string("Ljava/lang/Object;").subtype());
424+
}
425+
case '-':
426+
{
427+
#ifdef DEBUG
428+
std::cout << class_name << std::endl;
429+
#endif
395430
// parse name of type variable
396431
INVARIANT(src[src.size()-1]==';', "Generic type name must end on ';'.");
397432
PRECONDITION(!class_name.empty());

0 commit comments

Comments
 (0)