
org.checkerframework.dataflow.cfg.builder.LabelCell Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dataflow-shaded Show documentation
Show all versions of dataflow-shaded Show documentation
dataflow-shaded is a dataflow framework based on the javac compiler.
It differs from the org.checkerframework:dataflow artifact in two ways.
First, the packages in this artifact have been renamed to org.checkerframework.shaded.*.
Second, unlike the dataflow artifact, this artifact contains the dependencies it requires.
package org.checkerframework.dataflow.cfg.builder;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.javacutil.BugInCF;
/** Storage cell for a single Label, with tracking whether it was accessed. */
/*package-private*/ class LabelCell {
/** The label. If it is null, then it will be lazily set if {@link #accessLabel} is called. */
private @MonotonicNonNull Label label;
/** True if the label has been accessed. */
private boolean accessed;
/** Create a LabelCell with no label; the label will be lazily created if needed. */
protected LabelCell() {
this.accessed = false;
}
/**
* Create a LabelCell with the given label.
*
* @param label the label
*/
protected LabelCell(Label label) {
assert label != null;
this.label = label;
this.accessed = false;
}
public Label accessLabel() {
if (label == null) {
label = new Label();
}
accessed = true;
return label;
}
public Label peekLabel() {
if (label == null) {
throw new BugInCF("called peekLabel prematurely");
}
return label;
}
public boolean wasAccessed() {
return accessed;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy