Skip to content

Commit 0e6efc7

Browse files
author
Matthias Güdemann
committed
Documentation for class_loader_limit
1 parent 78d22fb commit 0e6efc7

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

jbmc/src/java_bytecode/java_class_loader_limit.cpp

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,38 @@ Author: Daniel Kroening, [email protected]
1313

1414
#include <json/json_parser.h>
1515

16-
/// initializes class with either regex matcher or match set
17-
/// \par parameters: parameter from `java-cp-include-files`
16+
/// Initializes class with either regex matcher or match set. If the string
17+
/// starts with an `@` it is treated as a path to a JSON file. Otherwise, it is
18+
/// treated as a regex.
19+
///
20+
/// The regex case describes which class files should be loaded in the form of a
21+
/// regular expression used with `regex_match`.
22+
///
23+
/// The match set is a list of files to load in JSON format, the argument is the
24+
/// name of the JSON file, prefixed with `@`. The file contains one section to
25+
/// list the .jar files to load and one section to list the .class files to load
26+
/// from the .jar.
27+
///
28+
/// for example a file called `load.json` with the following content:
29+
/// {
30+
/// "jar":
31+
/// [
32+
/// "A.jar",
33+
/// "B.jar"
34+
/// ],
35+
/// "classFiles":
36+
/// [
37+
/// "jarfile3$A.class",
38+
/// "jarfile3.class"
39+
/// ]
40+
/// }
41+
/// would be specified via `--java-cp-include-files @load.json` and would
42+
/// instruct the driver to load `A.jar` and `B.jar` and the two .class files
43+
/// `jarfile3$A.class` and `jarfile3.class`. All the rest of the .jar files is
44+
/// ignored.
45+
///
46+
/// \param java_cp_include_files: parameter from `java-cp-include-files` in the
47+
/// format as described above
1848
void java_class_loader_limitt::setup_class_load_limit(
1949
const std::string &java_cp_include_files)
2050
{
@@ -51,7 +81,9 @@ void java_class_loader_limitt::setup_class_load_limit(
5181
}
5282
}
5383

54-
/// \par parameters: class file name
84+
/// Use the class load limiter to decide whether a class file should be loaded
85+
/// or not.
86+
/// \param file_name: the name of the class file to load
5587
/// \return true if file should be loaded, else false
5688
bool java_class_loader_limitt::load_class_file(const std::string &file_name)
5789
{

jbmc/src/java_bytecode/java_class_loader_limit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Author: Daniel Kroening, [email protected]
1818
#include <util/irep.h>
1919
#include <util/message.h>
2020

21+
/// Class representing a filter for class file loading.
2122
class java_class_loader_limitt:public messaget
2223
{
2324
/// Whether to use regex_matcher instead of set_matcher

0 commit comments

Comments
 (0)