Skip to content

Commit

Permalink
Enforce VoidMissingNullable in testonly code
Browse files Browse the repository at this point in the history
The relaxation was useful to code NullMarked their production sources, but didn't bother with their test code. However, projects that want to check their entire codebase don't have great options as `-XepOpt:Nullness:Conservative` gates a lot of behavior behind it.

As we push further into null-marking code, annotating the types in test code will likely be beneficial anyway.

PiperOrigin-RevId: 707539601
  • Loading branch information
kevinoconnor7 authored and Error Prone Team committed Dec 18, 2024
1 parent a6b2442 commit 87eec2b
Showing 1 changed file with 0 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ public Description matchParameterizedType(
return NO_MATCH;
}

if (beingConservative && state.errorProneOptions().isTestOnlyTarget()) {
return NO_MATCH;
}

if (beingConservative && !isInNullMarkedScope(state)) {
return NO_MATCH;
}
Expand Down Expand Up @@ -127,10 +123,6 @@ private static boolean isInNullMarkedScope(VisitorState state) {

@Override
public Description matchMethod(MethodTree tree, VisitorState state) {
if (beingConservative && state.errorProneOptions().isTestOnlyTarget()) {
return NO_MATCH;
}

MethodSymbol sym = getSymbol(tree);
if (!typeMatches(sym.getReturnType(), sym, state)) {
return NO_MATCH;
Expand All @@ -143,10 +135,6 @@ public Description matchMethod(MethodTree tree, VisitorState state) {

@Override
public Description matchVariable(VariableTree tree, VisitorState state) {
if (beingConservative && state.errorProneOptions().isTestOnlyTarget()) {
return NO_MATCH;
}

if (hasImplicitType(tree, state)) {
/*
* In the case of `var`, a declaration-annotation @Nullable would be valid. But a type-use
Expand Down

0 comments on commit 87eec2b

Please sign in to comment.