From JVMS chapter 6.3:
[...] any of the
VirtualMachineError
subclasses defined below [InternalError
,OutOfMemoryError
,StackOverflowError
,UnknownError
] may be thrown at any time during the operation of the Java Virtual Machine
How does the JVMS define the phrase "at any time during the operation of the Java Virtual Machine"?
How do current JVMs interpret that phrase?
Specifically, does it mean that the four errors, java.lang.InternalError
, java.lang.OutOfMemoryError
, java.lang.StackOverflowError
, and java.lang.UnknownError
, may be thrown between statements? :
// ....
A(); B(); C();
try {
// nothing
} catch (InternalError | OutOfMemoryError | StackOverflowError | UnknownError e) {
// may occur?
}
D(); E(); F();
try {
; // semi-colon
} catch (InternalError | OutOfMemoryError | StackOverflowError | UnknownError e) {
// may occur?
}
G(); H(); I();
try {
; ; ;; ;;;;; ; ; ;;; ;; ;; ;; ;; ; ;; ; ;; // ... semi-colons
} catch (InternalError | OutOfMemoryError | StackOverflowError | UnknownError e) {
// may occur?
}
J(); K(); L();
// ....