|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.Utils
org.jmlspecs.jmlrac.TransUtils
org.jmlspecs.jmlrac.AssertionMethod
org.jmlspecs.jmlrac.PreOrPostconditionMethod
An abstract class for generating precondition or postconditin check methods for the given methods. The generated assertion methods inherit its superclass's assertions by dynamically invoking the corresponding assertion methods.
The class implements a variant of the Template Pattern
[GoF95], prescribed in the class AssertionMethod.
AssertionMethod| Nested Class Summary | |
private static class |
PreOrPostconditionMethod.StringPair
A record class that can store a pair of strings. |
| Field Summary | |
protected JmlMethodDeclaration |
methodDecl
target method for which assertion method is generated |
protected long |
modifiers
modifiers of the target method |
protected String |
name
name of the target method |
protected JFormalParameter[] |
parameters
parameters of the target method |
protected String |
stackMethod
|
| Fields inherited from class org.jmlspecs.jmlrac.AssertionMethod |
exceptionToThrow, isStatic, javadoc, methodIdentification, methodName, prefix, typeDecl |
| Fields inherited from class org.jmlspecs.jmlrac.TransUtils |
|
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Fields inherited from interface org.jmlspecs.jmlrac.RacConstants |
MN_CHECK_HC, MN_CHECK_INV, MN_CHECK_POST, MN_CHECK_PRE, MN_CHECK_XPOST, MN_EVAL_OLD, MN_GHOST, MN_INIT, MN_INTERNAL, MN_MODEL, MN_MODEL_PUBLIC, MN_RESTORE_FROM, MN_SAVE_TO, MN_SPEC, MN_SPEC_PUBLIC, TN_JMLCHECKABLE, TN_JMLSURROGATE, TN_JMLUNIT_TEST_POSTFIX, TN_JMLUNIT_TESTDATA_POSTFIX, TN_JMLVALUE, TN_SURROGATE, VN_ASSERTION, VN_CATCH_VAR, VN_CLASS_INIT, VN_CONSTRUCTED, VN_DELEGEE, VN_ERROR_SET, VN_EXCEPTION, VN_FREE_VAR, VN_INIT, VN_OLD_VAR, VN_POST_VAR, VN_PRE_VAR, VN_PRECOND, VN_RAC_COMPILED, VN_RAC_LEVEL, VN_RESULT, VN_STACK_VAR, VN_XRESULT |
| Constructor Summary | |
protected |
PreOrPostconditionMethod(JmlTypeDeclaration typeDecl,
JmlMethodDeclaration mdecl,
String stackMethod)
Construct a new PreOrPostconditionMethod object. |
| Method Summary | |
protected boolean |
canInherit()
Indicates whether the generated assertion method should try to dynamically inherit the corresponding assertion method of the superclass or interfaces. |
protected static String |
methodName(JmlMethodDeclaration mdecl)
Returns the name of assertion check method to be generated for the given method declaration. |
protected String |
nonReflectiveCall(CClass clazz,
JFormalParameter[] parameters,
String resultVar)
Return code that calls non-reflectively the pre or postcondition method of the given supertype, claszz. |
private static String |
nonreflectiveCallArguments(JFormalParameter[] parameters)
Return code that represents the arguments corresponding to the given formal parameters, parameters. |
protected String |
reflectiveCall(CClass clazz,
JFormalParameter[] parameters,
String resultVar)
Return code that calls reflectively the pre or postcondition method of the given supertype, claszz. |
private static PreOrPostconditionMethod.StringPair |
reflectiveCallArguments(JFormalParameter[] parameters)
Returns a pair of strings suitable for arguments to invoke dynamically a method with the given formal parameter, parameters. |
| Methods inherited from class org.jmlspecs.jmlrac.AssertionMethod |
buildHeader, checker, generate, hasExplicitSuperClass, inheritAssertion |
| Methods inherited from class org.multijava.util.Utils |
assertTrue, assertTrue, combineArrays, escapeString, escapeString, fail, fail, getFilePath, hasFlag, hasOtherFlags, parsePathParts, relativePathTo, splitQualifiedName, splitQualifiedName, stripJavaModifiers, stripNonJavaModifiers, stripPrivateModifier, unescapeString, vectorToArray, vectorToIntArray |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected final JmlMethodDeclaration methodDecl
protected final long modifiers
protected final JFormalParameter[] parameters
protected String stackMethod
protected String name
| Constructor Detail |
protected PreOrPostconditionMethod(JmlTypeDeclaration typeDecl,
JmlMethodDeclaration mdecl,
String stackMethod)
PreOrPostconditionMethod object.
| Method Detail |
protected boolean canInherit()
also protected normal_behavior ensures \result == !isStatic && !(methodDecl instanceof JmlConstructorDeclaration) && methodDecl.isOverriding();
protected static String methodName(JmlMethodDeclaration mdecl)
protected String reflectiveCall(CClass clazz,
JFormalParameter[] parameters,
String resultVar)
claszz.
private static PreOrPostconditionMethod.StringPair reflectiveCallArguments(JFormalParameter[] parameters)
parameters. The first of the pair is of the form,
"new java.lang.Class[] { T1.class, ..., Tn.class }",
and the second of the form
"new java.lang.Object[] { x1, ..., xn }".
protected String nonReflectiveCall(CClass clazz,
JFormalParameter[] parameters,
String resultVar)
claszz.
private static String nonreflectiveCallArguments(JFormalParameter[] parameters)
parameters.
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||