title: No-throw VirtualMachineError guarantees
body: <p>I've come to Java from C++. In the C++ world we pay attention to exception safety, and note that mutators can provide different guarantees in the face of exceptions thrown by the mutator itself or a method it delegates to (minimum, strong, no-throw). Implementing a method that has a strong exception guarantee requires that some basic operations are guaranteed never to throw an exception. The JLS makes statements about which operations can throw which kinds of exceptions, but the <code>VirtualMachineError</code> error presents a problem. Quoth the <a href="https://docs.oracle.com/javase/specs/jls/se7/html/jls-11.html#jls-11.1.2" rel="nofollow noreferrer">JLS</a>:</p>
  
  <blockquote>
    <p>an internal error or resource limitation prevents the Java virtual
    machine from implementing the semantics of the Java programming
    language; in this case, an instance of a subclass of
    <code>VirtualMachineError</code> is thrown.</p>
  </blockquote>
  
  <p>The JLS says no more about <code>VirtualMachineError</code>. An "internal error" means a bug in the JVM, so I'm not interested in that case: in the face of bugs in the JVM, all bets are off. But what about the "resource limitation" case? Are there any operations that are guaranteed never to fail because of a resource limitation?</p>