Go to the documentation of this file.
24 if(std::ifstream(path).good())
31 warning() <<
"Warning: failed to access JAR file `" << path <<
"'" <<
eom;
43 warning() <<
"Warning: failed to access directory `" << path <<
"'"
75 for(std::string::iterator it =
result.begin(); it !=
result.end(); it++)
92 for(std::string::iterator it =
result.begin(); it !=
result.end(); it++)
111 for(std::string::iterator it =
result.begin(); it !=
result.end(); it++)
132 switch(cp_entry.
kind)
134 case classpath_entryt::JAR:
137 case classpath_entryt::DIRECTORY:
151 const std::string &jar_file)
158 if(!
data.has_value())
161 debug() <<
"Getting class '" << class_name <<
"' from JAR " << jar_file
164 std::istringstream istream(*
data);
167 catch(
const std::runtime_error &)
169 error() <<
"failed to open JAR file '" << jar_file <<
"'" <<
eom;
181 const std::string &path)
187 if(std::ifstream(full_path))
189 debug() <<
"Getting class '" << class_name <<
"' from file " << full_path
jar_poolt jar_pool
a cache for jar_filet, by path name
#define UNREACHABLE
This should be used to mark dead code.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
static std::string file_to_class_name(const std::string &)
Convert a file name to the class name.
optionalt< java_bytecode_parse_treet > java_bytecode_parse(std::istream &istream, const irep_idt &class_name, message_handlert &message_handler, bool skip_instructions)
Attempt to parse a Java class from the given stream.
static std::string class_name_to_jar_file(const irep_idt &)
Convert a class name to a file name, does the inverse of file_to_class_name.
bool has_suffix(const std::string &s, const std::string &suffix)
An entry in the classpath.
mstreamt & result() const
optionalt< java_bytecode_parse_treet > get_class_from_jar(const irep_idt &class_name, const std::string &jar_file)
attempt to load a class from a given jar file
const std::string & id2string(const irep_idt &d)
std::string concat_dir_file(const std::string &directory, const std::string &file_name)
std::list< classpath_entryt > classpath_entries
List of entries in the classpath.
void add_classpath_entry(const std::string &)
Appends an entry to the class path, used for loading classes.
bool is_directory(const std::string &path)
optionalt< java_bytecode_parse_treet > load_class(const irep_idt &class_name, const classpath_entryt &)
attempt to load a class from a classpath_entry
nonstd::optional< T > optionalt
static std::string class_name_to_os_file(const irep_idt &)
Convert a class name to a file name, with OS-dependent syntax.
message_handlert & get_message_handler()
optionalt< java_bytecode_parse_treet > get_class_from_directory(const irep_idt &class_name, const std::string &path)
attempt to load a class from a given directory
bool has_prefix(const std::string &s, const std::string &prefix)
mstreamt & warning() const