Package bridge
Class Unchecked
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
bridge.Unchecked
- All Implemented Interfaces:
Serializable
A class for interacting with unchecked exceptions
- See Also:
- Notes:
- Unchecked must be constructed and thrown in a single statement. They may not be stored.
Usages of these constructors and methods are counted as
removals
.
-
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
Unchecked
Allows any type of exception to become unchecked- Parameters:
exception
- Exception
-
-
Method Details
-
check
Brings an (unchecked) exception into scope- Type Parameters:
X
- Exception type- Throws:
X extends Throwable
-
cast
Performs an unchecked cast- Type Parameters:
T
- Requested type- Parameters:
instance
- Object instance- Returns:
- The instance converted to the requested type.
- Throws:
ClassCastException
- When the instance is not convertible to the requested type.
-