Skip to content

Commit 74c5951

Browse files
committed
Don't lint during SuggestedFixes#compilesWithFix
Under certain circumstances this avoids triggering a compiler bug. It is also expected to speed up the trial compilation somewhat. The implicit assumption here is that it is okay to suggest a fix which introduces another warning. (This may not be so in general, but the introduced warning may be less severe or may be resolved manually.) See google#849.
1 parent ca8f8d4 commit 74c5951

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,17 @@ private Context createContext() {
14191419
// but does add them in response to passing --release. Here we invert that operation.
14201420
continue;
14211421
}
1422+
if (key.equals("-Xlint")
1423+
|| key.equals("-Xlint:")
1424+
|| key.equals("-Xdoclint")
1425+
|| key.equals("-Xdoclint:")
1426+
|| key.equals("-Xdoclint/package:")
1427+
|| key.equals("--doclint-format")) {
1428+
// For unknown reasons retaining -Xdoclint:reference here can cause an NPE; see #849. Since
1429+
// suggested fixes are unlikely to introduce lint errors that cannot be fixed manually, here
1430+
// we disable all lint checks. This _may_ also speed up compilation.
1431+
continue;
1432+
}
14221433
options.put(key, value);
14231434
}
14241435
return context;

0 commit comments

Comments
 (0)