Skip to content

Commit

Permalink
Use BugInCF instead of Error
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst authored and wmdietl committed Nov 3, 2021
1 parent b57bb13 commit fb592b2
Show file tree
Hide file tree
Showing 20 changed files with 3,855 additions and 3,980 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ public Node visitCompoundAssignment(CompoundAssignmentTree tree, Void p) {
targetRHS = unbox(targetLHS);
value = unbox(value);
} else {
throw new BugInCF("Both argument to logical operation must be numeric or boolean");
throw new BugInCF("Both arguments to logical operation must be numeric or boolean");
}

BinaryTree operTree =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public String toString() {
assert isConstant() : "@AssumeAssertion(nullness)";
return value.toString();
default:
throw new BugInCF("Unexpected type");
throw new BugInCF("Unexpected type: " + type);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.checkerframework.dataflow.analysis.Store;
import org.checkerframework.dataflow.cfg.node.FieldAccessNode;
import org.checkerframework.javacutil.AnnotationProvider;
import org.checkerframework.javacutil.BugInCF;
import org.checkerframework.javacutil.ElementUtils;
import org.checkerframework.javacutil.TypesUtils;

Expand Down Expand Up @@ -72,8 +73,8 @@ public FieldAccess(JavaExpression receiver, TypeMirror type, VariableElement fie
this.field = fieldElement;
String fieldName = fieldElement.toString();
if (fieldName.equals("class") || fieldName.equals("this")) {
Error e =
new Error(
BugInCF e =
new BugInCF(
String.format(
"bad field name \"%s\" in new FieldAccess(%s, %s, %s)%n",
fieldName, receiver, type, fieldElement));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,7 @@ private boolean isTypeAnnotation(AnnotationTree anno) {
annoSymbol = (ClassSymbol) ((JCFieldAccess) annoType).sym;
break;
default:
throw new Error("Unhandled kind: " + annoType.getKind() + " for " + anno);
throw new BugInCF("Unhandled kind: " + annoType.getKind() + " for " + anno);
}
for (AnnotationMirror metaAnno : annoSymbol.getAnnotationMirrors()) {
if (AnnotationUtils.areSameByName(metaAnno, TARGET)) {
Expand Down

0 comments on commit fb592b2

Please sign in to comment.