Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warning about @Nullable var args #296

Merged
merged 1 commit into from Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 0 additions & 18 deletions nullaway/src/main/java/com/uber/nullaway/NullAway.java
Expand Up @@ -492,24 +492,6 @@ public Description matchMethod(MethodTree tree, VisitorState state) {
return checkOverriding(closestOverriddenMethod, methodSymbol, null, state);
}
}
// Check that var args (if any) is @Nullable, as NullAway doesn't currently support this case
if (methodSymbol.isVarArgs()) {
VarSymbol varArgsSymbol =
methodSymbol.getParameters().get(methodSymbol.getParameters().size() - 1);
if (Nullness.hasNullableAnnotation(varArgsSymbol)) {
String message =
"NullAway doesn't currently support @Nullable VarArgs. "
+ "Consider removing the @Nullable annotation from "
+ varArgsSymbol.toString()
+ " in "
+ methodSymbol.toString()
+ " (this issue can cause other errors below, wherever the var args array is dereferenced)";
return errorBuilder.createErrorDescription(
new ErrorMessage(MessageTypes.NULLABLE_VARARGS_UNSUPPORTED, message),
state.getPath(),
buildDescription(tree));
}
}
return Description.NO_MATCH;
}

Expand Down
1 change: 0 additions & 1 deletion nullaway/src/test/java/com/uber/nullaway/NullAwayTest.java
Expand Up @@ -1715,7 +1715,6 @@ public void testNullableVarargs() {
"package com.uber;",
"import javax.annotation.Nullable;",
"public class Utilities {",
" // BUG: Diagnostic contains: NullAway doesn't currently support @Nullable VarArgs",
" public static String takesNullableVarargs(Object o, @Nullable Object... others) {",
" String s = o.toString() + \" \";",
" // BUG: Diagnostic contains: enhanced-for expression others is @Nullable",
Expand Down