Skip to content

Commit faebaf5

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 9b7a176 commit faebaf5

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
@@ -1404,6 +1404,17 @@ private Context createContext() {
14041404
// but does add them in response to passing --release. Here we invert that operation.
14051405
continue;
14061406
}
1407+
if (key.equals("-Xlint")
1408+
|| key.equals("-Xlint:")
1409+
|| key.equals("-Xdoclint")
1410+
|| key.equals("-Xdoclint:")
1411+
|| key.equals("-Xdoclint/package:")
1412+
|| key.equals("--doclint-format")) {
1413+
// For unknown reasons retaining -Xdoclint:reference here can cause an NPE; see #849. Since
1414+
// suggested fixes are unlikely to introduce lint errors that cannot be fixed manually, here
1415+
// we disable all lint checks. This _may_ also speed up compilation.
1416+
continue;
1417+
}
14071418
options.put(key, value);
14081419
}
14091420
return context;

0 commit comments

Comments
 (0)