Skip to content

Commit 97e1b9a

Browse files
author
svorenova
committed
Adding a warning and a commentary for unsupported generics, cleaning
1 parent 4f305de commit 97e1b9a

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/java_bytecode/java_bytecode_convert_class.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ void java_bytecode_convert_classt::convert(const classt &c)
117117
}
118118
catch(unsupported_java_class_siganture_exceptiont)
119119
{
120-
// Do nothing: we don't support parsing for example double bounded or
121-
// two entry elements
122-
120+
warning() << "we currently don't support parsing for example double "
121+
"bounded, recursive and wild card generics" << eom;
123122
}
124123
}
125124

src/java_bytecode/java_types.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ typet java_type_from_string(
201201
// type parameters (e.g. on generic methods on non-generic classes
202202
// or generic static methods). For now we skip over this part of the
203203
// signature and continue parsing the rest of the signature as normal
204+
// So for example, the following java method:
205+
// static void <T, U> foo(T t, U u, int x);
206+
// Would have a signature that looks like:
207+
// <T:Ljava/lang/Object;U:Ljava/lang/Object;>(TT;TU;I)V
208+
// So we skip all inside the angle brackets and parse the rest of the
209+
// string:
210+
// (TT;TU;I)V
204211
size_t closing_generic=find_closing_delimiter(src, 0, '<', '>');
205212
const typet &method_type=java_type_from_string(
206213
src.substr(closing_generic+1, std::string::npos), class_name);

src/java_bytecode/java_types.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Author: Daniel Kroening, [email protected]
1515
#include <util/std_types.h>
1616
#include <util/c_types.h>
1717
#include <util/config.h>
18+
#include <util/optional.h>
1819

1920
class java_class_typet:public class_typet
2021
{
@@ -366,7 +367,8 @@ class unsupported_java_class_siganture_exceptiont:public std::logic_error
366367
inline typet java_type_from_string_with_exception(
367368
const std::string &descriptor,
368369
const optionalt<std::string> &signature,
369-
const std::string &class_name) {
370+
const std::string &class_name)
371+
{
370372
try
371373
{
372374
return java_type_from_string(signature.value(), class_name);

0 commit comments

Comments
 (0)