title: InstantiationException on simple reflective call to newInstance on a class?
body: <p>I have an abstract class A, i.e.</p>
  
  <pre><code>public abstract class A {
  
      private final Object o;
  
      public A(Object o) {
          this.o = o;
      }
  
      public int a() {
          return 0;
      }
  
      public abstract int b();
  
  }
  </code></pre>
  
  <p>I have a subclass B, i.e.</p>
  
  <pre><code>public class B extends A {
  
      public B(Object o) {
          super(o);
      }
  
      @Override
      public int a() {
          return 1;
      }
  
      @Override
      public int b() {
          return 2;
      }
  
  }
  </code></pre>
  
  <p>I am executing the following piece of code:</p>
  
  <pre><code>Constructor c = B.class.getDeclaredConstructor(Object.class);
  B b = (B) c.newInstance(new Object());
  </code></pre>
  
  <p>and getting an InstantiationException on the call to newInstance, more specifically:</p>
  
  <pre><code>java.lang.InstantiationException
      at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
  </code></pre>
  
  <p>I don't know why I'm receiving the exception. I have looked at some other similar questions and seen things about the usage of final variables when calling the super constructor or problems with the abstract nature of the parent class, but I could not find a definitive answer to why this particular situation throws an InstantiationException. Any ideas?</p>