Skip to content

Commit

Permalink
Refactor: use class_typet instead of struct_typet for java class
Browse files Browse the repository at this point in the history
  • Loading branch information
peterschrammel committed Mar 6, 2018
1 parent fdba57c commit 881b127
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/java_bytecode/java_bytecode_convert_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,39 +478,39 @@ void java_bytecode_convert_classt::add_array_types(symbol_tablet &symbol_table)
if(symbol_table.has_symbol(symbol_type_identifier))
return;

struct_typet struct_type;
class_typet class_type;
// we have the base class, java.lang.Object, length and data
// of appropriate type
struct_type.set_tag(symbol_type_identifier);
class_type.set_tag(symbol_type_identifier);

struct_type.components().reserve(3);
struct_typet::componentt
comp0("@java.lang.Object", symbol_typet("java::java.lang.Object"));
class_type.components().reserve(3);
class_typet::componentt comp0(
"@java.lang.Object", symbol_typet("java::java.lang.Object"));
comp0.set_pretty_name("@java.lang.Object");
comp0.set_base_name("@java.lang.Object");
struct_type.components().push_back(comp0);
class_type.components().push_back(comp0);

struct_typet::componentt comp1("length", java_int_type());
class_typet::componentt comp1("length", java_int_type());
comp1.set_pretty_name("length");
comp1.set_base_name("length");
struct_type.components().push_back(comp1);
class_type.components().push_back(comp1);

struct_typet::componentt
comp2("data", java_reference_type(java_type_from_char(l)));
class_typet::componentt comp2(
"data", java_reference_type(java_type_from_char(l)));
comp2.set_pretty_name("data");
comp2.set_base_name("data");
struct_type.components().push_back(comp2);
class_type.components().push_back(comp2);

INVARIANT(
is_valid_java_array(struct_type),
is_valid_java_array(class_type),
"Constructed a new type representing a Java Array "
"object that doesn't match expectations");

symbolt symbol;
symbol.name=symbol_type_identifier;
symbol.base_name=symbol_type.get(ID_C_base_name);
symbol.is_type=true;
symbol.type=struct_type;
symbol.type = class_type;
symbol_table.add(symbol);

// Also provide a clone method:
Expand Down

0 comments on commit 881b127

Please sign in to comment.