Class CaptureVariable
-
Field Summary
Fields inherited from class org.checkerframework.framework.util.typeinference8.types.Variable
context, id, invocation, map, typeVariable, typeVariableJava, variableBounds -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the constraints generated when incorporating a capture bound, or null if the incorporation implies the bound false.booleanReturns true if this variable was created for a capture bound and the type argument it captures is a wildcard.booleanReturns true if this variable was created for a capture bound.voidsetCapturedWildcard(boolean capturedWildcard) Sets whether the type argument that this variable captures is a wildcard.toString()Methods inherited from class org.checkerframework.framework.util.typeinference8.types.Variable
getBounds, getInstantiation, getInvocation, getJavaType, hashCode, initialBounds, restore, save
-
Method Details
-
toString
-
getWildcardConstraints
Returns the constraints generated when incorporating a capture bound, or null if the incorporation implies the bound false. See JLS 18.3.2.- Parameters:
Ai- the captured type argumentBi- the bound of the type variable- Returns:
- constraints generated when incorporating a capture bound, or null if the bound false is implied
-
equals
Two capture variables are equal only if they are the same object. Every capture bound introduces fresh capture variables (see JLS 18.3.2), and the mapping created by
InferenceFactory.createThetaForCapture(com.sun.source.tree.ExpressionTree, org.checkerframework.framework.util.typeinference8.types.AbstractType)is not cached, so two capture bounds for the same invocation create distinct capture variables for the same type variable. Those variables stand for different types, soVariable.equals(java.lang.Object), which compares the type variable and the invocation, must not be used for them. Reference equality is also what the@Internedannotation on this class requires.Variable.hashCode()is still correct for capture variables: it may return the same value for two capture variables that are not equal, which is permitted. -
setCapturedWildcard
public void setCapturedWildcard(boolean capturedWildcard) Sets whether the type argument that this variable captures is a wildcard.- Parameters:
capturedWildcard- true if the captured type argument is a wildcard
-
isCaptureVariable
public boolean isCaptureVariable()Description copied from class:VariableReturns true if this variable was created for a capture bound.- Overrides:
isCaptureVariablein classVariable- Returns:
- true if this variable was created for a capture bound
-
isCapturedWildcard
public boolean isCapturedWildcard()Description copied from class:VariableReturns true if this variable was created for a capture bound and the type argument it captures is a wildcard.- Overrides:
isCapturedWildcardin classVariable- Returns:
- true if this variable was created for a captured wildcard
-