Enum UnresolvedCall.ResolutionStrategy
- java.lang.Object
-
- java.lang.Enum<UnresolvedCall.ResolutionStrategy>
-
- it.unive.lisa.program.cfg.statement.UnresolvedCall.ResolutionStrategy
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<UnresolvedCall.ResolutionStrategy>
- Enclosing class:
- UnresolvedCall
public static enum UnresolvedCall.ResolutionStrategy extends java.lang.Enum<UnresolvedCall.ResolutionStrategy>
An enum defining the different types of resolution strategies for call signatures. Depending on the language, targets of calls might be resolved (at compile time or runtime) relying on the static or runtime type of their parameters. Each strategy in this enum comes with a differentmatches(Parameter[], Expression[])implementation that can automatically detect if the signature of a cfg is matched by the given expressions representing the parameters for a call to that cfg.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DYNAMIC_TYPESA strategy where the dynamic (runtime) types of the parameters of the call are evaluated against the signature of a cfg: for each parameter, if at least one of the runtime types of the actual parameter can be assigned to the type of the formal parameter, thanmatches(Parameter[], Expression[])returntrue.FIRST_DYNAMIC_THEN_STATICA strategy where the first parameter is tested usingDYNAMIC_TYPES, while the rest is tested usingSTATIC_TYPES.STATIC_TYPESA strategy where the static types of the parameters of the call are evaluated against the signature of a cfg: for each parameter, if the static type of the actual parameter can be assigned to the type of the formal parameter, thanmatches(Parameter[], Expression[])returntrue.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract booleanmatches(int pos, Parameter formal, Expression actual)Yieldstrueif and only if the signature of thepos-th parameter of a cfg is matched by the given actual parameter, according to this strategy.booleanmatches(Parameter[] formals, Expression[] actuals)Yieldstrueif and only if the signature of a cfg (i.e.static UnresolvedCall.ResolutionStrategyvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static UnresolvedCall.ResolutionStrategy[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
STATIC_TYPES
public static final UnresolvedCall.ResolutionStrategy STATIC_TYPES
A strategy where the static types of the parameters of the call are evaluated against the signature of a cfg: for each parameter, if the static type of the actual parameter can be assigned to the type of the formal parameter, thanmatches(Parameter[], Expression[])returntrue.
-
DYNAMIC_TYPES
public static final UnresolvedCall.ResolutionStrategy DYNAMIC_TYPES
A strategy where the dynamic (runtime) types of the parameters of the call are evaluated against the signature of a cfg: for each parameter, if at least one of the runtime types of the actual parameter can be assigned to the type of the formal parameter, thanmatches(Parameter[], Expression[])returntrue.
-
FIRST_DYNAMIC_THEN_STATIC
public static final UnresolvedCall.ResolutionStrategy FIRST_DYNAMIC_THEN_STATIC
A strategy where the first parameter is tested usingDYNAMIC_TYPES, while the rest is tested usingSTATIC_TYPES.
-
-
Method Detail
-
values
public static UnresolvedCall.ResolutionStrategy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (UnresolvedCall.ResolutionStrategy c : UnresolvedCall.ResolutionStrategy.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static UnresolvedCall.ResolutionStrategy valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
matches
public final boolean matches(Parameter[] formals, Expression[] actuals)
Yieldstrueif and only if the signature of a cfg (i.e. the types of its parameters) is matched by the given actual parameters, according to this strategy.- Parameters:
formals- the parameters definition of the cfgactuals- the expression that are used as call parameters- Returns:
trueif and only if that condition holds
-
matches
protected abstract boolean matches(int pos, Parameter formal, Expression actual)Yieldstrueif and only if the signature of thepos-th parameter of a cfg is matched by the given actual parameter, according to this strategy.- Parameters:
pos- the position of the parameter being evaluatedformal- the parameter definition of the cfgactual- the expression that is used as parameter- Returns:
trueif and only if that condition holds
-
-