All Downloads are FREE. Search and download functionalities are using the official Maven repository.

framework.src.org.checkerframework.qualframework.base.dataflow.QualStore Maven / Gradle / Ivy

Go to download

Checker Qual is the set of annotations (qualifiers) and supporting classes used by the Checker Framework to type check Java source code. Please see artifact: org.checkerframework:checker

There is a newer version: 3.45.0
Show newest version
package org.checkerframework.qualframework.base.dataflow;

import org.checkerframework.dataflow.analysis.FlowExpressions.Receiver;
import org.checkerframework.dataflow.analysis.Store;
import org.checkerframework.dataflow.cfg.CFGVisualizer;
import org.checkerframework.framework.flow.CFStore;

/**
 * QualStore is a {@link Store} for quals.
 *
 * It proxies a {@link CFStore} adapter.
 */
public class QualStore implements Store> {

    private final CFStore adapter;
    private final QualAnalysis analysis;

    public QualStore(QualAnalysis analysis, CFStore adapter) {
        this.analysis = analysis;
        this.adapter = adapter;
    }

    @Override
    public QualStore copy() {
        return analysis.createCopiedStore(adapter);
    }

    @Override
    public QualStore leastUpperBound(QualStore other) {
        return analysis.createStore(adapter.leastUpperBound(other.adapter));
    }

    @Override
    public boolean canAlias(Receiver a, Receiver b) {
        return adapter.canAlias(a, b);
    }

    public CFStore getUnderlyingStore() {
        return adapter;
    }

    public void insertValue(Receiver r, Q regexAnnotation) {
        adapter.insertValue(r, analysis.getConverter().getAnnotation(regexAnnotation));
    }

    public void visualize(CFGVisualizer, ?> viz) {
        // TODO: this method currently isn't called. The corresponding
        // method on the adapter is called by the AnnotatedTypeFactory.
        // In the future, the QualifiedTypeFactory should call this method
        // and something like the following might work:
        // CFGVisualizer adaptViz = (CFGVisualizer) viz;
        // this.adapter.visualize((CFGVisualizer ) adaptViz);
        // however, the mismatch between the QualStore and the
        // CFStore might require some further refactorings.
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy