|
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.checker.JmlAbstractVisitor
org.jmlspecs.jmlrac.RacAbstractVisitor
org.jmlspecs.jmlrac.qexpr.AbstractExpressionVisitor
org.jmlspecs.checker.JmlAdmissibilityVisitor
A visitor class to check admissibility of JML invariants and represents clauses. Static invariants and static represents clauses, as well as static fields and methods calls appearing in invariants and represents clauses are not yet supported. For more datails about admissibility see "Modular Invariants for Layered Object Structures" by P. Mueller, A. Poetzsch-Heffter and G. Leavens, 2004. FIXME: Known Issues: 1. New Array Creation with Initializer: new Object{peerfield}[0] is admissible but rejected. Hard to fix (IMHO) 2. Hidden this: (field < 0 ? this : this).field == 0 is admissible but rejected. Quite easy to fix (IMHO)
| Nested Class Summary | |
protected class |
JmlAdmissibilityVisitor.NotAdmissibleException
An Exception which is thrown when some was found not to be admissible. |
| Field Summary | |
static String |
ADMISSIBILITY_CLASSICAL
Command line option to enable classical admissibility checks |
static String |
ADMISSIBILITY_NONE
Command line option to disable admissibility checks |
static String |
ADMISSIBILITY_OWNERSHIP
Command line option to enable ownership admissibility checks |
protected JmlExpressionContext |
ectx
The context of the expression to check |
protected boolean |
hasErrorsOrWarnings
Whether warnings or errors occured during the admissibility check. |
protected CFieldAccessor |
modelField
In the case of a represents clause, this field saves a reference to the model field, in order to enable it to appear in the represents expression and to ignore subclass separation for this field. |
| 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 | |
JmlAdmissibilityVisitor()
|
|
| Method Summary | |
protected static boolean |
checkAdmissibility(JExpression expr,
JmlExpressionContext ectx,
CFieldAccessor modelField)
Admissibility checks a JExpression. |
static boolean |
checkInvariant(JmlInvariant expr,
JmlExpressionContext ectx)
Admissibility checks an invariant. |
static boolean |
checkRepresentsClause(JmlRepresentsDecl decl,
JmlExpressionContext ectx)
Admissibility checks a represents clause. |
private static String |
getAdmissibility()
This method takes the command line admissibility string and returns the appropriate canonical admissibility option string. |
private static JmlAdmissibilityVisitor |
getVisitor()
Returns a new instance of the appropriate subclass of JmlAdmissibilityVisitor or null according to the chosen command line option "ownership", "classical" or "none." |
static boolean |
isAdmissibilityCheckEnabled()
Are the admissibility checks enabled ? |
static boolean |
isAdmissibilityOwnershipEnabled()
Is the ownership admissibility check enabled ? |
protected static boolean |
isThisAfterCasts(JExpression expr)
Whether the expr, after removing casts (JCastExpression, JUnaryPromote) is of type JThisExpression. |
protected static JExpression |
removeParentheses(JExpression expr)
If expr is of type JParenthesedExpression, this method returns the first child of expr which is not a JPatenthesedExpression. |
protected void |
visit(JExpression expr)
This method calls the JExpression.accept(MjcVisitor) method of expr. |
protected void |
warn(JExpression expr,
MessageDescription desc)
Emits a warning. |
| Methods inherited from class org.jmlspecs.jmlrac.RacAbstractVisitor |
visitRacNode, visitRacPredicate |
| 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 |
public static final String ADMISSIBILITY_CLASSICAL
public static final String ADMISSIBILITY_NONE
public static final String ADMISSIBILITY_OWNERSHIP
protected JmlExpressionContext ectx
protected boolean hasErrorsOrWarnings
protected CFieldAccessor modelField
| Constructor Detail |
public JmlAdmissibilityVisitor()
| Method Detail |
public static boolean checkInvariant(JmlInvariant expr,
JmlExpressionContext ectx)
expr - The invariant to checkectx - its context
public static boolean checkRepresentsClause(JmlRepresentsDecl decl,
JmlExpressionContext ectx)
decl - The represents clause to checkectx - its context
public static boolean isAdmissibilityCheckEnabled()
public static boolean isAdmissibilityOwnershipEnabled()
protected static boolean checkAdmissibility(JExpression expr,
JmlExpressionContext ectx,
CFieldAccessor modelField)
expr - the predicate to checkectx - its contextmodelField - the modelfield to check in case of a represents clause or null
in case of an invariant.
protected static JExpression removeParentheses(JExpression expr)
expr - the expression to remove its parentheses.
protected static boolean isThisAfterCasts(JExpression expr)
expr - to check for a this in casts
private static String getAdmissibility()
ADMISSIBILITY_CLASSICAL,
ADMISSIBILITY_OWNERSHIP,
ADMISSIBILITY_NONEprivate static JmlAdmissibilityVisitor getVisitor()
null for "none".
protected void warn(JExpression expr,
MessageDescription desc)
throws JmlAdmissibilityVisitor.NotAdmissibleException
expr - the expression the warning occured in.desc - the warning message.
JmlAdmissibilityVisitor.NotAdmissibleExceptionprotected void visit(JExpression expr)
JExpression.accept(MjcVisitor) method of expr. It enables subclasses overridding
this method to introduce custom initialization and termination control.
expr - The expr to be visited by this.
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||