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.Errorbecause 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,509 Bytes Line Count: 53 '\n' Characters Found
-
-
Field Summary
Fields Modifier and Type Field static longserialVersionUID
-
Constructor Summary
Constructors Constructor UnreachableError()UnreachableError(Throwable cause)
-
-
-
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 theSerializableImplementation 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.Exceptionandjava.lang.Errorclasses 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 aUnreachableErrorwith a pre-defined detail-message.- 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 or package." );
-
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 );
-
-