Skip to content

Commit

Permalink
Avoid nullness errors
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Ernst <mernst@cs.washington.edu>
  • Loading branch information
smillst and mernst committed Sep 27, 2023
1 parent 869386f commit e30dfd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ protected Set<Class<? extends Annotation>> createSupportedTypeQualifiers() {
if (!Signatures.isBinaryName(qualName)) {
throw new UserError("Malformed qualifier \"%s\" in -Aquals", qualName);
}
qualSet.add(loader.loadExternalAnnotationClass(qualName));
Class<? extends Annotation> annoClass = loader.loadExternalAnnotationClass(qualName);
if (annoClass == null) {
throw new UserError("Cannot load qualifier \"%s\" in -Aquals", qualName);
}
qualSet.add(annoClass);
}

// load directories of qualifiers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public Void visitBinary(BinaryTree tree, Void p) {
public Void visitMethodInvocation(MethodInvocationTree tree, Void p) {
if (isInvocationOfEquals(tree)) {
AnnotatedTypeMirror receiverType = atypeFactory.getReceiverType(tree);
assert receiverType != null : "@AssumeAssertion(nullness)";
AnnotatedTypeMirror comp = atypeFactory.getAnnotatedType(tree.getArguments().get(0));

if (this.checker.getLintOption("dotequals", true)
Expand Down

0 comments on commit e30dfd5

Please sign in to comment.