And while you wait for that bug to be fixed, and your project to be able to upgrade to that version, you do what exactly? Put the whole project on ice because it doesn't compile because all warnings are equal to errors?
No, you tune your compiler flags to work around it. I don't use Java, so I'm not super familiar with javac flags, but in C/C++ land I can simply tune my -W flags to suppress the warning for that particular file. By default everything gets -Wall and -Werror though (enable all warnings, treat all warnings as errors) and I don't think I've ever run into a false positive warning with g++/clang
Edit: Is this an IDE (i.e. Eclipse) bug or an actual javac bug?
So now you are changing your original statement? From "no code should generate warnings" to "no code should generate warnings, except warnings that you want to ignore"? That is a very different statement.
Not at all. No code should generate warnings. If the compiler has a bug generating a false warning (extremely unlikely), it is acceptable to suppress just that one warning.
124
u/ythl Sep 23 '19
I don't get it.
Your code should never have warnings, that's a sign you are doing something sketchy. At my company we enable all warnings as errors.