Skip to content

Commit 4c472e9

Browse files
committed
Always load classes with throw_runtime_exceptions
When the command-line option "--throw-runtime-exception" is enabled, the five runtime exception classes ArithmeticException ArrayIndexOutOfBoundsException ClassCastException NegativeArraySizeException NullPointerException should always be loaded. These five classes might appear without an explicit call to "throw new" in the program, and would therefore be ignored by java_class_loader. These changes fix bug TG-774.
1 parent 2f7ee60 commit 4c472e9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/java_bytecode/java_bytecode_language.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,19 @@ void java_bytecode_languaget::get_language_options(const cmdlinet &cmd)
6161
else
6262
lazy_methods_mode=LAZY_METHODS_MODE_EAGER;
6363

64+
if(cmd.isset("java-throw-runtime-exceptions"))
65+
{
66+
throw_runtime_exceptions = true;
67+
java_load_classes.insert(
68+
java_load_classes.end(),
69+
exception_needed_classes.begin(),
70+
exception_needed_classes.end());
71+
}
6472
if(cmd.isset("java-load-class"))
6573
{
66-
for(const auto &c : cmd.get_values("java-load-class"))
67-
java_load_classes.push_back(c);
74+
const auto &values = cmd.get_values("java-load-class");
75+
java_load_classes.insert(
76+
java_load_classes.end(), values.begin(), values.end());
6877
}
6978

7079
const std::list<std::string> &extra_entry_points=

0 commit comments

Comments
 (0)