class MaybeAliasedStatement {

    public static MaybeAliasedStatement analyze(AnalyzedRelation relation) {<FILL_FUNCTION_BODY>}

    private final AnalyzedRelation relation;
    private final Function<? super Symbol, ? extends Symbol> mapper;

    private MaybeAliasedStatement(AnalyzedRelation relation,
                                  Function<? super Symbol, ? extends Symbol> mapper) {
        this.relation = relation;
        this.mapper = mapper;
    }

    AnalyzedRelation nonAliasedRelation() {
        return relation;
    }

    Symbol maybeMapFields(Symbol symbol) {
        return mapper.apply(symbol);
    }
}

        if (relation instanceof AliasedAnalyzedRelation) {
            AliasedAnalyzedRelation aliasedAnalyzedRelation = (AliasedAnalyzedRelation) relation;
            return new MaybeAliasedStatement(
                aliasedAnalyzedRelation.relation(),
                FieldReplacer.bind(aliasedAnalyzedRelation::resolveField)
            );
        }
        return new MaybeAliasedStatement(relation, s -> s);
    
<no_super_class>