Skip to content

Commit 2f7ee60

Browse files
committed
Store list of runtime exceptions in new variable
The new public variable exception_needed_classes stores a list of Java exception classes that can be introduced by java_bytecode_instrument. These five classes can be generated by a Java program without explicitly using "throw new".
1 parent 396adaf commit 2f7ee60

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/java_bytecode/java_bytecode_instrument.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ class java_bytecode_instrumentt:public messaget
8080
};
8181

8282

83+
const std::vector<irep_idt> exception_needed_classes =
84+
{
85+
"java.lang.ArithmeticException",
86+
"java.lang.ArrayIndexOutOfBoundsException",
87+
"java.lang.ClassCastException",
88+
"java.lang.NegativeArraySizeException",
89+
"java.lang.NullPointerException"
90+
};
91+
8392
/// Creates a class stub for exc_name and generates a
8493
/// conditional GOTO such that exc_name is thrown when
8594
/// cond is met.

src/java_bytecode/java_bytecode_instrument.h

+2
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ void java_bytecode_instrument(
2626
const bool throw_runtime_exceptions,
2727
message_handlert &_message_handler);
2828

29+
extern const std::vector<irep_idt> exception_needed_classes;
30+
2931
#endif

0 commit comments

Comments
 (0)