jif.types.principal
Class Principal_c
java.lang.Object
polyglot.types.TypeObject_c
jif.types.principal.Principal_c
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Param, Principal, polyglot.types.TypeObject, polyglot.util.Copy
- Direct Known Subclasses:
- BottomPrincipal_c, ConjunctivePrincipal_c, DisjunctivePrincipal_c, DynamicPrincipal_c, ExternalPrincipal_c, ParamPrincipal_c, TopPrincipal_c, UnknownPrincipal_c, VarPrincipal_c
public abstract class Principal_c
- extends polyglot.types.TypeObject_c
- implements Principal
An abstract implementation of the Principal
interface.
- See Also:
- Serialized Form
Field Summary |
protected java.util.Set |
variables
|
Fields inherited from class polyglot.types.TypeObject_c |
position, ts |
Methods inherited from class polyglot.types.TypeObject_c |
copy, equals, position, typeSystem |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface polyglot.types.TypeObject |
position, typeSystem |
Methods inherited from interface polyglot.util.Copy |
copy |
variables
protected java.util.Set variables
Principal_c
public Principal_c(JifTypeSystem ts,
polyglot.util.Position pos)
Principal_c
public Principal_c(JifTypeSystem ts,
polyglot.util.Position pos,
PrincipalToJavaExpr toJava)
toJava
public polyglot.ast.Expr toJava(JifToJavaRewriter rw)
throws polyglot.types.SemanticException
- Specified by:
toJava
in interface Principal
- Throws:
polyglot.types.SemanticException
hasVariables
public final boolean hasVariables()
- Description copied from interface:
Principal
- Does the label contain any variables at all? This includes variables
that are in bounds of arg labels.
- Specified by:
hasVariables
in interface Principal
isTopPrincipal
public boolean isTopPrincipal()
- Specified by:
isTopPrincipal
in interface Principal
isBottomPrincipal
public boolean isBottomPrincipal()
- Specified by:
isBottomPrincipal
in interface Principal
isCanonical
public abstract boolean isCanonical()
- Specified by:
isCanonical
in interface Param
- Specified by:
isCanonical
in interface polyglot.types.TypeObject
isRuntimeRepresentable
public abstract boolean isRuntimeRepresentable()
- Specified by:
isRuntimeRepresentable
in interface Param
equalsImpl
public abstract boolean equalsImpl(polyglot.types.TypeObject o)
- Specified by:
equalsImpl
in interface polyglot.types.TypeObject
- Overrides:
equalsImpl
in class polyglot.types.TypeObject_c
hashCode
public abstract int hashCode()
- Overrides:
hashCode
in class polyglot.types.TypeObject_c
throwTypes
public java.util.List throwTypes(polyglot.types.TypeSystem ts)
- Description copied from interface:
Principal
- If the principal is runtime representable, when it is evaluated at
runtime it may throw exceptions. This method returns a list of
the exceptions that the runtime evaluation of the principal may produce.
If the principal cannot be evaluated at runtime, an empty list should be returned.
- Specified by:
throwTypes
in interface Principal
subst
public Principal subst(LabelSubstitution substitution)
throws polyglot.types.SemanticException
- Specified by:
subst
in interface Principal
- Parameters:
substitution
- The LabelSubstitution
to apply to this
principal
- Returns:
- the result of applying labelSubst to this principal.
- Throws:
polyglot.types.SemanticException
labelCheck
public PathMap labelCheck(JifContext A,
LabelChecker lc)
- Description copied from interface:
Principal
- Label check the principal, which will determine how much information may be
gained if the principal is evaluated at runtime. For example, given the
dynamic principal p, where p is a local variable, evaluation of this
label at runtime will reveal as much information as the label of p. For
example, the following code is illegal, as the runtime evaluation of the
principal reveals too much information
boolean{Alice:} secret = ...;
final principal{Alice:} p = secret?Bob:Chuck;
boolean{} leak = false;
if (p actsfor Bob) { // evaluation of p reveals
// information at level {Alice:}
leak = true;
}
- Specified by:
labelCheck
in interface Principal
- See Also:
Jif.labelCheck(LabelChecker)
,
Label.labelCheck(JifContext, LabelChecker)
variables
public java.util.Set variables()
- Description copied from interface:
Principal
- The set of variables that this label contains including variables contained
in upper bounds of arg labels.
- Specified by:
variables
in interface Principal
simplify
public Principal simplify()
- Description copied from interface:
Principal
- Simplify the label, using the actsfor relation if needed
- Specified by:
simplify
in interface Principal