Checked Exceptions do not exist on the JVM.

Ruslan Shevchenko rssh at
Wed May 20 23:06:11 PDT 2009

> Ruslan:
> Why do you keep mentioning LinkageError? I'll try to explain the 'not-
> care' keyword one more time:
> int f() not-care MyException {
>      throw MyException();
> }
> does the *exact* same thing as:
> int f() throws MyException {
>     throw MyException();
> }
> The only difference is for javac: In the second case, with the throws
> statement, the caller must either wrap their call to f() in a try/
> catch block nd catch MyException, -or-, the caller must add a 'throws
> MyException' to their method. However, in the not-care case, a caller
> does NOT have to do these things. That's all.

I understand what you mean. But after 'that's all' JVM must do something
with exception, which was not handled ...  hmm, in theory it can be
translated to LinkageError in process barrier.

 Oops, it was not for plain JVM ;) Plain JVM just do printStackTrace()
on exception. (I wrote small text to see this).

package x;

public class X

  public X() throws Exception
    throw new Exception("hi!");

  public static void main(String[] args) {
    try {
      X x = X.class.newInstance();
    } catch (InstantiationException ex) {
      System.err.println("instantiation exception");
    } catch (IllegalAccessException ex) {
      System.err.println("illegal access exception");


 But I guess this is implementation-specifics property of JVM.   I. e.
nothing prevent JVM-implementors to handle unhandled checked exceptions
and throw LinkageErrors on some barriers (function or process).
 And I can imagine optimizations, where such change is necessory.
> Also, we can't add 'throws Throwable' to Class.newInstance - it would
> break backwards compatibility. It's also not the only problem - you
> can't close the 'construct a class file' hole, and you certainly can't
> close the 'there are other languages that run on the JVM' hole. Java
> does not break backwards compatibility. I'll let Joe give the final
> word, but the odds that java will add 'throws Throwable' to
> Class.newInstance, or adds 'throws Exception' to java.lang.Runnable,
> are somewhere  between pigs flying and hell freezing over. It just
> won't happen.

 Some evolutions exists (i. e. all methods of Date deprecated, ThreadLocal
interdace changed a lot). May be changes to Runnable or Threads to
radical; but with Class.newInstantce() ...

 Ok, let's wait for process of library changes. (As I understand, it will
be after coin)

More information about the coin-dev mailing list