framework.src.org.checkerframework.qualframework.base.dataflow.QualStore Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of checker Show documentation
Show all versions of checker Show documentation
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.
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.
}
}