-
Notifications
You must be signed in to change notification settings - Fork 745
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
Checker reporting an ERROR affects EFFECTIVELY_FINAL symbol flag in subsequent source files #4595
Comments
@cushon sorry for the ping but would it be possible to get any feedback or basic ACK here ? |
I had a look It reproduces with the CLI:
With
|
I think I understand what's going on now. This logic means that Passing I think So the outcome might be to update the installation docs to recommend that flag. |
This is necessary to ensure javac compiles the 'flow' phase for subsequent compilation units after Error Prone reports diagnostics. The 'flow' phase is necessary among other things to set `EFFECTIVELY_FINAL`. Configuring a later stop policy also causes more diagnostics to be shown at once for failing builds when using `-XDcompilePolicy=simple`, which is helpful. #4595 RELNOTES=The javac flag `-XDshould-stop.ifError=FLOW` is now required when running Error Prone, see #4595 PiperOrigin-RevId: 686096407
See google/error-prone#4595 for motivation. This fixes a bug with the interaction between javac and Error Prone, but also improves diagnostic quality in general by showing more errors if there are multiple problems and multiple files being compiled. PiperOrigin-RevId: 686100365 Change-Id: I2e5e6dffdbbe1ca6480369a51a7ea3445db78a8a
This is necessary to ensure javac compiles the 'flow' phase for subsequent compilation units after Error Prone reports diagnostics. The 'flow' phase is necessary among other things to set `EFFECTIVELY_FINAL`. Configuring a later stop policy also causes more diagnostics to be shown at once for failing builds when using `-XDcompilePolicy=simple`, which is helpful. #4595 RELNOTES=The javac flag `-XDshould-stop.ifError=FLOW` is now required when running Error Prone, see #4595 PiperOrigin-RevId: 686102738
@xenoterracide this might be the issue you were seeing in uber/NullAway#923? Edit: nevermind looks like others already spotted this connection with #4305 |
I'm tentatively planning to require setting a stop-on-error policy when running Error Prone in the next release. 5828416 uses Either way, the logic that checks the flag is set should accept the different forms of the flag. Also note that there were some changes to the syntax of this option: https://bugs.openjdk.org/browse/JDK-8162546, https://bugs.openjdk.org/browse/JDK-8198314 |
This is equivalent to `-XDshould-stop.ifError=FLOW`, but the `-XD` flag is a internal javac debug flag interface that writes directly to the options table. The `--should-stop` flags are slightly more standard. #4595 PiperOrigin-RevId: 686353769
This is equivalent to `-XDshould-stop.ifError=FLOW`, but the `-XD` flag is a internal javac debug flag interface that writes directly to the options table. The `--should-stop` flags are slightly more standard. #4595 PiperOrigin-RevId: 686530096
The fix is released in https://github.com/google/error-prone/releases/tag/v2.34.0 |
@cushon it appears that the new |
Thanks for the catch, I missed that there are two calls to |
…g the `-Xplugin` integration See #4595 (comment) PiperOrigin-RevId: 687659943
…g the `-Xplugin` integration See #4595 (comment) PiperOrigin-RevId: 690786174
sorry for the late response. |
I was upgrading error-prone to 2.31.0 on a branch for a project and it started reporting both
DefaultCharset
andFormatStringAnnotation
violations in a module.The former were expected and valid but the latter left me scratching my head as the
FormatStringAnnotation
checker was not modified between the versions afaict.I tried reproducing the
FormatStringAnnotation
violations in an error-prone unit test but the code was passing the check just fine.Then I tried to reproduce the whole scenario in an error-prone integration test and was successful, so I have pushed the test code here:
XN137#1
note:
ERROR
has been reported byUnusedVariable
, the symbol flags are different in subsequent files and theEFFECTIVELY_FINAL
flag is no longer set and soFormatStringAnnotation
is reporting "phantom violations"UnusedVariable
is set toWARN
UnusedVariable
ERROR
violationDefaultCharset
withUnusedVariable
to show its not related toDefaultLocale
/String.format
having any shared state withFormatStringAnnotation
please take a look and let me know whether this is expected behavior in errorprone (or javac) or a potential bug?
If the former, maybe this should be documented somewhere as it can be really confusing if checker B starts reporting "unjustified" violations just because checker A has already reported an ERROR.
sorry in case i missed something obvious that would explain this behavior.
The text was updated successfully, but these errors were encountered: