jif.extension
Class CallHelper

java.lang.Object
  extended by jif.extension.CallHelper

public class CallHelper
extends java.lang.Object

This is a tool to label check method calls. This class should be used by creating an instance of it, and then calling the method checkCall(LabelChecker). After the call to that method, the remaining methods (which are getter methods) may be called.


Constructor Summary
CallHelper(Label receiverLabel, polyglot.ast.Receiver receiver, polyglot.types.ReferenceType calleeContainer, JifProcedureInstance pi, java.util.List actualArgs, polyglot.util.Position position)
           
CallHelper(Label receiverLabel, polyglot.types.ReferenceType calleeContainer, JifProcedureInstance pi, java.util.List actualArgs, polyglot.util.Position position)
           
 
Method Summary
 void bindVarLabels(LabelChecker lc, VarLabel receiverVarLabel, java.util.List actualArgVarLabels, java.util.List actualParamVarLabels)
          Bind the given var labels to the appropriate labels that have been calculated during the call checking.
 void checkCall(LabelChecker lc, java.util.List throwTypes, boolean targetMayBeNull)
          Check method calls.
 void checkOverride(LabelChecker lc)
          this.pi is a Jif method instance that this.overridingMethod is attempting to override.
protected static java.util.List getArgLabelsFromFormalTypes(java.util.List formalTypes, JifTypeSystem jts)
           
 Label instantiate(JifContext A, Label L)
           
 Principal instantiate(JifContext A, Principal p)
          replaces any signature ArgLabels in p with the appropriate label, and replaces any signature ArgPrincipal with the appropriate prinicipal.
 polyglot.types.Type instantiate(JifContext A, polyglot.types.Type t)
           
 java.util.List labelCheckedArgs()
           
static CallHelper OverrideHelper(JifMethodInstance overridden, JifMethodInstance overriding, LabelChecker lc)
           
 polyglot.types.Type returnType()
           
 PathMap X()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallHelper

public CallHelper(Label receiverLabel,
                  polyglot.ast.Receiver receiver,
                  polyglot.types.ReferenceType calleeContainer,
                  JifProcedureInstance pi,
                  java.util.List actualArgs,
                  polyglot.util.Position position)

CallHelper

public CallHelper(Label receiverLabel,
                  polyglot.types.ReferenceType calleeContainer,
                  JifProcedureInstance pi,
                  java.util.List actualArgs,
                  polyglot.util.Position position)
Method Detail

OverrideHelper

public static CallHelper OverrideHelper(JifMethodInstance overridden,
                                        JifMethodInstance overriding,
                                        LabelChecker lc)

returnType

public polyglot.types.Type returnType()

labelCheckedArgs

public java.util.List labelCheckedArgs()

X

public PathMap X()

checkCall

public void checkCall(LabelChecker lc,
                      java.util.List throwTypes,
                      boolean targetMayBeNull)
               throws polyglot.types.SemanticException
Check method calls. (Thesis, Figure 4.29)

Throws:
polyglot.types.SemanticException

bindVarLabels

public void bindVarLabels(LabelChecker lc,
                          VarLabel receiverVarLabel,
                          java.util.List actualArgVarLabels,
                          java.util.List actualParamVarLabels)
                   throws polyglot.types.SemanticException
Bind the given var labels to the appropriate labels that have been calculated during the call checking.

Parameters:
lc - the LabelChecker
receiverVarLabel - the VarLabel used to stand in for the label of the receiver
actualArgVarLabels - a list of VarLabels that were used to stand in for the labels of the actual arguments
actualParamVarLabels - a list of VarLabels that were used to stand in for the labels of the actual parameters
Throws:
polyglot.types.SemanticException

getArgLabelsFromFormalTypes

protected static java.util.List getArgLabelsFromFormalTypes(java.util.List formalTypes,
                                                            JifTypeSystem jts)

instantiate

public Label instantiate(JifContext A,
                         Label L)
                  throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

instantiate

public Principal instantiate(JifContext A,
                             Principal p)
                      throws polyglot.types.SemanticException
replaces any signature ArgLabels in p with the appropriate label, and replaces any signature ArgPrincipal with the appropriate prinicipal.

Throws:
polyglot.types.SemanticException

instantiate

public polyglot.types.Type instantiate(JifContext A,
                                       polyglot.types.Type t)
                                throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

checkOverride

public void checkOverride(LabelChecker lc)
                   throws polyglot.types.SemanticException
this.pi is a Jif method instance that this.overridingMethod is attempting to override. Previous type checks have made sure that things like abstractness, access flags, throw sets, etc. are ok. We need to check that the labels conform.

Throws:
polyglot.types.SemanticException