jif.extension

## Class LabelTypeCheckUtil

- java.lang.Object
- - jif.extension.LabelTypeCheckUtil

-     public class LabelTypeCheckUtil
      extends java.lang.Object

  Contains some common utility code to type check dynamic labels and principals

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected JifTypeSystem` | `ts`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LabelTypeCheckUtil(JifTypeSystem ts)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `PathMap` | `labelCheckType(polyglot.types.Type t, LabelChecker lc, java.util.List<polyglot.types.Type> throwTypes, polyglot.util.Position pos)`
    `java.util.List<PathMap>` | `labelCheckTypeParams(polyglot.types.Type t, LabelChecker lc, java.util.List<polyglot.types.Type> throwTypes, polyglot.util.Position pos)`
    `java.util.Collection<Label>` | `labelComponents(Label L)`
    `java.util.Set<polyglot.types.LocalInstance>` | `localInstancesUsed(JifClassType type)` Returns a set of local instances that are used in the type.
    `java.util.List<polyglot.types.Type>` | `throwTypes(JifClassType type)` Return the types that may be thrown by a runtime evalution of the type `type`.
    `void` | `typeCheckLabel(polyglot.visit.TypeChecker tc, Label Lbl)` Check that all access paths occurring in label Lbl have the appropriate type.
    `void` | `typeCheckPolicy(polyglot.visit.TypeChecker tc, Policy p)`
    `void` | `typeCheckPrincipal(polyglot.visit.TypeChecker tc, Principal principal)` Check the type of any access path contained in a dynamic principal.
    `void` | `typeCheckType(polyglot.visit.TypeChecker tc, polyglot.types.Type t)`
    `protected void` | `updateContextForParam(LabelChecker lc, JifContext A, PathMap Xprev)` Utility method for updating the context for checking a parameter for the type.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ts

          protected final JifTypeSystem ts

  - ### Constructor Detail

    - #### LabelTypeCheckUtil

          public LabelTypeCheckUtil(JifTypeSystem ts)

  - ### Method Detail

    - #### typeCheckPrincipal

          public void typeCheckPrincipal(polyglot.visit.TypeChecker tc,
                                         Principal principal)
                                  throws polyglot.types.SemanticException

      Check the type of any access path contained in a dynamic principal. All such access paths should have type Principal.
      Parameters:
        `tc` -
        `principal` -
      Throws:
        `polyglot.types.SemanticException`

    - #### typeCheckLabel

          public void typeCheckLabel(polyglot.visit.TypeChecker tc,
                                     Label Lbl)
                              throws polyglot.types.SemanticException

      Check that all access paths occurring in label Lbl have the appropriate type.
      Parameters:
        `tc` -
        `Lbl` -
      Throws:
        `polyglot.types.SemanticException`

    - #### labelComponents

          public java.util.Collection<Label> labelComponents(Label L)

    - #### typeCheckPolicy

          public void typeCheckPolicy(polyglot.visit.TypeChecker tc,
                                      Policy p)
                               throws polyglot.types.SemanticException

      Throws:
        `polyglot.types.SemanticException`

    - #### typeCheckType

          public void typeCheckType(polyglot.visit.TypeChecker tc,
                                    polyglot.types.Type t)
                             throws polyglot.types.SemanticException

      Throws:
        `polyglot.types.SemanticException`

    - #### labelCheckType

          public PathMap labelCheckType(polyglot.types.Type t,
                                        LabelChecker lc,
                                        java.util.List<polyglot.types.Type> throwTypes,
                                        polyglot.util.Position pos)
                                 throws polyglot.types.SemanticException

      Throws:
        `polyglot.types.SemanticException`

    - #### labelCheckTypeParams

          public java.util.List<PathMap> labelCheckTypeParams(polyglot.types.Type t,
                                                              LabelChecker lc,
                                                              java.util.List<polyglot.types.Type> throwTypes,
                                                              polyglot.util.Position pos)
                                                       throws polyglot.types.SemanticException

      Parameters:
        `t` -
        `lc` -
      Returns:
        List of `PathMap`s, one for each parameter of the subst type.
      Throws:
        `polyglot.types.SemanticException`

    - #### updateContextForParam

          protected void updateContextForParam(LabelChecker lc,
                                               JifContext A,
                                               PathMap Xprev)

      Utility method for updating the context for checking a parameter for the type. Useful for overriding in projects like Fabric.

    - #### throwTypes

          public java.util.List<polyglot.types.Type> throwTypes(JifClassType type)

      Return the types that may be thrown by a runtime evalution of the type `type`.
      Parameters:
        `type` -
      Returns:
        the types that may be thrown by a runtime evalution of the type `type`.

    - #### localInstancesUsed

          public java.util.Set<polyglot.types.LocalInstance> localInstancesUsed(JifClassType type)

      Returns a set of local instances that are used in the type.