use of org.checkerframework.framework.util.FlowExpressionParseUtil.FlowExpressionContext in project checker-framework by typetools.
the class DependentTypesHelper method standardizeReturnType.
public void standardizeReturnType(MethodTree m, AnnotatedTypeMirror atm) {
if (atm.getKind() == TypeKind.NONE) {
return;
}
if (!hasDependentType(atm)) {
return;
}
Element ele = TreeUtils.elementFromDeclaration(m);
TypeMirror enclosingType = ElementUtils.enclosingClass(ele).asType();
FlowExpressionContext context = FlowExpressionContext.buildContextForMethodDeclaration(m, enclosingType, factory.getContext());
standardizeDoNotUseLocals(context, factory.getPath(m), atm);
}
use of org.checkerframework.framework.util.FlowExpressionParseUtil.FlowExpressionContext in project checker-framework by typetools.
the class DependentTypesHelper method viewpointAdaptTypeVariableBounds.
/**
* Viewpoint-adapts the dependent type annotations on the bounds to the use of the type.
*
* @param classDecl class or interface declaration whose type variables should be viewpoint
* adapted
* @param bounds annotated types of the bounds of the type variables
* @param pathToUse tree path to the use of the class or interface
*/
public void viewpointAdaptTypeVariableBounds(TypeElement classDecl, List<AnnotatedTypeParameterBounds> bounds, TreePath pathToUse) {
FlowExpressions.Receiver r = FlowExpressions.internalReprOfImplicitReceiver(classDecl);
FlowExpressionContext context = new FlowExpressionContext(r, null, factory.getContext());
for (AnnotatedTypeParameterBounds bound : bounds) {
standardizeDoNotUseLocals(context, pathToUse, bound.getUpperBound());
standardizeDoNotUseLocals(context, pathToUse, bound.getLowerBound());
}
}
use of org.checkerframework.framework.util.FlowExpressionParseUtil.FlowExpressionContext in project checker-framework by typetools.
the class DependentTypesHelper method checkTypeVariables.
private void checkTypeVariables(MethodTree node, AnnotatedExecutableType methodType) {
Element ele = TreeUtils.elementFromDeclaration(node);
TypeMirror enclosingType = ElementUtils.enclosingClass(ele).asType();
FlowExpressionContext context = FlowExpressionContext.buildContextForMethodDeclaration(node, enclosingType, factory.getContext());
for (int i = 0; i < methodType.getTypeVariables().size(); i++) {
AnnotatedTypeMirror atm = methodType.getTypeVariables().get(i);
standardizeDoNotUseLocals(context, factory.getPath(node), atm);
checkType(atm, node.getTypeParameters().get(i));
}
}
use of org.checkerframework.framework.util.FlowExpressionParseUtil.FlowExpressionContext in project checker-framework by typetools.
the class DependentTypesHelper method standardizeNewClassTree.
public void standardizeNewClassTree(NewClassTree tree, AnnotatedDeclaredType type) {
if (!hasDependentType(type)) {
return;
}
TreePath path = factory.getPath(tree);
FlowExpressions.Receiver r = FlowExpressions.internalReprOfImplicitReceiver(TreeUtils.elementFromUse(tree));
FlowExpressionContext context = new FlowExpressionContext(r, FlowExpressions.getParametersOfEnclosingMethod(factory, path), factory.getContext());
standardizeUseLocals(context, path, type);
}
use of org.checkerframework.framework.util.FlowExpressionParseUtil.FlowExpressionContext in project checker-framework by typetools.
the class DependentTypesHelper method standardizeExpression.
public void standardizeExpression(ExpressionTree tree, AnnotatedTypeMirror annotatedType) {
if (!hasDependentType(annotatedType)) {
return;
}
TreePath path = factory.getPath(tree);
if (path == null) {
return;
}
Tree enclosingClass = TreeUtils.enclosingClass(path);
if (enclosingClass == null) {
return;
}
TypeMirror enclosingType = TreeUtils.typeOf(enclosingClass);
FlowExpressions.Receiver receiver = FlowExpressions.internalReprOfPseudoReceiver(path, enclosingType);
FlowExpressionContext localContext = new FlowExpressionContext(receiver, FlowExpressions.getParametersOfEnclosingMethod(factory, path), factory.getContext());
standardizeUseLocals(localContext, path, annotatedType);
}
Aggregations