Skip to content

Commit 1369290

Browse files
committed
fix error message printing
1 parent bce6761 commit 1369290

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

nullaway/src/main/java/com/uber/nullaway/generics/GenericTypePrettyPrintingVisitor.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ public String visitArrayType(Type.ArrayType t, @Nullable Void unused) {
8989
return sb.append(" []").toString();
9090
}
9191

92+
@Override
93+
public String visitErrorType(Type.ErrorType t, @Nullable Void unused) {
94+
// this arises for our synthetic @Nullable and @NonNull annotations; we just return the simple
95+
// name
96+
return t.tsym.getSimpleName().toString();
97+
}
98+
9299
@Override
93100
public String visitType(Type t, @Nullable Void s) {
94101
return t.toString();

nullaway/src/test/java/com/uber/nullaway/jspecify/GenericMethodTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ abstract class TestCase {
425425
static class Bar<T extends @Nullable Object> {}
426426
abstract <U> Bar<U> make(Bar<U> other);
427427
void test(Bar<Bar<String>> other) {
428-
// BUG: Diagnostic contains: incompatible types: Bar<Bar<String>> cannot be converted to Bar<Bar<@Nullable String>>
428+
// BUG: Diagnostic contains: incompatible types: Bar<@NonNull Bar<String>> cannot be converted to Bar<Bar<@Nullable String>>
429429
Bar<Bar<@Nullable String>> unused = make(other);
430430
}
431431
}

0 commit comments

Comments
 (0)