jif.types.principal

## Interface Principal

- All Superinterfaces:
    ActsForParam, java.lang.Cloneable, polyglot.util.Copy<polyglot.types.TypeObject>, Param, java.io.Serializable, polyglot.types.TypeObject
  All Known Subinterfaces:
    BottomPrincipal, ConjunctivePrincipal, DisjunctivePrincipal, DynamicPrincipal, ExternalPrincipal, ParamPrincipal, TopPrincipal, UnknownPrincipal, VarPrincipal
  All Known Implementing Classes:
    BottomPrincipal_c, ConjunctivePrincipal_c, DisjunctivePrincipal_c, DynamicPrincipal_c, ExternalPrincipal_c, ParamPrincipal_c, Principal_c, TopPrincipal_c, UnknownPrincipal_c, VarPrincipal_c

      public interface Principal
      extends ActsForParam

  The root interface of all kinds of Jif principals.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface polyglot.util.Copy

      `polyglot.util.Copy.Util`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `hasVariables()` Does the label contain any variables at all? This includes variables that are in bounds of arg labels.
    `boolean` | `isBottomPrincipal()`
    `boolean` | `isTopPrincipal()`
    `PathMap` | `labelCheck(JifContext A, LabelChecker lc)` Label check the principal, which will determine how much information may be gained if the principal is evaluated at runtime.
    `Principal` | `simplify()` Simplify the label, using the actsfor relation if needed
    `Principal` | `subst(LabelSubstitution labelSubst)`
    `java.util.List<polyglot.types.Type>` | `throwTypes(polyglot.types.TypeSystem ts)` If the principal is runtime representable, when it is evaluated at runtime it may throw exceptions.
    `java.util.Set<Variable>` | `variables()` The set of variables that this label contains including variables contained in upper bounds of arg labels.

    - ### Methods inherited from interface jif.types.ActsForParam

      `toJava`

    - ### Methods inherited from interface jif.types.Param

      `isCanonical, isRuntimeRepresentable, typeSystem`

    - ### Methods inherited from interface polyglot.types.TypeObject

      `equalsImpl, position`

    - ### Methods inherited from interface polyglot.util.Copy

      `copy`

- - ### Method Detail

    - #### subst

          Principal subst(LabelSubstitution labelSubst)
                   throws polyglot.types.SemanticException

      Specified by:
        `subst` in interface `ActsForParam`
      Parameters:
        `labelSubst` - The `LabelSubstitution` to apply to this principal
      Returns:
        the result of applying labelSubst to this principal.
      Throws:
        `polyglot.types.SemanticException`

    - #### labelCheck

          PathMap labelCheck(JifContext A,
                             LabelChecker lc)

      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;
                  }

      See Also:
        `JifExt.labelCheck(LabelChecker)`, `Label.labelCheck(JifContext, LabelChecker)`

    - #### throwTypes

          java.util.List<polyglot.types.Type> throwTypes(polyglot.types.TypeSystem ts)

      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.

    - #### hasVariables

          boolean hasVariables()

      Does the label contain any variables at all? This includes variables that are in bounds of arg labels.

    - #### variables

          java.util.Set<Variable> variables()

      The set of variables that this label contains including variables contained in upper bounds of arg labels.

    - #### isTopPrincipal

          boolean isTopPrincipal()

    - #### isBottomPrincipal

          boolean isBottomPrincipal()

    - #### simplify

          Principal simplify()

      Simplify the label, using the actsfor relation if needed
      Specified by:
        `simplify` in interface `ActsForParam`