
org.checkerframework.dataflow.expression.ThisReference 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.expression;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.dataflow.analysis.Store;
import org.checkerframework.javacutil.AnnotationProvider;
import org.checkerframework.javacutil.TypesUtils;
import javax.lang.model.type.TypeMirror;
/** A use of {@code this}. */
public class ThisReference extends JavaExpression {
/**
* Create a new ThisReference.
*
* @param type the type of the {@code this} reference
*/
public ThisReference(TypeMirror type) {
super(type);
}
@Override
public boolean equals(@Nullable Object obj) {
return obj instanceof ThisReference;
}
@Override
public int hashCode() {
return 0;
}
@Override
public String toString() {
return "this";
}
@Override
public boolean containsOfClass(Class extends JavaExpression> clazz) {
return getClass() == clazz;
}
@Override
public boolean isDeterministic(AnnotationProvider provider) {
return true;
}
@Override
public boolean isUnassignableByOtherCode() {
return true;
}
@Override
public boolean isUnmodifiableByOtherCode() {
return TypesUtils.isImmutableTypeInJdk(type);
}
@Override
public boolean syntacticEquals(JavaExpression je) {
return je instanceof ThisReference;
}
@Override
public boolean containsSyntacticEqualJavaExpression(JavaExpression other) {
return this.syntacticEquals(other);
}
@Override
public boolean containsModifiableAliasOf(Store> store, JavaExpression other) {
return false; // 'this' is not modifiable
}
@Override
public R accept(JavaExpressionVisitor visitor, P p) {
return visitor.visitThisReference(this, p);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy