org.checkerframework.checker.nullness.NullnessAnalysis 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.checker.nullness;
import javax.lang.model.type.TypeMirror;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.common.basetype.BaseTypeChecker;
import org.checkerframework.framework.flow.CFAbstractAnalysis;
import org.checkerframework.framework.flow.CFAbstractValue;
import org.checkerframework.javacutil.AnnotationMirrorSet;
/**
* The analysis class for the non-null type system (serves as factory for the transfer function,
* stores and abstract values.
*/
public class NullnessAnalysis
extends CFAbstractAnalysis {
/**
* Creates a new {@code NullnessAnalysis}.
*
* @param checker the checker
* @param factory the factory
*/
public NullnessAnalysis(BaseTypeChecker checker, NullnessAnnotatedTypeFactory factory) {
super(checker, factory);
}
@Override
public NullnessStore createEmptyStore(boolean sequentialSemantics) {
return new NullnessStore(this, sequentialSemantics);
}
@Override
public NullnessStore createCopiedStore(NullnessStore s) {
return new NullnessStore(s);
}
@Override
public @Nullable NullnessValue createAbstractValue(
AnnotationMirrorSet annotations, TypeMirror underlyingType) {
if (!CFAbstractValue.validateSet(annotations, underlyingType, atypeFactory)) {
return null;
}
return new NullnessValue(this, annotations, underlyingType);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy