orbital.util
Class SuspiciousError
java.lang.Object
java.lang.Throwable
java.lang.Error
java.lang.VirtualMachineError
java.lang.InternalError
orbital.util.SuspiciousError
- All Implemented Interfaces:
- java.io.Serializable
public class SuspiciousError
- extends java.lang.InternalError
This class is a SuspiciousError thrown like an InternalError whenever logical errors raise
which should not normally occur for correct semantics.
This particular error should raise if a cautious assumption fails even after
it should have already been tested.
As an example for distinction consider:
if (a.still_available())
try {
assert a.count()!=0 : "still_available() and count() consistent";
processAll(a);
assert a.count()==0 : "all data processed";
}
// exceptions which simply cannot occur semantically correct
catch(SemanticallyUnavailableException oops) {throw new SuspiciousError("exception unavailable");}
// exceptions that are semantically and pragmatically impossible
catch(ImpossibleException imp) {throw new InternalError("panic");}
else
assert a.count()==0 : "still_available() and count() consistent";
So you should distinguish two situations:
try {
if (a instanceof Thing)
((Thing)a).setImportantAspect(42);
} // exceptions that are semantically and pragmatically impossible
catch(ClassCastException imp) {throw new InternalError("panic: classcast garbage");}
Object arg;
arg = new Thing("something");
try {
// could do assert a instanceof Thing,"a Thing remains a Thing");
((Thing)a).setImportantAspect(6*9);
}
// exceptions which simply cannot occur semantically correct
catch(ClassCastException oops) {throw new SuspiciousError("should not happen");}
- Author:
- André Platzer
- See Also:
InternalError
,
Serialized Form
Methods inherited from class java.lang.Throwable |
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
SuspiciousError
public SuspiciousError(java.lang.String message)
SuspiciousError
public SuspiciousError()
Copyright © 1996-2009 André Platzer
All Rights Reserved.