|
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
org.jmlspecs.checker.JmlOwnershipAdmissibilityVisitor
| Nested Class Summary | |
private static class |
JmlOwnershipAdmissibilityVisitor.State
A data structure to store the current state of this visitor. |
| Nested classes inherited from class org.jmlspecs.checker.JmlAdmissibilityVisitor |
JmlAdmissibilityVisitor.NotAdmissibleException |
| Field Summary | |
private boolean |
isCastedToRep
Was something casted to rep ? |
private boolean |
needsArrayBaseNotReadOnly
Indicates whether the declared array base-type universe modifier must be checked when accessing the array. |
private boolean |
needsRep
Indicates whether the pivot field g0 must be a rep field, i.e. whether rule 3 must be applied. |
private JExpression |
potentiallyNotAdmissible
In order to get meaningful error messages, the JExpression where needsRep was set is stored. |
private Stack |
stateStack
The state of this JmlOwnershipAdmissibilityVisitor is often saved at the beginning of a visit-method, and restored at its end. |
| Fields inherited from class org.jmlspecs.checker.JmlAdmissibilityVisitor |
ADMISSIBILITY_CLASSICAL, ADMISSIBILITY_NONE, ADMISSIBILITY_OWNERSHIP, ectx, hasErrorsOrWarnings, modelField |
| 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 | |
(package private) |
JmlOwnershipAdmissibilityVisitor()
|
| Method Summary | |
private void |
clearCurrentState()
Clears the current state of this visitor, i.e. sets all fields to their initial value. |
private void |
popState()
Restores the last pushed state. |
private void |
pushState()
Stores a copy of the current state and pushes this copy onto the top if stateStack. |
protected void |
visit(JExpression expr)
This method calls the JExpression.accept(MjcVisitor) method of expr. |
void |
visitArrayAccessExpression(JArrayAccessExpression self)
Visits the given array access expression, self. |
void |
visitArrayDimsAndInit(JArrayDimsAndInits self)
Visits the given array dimension and initializer, self. |
void |
visitCastExpression(JCastExpression self)
Visits the given cast expression, self. |
void |
visitConditionalExpression(JConditionalExpression self)
Visits the given conditional expression, self. |
void |
visitFieldExpression(JClassFieldExpression self)
Visits the given class field expression, self. |
void |
visitMethodCallExpression(JMethodCallExpression self)
Visits the given method expression, self. |
void |
visitNewObjectExpression(JNewObjectExpression self)
Visits the given new object expression, self. |
void |
visitThisExpression(JThisExpression self)
Visits the given this expression, self. |
| Methods inherited from class org.jmlspecs.checker.JmlAdmissibilityVisitor |
checkAdmissibility, checkInvariant, checkRepresentsClause, isAdmissibilityCheckEnabled, isAdmissibilityOwnershipEnabled, isThisAfterCasts, removeParentheses, warn |
| 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 |
private boolean needsRep
private boolean needsArrayBaseNotReadOnly
private boolean isCastedToRep
visitArrayAccessExpression(JArrayAccessExpression)private JExpression potentiallyNotAdmissible
private final Stack stateStack
pushState(),
popState(),
clearCurrentState(),
JmlOwnershipAdmissibilityVisitor.State| Constructor Detail |
JmlOwnershipAdmissibilityVisitor()
| Method Detail |
private void pushState()
private void popState()
private void clearCurrentState()
stateStack is not affected.
protected void visit(JExpression expr)
JmlAdmissibilityVisitorJExpression.accept(MjcVisitor) method of expr. It enables subclasses overridding
this method to introduce custom initialization and termination control.
visit in class JmlAdmissibilityVisitorpublic void visitArrayAccessExpression(JArrayAccessExpression self)
self. By default, this method visits both prefix
and accessor of self.
The logic is as follows:
needsRep && isCastedToRep && isArrayBaseElement: impossible
needsRep && isCastedToRep && !isArrayBaseElement: impossible
needsRep && !isCastedToRep && isArrayBaseElement: set needsArrayBaseNotReadOnly
needsRep && !isCastedToRep && !isArrayBaseElement: no action
!needsRep && isCastedToRep && isArrayBaseElement: clear isCastedToRep, set needsRep
!needsRep && isCastedToRep && !isArrayBaseElement: no action
!needsRep && !isCastedToRep && isArrayBaseElement: set needsRep
!needsRep && !isCastedToRep && !isArrayBaseElement: set needsRep
visitArrayAccessExpression in interface MjcVisitorvisitArrayAccessExpression in class AbstractExpressionVisitorpublic void visitFieldExpression(JClassFieldExpression self)
self. By
default, this method visits the prefix of self if
it is not null.
visitFieldExpression in interface MjcVisitorvisitFieldExpression in class AbstractExpressionVisitorpublic void visitMethodCallExpression(JMethodCallExpression self)
self. By
default, this method visits both prefix and arguments of
self. Method calls are not supported yet, but the
receiver object and the method parameters are checked.
visitMethodCallExpression in interface MjcVisitorvisitMethodCallExpression in class AbstractExpressionVisitorpublic void visitNewObjectExpression(JNewObjectExpression self)
self. By default, this method visits both the
this expression and parameters of self. Object creation
is not supported yet, but the receiver object and the parameters are checked.
visitNewObjectExpression in interface MjcVisitorvisitNewObjectExpression in class AbstractExpressionVisitorpublic void visitConditionalExpression(JConditionalExpression self)
self. By
default, this method visits the condition, left and right
expressions of self.
visitConditionalExpression in interface MjcVisitorvisitConditionalExpression in class AbstractExpressionVisitorpublic void visitArrayDimsAndInit(JArrayDimsAndInits self)
self. By default, this method visits both the
dimension expression and initializer of self.
visitArrayDimsAndInit in interface MjcVisitorvisitArrayDimsAndInit in class AbstractExpressionVisitorpublic void visitThisExpression(JThisExpression self)
self. By
default, this method does nothing.
visitThisExpression in interface MjcVisitorvisitThisExpression in class AbstractExpressionVisitorpublic void visitCastExpression(JCastExpression self)
self. By
default, this method visits the expression of
self. If the cast does not involve universe types,
then there is no problem, otherwise ...
visitCastExpression in interface MjcVisitorvisitCastExpression in class AbstractExpressionVisitor
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||