# Class ObjectInstantiationException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.gradle.api.reflect.ObjectInstantiationException

All Implemented Interfaces:
  `Serializable`

public class ObjectInstantiationException extends RuntimeException
Thrown when an object cannot be instantiated.

Since:
  4.2
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ObjectInstantiationException(Class<?> targetType, @Nullable Throwable throwable)`
  Creates a new `ObjectInstantiationException`.

- ## Method Summary

  ### Methods inherited from class Throwable

  `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### ObjectInstantiationException

    public ObjectInstantiationException(Class<?> targetType, @Nullable Throwable throwable)
    Creates a new `ObjectInstantiationException`.
    Since:
      4.2