Skip to content

Commit a0c91fc

Browse files
committed
Fix position of marker for dereference of nullable errors
1 parent 1b92dc5 commit a0c91fc

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

checker/src/main/java/org/checkerframework/checker/nullness/NullnessVisitor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ public Void visitMemberSelect(MemberSelectTree tree, Void p) {
271271
|| tree.getExpression().getKind() == Tree.Kind.PARAMETERIZED_TYPE
272272
// case 8. static member access
273273
|| ElementUtils.isStatic(e))) {
274-
checkForNullability(tree.getExpression(), DEREFERENCE_OF_NULLABLE);
274+
AnnotatedTypeMirror type = atypeFactory.getAnnotatedType(tree.getExpression());
275+
checkForNullability(type, tree.getExpression(), DEREFERENCE_OF_NULLABLE);
275276
}
276277

277278
return super.visitMemberSelect(tree, p);
@@ -743,7 +744,8 @@ public Void visitForLoop(ForLoopTree tree, Void p) {
743744
public Void visitNewClass(NewClassTree tree, Void p) {
744745
ExpressionTree enclosingExpr = tree.getEnclosingExpression();
745746
if (enclosingExpr != null) {
746-
checkForNullability(enclosingExpr, DEREFERENCE_OF_NULLABLE);
747+
AnnotatedTypeMirror type = atypeFactory.getAnnotatedType(enclosingExpr);
748+
checkForNullability(type, enclosingExpr, DEREFERENCE_OF_NULLABLE);
747749
}
748750
AnnotatedDeclaredType type = atypeFactory.getAnnotatedType(tree);
749751
ExpressionTree identifier = tree.getIdentifier();

docs/manual/contributors.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,5 @@
136136
Vlastimil Dort,
137137
Weitian Xing,
138138
Werner Dietl,
139+
Wuyue (Tony) Sun,
139140
Zhiping Cai.

0 commit comments

Comments
 (0)