use of com.google.errorprone.refaster.UTypeVar.TypeWithExpression in project error-prone by google.
the class UTypeVarIdent method defaultAction.
@Override
protected Choice<Unifier> defaultAction(Tree target, Unifier unifier) {
JCExpression expr = (JCExpression) target;
Type targetType = expr.type;
if (targetType == null) {
return Choice.none();
}
@Nullable TypeWithExpression boundType = unifier.getBinding(key());
if (boundType == null) {
unifier.putBinding(key(), expr.accept(QUALIFIED_FROM_PACKAGE, null) ? TypeWithExpression.create(targetType) : /* use the ImportPolicy to refer to this type */
TypeWithExpression.create(targetType, expr));
return Choice.of(unifier);
} else if (unifier.types().isSameType(targetType, boundType.type())) {
return Choice.of(unifier);
}
return Choice.none();
}
Aggregations