Skip to content

Commit

Permalink
Improving warnings for unsupported signatures for generics
Browse files Browse the repository at this point in the history
  • Loading branch information
majakusber committed Mar 21, 2018
1 parent c6ccc8c commit e601d78
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
26 changes: 15 additions & 11 deletions src/java_bytecode/java_bytecode_convert_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,12 @@ void java_bytecode_convert_classt::convert(const classt &c)
}
class_type=generic_class_type;
}
catch(unsupported_java_class_signature_exceptiont)
catch(unsupported_java_class_signature_exceptiont &e)
{
warning() << "we currently don't support parsing for example double "
"bounded, recursive and wild card generics" << eom;
warning() << "Class: " << c.name
<< "\n could not parse signature: " << c.signature.value()
<< "\n " << e.what() << "\n ignoring that the class is generic"
<< eom;
}
}

Expand Down Expand Up @@ -253,11 +255,12 @@ void java_bytecode_convert_classt::convert(const classt &c)
base, superclass_ref.value(), qualified_classname);
class_type.add_base(generic_base);
}
catch(unsupported_java_class_signature_exceptiont)
catch(unsupported_java_class_signature_exceptiont &e)
{
debug() << "unsupported generic superclass signature "
<< id2string(*superclass_ref)
<< " falling back on using the descriptor" << eom;
warning() << "Superclass: " << c.extends << " of class: " << c.name
<< "\n could not parse signature: " << superclass_ref.value()
<< "\n " << e.what()
<< "\n ignoring that the superclass is generic" << eom;
class_type.add_base(base);
}
}
Expand Down Expand Up @@ -292,11 +295,12 @@ void java_bytecode_convert_classt::convert(const classt &c)
base, interface_ref.value(), qualified_classname);
class_type.add_base(generic_base);
}
catch(unsupported_java_class_signature_exceptiont)
catch(unsupported_java_class_signature_exceptiont &e)
{
debug() << "unsupported generic interface signature "
<< id2string(*interface_ref)
<< " falling back on using the descriptor" << eom;
warning() << "Interface: " << interface << " of class: " << c.name
<< "\n could not parse signature: " << interface_ref.value()
<< "\n " << e.what()
<< "\n ignoring that the interface is generic" << eom;
class_type.add_base(base);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/java_bytecode/java_bytecode_convert_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,15 @@ code_typet member_type_lazy(
}
else
{
message.warning() << "method: " << class_name << "." << method_name
message.warning() << "Method: " << class_name << "." << method_name
<< "\n signature: " << signature.value() << "\n descriptor: "
<< descriptor << "\n different number of parameters, reverting to "
"descriptor" << message.eom;
}
}
catch(unsupported_java_class_signature_exceptiont &e)
{
message.warning() << "method: " << class_name << "." << method_name
message.warning() << "Method: " << class_name << "." << method_name
<< "\n could not parse signature: " << signature.value() << "\n "
<< e.what() << "\n" << " reverting to descriptor: "
<< descriptor << message.eom;
Expand Down

0 comments on commit e601d78

Please sign in to comment.