@@ -120,13 +120,9 @@ static bool operator==(const irep_idt &what, const patternt &pattern)
120
120
return pattern==what;
121
121
}
122
122
123
- // name contains <init> or <clinit>
124
- bool java_bytecode_convert_methodt::is_constructor (
125
- const class_typet::methodt &method)
123
+ static bool is_constructor (const irep_idt &method_name)
126
124
{
127
- const std::string &name (id2string (method.get_name ()));
128
- const std::string::size_type &npos (std::string::npos);
129
- return npos!=name.find (" <init>" ) || npos!=name.find (" <clinit>" );
125
+ return id2string (method_name).find (" <init>" ) != std::string::npos;
130
126
}
131
127
132
128
exprt::operandst java_bytecode_convert_methodt::pop (std::size_t n)
@@ -345,7 +341,7 @@ void java_bytecode_convert_method_lazy(
345
341
else
346
342
member_type.set_access (ID_default);
347
343
348
- if (method_symbol.base_name == " <init> " )
344
+ if (is_constructor ( method_symbol.base_name ) )
349
345
{
350
346
method_symbol.pretty_name =
351
347
id2string (class_symbol.pretty_name )+" ." +
@@ -537,7 +533,7 @@ void java_bytecode_convert_methodt::convert(
537
533
// The pretty name of a constructor includes the base name of the class
538
534
// instead of the internal method name "<init>". For regular methods, it's
539
535
// just the base name of the method.
540
- if (method_symbol.base_name == " <init> " )
536
+ if (is_constructor ( method_symbol.base_name ) )
541
537
{
542
538
method_symbol.pretty_name = id2string (class_symbol.pretty_name ) + " ." +
543
539
id2string (class_symbol.base_name ) + " ()" ;
@@ -1271,9 +1267,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1271
1267
// constructors.
1272
1268
if (statement==" invokespecial" )
1273
1269
{
1274
- if (
1275
- id2string (arg0.get (ID_identifier)).find (" <init>" ) !=
1276
- std::string::npos)
1270
+ if (is_constructor (arg0.get (ID_identifier)))
1277
1271
{
1278
1272
if (needed_lazy_methods)
1279
1273
needed_lazy_methods->add_needed_class (classname);
0 commit comments