@@ -81,9 +81,9 @@ java_class_loadert::parse_tree_with_overlayst &java_class_loadert::operator()(
81
81
optionalt<java_bytecode_parse_treet> java_class_loadert::get_class_from_jar (
82
82
const irep_idt &class_name,
83
83
const std::string &jar_file,
84
- const jar_indext &jar_index,
85
84
java_class_loader_limitt &class_loader_limit)
86
85
{
86
+ jar_indext &jar_index = jars_by_path.at (jar_file);
87
87
auto jar_index_it = jar_index.find (class_name);
88
88
if (jar_index_it == jar_index.end ())
89
89
return {};
@@ -112,11 +112,9 @@ java_class_loadert::get_parse_tree(
112
112
// First add all given JAR files
113
113
for (const auto &jar_file : jar_files)
114
114
{
115
- jar_index_optcreft index = read_jar_file (class_loader_limit, jar_file);
116
- if (!index )
117
- continue ;
115
+ read_jar_file (class_loader_limit, jar_file);
118
116
optionalt<java_bytecode_parse_treet> parse_tree =
119
- get_class_from_jar (class_name, jar_file, * index , class_loader_limit);
117
+ get_class_from_jar (class_name, jar_file, class_loader_limit);
120
118
if (parse_tree)
121
119
parse_trees.push_back (*parse_tree);
122
120
}
@@ -132,26 +130,23 @@ java_class_loadert::get_parse_tree(
132
130
133
131
// This does not read from the jar file but from the jar_filet object we
134
132
// just created
135
- jar_index_optcreft index = read_jar_file (class_loader_limit, core_models);
136
- if (index )
137
- {
138
- optionalt<java_bytecode_parse_treet> parse_tree =
139
- get_class_from_jar (class_name, core_models, *index , class_loader_limit);
140
- if (parse_tree)
141
- parse_trees.push_back (*parse_tree);
142
- }
133
+ read_jar_file (class_loader_limit, core_models);
134
+
135
+ optionalt<java_bytecode_parse_treet> parse_tree =
136
+ get_class_from_jar (class_name, core_models, class_loader_limit);
137
+ if (parse_tree)
138
+ parse_trees.push_back (*parse_tree);
143
139
}
144
140
145
141
// Then add everything on the class path
146
142
for (const auto &cp_entry : config.java .classpath )
147
143
{
148
144
if (has_suffix (cp_entry, " .jar" ))
149
145
{
150
- jar_index_optcreft index = read_jar_file (class_loader_limit, cp_entry);
151
- if (!index )
152
- continue ;
146
+ read_jar_file (class_loader_limit, cp_entry);
147
+
153
148
optionalt<java_bytecode_parse_treet> parse_tree =
154
- get_class_from_jar (class_name, cp_entry, * index , class_loader_limit);
149
+ get_class_from_jar (class_name, cp_entry, class_loader_limit);
155
150
if (parse_tree)
156
151
parse_trees.push_back (*parse_tree);
157
152
}
0 commit comments