File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 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)
223223 return class_name;
224224}
225225
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>
227234build_class_name (const std::string src, const std::string &class_name_prefix)
228235{
229236 PRECONDITION (src[0 ] == ' L' );
230237 // ends on ;
231238 if (src[src.size () - 1 ] != ' ;' )
232- throw " invalid string for reference type " ;
239+ return optionalt<reference_typet>() ;
233240
234241 std::string container_class = gather_full_class_name (src);
235242 std::string identifier = " java::" + container_class;
@@ -473,7 +480,12 @@ typet java_type_from_string(
473480 }
474481 case ' L' :
475482 {
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 ();
477489 }
478490 case ' *' :
479491 case ' +' :
You can’t perform that action at this time.
0 commit comments