Skip to content

Commit 7d7424f

Browse files
committed
Document the new class loading strategy for JARs
1 parent 091d072 commit 7d7424f

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

jbmc/src/janalyzer/janalyzer_parse_options.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,12 @@ void janalyzer_parse_optionst::help()
733733
"Usage: Purpose:\n"
734734
"\n"
735735
" janalyzer [-?] [-h] [--help] show help\n"
736-
" janalyzer class name of class to be checked\n"
736+
" janalyzer class name of class or JAR file to be checked\n"
737+
" In the case of a JAR file, if a main class can be\n" // NOLINT(*)
738+
" inferred from --main-class, --function, or the JAR\n" // NOLINT(*)
739+
" manifest (checked in this order), the behavior is\n" // NOLINT(*)
740+
" the same as running janalyzer on the corresponding\n" // NOLINT(*)
741+
" class file."
737742
"\n"
738743
"Task options:\n"
739744
" --show display the abstract domains\n"

jbmc/src/java_bytecode/java_bytecode_language.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ bool java_bytecode_languaget::preprocess(
168168
return true;
169169
}
170170

171+
/// We set the main class (i.e.\ class to start the class loading analysis from,
172+
/// see \ref java_class_loadert) depending on the file type of `path`.
173+
/// `path` can be the name of either a .class file or a .jar file.
174+
/// If it is a .class file, the top-level class in this file is the main class.
175+
/// If it is a .jar file, we first check for the main class in three steps
176+
/// 1) the argument of the --main-class command-line option,
177+
/// 2) the class implied by the argument of the --function option,
178+
/// 3) the manifest file of the JAR.
179+
/// If no main class was found, all classes in the JAR file are loaded.
171180
bool java_bytecode_languaget::parse(
172181
std::istream &,
173182
const std::string &path)

jbmc/src/jbmc/jbmc_parse_options.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,12 @@ void jbmc_parse_optionst::help()
10181018
"Usage: Purpose:\n"
10191019
"\n"
10201020
" jbmc [-?] [-h] [--help] show help\n"
1021-
" jbmc class name of class to be checked\n"
1021+
" jbmc class name of class or JAR file to be checked\n"
1022+
" In the case of a JAR file, if a main class can be\n" // NOLINT(*)
1023+
" inferred from --main-class, --function, or the JAR\n" // NOLINT(*)
1024+
" manifest (checked in this order), the behavior is\n" // NOLINT(*)
1025+
" the same as running jbmc on the corresponding\n" // NOLINT(*)
1026+
" class file."
10221027
"\n"
10231028
"Analysis options:\n"
10241029
HELP_SHOW_PROPERTIES

0 commit comments

Comments
 (0)