|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jmlspecs.jml4.rac.runtime.JMLChecker
public abstract class JMLChecker
A class to set various runtime options and to check and report runtime assertion violations.
Nested Class Summary | |
---|---|
static class |
JMLChecker.CoverageCount
|
Field Summary | |
---|---|
static JMLNonExecutableException |
ANGELIC_EXCEPTION
An exception object indicating angelic undefinedness. |
static java.util.HashMap<java.lang.String,java.lang.Class<?>> |
classes
A map from fully qualified class names to class objects. |
static int |
CONSTRAINT
|
static java.lang.RuntimeException |
DEMONIC_EXCEPTION
An exception object indicating demonic undefinedness. |
static int |
INTRACONDITION
|
static int |
INVARIANT
|
static java.lang.Class<?> |
NO_CLASS
A unique object to indicate non-existing class. |
static int |
POSTCONDITION
|
static int |
PRECONDITION
|
static int |
PROTOCOL
|
Fields inherited from interface org.jmlspecs.jml4.rac.runtime.JMLOption |
---|
ALL, NONE, PRECONDITIONS_ONLY |
Constructor Summary | |
---|---|
JMLChecker()
|
Method Summary | |
---|---|
static void |
addCoverage(java.lang.String location,
boolean value)
|
static void |
clearCoverage()
|
static void |
enter()
Indicates the start of assertion check by the current thread. |
static void |
exit()
Indicates the end of assertion check for the current thread. |
static int |
getLevel()
Returns the current global runtime assertion check level. |
static int |
getLevel(java.lang.Class<?> clazz)
Returns the current runtime assertion check level of the given class, clazz . |
static java.lang.Object |
getSurrogate(java.lang.String name,
java.lang.Class<?> clazz,
java.lang.Object thisObj)
Returns a surrogate object, an instance of the given surrogate class clazz , that is suitable for statically
calling JML access methods on the object thisObj . |
static boolean |
inheritedFrom(java.lang.Class<?> clazz,
java.lang.String name,
java.lang.Class<?>[] params)
Returns true if a method named name with the
formal parameter types, params , can be inherited
from the type, class , or its supertypes. |
static boolean |
isActive(int type)
Determines if the runtime code for checking this type of assertion should be executed. |
static boolean |
isRACCompiled(java.lang.Class<?> clazz)
Returns true only if the given class, clazz , is
compiled with runtime assertion check code. |
static boolean |
reportAssumptionViolation()
Indicates whether an assumption violation should be reported to the user by throwing an appropriate exception (i.e., JMLIntraconditionError ). |
static void |
reportAssumptionViolation(boolean flag)
Sets whether an assumption violation should be reported to the user by throwing an appropriate exception (i.e., JMLIntraconditionError ). |
static void |
reportCoverage(java.io.PrintStream writer)
|
static void |
setLevel(java.lang.Class clazz,
int l)
Sets the runtime assertion check level of the class, clazz , to the level, l . |
static void |
setLevel(int l)
Sets the global runtime assertion check level to the level l . |
static java.lang.String |
toString(boolean i)
Returns the string representation of the given argument. |
static java.lang.String |
toString(byte i)
Returns the string representation of the given argument. |
static java.lang.String |
toString(char i)
Returns the string representation of the given argument. |
static java.lang.String |
toString(double value)
Returns the string representation of the given argument. |
static java.lang.String |
toString(float value)
Returns the string representation of the given argument. |
static java.lang.String |
toString(int i)
Returns the string representation of the given argument. |
static java.lang.String |
toString(long i)
Returns the string representation of the given argument. |
static java.lang.String |
toString(java.lang.Object obj)
Returns the result of invoking the toString method
to the argument, obj . |
static java.lang.String |
toString(short i)
Returns the string representation of the given argument. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.util.HashMap<java.lang.String,java.lang.Class<?>> classes
NO_CLASS
, it
means that there is no such named class. This map is used by
the generated method rac$forName(String)
, to save
class lookup and load time.
public static final java.lang.Class<?> NO_CLASS
classes
.
public static final JMLNonExecutableException ANGELIC_EXCEPTION
public static final java.lang.RuntimeException DEMONIC_EXCEPTION
public static final int PRECONDITION
public static final int POSTCONDITION
public static final int INVARIANT
public static final int CONSTRAINT
public static final int INTRACONDITION
public static final int PROTOCOL
Constructor Detail |
---|
public JMLChecker()
Method Detail |
---|
public static boolean isRACCompiled(java.lang.Class<?> clazz)
clazz
, is
compiled with runtime assertion check code.
public static void setLevel(int l)
l
.
normal_behavior requires l == NONE || l == PRECONDITIONS_ONLY || l == ALL; assignable level; ensures level == l;
public static int getLevel()
NONE
,
PRECONDITIONS_ONLY
, or ALL
.
normal_behavior assignable \nothing; ensures \result == level;
public static void setLevel(java.lang.Class clazz, int l)
clazz
, to the level, l
. If no such
class exists, this method has no effect.
normal_behavior requires l == NONE || l == PRECONDITIONS_ONLY || l == ALL; assignable \not_specified;
public static boolean inheritedFrom(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>[] params)
name
with the
formal parameter types, params
, can be inherited
from the type, class
, or its supertypes. If
either clazz
or name
is null, false
is returned.
public static int getLevel(java.lang.Class<?> clazz)
clazz
. The returned value is
NONE
, PRECONDITIONS_ONLY
, or
ALL
. If no such class is found or the class is not
compiled with runtime assertion check code, NONE
is returned.
public static boolean reportAssumptionViolation()
JMLIntraconditionError
).
The default is to report assumption violations.
reportAssumptionViolation(boolean)
public static void reportAssumptionViolation(boolean flag)
JMLIntraconditionError
).
The default is to report assumption violations.
reportAssumptionViolation()
public static void enter()
normal_behavior old Thread cur = Thread.currentThread(); requires !threadsBeingChecked.contains(cur); assignable threadsBeingChecked; ensures (* threadsBeingChecked.add(cur) *);
public static void exit()
normal_behavior old Thread cur = Thread.currentThread(); requires threadsBeingChecked.contains(cur); assignable threadsBeingChecked; ensures (* threadsBeingChecked.remove(cur) *);
public static boolean isActive(int type)
type
- Type of the current assertion check (e.g., PRECONDITION)
public static java.lang.Object getSurrogate(java.lang.String name, java.lang.Class<?> clazz, java.lang.Object thisObj)
clazz
, that is suitable for statically
calling JML access methods on the object thisObj
.
The argument clazz
must be a surrogate class. If
the object thisObj
itself is a surrogate, the
delegee's surrogate cache is looked upon for an existing
surrogate object or creating a new one; otherwise, the object's
surrogate cache is looked upon. The arument name
equals to clazz.getName(); it is passed in for the performance
reason, i.e., to prevent extra calls to the method getName().
public static java.lang.String toString(java.lang.Object obj)
toString
method
to the argument, obj
. If the argument is null, "null"
is returned. If the invocation encounters an exception,
"UNKNOWN" is returned; otherwise, the result of invocation
is returned.
public static java.lang.String toString(boolean i)
public static java.lang.String toString(byte i)
public static java.lang.String toString(char i)
public static java.lang.String toString(int i)
public static java.lang.String toString(short i)
public static java.lang.String toString(long i)
public static java.lang.String toString(float value)
public static java.lang.String toString(double value)
public static void clearCoverage()
public static void addCoverage(java.lang.String location, boolean value)
public static void reportCoverage(java.io.PrintStream writer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |