Skip to content

Commit

Permalink
Annotate isPoly() as @Pure
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed Oct 29, 2020
1 parent 2d93c75 commit 38b8ca2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public boolean isUI() {
*
* @return true if this is PolyUIEffect
*/
@Pure
public boolean isPoly() {
return annotClass == PolyUIEffect.class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.checkerframework.checker.index.qual.UpperBoundUnknown;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.dataflow.cfg.node.Node;
import org.checkerframework.dataflow.qual.Pure;
import org.checkerframework.framework.type.AnnotatedTypeMirror;
import org.checkerframework.javacutil.AnnotationBuilder;
import org.checkerframework.javacutil.AnnotationUtils;
Expand Down Expand Up @@ -208,6 +209,12 @@ public boolean isBottom() {
return false;
}

/**
* Return true if this is UBQualifier.PolyQualifier.
*
* @return true if this is UBQualifier.PolyQualifier
*/
@Pure
public boolean isPoly() {
return false;
}
Expand Down Expand Up @@ -1058,6 +1065,7 @@ private static class PolyQualifier extends UBQualifier {
static final UBQualifier POLY = new PolyQualifier();

@Override
@Pure
public boolean isPoly() {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.checkerframework.checker.signature.qual.CanonicalName;
import org.checkerframework.dataflow.qual.Pure;
import org.checkerframework.framework.qual.AnnotatedFor;
import org.checkerframework.framework.qual.PolymorphicQualifier;
import org.checkerframework.framework.qual.SubtypeOf;
Expand Down Expand Up @@ -782,6 +783,7 @@ public boolean isBottom() {
return poly;
}

@Pure
@Override
public boolean isPoly() {
return this.poly == this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.checkerframework.checker.interning.qual.Interned;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.signature.qual.CanonicalName;
import org.checkerframework.dataflow.qual.Pure;
import org.checkerframework.framework.qual.AnnotatedFor;

/**
Expand Down Expand Up @@ -81,6 +82,7 @@
*
* @return true if this is polymorphic
*/
@Pure
boolean isPoly();

/**
Expand Down

0 comments on commit 38b8ca2

Please sign in to comment.