Skip to content

Commit 92799f0

Browse files
committed
Remove Java's unnecessary languaget::parse peculiarity
We can safely use the three-argument version and thereby avoid a need for casting.
1 parent d635850 commit 92799f0

File tree

5 files changed

+6
-22
lines changed

5 files changed

+6
-22
lines changed

jbmc/src/janalyzer/janalyzer_parse_options.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ int janalyzer_parse_optionst::doit()
380380

381381
log.status() << "Parsing ..." << messaget::eom;
382382

383-
if(static_cast<java_bytecode_languaget *>(language.get())
384-
->parse(ui_message_handler))
383+
std::istringstream unused;
384+
if(language.get()->parse(unused, "", ui_message_handler))
385385
{
386386
log.error() << "PARSING ERROR" << messaget::eom;
387387
return CPROVER_EXIT_PARSE_ERROR;

jbmc/src/java_bytecode/java_bytecode_language.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -362,17 +362,6 @@ void java_bytecode_languaget::parse_from_main_class(
362362
}
363363
}
364364

365-
/// We set the main class (i.e.\ class to start the class loading analysis,
366-
/// see \ref java_class_loadert) when we have have been given a main class.
367-
bool java_bytecode_languaget::parse(message_handlert &message_handler)
368-
{
369-
PRECONDITION(language_options.has_value());
370-
initialize_class_loader(message_handler);
371-
main_class = config.java.main_class;
372-
parse_from_main_class(message_handler);
373-
return false;
374-
}
375-
376365
/// We set the main class (i.e.\ class to start the class loading analysis,
377366
/// see \ref java_class_loadert)
378367
/// when we have a JAR file given via the -jar option:

jbmc/src/java_bytecode/java_bytecode_language.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,6 @@ class java_bytecode_languaget:public languaget
267267
std::ostream &outstream,
268268
message_handlert &message_handler) override;
269269

270-
// This is an extension to languaget
271-
// required because parsing of Java programs can be initiated without
272-
// opening a file first or providing a path to a file
273-
// as dictated by \ref languaget.
274-
virtual bool parse(message_handlert &);
275-
276270
bool parse(
277271
std::istream &instream,
278272
const std::string &path,

jbmc/src/java_bytecode/lazy_goto_model.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ void lazy_goto_modelt::initialize(
145145

146146
msg.status() << "Parsing ..." << messaget::eom;
147147

148-
if(dynamic_cast<java_bytecode_languaget &>(language).parse(message_handler))
148+
std::istringstream unused;
149+
if(language.parse(unused, "", message_handler))
149150
{
150151
throw invalid_input_exceptiont("PARSING ERROR");
151152
}

jbmc/src/jbmc/jbmc_parse_options.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,8 @@ int jbmc_parse_optionst::doit()
458458

459459
log.status() << "Parsing ..." << messaget::eom;
460460

461-
if(static_cast<java_bytecode_languaget *>(language.get())
462-
->parse(ui_message_handler))
461+
std::istringstream unused;
462+
if(language.get()->parse(unused, "", ui_message_handler))
463463
{
464464
log.error() << "PARSING ERROR" << messaget::eom;
465465
return CPROVER_EXIT_PARSE_ERROR;

0 commit comments

Comments
 (0)