From e601d788649f8871aa8c737682f81be6accf0c72 Mon Sep 17 00:00:00 2001 From: svorenova Date: Wed, 21 Mar 2018 12:25:37 +0000 Subject: [PATCH] Improving warnings for unsupported signatures for generics --- .../java_bytecode_convert_class.cpp | 26 +++++++++++-------- .../java_bytecode_convert_method.cpp | 4 +-- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/java_bytecode/java_bytecode_convert_class.cpp b/src/java_bytecode/java_bytecode_convert_class.cpp index 6c84b21f532a..317c4f3c3616 100644 --- a/src/java_bytecode/java_bytecode_convert_class.cpp +++ b/src/java_bytecode/java_bytecode_convert_class.cpp @@ -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; } } @@ -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); } } @@ -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); } } diff --git a/src/java_bytecode/java_bytecode_convert_method.cpp b/src/java_bytecode/java_bytecode_convert_method.cpp index 366674e85dc9..7d19ac2e7d7d 100644 --- a/src/java_bytecode/java_bytecode_convert_method.cpp +++ b/src/java_bytecode/java_bytecode_convert_method.cpp @@ -286,7 +286,7 @@ 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; @@ -294,7 +294,7 @@ code_typet member_type_lazy( } 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;