File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -223,13 +223,20 @@ std::string gather_full_class_name(const std::string &src)
223
223
return class_name;
224
224
}
225
225
226
- reference_typet
226
+ // / For parsing a class type reference
227
+ // / \param src: The input string
228
+ // / Either a signature: "Lpackage/class<TT;>.innerclass<Ljava/lang/Foo;>;
229
+ // / Or a descriptor: "Lpackage.class$inner;
230
+ // / \param class_name_prefix: The name of the class to use to prefix any found
231
+ // / generic types
232
+ // / \return The reference type if parsed correctly, no value if parsing fails.
233
+ optionalt<reference_typet>
227
234
build_class_name (const std::string src, const std::string &class_name_prefix)
228
235
{
229
236
PRECONDITION (src[0 ] == ' L' );
230
237
// ends on ;
231
238
if (src[src.size () - 1 ] != ' ;' )
232
- throw " invalid string for reference type " ;
239
+ return optionalt<reference_typet>() ;
233
240
234
241
std::string container_class = gather_full_class_name (src);
235
242
std::string identifier = " java::" + container_class;
@@ -473,7 +480,12 @@ typet java_type_from_string(
473
480
}
474
481
case ' L' :
475
482
{
476
- return build_class_name (src, class_name_prefix);
483
+ const optionalt<reference_typet> &class_type =
484
+ build_class_name (src, class_name_prefix);
485
+ if (class_type)
486
+ return class_type.value ();
487
+ else
488
+ return nil_typet ();
477
489
}
478
490
case ' *' :
479
491
case ' +' :
You can’t perform that action at this time.
0 commit comments