@@ -81,6 +81,11 @@ void java_class_loadert::add_classpath_entry(const std::string &path)
8181 }
8282}
8383
84+ // / Load class from jar file.
85+ // / \param class_name: name of class to load in Java source format
86+ // / \param jar_file: path of the jar file
87+ // / \param jar_index: the index of the jar file
88+ // / \return optional value of parse tree, empty if class cannot be loaded
8489optionalt<java_bytecode_parse_treet> java_class_loadert::get_class_from_jar (
8590 const irep_idt &class_name,
8691 const std::string &jar_file,
@@ -102,6 +107,10 @@ optionalt<java_bytecode_parse_treet> java_class_loadert::get_class_from_jar(
102107 return java_bytecode_parse (istream, get_message_handler ());
103108}
104109
110+ // / Check if class is an overlay class by inspecting the `ID_overlay_class`
111+ // / annotation.
112+ // / \param c: a `classt` object from a java byte code parse tree
113+ // / \return true if parsed class is an overlay class, else false
105114static bool is_overlay_class (const java_bytecode_parse_treet::classt &c)
106115{
107116 return java_bytecode_parse_treet::find_annotation (
@@ -228,6 +237,9 @@ java_class_loadert::get_parse_tree(
228237 return parse_trees;
229238}
230239
240+ // / Load all class files from a .jar file, and store name of .jar in
241+ // / `classpath_entreies`.
242+ // / \param jar_path: the path for the .jar to load
231243void java_class_loadert::load_entire_jar (
232244 const std::string &jar_path)
233245{
@@ -280,6 +292,12 @@ java_class_loadert::jar_index_optcreft java_class_loadert::read_jar_file(
280292 return std::cref (jar_index);
281293}
282294
295+ // / Convert a file name to the class name. Java interprets folders as packages,
296+ // / therefore a prefix of `./` is removed if necessary, and all `/` are
297+ // / converted to `.`. For example a class file `./com/diffblue/test.class` is
298+ // / converted to the class name `com.diffblue.test`.
299+ // / \param file: the name of the class file
300+ // / \return the file name converted to Java class name
283301std::string java_class_loadert::file_to_class_name (const std::string &file)
284302{
285303 std::string result=file;
@@ -307,6 +325,10 @@ std::string java_class_loadert::file_to_class_name(const std::string &file)
307325 return result;
308326}
309327
328+ // / Convert a class name to a file name, does the inverse of \ref
329+ // / file_to_class_name.
330+ // / \param class_name: the name of the class
331+ // / \return the class name converted to file name
310332std::string java_class_loadert::class_name_to_file (const irep_idt &class_name)
311333{
312334 std::string result=id2string (class_name);
0 commit comments