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

Option to mark warnings as errors #424

Open
vanniktech opened this issue Jul 4, 2016 · 9 comments
Open

Option to mark warnings as errors #424

vanniktech opened this issue Jul 4, 2016 · 9 comments

Comments

@vanniktech
Copy link

vanniktech commented Jul 4, 2016

I'd love an option to mark error prone warnings as errors so that even warnings won't get ignored.

While it is possible to do the following:

tasks.withType(JavaCompile) {
  options.compilerArgs += [ '-Werror' ]
}

it does not really suffice since all warnings are then marked as errors. Another option would be for every error prone rule to increase the severity though this will get impossible to maintain.

Maybe it could be something as simple as -Xep:WarningsAsErrors.

@cushon
Copy link
Collaborator

cushon commented Jul 13, 2016

This sounds like a good idea to me. We've also received requests for a flag to enable all checks as warnings (even if they're errors by default) in order to collect the full list of diagnostics for a codebase. I imagine the implementation of the two flags would be very similar.

@vanniktech
Copy link
Author

@cushon wasn't this implemented the other way around meaning that you can downgrade errors to warnings but not the other way around?

@emartynov
Copy link

Is it implemented?

@jbduncan
Copy link
Contributor

@emartynov Not yet, sadly. :(

I think @cushon mistakenly closed this issue when he implemented the option to convert all errors to warnings, rather than an option for converting all warnings to errors.

@emartynov
Copy link

Thanks! Would be nice to re-open it :)

@jbduncan
Copy link
Contributor

Indeed! :)

But alas I'm not a Googler, so I don't have permissions to reopen this issue.

@cushon WDYT?

@msridhar
Copy link
Contributor

Agreed this should be re-opened, but I'm curious about the downsides of -Werror; it seems to be good enough for us. Which built-in javac warnings do folks find to be to noisy?

@emartynov
Copy link

We have one warning about using deprecated API and it will break the build now. I don't know if I would want to mix deprecation and error-prone warnings. But probably, any warning should be caught and fixed as soon as possible.

@cushon cushon reopened this Aug 27, 2018
@msridhar
Copy link
Contributor

We have one warning about using deprecated API and it will break the build now. I don't know if I would want to mix deprecation and error-prone warnings. But probably, any warning should be caught and fixed as soon as possible.

Can you use -Xlint:-deprecation to disable the deprecation lint as a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants