Package Torello.Java
Class UnreachableError
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Error
-
- Torello.Java.UnreachableError
-
- All Implemented Interfaces:
java.io.Serializable
public class UnreachableError extends java.lang.Error
If a code-block that was theoretically unreachable is actually reached, this error is a great class to make use-of during any debugging-phase of the development-process. The detail message in this class may not be configured using the constructors to this class - it is set inside this class' constructor, and cannot be modified! It's a pre-defined message, and informs the reader that the problem that's been encountered is with programing logic itself (and it needs to be addressed by the progrmmer).
NOTE: This class extendsjava.lang.Error
because it should be used and 'thought-of' in a way similar to a Javaassert
-statement. Such coding practice is usually restricted to the debugging phase of development, and extra care should be taken to ensure that the final version of releasable-code would never be capable of throwingUnreachableError
, unless some here-to-fore unrecognized constraints are reached or broken.
The build code for theJava HTML '.jar'
makes quite a bit of use of thisError
. It should not be thrown, but when it is, it means the code has to be changed.- See Also:
- Serialized Form
Hi-Lited Source-Code:- View Here: Torello/Java/UnreachableError.java
- Open New Browser-Tab: Torello/Java/UnreachableError.java
File Size: 2,484 Bytes Line Count: 50 '\n' Characters Found
-
-
Field Summary
Fields Modifier and Type Field static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description UnreachableError()
Constructs aUnreachableError
with a pre-defined detail-message.UnreachableError(Throwable cause)
Constructs a new exception with the specified'cause'
and a pre-defined
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
This fulfils the SerialVersion UID requirement for all classes that implement Java'sinterface java.io.Serializable
. Using theSerializable
Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.
Note that Java'sjava.lang.Exception
andjava.lang.Error
classes implement theSerializable interface
, and a warning-free build expects this field be defined here.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final long serialVersionUID = 1;
-
-
Constructor Detail
-
UnreachableError
public UnreachableError()
Constructs aUnreachableError
with a pre-defined detail-message.
-
UnreachableError
public UnreachableError(java.lang.Throwable cause)
Constructs a new exception with the specified'cause'
and a pre-defined- Parameters:
cause
- The cause (which is saved for later retrieval by theThrowable.getCause()
method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)- Code:
- Exact Constructor Body:
super( "This code path has reached a point that was theoretically, or thought-to-be " + "unreachable. This is the fault of the developer of this class package. A cause " + "Throwable has been provided. Please see this.getCause() for more information.", cause );
-
-