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

The Checker Framework enhances Java’s type system to make it more powerful and useful. This lets software developers detect and prevent errors in their Java programs. The Checker Framework includes compiler plug-ins ("checkers") that find bugs or verify their absence. It also permits you to write your own compiler plug-ins.

There is a newer version: 3.42.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