1919
2020#include < java_bytecode/java_bytecode_language.h>
2121
22- // / Go through the process of loading, typechecking and finalising loading a
22+ // / Go through the process of loading, type-checking and finalising loading a
2323// / specific class file to build the symbol table.
2424// / \param java_class_name: The name of the class file to load. It should not
2525// / include the .class extension.
2626// / \param class_path: The path to load the class from. Should be relative to
2727// / the unit directory.
28+ // / \param main: The name of the main function or "" to use the default
29+ // / behaviour to find a main function.
2830// / \return The symbol table that is generated by parsing this file.
2931symbol_tablet load_java_class (
3032 const std::string &java_class_name,
31- const std::string &class_path)
33+ const std::string &class_path,
34+ const std::string &main)
3235{
3336 return load_java_class (
34- java_class_name, class_path, new_java_bytecode_language ());
37+ java_class_name, class_path, main, new_java_bytecode_language ());
3538}
3639
40+ // / Go through the process of loading, type-checking and finalising loading a
41+ // / specific class file to build the symbol table.
42+ // / \param java_class_name: The name of the class file to load. It should not
43+ // / include the .class extension.
44+ // / \param class_path: The path to load the class from. Should be relative to
45+ // / the unit directory.
46+ // / \param main: The name of the main function or "" to use the default
47+ // / behaviour to find a main function.
48+ // / \param java_lang: The language implementation to use for the loading,
49+ // / which will be destroyed by this function.
50+ // / \return The symbol table that is generated by parsing this file.
3751symbol_tablet load_java_class (
3852 const std::string &java_class_name,
3953 const std::string &class_path,
54+ const std::string &main,
4055 std::unique_ptr<languaget> &&java_lang)
4156{
4257 // We expect the name of the class without the .class suffix to allow us to
@@ -58,6 +73,7 @@ symbol_tablet load_java_class(
5873 command_line.set (" java-cp-include-files" , class_path);
5974 config.java .classpath .clear ();
6075 config.java .classpath .push_back (class_path);
76+ config.main = main;
6177
6278 // Add the language to the model
6379 language_filet &lf=lazy_goto_model.add_language_file (filename);
0 commit comments