title: Why NativeMethodAccessorImpl declare InvocationTargetException
body: <p><a href="https://github.com/frohoff/jdk8u-jdk/blob/master/src/share/classes/sun/reflect/NativeMethodAccessorImpl.java" rel="nofollow noreferrer">NativeMethodAccessorImpl invoke method</a> declare it can throws  <code>IllegalArgumentException</code> or <code>InvocationTargetException</code></p>
  
  <blockquote>
  <pre><code>public Object invoke(Object obj, Object[] args)
      throws IllegalArgumentException, InvocationTargetException
  {
      // We can't inflate methods belonging to vm-anonymous classes because
      // that kind of class can't be referred to by name, hence can't be
      // found from the generated bytecode.
      if (++numInvocations &gt; ReflectionFactory.inflationThreshold()
              &amp;&amp; !ReflectUtil.isVMAnonymousClass(method.getDeclaringClass())) {
          MethodAccessorImpl acc = (MethodAccessorImpl)
              new MethodAccessorGenerator().
                  generateMethod(method.getDeclaringClass(),
                                 method.getName(),
                                 method.getParameterTypes(),
                                 method.getReturnType(),
                                 method.getExceptionTypes(),
                                 method.getModifiers());
          parent.setDelegate(acc);
      }
      return invoke0(method, obj, args);
  }
  private static native Object invoke0(Method m, Object obj, Object[] args);
  </code></pre>
  </blockquote>
  
  <p>Native method <a href="https://stackoverflow.com/questions/36125950/what-is-wrong-with-my-method-invoke-call">throws IllegalArgumentException</a> in some cases, e.g.</p>
  
  <blockquote>
  <pre><code>Exception in thread "main" java.lang.IllegalArgumentException: argument type mismatch
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  </code></pre>
  </blockquote>
  
  <p>But I don't see any option for throwing <code>InvocationTargetException</code> <strong>checked exception</strong></p>
  
  <p>Can <code>InvocationTargetException</code> be thrown by native method <code>invoke0</code> (which doesn't declare exceptions)?</p>
  
  <p>Or is <code>InvocationTargetException</code> remains because of method signature backward/future compatibility ?</p>